diff --git a/rust/Cargo.lock b/rust/Cargo.lock index 741e65eefd95c..3f3c36157e36b 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -521,6 +521,15 @@ version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9475866fec1451be56a3c2400fd081ff546538961565ccb5b7142cbd22bc7a51" +[[package]] +name = "base64-simd" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "781dd20c3aff0bd194fe7d2a977dd92f21c173891f3a03b677359e5fa457e5d5" +dependencies = [ + "simd-abstraction", +] + [[package]] name = "base64ct" version = "1.6.0" @@ -568,6 +577,18 @@ dependencies = [ "serde", ] +[[package]] +name = "bitvec" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] + [[package]] name = "block-buffer" version = "0.10.4" @@ -963,15 +984,19 @@ version = "0.1.0" dependencies = [ "axum 0.7.5", "common-alloc", + "common-dns", "common-kafka", "common-metrics", "common-types", "envconfig", "health", + "httpmock", "metrics", "rdkafka", + "reqwest 0.12.3", "serde", "serde_json", + "sourcemap", "sqlx", "thiserror", "tokio", @@ -1027,6 +1052,22 @@ dependencies = [ "parking_lot_core", ] +[[package]] +name = "data-encoding" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" + +[[package]] +name = "debugid" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef552e6f588e446098f6ba40d89ac146c8c7b64aade83c051ee00bb5d2bc18d" +dependencies = [ + "serde", + "uuid", +] + [[package]] name = "der" version = "0.7.8" @@ -1366,6 +1407,12 @@ dependencies = [ "thiserror", ] +[[package]] +name = "funty" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" + [[package]] name = "futures" version = "0.3.30" @@ -2043,6 +2090,12 @@ dependencies = [ "unicode-normalization", ] +[[package]] +name = "if_chain" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb56e1aa765b4b4f3aadfab769793b7087bb03a4ea4920644a6d238e2df5b9ed" + [[package]] name = "indenter" version = "0.3.3" @@ -2441,7 +2494,7 @@ dependencies = [ "libloading", "neon-macros", "once_cell", - "semver", + "semver 1.0.23", "send_wrapper", "smallvec", ] @@ -2748,6 +2801,12 @@ dependencies = [ "num-traits", ] +[[package]] +name = "outref" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f222829ae9293e33a9f5e9f440c6760a3d450a64affe1846486b140db81c1f4" + [[package]] name = "overload" version = "0.1.1" @@ -3075,6 +3134,12 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + [[package]] name = "rand" version = "0.8.5" @@ -3374,6 +3439,21 @@ version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +dependencies = [ + "semver 0.9.0", +] + [[package]] name = "rustix" version = "0.37.27" @@ -3517,12 +3597,27 @@ dependencies = [ "libc", ] +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +dependencies = [ + "semver-parser", +] + [[package]] name = "semver" version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" + [[package]] name = "send_wrapper" version = "0.6.0" @@ -3671,6 +3766,15 @@ dependencies = [ "rand_core", ] +[[package]] +name = "simd-abstraction" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cadb29c57caadc51ff8346233b5cec1d240b68ce55cf1afc764818791876987" +dependencies = [ + "outref", +] + [[package]] name = "similar" version = "2.5.0" @@ -3724,6 +3828,25 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "sourcemap" +version = "9.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dab08a862c70980b8e23698b507e272317ae52a608a164a844111f5372374f1f" +dependencies = [ + "base64-simd", + "bitvec", + "data-encoding", + "debugid", + "if_chain", + "rustc-hash", + "rustc_version", + "serde", + "serde_json", + "unicode-id-start", + "url", +] + [[package]] name = "spin" version = "0.9.8" @@ -4084,6 +4207,12 @@ dependencies = [ "libc", ] +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + [[package]] name = "tempfile" version = "3.10.0" @@ -4497,6 +4626,12 @@ version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" +[[package]] +name = "unicode-id-start" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97e2a3c5fc9de285c0e805d98eba666adb4b2d9e1049ce44821ff7707cc34e91" + [[package]] name = "unicode-ident" version = "1.0.12" @@ -4937,6 +5072,15 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "wyz" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +dependencies = [ + "tap", +] + [[package]] name = "zerocopy" version = "0.7.32" diff --git a/rust/cymbal/Cargo.toml b/rust/cymbal/Cargo.toml index ca533f1a8fe0a..532730d12e36a 100644 --- a/rust/cymbal/Cargo.toml +++ b/rust/cymbal/Cargo.toml @@ -16,10 +16,16 @@ common-metrics = { path = "../common/metrics" } common-alloc = { path = "../common/alloc" } common-kafka = { path = "../common/kafka" } common-types = { path = "../common/types" } +common-dns = { path = "../common/dns" } thiserror = { workspace = true } sqlx = { workspace = true } serde_json = { workspace = true } serde = { workspace = true } +sourcemap = "9.0.0" +reqwest = { workspace = true } + +[dev-dependencies] +httpmock = { workspace = true } [lints] workspace = true diff --git a/rust/cymbal/src/app_context.rs b/rust/cymbal/src/app_context.rs index 3d21c2bd24b78..bbcf0fe6d21b8 100644 --- a/rust/cymbal/src/app_context.rs +++ b/rust/cymbal/src/app_context.rs @@ -5,13 +5,19 @@ use health::{HealthHandle, HealthRegistry}; use sqlx::{postgres::PgPoolOptions, PgPool}; use tracing::info; -use crate::{config::Config, error::Error}; +use crate::{ + config::Config, + error::Error, + resolver::{Resolver, ResolverImpl}, + symbol_store::{basic::BasicStore, caching::CachingStore}, +}; pub struct AppContext { pub health_registry: HealthRegistry, pub worker_liveness: HealthHandle, pub consumer: SingleTopicConsumer, pub pool: PgPool, + pub resolver: Box, } impl AppContext { @@ -31,11 +37,22 @@ impl AppContext { config.consumer.kafka_consumer_topic ); + // We're going to make heavy use of this "layering" pattern with stores, e.g. a we'll add an s3 + // store that wraps an underlying basic one and stores the returned values in s3, and looks in s3 + // before making fetches, etc. + let symbol_store = BasicStore::new(config)?; + let symbol_store = + CachingStore::new(Box::new(symbol_store), config.symbol_store_cache_max_bytes); + + // Box box, box box + let resolver = Box::new(ResolverImpl::new(Box::new(symbol_store))); + Ok(Self { health_registry, worker_liveness, consumer, pool, + resolver, }) } } diff --git a/rust/cymbal/src/config.rs b/rust/cymbal/src/config.rs index e1493477d2576..a73e0a12d6ce5 100644 --- a/rust/cymbal/src/config.rs +++ b/rust/cymbal/src/config.rs @@ -28,6 +28,16 @@ pub struct Config { #[envconfig(default = "true")] pub skip_reads: bool, + + // cymbal makes HTTP get requests to auto-resolve sourcemaps - and follows redirects. To protect against SSRF, we only allow requests to public URLs by default + #[envconfig(default = "false")] + pub allow_internal_ips: bool, + + #[envconfig(default = "30")] + pub sourcemap_timeout_seconds: u64, + + #[envconfig(default = "100000000")] // 100MB - in prod, we should use closer to 1-10GB + pub symbol_store_cache_max_bytes: usize, } impl Config { diff --git a/rust/cymbal/src/error.rs b/rust/cymbal/src/error.rs index b7a91ef74d02c..75bfbaffc0837 100644 --- a/rust/cymbal/src/error.rs +++ b/rust/cymbal/src/error.rs @@ -9,4 +9,14 @@ pub enum Error { KafkaError(#[from] KafkaError), #[error("Sqlx error: {0}")] SqlxError(#[from] sqlx::Error), + #[error("Reqwest error: {0}")] + ReqwestError(#[from] reqwest::Error), + #[error("Not implemented error: {0}")] + NotImplementedError(String), + #[error("Lookup failed: {0}")] + LookupFailed(String), + #[error("Could not get source ref from: {0}")] + InvalidSourceRef(String), + #[error("sourcemap error: {0}")] + SourceMapError(#[from] sourcemap::Error), } diff --git a/rust/cymbal/src/langs/js.rs b/rust/cymbal/src/langs/js.rs new file mode 100644 index 0000000000000..fa5c272af1f34 --- /dev/null +++ b/rust/cymbal/src/langs/js.rs @@ -0,0 +1,70 @@ +use reqwest::Url; +use serde::Deserialize; + +use crate::error::Error; + +// A minifed JS stack frame. Just the minimal information needed to lookup some +// sourcemap for it and produce a "real" stack frame. +// TODO - how do we know if this frame is minified? If it isn't, we can skip a lot of work, but I think we have to guess? Based on whether we can get a sourcemap for it? +#[derive(Debug, Clone, Deserialize)] +pub struct RawJSFrame { + #[serde(rename = "lineno")] + pub line: u32, + #[serde(rename = "colno")] + pub column: u32, + #[serde(rename = "filename")] + pub script_url: String, + pub in_app: bool, + #[serde(rename = "function")] + pub fn_name: String, +} + +impl RawJSFrame { + pub fn source_ref(&self) -> Result { + // Frame scrupt URLs are in the form: `:///::`. We + // want to strip the line and column, if they're present, and then return the rest + let to_protocol_end = self + .script_url + .find("://") + .ok_or(Error::InvalidSourceRef(self.script_url.clone()))? + + 3; + + let (protocol, rest) = self.script_url.split_at(to_protocol_end); + let to_end_of_path = rest.find(':').unwrap_or(rest.len()); + let useful = protocol.len() + to_end_of_path; + let url = &self.script_url[..useful]; + Url::parse(url).map_err(|_| Error::InvalidSourceRef(self.script_url.clone())) + } +} + +#[cfg(test)] +mod test { + #[test] + fn source_ref_generation() { + let frame = super::RawJSFrame { + line: 1, + column: 2, + script_url: "http://example.com/path/to/file.js:1:2".to_string(), + in_app: true, + fn_name: "main".to_string(), + }; + + assert_eq!( + frame.source_ref().unwrap(), + "http://example.com/path/to/file.js".parse().unwrap() + ); + + let frame = super::RawJSFrame { + line: 1, + column: 2, + script_url: "http://example.com/path/to/file.js".to_string(), + in_app: true, + fn_name: "main".to_string(), + }; + + assert_eq!( + frame.source_ref().unwrap(), + "http://example.com/path/to/file.js".parse().unwrap() + ); + } +} diff --git a/rust/cymbal/src/langs/mod.rs b/rust/cymbal/src/langs/mod.rs new file mode 100644 index 0000000000000..cb71828f95d73 --- /dev/null +++ b/rust/cymbal/src/langs/mod.rs @@ -0,0 +1 @@ +pub mod js; diff --git a/rust/cymbal/src/lib.rs b/rust/cymbal/src/lib.rs index 107aab957b8de..d923f4d04b93c 100644 --- a/rust/cymbal/src/lib.rs +++ b/rust/cymbal/src/lib.rs @@ -1,5 +1,8 @@ pub mod app_context; pub mod config; pub mod error; -pub mod symbols; -pub mod traits; +pub mod langs; +pub mod metric_consts; +pub mod resolver; +pub mod symbol_store; +pub mod types; diff --git a/rust/cymbal/src/main.rs b/rust/cymbal/src/main.rs index b6d9e5b47d36d..ea706b27db2a4 100644 --- a/rust/cymbal/src/main.rs +++ b/rust/cymbal/src/main.rs @@ -8,7 +8,8 @@ use cymbal::{ app_context::AppContext, config::Config, error::Error, - symbols::types::{PropertyView, RawFrame}, + metric_consts::{ERRORS, EVENT_RECEIVED, STACK_PROCESSED}, + types::{frames::RawFrame, ErrProps}, }; use envconfig::Envconfig; use tokio::task::JoinHandle; @@ -70,12 +71,12 @@ async fn main() -> Result<(), Error> { Err(err) => { // If we failed to parse the message, or it was empty, just log and continue, our // consumer has already stored the offset for us. - metrics::counter!("cymbal_errors", "cause" => "recv_err").increment(1); + metrics::counter!(ERRORS, "cause" => "recv_err").increment(1); error!("Error receiving message: {:?}", err); continue; } }; - metrics::counter!("cymbal_events_received").increment(1); + metrics::counter!(EVENT_RECEIVED).increment(1); offset.store().unwrap(); @@ -85,31 +86,33 @@ async fn main() -> Result<(), Error> { } let Some(properties) = &event.properties else { - metrics::counter!("cymbal_errors", "cause" => "no_properties").increment(1); + metrics::counter!(ERRORS, "cause" => "no_properties").increment(1); continue; }; - let properties: PropertyView = match serde_json::from_str(properties) { + let properties: ErrProps = match serde_json::from_str(properties) { Ok(r) => r, Err(err) => { - metrics::counter!("cymbal_errors", "cause" => "invalid_exception_properties") - .increment(1); + metrics::counter!(ERRORS, "cause" => "invalid_exception_properties").increment(1); error!("Error parsing properties: {:?}", err); continue; } }; - let _stack_trace: Vec = - match serde_json::from_str(&properties.exception_stack_trace_raw) { - Ok(r) => r, - Err(err) => { - metrics::counter!("cymbal_errors", "cause" => "invalid_stack_trace") - .increment(1); - error!("Error parsing stack trace: {:?}", err); - continue; - } - }; - - metrics::counter!("cymbal_stack_track_processed").increment(1); + let Some(trace) = properties.exception_stack_trace_raw.as_ref() else { + metrics::counter!(ERRORS, "cause" => "no_stack_trace").increment(1); + continue; + }; + + let _stack_trace: Vec = match serde_json::from_str(trace) { + Ok(r) => r, + Err(err) => { + metrics::counter!(ERRORS, "cause" => "invalid_stack_trace").increment(1); + error!("Error parsing stack trace: {:?}", err); + continue; + } + }; + + metrics::counter!(STACK_PROCESSED).increment(1); } } diff --git a/rust/cymbal/src/metric_consts.rs b/rust/cymbal/src/metric_consts.rs new file mode 100644 index 0000000000000..8ac2798e64d5d --- /dev/null +++ b/rust/cymbal/src/metric_consts.rs @@ -0,0 +1,14 @@ +pub const ERRORS: &str = "cymbal_errors"; +pub const EVENT_RECEIVED: &str = "cymbal_event_received"; +pub const STACK_PROCESSED: &str = "cymbal_stack_track_processed"; +pub const BASIC_FETCHES: &str = "cymbal_basic_fetches"; +pub const SOURCEMAP_HEADER_FOUND: &str = "cymbal_sourcemap_header_found"; +pub const SOURCEMAP_BODY_REF_FOUND: &str = "cymbal_sourcemap_body_ref_found"; +pub const SOURCE_REF_BODY_FETCHES: &str = "cymbal_source_ref_body_fetches"; +pub const SOURCEMAP_NOT_FOUND: &str = "cymbal_sourcemap_not_found"; +pub const SOURCEMAP_BODY_FETCHES: &str = "cymbal_sourcemap_body_fetches"; +pub const STORE_CACHE_HITS: &str = "cymbal_store_cache_hits"; +pub const STORE_CACHE_MISSES: &str = "cymbal_store_cache_misses"; +pub const STORE_CACHED_BYTES: &str = "cymbal_store_cached_bytes"; +pub const STORE_CACHE_SIZE: &str = "cymbal_store_cache_size"; +pub const STORE_CACHE_EVICTIONS: &str = "cymbal_store_cache_evictions"; diff --git a/rust/cymbal/src/resolver.rs b/rust/cymbal/src/resolver.rs new file mode 100644 index 0000000000000..a11ded8623e65 --- /dev/null +++ b/rust/cymbal/src/resolver.rs @@ -0,0 +1,42 @@ +use crate::{ + error::Error, + symbol_store::SymbolStore, + types::frames::{Frame, RawFrame}, +}; +use axum::async_trait; +use sourcemap::SourceMap; + +#[async_trait] +pub trait Resolver: Send + Sync + 'static { + // Resolvers work on a per-frame basis, so we can be clever about the order + // in which we resolve them. We also force any resolver to handle all frame + // types + async fn resolve(&self, raw: RawFrame, team_id: i32) -> Result; +} + +pub struct ResolverImpl { + pub store: Box, +} + +#[async_trait] +impl Resolver for ResolverImpl { + async fn resolve(&self, raw: RawFrame, team_id: i32) -> Result { + let source_ref = raw.source_ref()?; + let source = self.store.fetch(team_id, source_ref).await?; + + // Since we only support js right now, this is all we do. Everything from here + // is js specific + let RawFrame::JavaScript(raw) = raw; + let sm = SourceMap::from_reader(source.as_slice())?; + let token = sm + .lookup_token(raw.line, raw.column) + .ok_or_else(|| Error::LookupFailed(String::from("Token not found")))?; + Ok((raw, token).into()) + } +} + +impl ResolverImpl { + pub fn new(store: Box) -> Self { + Self { store } + } +} diff --git a/rust/cymbal/src/symbol_store/basic.rs b/rust/cymbal/src/symbol_store/basic.rs new file mode 100644 index 0000000000000..ce60b86357952 --- /dev/null +++ b/rust/cymbal/src/symbol_store/basic.rs @@ -0,0 +1,204 @@ +use std::{sync::Arc, time::Duration}; + +use axum::async_trait; +use reqwest::Url; +use tracing::{info, warn}; + +use crate::{ + config::Config, + error::Error, + metric_consts::{ + BASIC_FETCHES, SOURCEMAP_BODY_FETCHES, SOURCEMAP_BODY_REF_FOUND, SOURCEMAP_HEADER_FOUND, + SOURCEMAP_NOT_FOUND, SOURCE_REF_BODY_FETCHES, + }, +}; + +use super::{SymbolSetRef, SymbolStore}; + +// A store that implements basic lookups, for whatever that means for each language. In +// JS, that means it does fetching and searches for sourcemap references. In other languages, +// it might mean talking to S3, or something else. It implements no caching, and no storing of +// fetched symbol sets - other stores should wrap this one to provide that functionality. +pub struct BasicStore { + pub client: reqwest::Client, +} + +impl BasicStore { + pub fn new(config: &Config) -> Result { + let mut client = reqwest::Client::builder(); + + let timeout = Duration::from_secs(config.sourcemap_timeout_seconds); + + if !config.allow_internal_ips { + client = client.dns_resolver(Arc::new(common_dns::PublicIPv4Resolver {})); + } else { + warn!("Internal IPs are allowed, this is a security risk"); + } + + let client = client.timeout(timeout).build()?; + + Ok(Self { client }) + } +} + +#[async_trait] +impl SymbolStore for BasicStore { + async fn fetch(&self, _: i32, r: SymbolSetRef) -> Result>, Error> { + metrics::counter!(BASIC_FETCHES).increment(1); + let SymbolSetRef::Js(sref) = r; // We only support this + let Some(sourcemap_url) = find_sourcemap_url(&self.client, sref.clone()).await? else { + warn!("No sourcemap URL found for {}", sref); + // TODO - this might not actually count as an error, and simply means we don't /need/ a sourcemap + // for a give frame, but I haven't decided how to handle that yet + return Err(Error::InvalidSourceRef(format!( + "No sourcemap URL found for {}", + sref + ))); + }; + fetch_source_map(&self.client, sourcemap_url) + .await + .map(Arc::new) + } +} + +async fn find_sourcemap_url(client: &reqwest::Client, start: Url) -> Result, Error> { + info!("Fetching sourcemap from {}", start); + let res = client.get(start).send().await?; + + // we use the final URL of the response in the relative case, to account for any redirects + let mut final_url = res.url().clone(); + + // First, we check for the sourcemap headers: SourceMap, or X-SourceMap + let headers = res.headers(); + let header_url = headers + .get("SourceMap") + .or_else(|| headers.get("X-SourceMap")); + + if let Some(header_url) = header_url { + info!("Found sourcemap header: {:?}", header_url); + metrics::counter!(SOURCEMAP_HEADER_FOUND).increment(1); + let url = header_url.to_str().map_err(|_| { + Error::InvalidSourceRef(format!("Failed to parse url from header of {}", res.url())) + })?; + + let url = if url.starts_with("http") { + url.parse() + .map_err(|_| Error::InvalidSourceRef(format!("Failed to parse {} to a url", url)))? + } else { + final_url.set_path(url); + final_url + }; + return Ok(Some(url)); + } + + // If we didn't find a header, we have to check the body + + // Grab the body as text, and split it into lines + metrics::counter!(SOURCE_REF_BODY_FETCHES).increment(1); + let body = res.text().await?; + let lines = body.lines().rev(); // Our needle tends to be at the bottom of the haystack + for line in lines { + if line.starts_with("//# sourceMappingURL=") { + metrics::counter!(SOURCEMAP_BODY_REF_FOUND).increment(1); + let found = line.trim_start_matches("//# sourceMappingURL="); + // These URLs can be relative, so we have to check if they are, and if they are, append the base URLs domain to them + let url = if found.starts_with("http") { + found.parse().map_err(|_| { + Error::InvalidSourceRef(format!("Failed to parse url from found ref {}", found)) + })? + } else { + final_url.set_path(found); + final_url + }; + return Ok(Some(url)); + } + } + + metrics::counter!(SOURCEMAP_NOT_FOUND).increment(1); + + Ok(None) // We didn't hit an error, but we failed to find a sourcemap for the provided URL +} + +async fn fetch_source_map(client: &reqwest::Client, url: Url) -> Result, Error> { + metrics::counter!(SOURCEMAP_BODY_FETCHES).increment(1); + let res = client.get(url).send().await?; + let bytes = res.bytes().await?; + Ok(bytes.to_vec()) +} + +#[cfg(test)] +mod test { + use httpmock::MockServer; + + const MINIFIED: &[u8] = include_bytes!("../../tests/static/chunk-PGUQKT6S.js"); + const MAP: &[u8] = include_bytes!("../../tests/static/chunk-PGUQKT6S.js.map"); + + use super::*; + + #[tokio::test] + async fn find_sourcemap_url_in_body_test() { + let server = MockServer::start(); + + let mock = server.mock(|when, then| { + when.method("GET").path("/static/chunk-PGUQKT6S.js"); + then.status(200).body(MINIFIED); + }); + + let client = reqwest::Client::new(); + let url = server.url("/static/chunk-PGUQKT6S.js").parse().unwrap(); + let res = find_sourcemap_url(&client, url).await.unwrap(); + + // We're doing relative-URL resolution here, so we have to account for that + let expected = Some(server.url("/static/chunk-PGUQKT6S.js.map").parse().unwrap()); + assert_eq!(res, expected); + mock.assert_hits(1); + } + + #[tokio::test] + async fn fetch_source_map_test() { + // This ones maybe a little silly - we're almost just testing reqwest + let server = MockServer::start(); + + let mock = server.mock(|when, then| { + when.method("GET").path("/static/chunk-PGUQKT6S.js.map"); + then.status(200).body(MAP); + }); + + let client = reqwest::Client::new(); + let url = server.url("/static/chunk-PGUQKT6S.js.map").parse().unwrap(); + let res = fetch_source_map(&client, url).await.unwrap(); + + assert_eq!(res, MAP); + mock.assert_hits(1); + } + + #[tokio::test] + async fn full_follows_links_test() { + let server = MockServer::start(); + + let first_mock = server.mock(|when, then| { + when.method("GET").path("/static/chunk-PGUQKT6S.js"); + then.status(200).body(MINIFIED); + }); + + let second_mock = server.mock(|when, then| { + when.method("GET").path("/static/chunk-PGUQKT6S.js.map"); + then.status(200).body(MAP); + }); + + let mut config = Config::init_with_defaults().unwrap(); + // Needed because we're using mockserver, so hitting localhost + config.allow_internal_ips = true; + let store = BasicStore::new(&config).unwrap(); + + let start_url = server.url("/static/chunk-PGUQKT6S.js").parse().unwrap(); + + let res = store.fetch(1, SymbolSetRef::Js(start_url)).await.unwrap(); + + assert_eq!(*res, MAP); + first_mock.assert_hits(1); + second_mock.assert_hits(1); + } + + // TODO - tests for the non-relative //sourcemap case, for the SourceMap header, and for the X-SourceMap header +} diff --git a/rust/cymbal/src/symbol_store/caching.rs b/rust/cymbal/src/symbol_store/caching.rs new file mode 100644 index 0000000000000..c6e74f1f33955 --- /dev/null +++ b/rust/cymbal/src/symbol_store/caching.rs @@ -0,0 +1,121 @@ +use std::{collections::HashMap, sync::Arc, time::Instant}; + +use axum::async_trait; +use tokio::sync::Mutex; + +use crate::{ + error::Error, + metric_consts::{ + STORE_CACHED_BYTES, STORE_CACHE_EVICTIONS, STORE_CACHE_HITS, STORE_CACHE_MISSES, + STORE_CACHE_SIZE, + }, +}; + +use super::{SymbolSetRef, SymbolStore}; + +pub struct CachingStore { + inner: Box, + cache: Mutex, +} + +impl CachingStore { + pub fn new(inner: Box, max_bytes: usize) -> Self { + metrics::gauge!(STORE_CACHE_SIZE).set(max_bytes as f64); + Self { + inner, + cache: Mutex::new(CacheInner { + cached: Default::default(), + max_bytes, + held_bytes: 0, + }), + } + } +} + +#[async_trait] +impl SymbolStore for CachingStore { + async fn fetch(&self, team_id: i32, r: SymbolSetRef) -> Result>, Error> { + let mut cache = self.cache.lock().await; + + if let Some(cached) = cache.get(&r) { + metrics::counter!(STORE_CACHE_HITS).increment(1); + return Ok(cached); + } + metrics::counter!(STORE_CACHE_MISSES).increment(1); + + // We hold the cache lock across the underlying fetch, so that if two threads + // are racing to fetch the same item, we don't end up doing the request/data transfer twice. + let res = self.inner.fetch(team_id, r.clone()).await?; + + cache.insert(r, Arc::clone(&res)); + + Ok(res) + } +} + +struct CacheInner { + // We expect this cache to consist of few, but large, items. + cached: HashMap, + held_bytes: usize, + max_bytes: usize, +} + +// TODO - someone smarter than me should replace all this with a proper caching lib, +// but I'm too lazy, I uhh mean task focused, to go evaluate one right now. +impl CacheInner { + fn insert(&mut self, key: SymbolSetRef, value: Arc>) { + self.held_bytes += value.len(); + self.cached.insert( + key, + CachedSymbolSet { + data: value, + last_used: Instant::now(), + }, + ); + + self.evict(); + } + + fn get(&mut self, key: &SymbolSetRef) -> Option>> { + self.cached.get_mut(key).map(|v| { + v.last_used = Instant::now(); + Arc::clone(&v.data) + }) + } + + fn evict(&mut self) { + if self.held_bytes <= self.max_bytes { + metrics::gauge!(STORE_CACHED_BYTES).set(self.held_bytes as f64); + return; + } + + metrics::counter!(STORE_CACHE_EVICTIONS).increment(1); + + let mut vals: Vec<_> = self.cached.iter().collect(); + + // Sort to oldest-last, then pop until we're below the water line + vals.sort_unstable_by_key(|(_, v)| v.last_used); + vals.reverse(); + + // We're borrowing all these refs from the hashmap, so we collect here to + // remove them in a separate pass. + let mut to_remove = vec![]; + while self.held_bytes > self.max_bytes && !vals.is_empty() { + // We can unwrap here because we know we're not empty from the line above + let (to_remove_key, to_remove_val) = vals.pop().unwrap(); + self.held_bytes -= to_remove_val.data.len(); + to_remove.push(to_remove_key.clone()); + } + + for key in to_remove { + self.cached.remove(&key); + } + + metrics::gauge!(STORE_CACHED_BYTES).set(self.held_bytes as f64); + } +} + +struct CachedSymbolSet { + pub data: Arc>, + pub last_used: Instant, +} diff --git a/rust/cymbal/src/symbol_store/mod.rs b/rust/cymbal/src/symbol_store/mod.rs new file mode 100644 index 0000000000000..b52e42b0ce689 --- /dev/null +++ b/rust/cymbal/src/symbol_store/mod.rs @@ -0,0 +1,20 @@ +use std::sync::Arc; + +use axum::async_trait; +use reqwest::Url; + +use crate::error::Error; + +pub mod basic; +pub mod caching; + +#[async_trait] +pub trait SymbolStore: Send + Sync + 'static { + // Symbol stores return an Arc, to allow them to cache (and evict) without any consent from callers + async fn fetch(&self, team_id: i32, r: SymbolSetRef) -> Result>, Error>; +} + +#[derive(Debug, Clone, Hash, Eq, PartialEq)] +pub enum SymbolSetRef { + Js(Url), +} diff --git a/rust/cymbal/src/symbols/js.rs b/rust/cymbal/src/symbols/js.rs deleted file mode 100644 index 59701e30d3ac8..0000000000000 --- a/rust/cymbal/src/symbols/js.rs +++ /dev/null @@ -1,25 +0,0 @@ -use serde::{Deserialize, Serialize}; - -// A minifed JS stack frame. Just the minimal information needed to lookup some -// sourcemap for it and produce a "real" stack frame. -#[derive(Debug, Clone, Deserialize)] -pub struct RawJSFrame { - #[serde(rename = "lineno")] - pub line: u32, - #[serde(rename = "colno")] - pub column: u32, - #[serde(rename = "filename")] - pub uri: String, - pub in_app: bool, - #[serde(rename = "function")] - pub fn_name: String, -} - -#[derive(Debug, Clone, Serialize)] -pub struct ProcessedFrame { - pub line: u32, - pub column: u32, - pub uri: String, - pub in_app: bool, - pub fn_name: String, -} diff --git a/rust/cymbal/src/symbols/mod.rs b/rust/cymbal/src/symbols/mod.rs deleted file mode 100644 index 88cc15bfba33b..0000000000000 --- a/rust/cymbal/src/symbols/mod.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub mod js; -pub mod symbolifier; -pub mod types; diff --git a/rust/cymbal/src/symbols/symbolifier.rs b/rust/cymbal/src/symbols/symbolifier.rs deleted file mode 100644 index 75f53d781cce1..0000000000000 --- a/rust/cymbal/src/symbols/symbolifier.rs +++ /dev/null @@ -1,9 +0,0 @@ -use super::types::{ProcessedStack, RawStack}; - -pub struct Symbolifier; - -impl Symbolifier { - pub fn symbolify(_stack: RawStack) -> ProcessedStack { - unimplemented!() - } -} diff --git a/rust/cymbal/src/symbols/types.rs b/rust/cymbal/src/symbols/types.rs deleted file mode 100644 index 08239ab5c4254..0000000000000 --- a/rust/cymbal/src/symbols/types.rs +++ /dev/null @@ -1,79 +0,0 @@ -use std::collections::HashMap; - -use serde::Deserialize; -use serde::Serialize; -use serde_json::Value; - -use super::{js::RawJSFrame, symbolifier::Symbolifier}; - -#[derive(Debug, Deserialize)] -#[serde(untagged)] -pub enum RawFrame { - JavaScript(RawJSFrame), -} - -// Stacks don't care what the "type" of the frames they contain are, and even permit -// frames of different types to be mixed together, because we're going to end up "exploding" -// them into their frame-set anyway, and dispatching a task per frame in a language-agnostic -// way. Supporting mixed-type stacks is a side benefit of this - I don't know that we'll ever -// see them, but we get the flexibility "for free" -#[derive(Debug, Deserialize)] -pub struct RawStack { - pub frames: Vec, -} - -pub enum ProcessedFrame { - JavaScript(), -} - -pub struct ProcessedStack { - pub frames: Vec, -} - -impl RawStack { - pub async fn process(self, _sym: &Symbolifier) -> ProcessedStack { - unimplemented!() - } -} - -#[derive(Debug, Deserialize, Serialize, Clone)] -pub struct PropertyView { - #[serde(rename = "$exception_type")] - pub exception_type: String, - #[serde(rename = "$exception_message")] - pub exception_message: String, - #[serde(rename = "$exception_stack_trace_raw")] - pub exception_stack_trace_raw: String, - #[serde(rename = "$exception_level")] - pub exception_level: String, - #[serde(rename = "$exception_source")] - pub exception_source: String, - #[serde(rename = "$exception_lineno")] - pub exception_line: u32, - #[serde(rename = "$exception_colno")] - pub exception_col: u32, - #[serde(flatten)] - other: HashMap, -} - -#[cfg(test)] -mod test { - use common_types::ClickHouseEvent; - - use crate::symbols::types::{PropertyView, RawFrame}; - - #[test] - fn it_symbolifies() { - let raw: &'static str = include_str!("../../tests/static/raw_js_stack.json"); - - let raw: ClickHouseEvent = serde_json::from_str(raw).unwrap(); - - let exception_properties: PropertyView = - serde_json::from_str(&raw.properties.unwrap()).unwrap(); - - let stack_trace: Vec = - serde_json::from_str(&exception_properties.exception_stack_trace_raw).unwrap(); - - println!("{:?}", stack_trace); - } -} diff --git a/rust/cymbal/src/traits.rs b/rust/cymbal/src/traits.rs deleted file mode 100644 index 1449c934793d5..0000000000000 --- a/rust/cymbal/src/traits.rs +++ /dev/null @@ -1,13 +0,0 @@ -use crate::symbols::types::RawStack; - -// An "exception" is anything that can self-identify with a "fingerprint" -pub trait Exception { - fn id(&self) -> String; - fn to_raw(self) -> serde_json::Value; -} - -// Some excpetions have a raw stack trace we can process. If they do, - -pub trait Stacked: Exception { - fn stack(&self) -> RawStack; -} diff --git a/rust/cymbal/src/types/error.rs b/rust/cymbal/src/types/error.rs new file mode 100644 index 0000000000000..a01b36fbfb297 --- /dev/null +++ b/rust/cymbal/src/types/error.rs @@ -0,0 +1,4 @@ +use thiserror::Error; + +#[derive(Debug, Clone, Error)] +pub enum Error {} diff --git a/rust/cymbal/src/types/frames.rs b/rust/cymbal/src/types/frames.rs new file mode 100644 index 0000000000000..395e223c7df15 --- /dev/null +++ b/rust/cymbal/src/types/frames.rs @@ -0,0 +1,48 @@ +use serde::{Deserialize, Serialize}; +use sourcemap::Token; + +use crate::{error::Error, langs::js::RawJSFrame, symbol_store::SymbolSetRef}; + +// We consume a huge variety of differently shaped stack frames, which we have special-case +// transformation for, to produce a single, unified representation of a frame. +#[derive(Debug, Deserialize)] +#[serde(untagged)] +pub enum RawFrame { + JavaScript(RawJSFrame), +} + +impl RawFrame { + pub fn source_ref(&self) -> Result { + let RawFrame::JavaScript(raw) = self; + let id = raw.source_ref(); + id.map(SymbolSetRef::Js) + } +} + +// We emit a single, unified representation of a frame, which is what we pass on to users. +#[derive(Debug, Clone, Serialize)] +pub struct Frame { + pub mangled_name: String, // Mangled name of the function + pub line: Option, // Line the function is define on, if known + pub column: Option, // Column the function is defined on, if known + pub source: Option, // Generally, the file the function is defined in + pub in_app: bool, // We hard-require clients to tell us this? + pub resolved_name: Option, // The name of the function, after symbolification + pub lang: String, // The language of the frame. Always known (I guess?) +} + +impl From<(RawJSFrame, Token<'_>)> for Frame { + fn from(src: (RawJSFrame, Token)) -> Self { + let (raw_frame, token) = src; + + Self { + mangled_name: raw_frame.fn_name, + line: Some(token.get_src_line()), + column: Some(token.get_src_col()), + source: token.get_source().map(String::from), + in_app: raw_frame.in_app, + resolved_name: token.get_name().map(String::from), + lang: "javascript".to_string(), + } + } +} diff --git a/rust/cymbal/src/types/mod.rs b/rust/cymbal/src/types/mod.rs new file mode 100644 index 0000000000000..2b129c130720e --- /dev/null +++ b/rust/cymbal/src/types/mod.rs @@ -0,0 +1,54 @@ +use std::collections::HashMap; + +use serde::{Deserialize, Serialize}; +use serde_json::Value; + +pub mod error; +pub mod frames; +pub mod stacks; + +// Given a Clickhouse Event's properties, we care about the contents +// of only a small subset. This struct is used to give us a strongly-typed +// "view" of those event properties we care about. +#[derive(Debug, Deserialize, Serialize, Clone)] +pub struct ErrProps { + #[serde(rename = "$exception_type")] + pub exception_type: String, // Required from exception producers - we will not process events without this + #[serde(rename = "$exception_message")] + pub exception_message: String, // Required from exception producers - we will not process events without this + #[serde(rename = "$exception_stack_trace_raw")] + pub exception_stack_trace_raw: Option, // Not all exceptions have a stack trace + #[serde(rename = "$exception_level")] + pub exception_level: Option, // We generally don't touch this, but we break it out explicitly for users. Not all exceptions have a level + #[serde(rename = "$exception_source")] + pub exception_source: Option, // For some languages, we can associate the exception with e.g. a source file or binary. + #[serde(rename = "$exception_lineno")] + pub exception_line: Option, // Some exceptions have a source line + #[serde(rename = "$exception_colno")] + pub exception_col: Option, // Some even have a column + #[serde(flatten)] // A catch-all for all the properties we don't "care" about + pub other: HashMap, +} + +#[cfg(test)] +mod test { + use common_types::ClickHouseEvent; + + use crate::types::frames::RawFrame; + + use super::ErrProps; + + #[test] + fn it_symbolifies() { + let raw: &'static str = include_str!("../../tests/static/raw_js_stack.json"); + + let raw: ClickHouseEvent = serde_json::from_str(raw).unwrap(); + + let props: ErrProps = serde_json::from_str(&raw.properties.unwrap()).unwrap(); + + let stack_trace: Vec = + serde_json::from_str(props.exception_stack_trace_raw.as_ref().unwrap()).unwrap(); + + println!("{:?}", stack_trace); + } +} diff --git a/rust/cymbal/src/types/stacks.rs b/rust/cymbal/src/types/stacks.rs new file mode 100644 index 0000000000000..c60198dad2a7a --- /dev/null +++ b/rust/cymbal/src/types/stacks.rs @@ -0,0 +1,19 @@ +use serde::{Deserialize, Serialize}; + +use super::frames::{Frame, RawFrame}; + +// The stacks we consume are a list of frames. This structure is very flexible, so that +// we support stacks of intermingled languages or types. We only case about special-cased +// handling on a per-frame basis, not a per-stack basis. All the "logic" lives at the frame +// level +#[derive(Debug, Deserialize)] +pub struct RawStack { + pub frames: Vec, +} + +// Our resolved stacks are, as you'd expect, just a vecs of frames. We might add +// "stack-level" information at some point, if we find a need. +#[derive(Debug, Serialize)] +pub struct Stack { + pub frames: Vec, +} diff --git a/rust/cymbal/tests/static/chunk-PGUQKT6S.js b/rust/cymbal/tests/static/chunk-PGUQKT6S.js new file mode 100644 index 0000000000000..01f497fcbfa8f --- /dev/null +++ b/rust/cymbal/tests/static/chunk-PGUQKT6S.js @@ -0,0 +1,659 @@ +import{a as J,c as PK,f as _,g as D,h as b,i as E,k as v}from"/static/chunk-W2W3QRMT.js";function As(n,e=0){return n[n.length-(1+e)]}function jF(n){if(n.length===0)throw new Error("Invalid tail call");return[n.slice(0,n.length-1),n[n.length-1]]}function Ht(n,e,t=(i,o)=>i===o){if(n===e)return!0;if(!n||!e||n.length!==e.length)return!1;for(let i=0,o=n.length;it(n[i],e))}function OK(n,e){let t=0,i=n-1;for(;t<=i;){let o=(t+i)/2|0,s=e(o);if(s<0)t=o+1;else if(s>0)i=o-1;else return o}return-(t+1)}function $F(n,e,t){if(n=n|0,n>=e.length)throw new TypeError("invalid index");let i=e[Math.floor(e.length*Math.random())],o=[],s=[],r=[];for(let a of e){let l=t(a,i);l<0?o.push(a):l>0?s.push(a):r.push(a)}return n!!e)}function mI(n){let e=0;for(let t=0;t0}function xr(n,e=t=>t){let t=new Set;return n.filter(i=>{let o=e(i);return t.has(o)?!1:(t.add(o),!0)})}function lg(n,e){return n.length>0?n[0]:e}function Un(n,e){let t=typeof e=="number"?n:0;typeof e=="number"?t=n:(t=0,e=n);let i=[];if(t<=e)for(let o=t;oe;o--)i.push(o);return i}function fd(n,e,t){let i=n.slice(0,e),o=n.slice(e);return i.concat(t,o)}function q1(n,e){let t=n.indexOf(e);t>-1&&(n.splice(t,1),n.unshift(e))}function x_(n,e){let t=n.indexOf(e);t>-1&&(n.splice(t,1),n.push(e))}function L_(n,e){for(let t of e)n.push(t)}function QF(n){return Array.isArray(n)?n:[n]}function FK(n,e,t){let i=JF(n,e),o=n.length,s=t.length;n.length=o+s;for(let r=o-1;r>=i;r--)n[r+s]=n[r];for(let r=0;re(n(t),n(i))}function e9(...n){return(e,t)=>{for(let i of n){let o=i(e,t);if(!S_.isNeitherLessOrGreaterThan(o))return o}return S_.neitherLessOrGreaterThan}}function i9(n){return(e,t)=>-n(e,t)}var S_,ma,t9,mo,ga,qF,wt=J(()=>{"use strict";_();v();b();(function(n){function e(s){return s<0}n.isLessThan=e;function t(s){return s<=0}n.isLessThanOrEqual=t;function i(s){return s>0}n.isGreaterThan=i;function o(s){return s===0}n.isNeitherLessOrGreaterThan=o,n.greaterThan=1,n.lessThan=-1,n.neitherLessOrGreaterThan=0})(S_||(S_={}));ma=(n,e)=>n-e,t9=(n,e)=>ma(n?1:0,e?1:0);mo=class{constructor(e){this.items=e,this.firstIdx=0,this.lastIdx=this.items.length-1}get length(){return this.lastIdx-this.firstIdx+1}takeWhile(e){let t=this.firstIdx;for(;t=0&&e(this.items[t]);)t--;let i=t===this.lastIdx?null:this.items.slice(t+1,this.lastIdx+1);return this.lastIdx=t,i}peek(){if(this.length!==0)return this.items[this.firstIdx]}dequeue(){let e=this.items[this.firstIdx];return this.firstIdx++,e}takeCount(e){let t=this.items.slice(this.firstIdx,this.firstIdx+e);return this.firstIdx+=e,t}},ga=class n{constructor(e){this.iterate=e}toArray(){let e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(e){return new n(t=>this.iterate(i=>e(i)?t(i):!0))}map(e){return new n(t=>this.iterate(i=>t(e(i))))}findLast(e){let t;return this.iterate(i=>(e(i)&&(t=i),!0)),t}findLastMaxBy(e){let t,i=!0;return this.iterate(o=>((i||S_.isGreaterThan(e(o,t)))&&(i=!1,t=o),!0)),t}};ga.empty=new ga(n=>{});qF=class n{constructor(e){this._indexMap=e}static createSortPermutation(e,t){let i=Array.from(e.keys()).sort((o,s)=>t(e[o],e[s]));return new n(i)}apply(e){return e.map((t,i)=>e[this._indexMap[i]])}inverse(){let e=this._indexMap.slice();for(let t=0;t"u"}function bc(n){return!io(n)}function io(n){return ds(n)||n===null}function Ms(n,e){if(!n)throw new Error(e?`Unexpected type, expected '${e}'`:"Unexpected type")}function G1(n){if(io(n))throw new Error("Assertion Failed: argument is undefined or null");return n}function cg(n){return typeof n=="function"}function o9(n,e){let t=Math.min(n.length,e.length);for(let i=0;i{"use strict";_();v();b()});function cl(n){if(!n||typeof n!="object"||n instanceof RegExp)return n;let e=Array.isArray(n)?[]:{};return Object.entries(n).forEach(([t,i])=>{e[t]=i&&typeof i=="object"?cl(i):i}),e}function s9(n){if(!n||typeof n!="object")return n;let e=[n];for(;e.length>0;){let t=e.shift();Object.freeze(t);for(let i in t)if(r9.call(t,i)){let o=t[i];typeof o=="object"&&!Object.isFrozen(o)&&!n9(o)&&e.push(o)}}return n}function Z1(n,e){return bI(n,e,new Set)}function bI(n,e,t){if(io(n))return n;let i=e(n);if(typeof i<"u")return i;if(Array.isArray(n)){let o=[];for(let s of n)o.push(bI(s,e,t));return o}if(dn(n)){if(t.has(n))throw new Error("Cannot clone recursive data-structure");t.add(n);let o={};for(let s in n)r9.call(n,s)&&(o[s]=bI(n[s],e,t));return t.delete(n),o}return n}function WK(n,e,t=!0){return dn(n)?(dn(e)&&Object.keys(e).forEach(i=>{i in n?t&&(dn(n[i])&&dn(e[i])?WK(n[i],e[i],t):n[i]=e[i]):n[i]=e[i]}),n):e}function hn(n,e){if(n===e)return!0;if(n==null||e===null||e===void 0||typeof n!=typeof e||typeof n!="object"||Array.isArray(n)!==Array.isArray(e))return!1;let t,i;if(Array.isArray(n)){if(n.length!==e.length)return!1;for(t=0;tfunction(){let s=Array.prototype.slice.call(arguments,0);return e(o,s)},i={};for(let o of n)i[o]=t(o);return i}var r9,hs=J(()=>{"use strict";_();v();b();xi();r9=Object.prototype.hasOwnProperty});function l9(n,e){let t;return e.length===0?t=n:t=n.replace(/\{(\d+)\}/g,(i,o)=>{let s=o[0],r=e[s],a=i;return typeof r=="string"?a=r:(typeof r=="number"||typeof r=="boolean"||r===void 0||r===null)&&(a=String(r)),a}),VK&&(t="\uFF3B"+t.replace(/[aouei]/g,"$&$&")+"\uFF3D"),t}function p(n,e,...t){return l9(e,t)}function Zte(n,e,...t){let i=l9(e,t);return{value:i,original:i}}var VK,Ge=J(()=>{"use strict";_();v();b();VK=typeof document<"u"&&document.location&&document.location.hash.indexOf("pseudo=true")>=0});function p9(){if(!h9){h9=!0;let n=new Uint8Array(2);n[0]=1,n[1]=2,d9=new Uint16Array(n.buffer)[0]===513}return d9}var vI,CI,hg,D_,E_,k_,HK,u9,yI,UK,SI,KK,f9,X1,Q1,c9,$K,_a,vc,To,g9,qK,wI,Li,Be,mi,md,hl,jK,m9,Rs,J1,dl,eie,GK,eC,po,d9,h9,xI,_9,b9,v9,C9,Lt=J(()=>{"use strict";_();v();b();Ge();hg="en",D_=!1,E_=!1,k_=!1,HK=!1,u9=!1,yI=!1,UK=!1,SI=!1,KK=!1,f9=!1,Q1=hg,c9=hg,vc=globalThis;typeof vc.vscode<"u"&&typeof vc.vscode.process<"u"?To=vc.vscode.process:typeof D<"u"&&typeof((vI=D===null||D===void 0?void 0:D.versions)===null||vI===void 0?void 0:vI.node)=="string"&&(To=D);g9=typeof((CI=To?.versions)===null||CI===void 0?void 0:CI.electron)=="string",qK=g9&&To?.type==="renderer";if(typeof To=="object"){D_=To.platform==="win32",E_=To.platform==="darwin",k_=To.platform==="linux",HK=k_&&!!To.env.SNAP&&!!To.env.SNAP_REVISION,UK=g9,KK=!!To.env.CI||!!To.env.BUILD_ARTIFACTSTAGINGDIRECTORY,X1=hg,Q1=hg;let n=To.env.VSCODE_NLS_CONFIG;if(n)try{let e=JSON.parse(n),t=e.availableLanguages["*"];X1=e.locale,c9=e.osLocale,Q1=t||hg,$K=e._translationsConfigFile}catch{}u9=!0}else typeof navigator=="object"&&!qK?(_a=navigator.userAgent,D_=_a.indexOf("Windows")>=0,E_=_a.indexOf("Macintosh")>=0,SI=(_a.indexOf("Macintosh")>=0||_a.indexOf("iPad")>=0||_a.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,k_=_a.indexOf("Linux")>=0,f9=_a?.indexOf("Mobi")>=0,yI=!0,X1=(p({key:"ensureLoaderPluginIsLoaded",comment:["{Locked}"]},"_"),void 0)||hg,Q1=X1,c9=navigator.language):console.error("Unable to resolve platform.");wI=0;E_?wI=1:D_?wI=3:k_&&(wI=2);Li=D_,Be=E_,mi=k_,md=u9,hl=yI,jK=yI&&typeof vc.importScripts=="function",m9=jK?vc.origin:void 0,Rs=SI,J1=f9,dl=_a,eie=Q1,GK=typeof vc.postMessage=="function"&&!vc.importScripts,eC=(()=>{if(GK){let n=[];vc.addEventListener("message",t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let i=0,o=n.length;i{let i=++e;n.push({id:i,callback:t}),vc.postMessage({vscodeScheduleAsyncWork:i},"*")}}return n=>setTimeout(n)})(),po=E_||SI?2:D_?1:3,d9=!0,h9=!1;xI=!!(dl&&dl.indexOf("Chrome")>=0),_9=!!(dl&&dl.indexOf("Firefox")>=0),b9=!!(!xI&&dl&&dl.indexOf("Safari")>=0),v9=!!(dl&&dl.indexOf("Edg/")>=0),C9=!!(dl&&dl.indexOf("Android")>=0)});var nn,I_=J(()=>{"use strict";_();v();b();nn={tabSize:4,indentSize:4,insertSpaces:!0,detectIndentation:!0,trimAutoWhitespace:!0,largeFileOptimizations:!0,bracketPairColorizationOptions:{enabled:!0,independentColorPoolPerBracketType:!1}}});var ht,js=J(()=>{"use strict";_();v();b();(function(n){function e(y){return y&&typeof y=="object"&&typeof y[Symbol.iterator]=="function"}n.is=e;let t=Object.freeze([]);function i(){return t}n.empty=i;function*o(y){yield y}n.single=o;function s(y){return e(y)?y:o(y)}n.wrap=s;function r(y){return y||t}n.from=r;function*a(y){for(let x=y.length-1;x>=0;x--)yield y[x]}n.reverse=a;function l(y){return!y||y[Symbol.iterator]().next().done===!0}n.isEmpty=l;function c(y){return y[Symbol.iterator]().next().value}n.first=c;function d(y,x){for(let k of y)if(x(k))return!0;return!1}n.some=d;function h(y,x){for(let k of y)if(x(k))return k}n.find=h;function*u(y,x){for(let k of y)x(k)&&(yield k)}n.filter=u;function*f(y,x){let k=0;for(let T of y)yield x(T,k++)}n.map=f;function*g(...y){for(let x of y)yield*x}n.concat=g;function m(y,x,k){let T=k;for(let N of y)T=x(T,N);return T}n.reduce=m;function*C(y,x,k=y.length){for(x<0&&(x+=y.length),k<0?k+=y.length:k>y.length&&(k=y.length);x{"use strict";_();v();b();Ai=class n{constructor(e){this.element=e,this.next=n.Undefined,this.prev=n.Undefined}};Ai.Undefined=new Ai(void 0);Ii=class{constructor(){this._first=Ai.Undefined,this._last=Ai.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===Ai.Undefined}clear(){let e=this._first;for(;e!==Ai.Undefined;){let t=e.next;e.prev=Ai.Undefined,e.next=Ai.Undefined,e=t}this._first=Ai.Undefined,this._last=Ai.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let i=new Ai(e);if(this._first===Ai.Undefined)this._first=i,this._last=i;else if(t){let s=this._last;this._last=i,i.prev=s,s.next=i}else{let s=this._first;this._first=i,i.next=s,s.prev=i}this._size+=1;let o=!1;return()=>{o||(o=!0,this._remove(i))}}shift(){if(this._first!==Ai.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Ai.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Ai.Undefined&&e.next!==Ai.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===Ai.Undefined&&e.next===Ai.Undefined?(this._first=Ai.Undefined,this._last=Ai.Undefined):e.next===Ai.Undefined?(this._last=this._last.prev,this._last.next=Ai.Undefined):e.prev===Ai.Undefined&&(this._first=this._first.next,this._first.prev=Ai.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==Ai.Undefined;)yield e.element,e=e.next}}});function ZK(n=""){let e="(-?\\d*\\.\\d\\w*)|([^";for(let t of LI)n.indexOf(t)>=0||(e+="\\"+t);return e+="\\s]+)",new RegExp(e,"g")}function N_(n){let e=T_;if(n&&n instanceof RegExp)if(n.global)e=n;else{let t="g";n.ignoreCase&&(t+="i"),n.multiline&&(t+="m"),n.unicode&&(t+="u"),e=new RegExp(n.source,t)}return e.lastIndex=0,e}function pd(n,e,t,i,o){if(e=N_(e),o||(o=ht.first(w9)),t.length>o.maxLen){let c=n-o.maxLen/2;return c<0?c=0:i+=c,t=t.substring(c,n+o.maxLen/2),pd(n,e,t,i,o)}let s=Date.now(),r=n-1-i,a=-1,l=null;for(let c=1;!(Date.now()-s>=o.timeBudget);c++){let d=r-o.windowSize*c;e.lastIndex=Math.max(0,d);let h=YK(e,t,r,a);if(!h&&l||(l=h,d<=0))break;a=d}if(l){let c={word:l[0],startColumn:i+1+l.index,endColumn:i+1+l.index+l[0].length};return e.lastIndex=0,c}return null}function YK(n,e,t,i){let o;for(;o=n.exec(e);){let s=o.index||0;if(s<=t&&n.lastIndex>=t)return o;if(i>0&&s>i)return null}return null}var LI,T_,w9,ug=J(()=>{"use strict";_();v();b();js();kr();LI="`~!@#$%^&*()-=+[{]}\\|;:'\",.<>/?";T_=ZK();w9=new Ii;w9.unshift({maxLen:1e3,windowSize:15,timeBudget:150})});function ut(n){yd(n)||x9.onUnexpectedError(n)}function oC(n){yd(n)||x9.onUnexpectedExternalError(n)}function cT(n){if(n instanceof Error){let{name:e,message:t}=n,i=n.stacktrace||n.stack;return{$isError:!0,name:e,message:t,stack:i,noTelemetry:R_.isErrorNoTelemetry(n)}}return n}function yd(n){return n instanceof Dr?!0:n instanceof Error&&n.name===iC&&n.message===iC}function L9(){let n=new Error(iC);return n.name=n.message,n}function Sd(n){return n?new Error(`Illegal argument: ${n}`):new Error("Illegal argument")}function _g(n){return n?new Error(`Illegal state: ${n}`):new Error("Illegal state")}var lT,x9,iC,Dr,nC,R_,St,xt=J(()=>{"use strict";_();v();b();lT=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?R_.isErrorNoTelemetry(e)?new R_(e.message+` + +`+e.stack):new Error(e.message+` + +`+e.stack):e},0)}}emit(e){this.listeners.forEach(t=>{t(e)})}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},x9=new lT;iC="Canceled";Dr=class extends Error{constructor(){super(iC),this.name=this.message}};nC=class extends Error{constructor(e){super("NotSupported"),e&&(this.message=e)}},R_=class n extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(e){if(e instanceof n)return e;let t=new n;return t.message=e.message,t.stack=e.stack,t}static isErrorNoTelemetry(e){return e.name==="CodeExpectedError"}},St=class n extends Error{constructor(e){super(e||"An unexpected bug occurred."),Object.setPrototypeOf(this,n.prototype)}}});function wa(n,e){let t=this,i=!1,o;return function(){if(i)return o;if(i=!0,e)try{o=n.apply(t,arguments)}finally{e()}else o=n.apply(t,arguments);return o}}var bg=J(()=>{"use strict";_();v();b()});function r$(n){us=n}function ou(n){return us?.trackDisposable(n),n}function su(n){us?.markAsDisposed(n)}function sC(n,e){us?.setParent(n,e)}function a$(n,e){if(us)for(let t of n)us.setParent(t,e)}function Ld(n){return us?.markAsSingleton(n),n}function aC(n){return typeof n=="object"&&n!==null&&typeof n.dispose=="function"&&n.dispose.length===0}function li(n){if(ht.is(n)){let e=[];for(let t of n)if(t)try{t.dispose()}catch(i){e.push(i)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"Encountered errors while disposing of store");return Array.isArray(n)?[]:n}else if(n)return n.dispose(),n}function _o(...n){let e=be(()=>li(n));return a$(n,e),e}function be(n){let e=ou({dispose:wa(()=>{su(e),n()})});return e}var s$,us,ae,H,no,k9,rC,xd,le=J(()=>{"use strict";_();v();b();bg();js();s$=!1,us=null;if(s$){let n="__is_disposable_tracked__";r$(new class{trackDisposable(e){let t=new Error("Potentially leaked disposable").stack;setTimeout(()=>{e[n]||console.log(t)},3e3)}setParent(e,t){if(e&&e!==H.None)try{e[n]=!0}catch{}}markAsDisposed(e){if(e&&e!==H.None)try{e[n]=!0}catch{}}markAsSingleton(e){}})}ae=class n{constructor(){this._toDispose=new Set,this._isDisposed=!1,ou(this)}dispose(){this._isDisposed||(su(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{li(this._toDispose)}finally{this._toDispose.clear()}}add(e){if(!e)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return sC(e,this),this._isDisposed?n.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(e),e}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),sC(e,null))}};ae.DISABLE_DISPOSED_WARNING=!1;H=class{constructor(){this._store=new ae,ou(this),sC(this._store,this)}dispose(){su(this),this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};H.None=Object.freeze({dispose(){}});no=class{constructor(){this._isDisposed=!1,ou(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||((t=this._value)===null||t===void 0||t.dispose(),e&&sC(e,this),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=!0,su(this),(e=this._value)===null||e===void 0||e.dispose(),this._value=void 0}},k9=class{constructor(e){this._disposable=e,this._counter=1}acquire(){return this._counter++,this}release(){return--this._counter===0&&this._disposable.dispose(),this}},rC=class{constructor(e){this.object=e}dispose(){}},xd=class{constructor(){this._store=new Map,this._isDisposed=!1,ou(this)}dispose(){su(this),this._isDisposed=!0,this.clearAndDisposeAll()}clearAndDisposeAll(){if(this._store.size)try{li(this._store.values())}finally{this._store.clear()}}get(e){return this._store.get(e)}set(e,t,i=!1){var o;this._isDisposed&&console.warn(new Error("Trying to add a disposable to a DisposableMap that has already been disposed of. The added object will be leaked!").stack),i||(o=this._store.get(e))===null||o===void 0||o.dispose(),this._store.set(e,t)}deleteAndDispose(e){var t;(t=this._store.get(e))===null||t===void 0||t.dispose(),this._store.delete(e)}[Symbol.iterator](){return this._store[Symbol.iterator]()}}});var l$,Er,vg=J(()=>{"use strict";_();v();b();l$=globalThis.performance&&typeof globalThis.performance.now=="function",Er=class n{static create(e){return new n(e)}constructor(e){this._now=l$&&e===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}}});var c$,D9,d$,ie,O_,E9,dT,F_,Cg,h$,u$,P_,B,I9,lC,ul,wg,cC,dC,kd,B_,ye=J(()=>{"use strict";_();v();b();xt();bg();le();kr();vg();c$=!1,D9=!1,d$=!1;(function(n){n.None=()=>H.None;function e(V){if(d$){let{onDidAddListener:z}=V,te=F_.create(),ee=0;V.onDidAddListener=()=>{++ee===2&&(console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here"),te.print()),z?.()}}}function t(V,z){return u(V,()=>{},0,void 0,!0,void 0,z)}n.defer=t;function i(V){return(z,te=null,ee)=>{let ce=!1,Ce;return Ce=V(Se=>{if(!ce)return Ce?Ce.dispose():ce=!0,z.call(te,Se)},null,ee),ce&&Ce.dispose(),Ce}}n.once=i;function o(V,z,te){return d((ee,ce=null,Ce)=>V(Se=>ee.call(ce,z(Se)),null,Ce),te)}n.map=o;function s(V,z,te){return d((ee,ce=null,Ce)=>V(Se=>{z(Se),ee.call(ce,Se)},null,Ce),te)}n.forEach=s;function r(V,z,te){return d((ee,ce=null,Ce)=>V(Se=>z(Se)&&ee.call(ce,Se),null,Ce),te)}n.filter=r;function a(V){return V}n.signal=a;function l(...V){return(z,te=null,ee)=>{let ce=_o(...V.map(Ce=>Ce(Se=>z.call(te,Se))));return h(ce,ee)}}n.any=l;function c(V,z,te,ee){let ce=te;return o(V,Ce=>(ce=z(ce,Ce),ce),ee)}n.reduce=c;function d(V,z){let te,ee={onWillAddFirstListener(){te=V(ce.fire,ce)},onDidRemoveLastListener(){te?.dispose()}};z||e(ee);let ce=new B(ee);return z?.add(ce),ce.event}function h(V,z){return z instanceof Array?z.push(V):z&&z.add(V),V}function u(V,z,te=100,ee=!1,ce=!1,Ce,Se){let pe,Pe,Qe,Te=0,de,Ki={leakWarningThreshold:Ce,onWillAddFirstListener(){pe=V(Gi=>{Te++,Pe=z(Pe,Gi),ee&&!Qe&&(Vn.fire(Pe),Pe=void 0),de=()=>{let Ns=Pe;Pe=void 0,Qe=void 0,(!ee||Te>1)&&Vn.fire(Ns),Te=0},typeof te=="number"?(clearTimeout(Qe),Qe=setTimeout(de,te)):Qe===void 0&&(Qe=0,queueMicrotask(de))})},onWillRemoveListener(){ce&&Te>0&&de?.()},onDidRemoveLastListener(){de=void 0,pe.dispose()}};Se||e(Ki);let Vn=new B(Ki);return Se?.add(Vn),Vn.event}n.debounce=u;function f(V,z=0,te){return n.debounce(V,(ee,ce)=>ee?(ee.push(ce),ee):[ce],z,void 0,!0,void 0,te)}n.accumulate=f;function g(V,z=(ee,ce)=>ee===ce,te){let ee=!0,ce;return r(V,Ce=>{let Se=ee||!z(Ce,ce);return ee=!1,ce=Ce,Se},te)}n.latch=g;function m(V,z,te){return[n.filter(V,z,te),n.filter(V,ee=>!z(ee),te)]}n.split=m;function C(V,z=!1,te=[],ee){let ce=te.slice(),Ce=V(Pe=>{ce?ce.push(Pe):pe.fire(Pe)});ee&&ee.add(Ce);let Se=()=>{ce?.forEach(Pe=>pe.fire(Pe)),ce=null},pe=new B({onWillAddFirstListener(){Ce||(Ce=V(Pe=>pe.fire(Pe)),ee&&ee.add(Ce))},onDidAddFirstListener(){ce&&(z?setTimeout(Se):Se())},onDidRemoveLastListener(){Ce&&Ce.dispose(),Ce=null}});return ee&&ee.add(pe),pe.event}n.buffer=C;function S(V,z){return(ee,ce,Ce)=>{let Se=z(new y);return V(function(pe){let Pe=Se.evaluate(pe);Pe!==w&&ee.call(ce,Pe)},void 0,Ce)}}n.chain=S;let w=Symbol("HaltChainable");class y{constructor(){this.steps=[]}map(z){return this.steps.push(z),this}forEach(z){return this.steps.push(te=>(z(te),te)),this}filter(z){return this.steps.push(te=>z(te)?te:w),this}reduce(z,te){let ee=te;return this.steps.push(ce=>(ee=z(ee,ce),ee)),this}latch(z=(te,ee)=>te===ee){let te=!0,ee;return this.steps.push(ce=>{let Ce=te||!z(ce,ee);return te=!1,ee=ce,Ce?ce:w}),this}evaluate(z){for(let te of this.steps)if(z=te(z),z===w)break;return z}}function x(V,z,te=ee=>ee){let ee=(...pe)=>Se.fire(te(...pe)),ce=()=>V.on(z,ee),Ce=()=>V.removeListener(z,ee),Se=new B({onWillAddFirstListener:ce,onDidRemoveLastListener:Ce});return Se.event}n.fromNodeEventEmitter=x;function k(V,z,te=ee=>ee){let ee=(...pe)=>Se.fire(te(...pe)),ce=()=>V.addEventListener(z,ee),Ce=()=>V.removeEventListener(z,ee),Se=new B({onWillAddFirstListener:ce,onDidRemoveLastListener:Ce});return Se.event}n.fromDOMEventEmitter=k;function T(V){return new Promise(z=>i(V)(z))}n.toPromise=T;function N(V){let z=new B;return V.then(te=>{z.fire(te)},()=>{z.fire(void 0)}).finally(()=>{z.dispose()}),z.event}n.fromPromise=N;function M(V,z,te){return z(te),V(ee=>z(ee))}n.runAndSubscribe=M;class W{constructor(z,te){this._observable=z,this._counter=0,this._hasChanged=!1;let ee={onWillAddFirstListener:()=>{z.addObserver(this)},onDidRemoveLastListener:()=>{z.removeObserver(this)}};te||e(ee),this.emitter=new B(ee),te&&te.add(this.emitter)}beginUpdate(z){this._counter++}handlePossibleChange(z){}handleChange(z,te){this._hasChanged=!0}endUpdate(z){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function j(V,z){return new W(V,z).emitter.event}n.fromObservable=j;function G(V){return(z,te,ee)=>{let ce=0,Ce=!1,Se={beginUpdate(){ce++},endUpdate(){ce--,ce===0&&(V.reportChanges(),Ce&&(Ce=!1,z.call(te)))},handlePossibleChange(){},handleChange(){Ce=!0}};V.addObserver(Se),V.reportChanges();let pe={dispose(){V.removeObserver(Se)}};return ee instanceof ae?ee.add(pe):Array.isArray(ee)&&ee.push(pe),pe}}n.fromObservableLight=G})(ie||(ie={}));O_=class n{constructor(e){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${e}_${n._idPool++}`,n.all.add(this)}start(e){this._stopWatch=new Er,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};O_.all=new Set;O_._idPool=0;E9=-1,dT=class{constructor(e,t=Math.random().toString(18).slice(2,5)){this.threshold=e,this.name=t,this._warnCountdown=0}dispose(){var e;(e=this._stacks)===null||e===void 0||e.clear()}check(e,t){let i=this.threshold;if(i<=0||t{let s=this._stacks.get(e.value)||0;this._stacks.set(e.value,s-1)}}},F_=class n{static create(){var e;return new n((e=new Error().stack)!==null&&e!==void 0?e:"")}constructor(e){this.value=e}print(){console.warn(this.value.split(` +`).slice(2).join(` +`))}},Cg=class{constructor(e){this.value=e}},h$=2,u$=(n,e)=>{if(n instanceof Cg)e(n);else for(let t=0;t{typeof n=="string"&&(console.warn("[LEAKING LISTENER] GC'ed a listener that was NOT yet disposed. This is where is was created:"),console.warn(n))}):void 0,B=class{constructor(e){var t,i,o,s,r;this._size=0,this._options=e,this._leakageMon=E9>0||!((t=this._options)===null||t===void 0)&&t.leakWarningThreshold?new dT((o=(i=this._options)===null||i===void 0?void 0:i.leakWarningThreshold)!==null&&o!==void 0?o:E9):void 0,this._perfMon=!((s=this._options)===null||s===void 0)&&s._profName?new O_(this._options._profName):void 0,this._deliveryQueue=(r=this._options)===null||r===void 0?void 0:r.deliveryQueue}dispose(){var e,t,i,o;if(!this._disposed){if(this._disposed=!0,((e=this._deliveryQueue)===null||e===void 0?void 0:e.current)===this&&this._deliveryQueue.reset(),this._listeners){if(D9){let s=this._listeners;queueMicrotask(()=>{u$(s,r=>{var a;return(a=r.stack)===null||a===void 0?void 0:a.print()})})}this._listeners=void 0,this._size=0}(i=(t=this._options)===null||t===void 0?void 0:t.onDidRemoveLastListener)===null||i===void 0||i.call(t),(o=this._leakageMon)===null||o===void 0||o.dispose()}}get event(){var e;return(e=this._event)!==null&&e!==void 0||(this._event=(t,i,o)=>{var s,r,a,l,c;if(this._leakageMon&&this._size>this._leakageMon.threshold*3)return console.warn(`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far`),H.None;if(this._disposed)return H.None;i&&(t=t.bind(i));let d=new Cg(t),h,u;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(d.stack=F_.create(),h=this._leakageMon.check(d.stack,this._size+1)),D9&&(d.stack=u??F_.create()),this._listeners?this._listeners instanceof Cg?((c=this._deliveryQueue)!==null&&c!==void 0||(this._deliveryQueue=new lC),this._listeners=[this._listeners,d]):this._listeners.push(d):((r=(s=this._options)===null||s===void 0?void 0:s.onWillAddFirstListener)===null||r===void 0||r.call(s,this),this._listeners=d,(l=(a=this._options)===null||a===void 0?void 0:a.onDidAddFirstListener)===null||l===void 0||l.call(a,this)),this._size++;let f=be(()=>{P_?.unregister(f),h?.(),this._removeListener(d)});if(o instanceof ae?o.add(f):Array.isArray(o)&&o.push(f),P_){let g=new Error().stack.split(` +`).slice(2).join(` +`).trim();P_.register(f,g,f)}return f}),this._event}_removeListener(e){var t,i,o,s;if((i=(t=this._options)===null||t===void 0?void 0:t.onWillRemoveListener)===null||i===void 0||i.call(t,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(s=(o=this._options)===null||o===void 0?void 0:o.onDidRemoveLastListener)===null||s===void 0||s.call(o,this),this._size=0;return}let r=this._listeners,a=r.indexOf(e);if(a===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,r[a]=void 0;let l=this._deliveryQueue.current===this;if(this._size*h$<=r.length){let c=0;for(let d=0;d0}},I9=()=>new lC,lC=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,i){this.i=0,this.end=i,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},ul=class extends B{constructor(e){super(e),this._isPaused=0,this._eventQueue=new Ii,this._mergeFn=e?.merge}pause(){this._isPaused++}resume(){if(this._isPaused!==0&&--this._isPaused===0)if(this._mergeFn){if(this._eventQueue.size>0){let e=Array.from(this._eventQueue);this._eventQueue.clear(),super.fire(this._mergeFn(e))}}else for(;!this._isPaused&&this._eventQueue.size!==0;)super.fire(this._eventQueue.shift())}fire(e){this._size&&(this._isPaused!==0?this._eventQueue.push(e):super.fire(e))}},wg=class extends ul{constructor(e){var t;super(e),this._delay=(t=e.delay)!==null&&t!==void 0?t:100}fire(e){this._handle||(this.pause(),this._handle=setTimeout(()=>{this._handle=void 0,this.resume()},this._delay)),super.fire(e)}},cC=class extends B{constructor(e){super(e),this._queuedEvents=[],this._mergeFn=e?.merge}fire(e){this.hasListeners()&&(this._queuedEvents.push(e),this._queuedEvents.length===1&&queueMicrotask(()=>{this._mergeFn?super.fire(this._mergeFn(this._queuedEvents)):this._queuedEvents.forEach(t=>super.fire(t)),this._queuedEvents=[]}))}},dC=class{constructor(){this.hasListeners=!1,this.events=[],this.emitter=new B({onWillAddFirstListener:()=>this.onFirstListenerAdd(),onDidRemoveLastListener:()=>this.onLastListenerRemove()})}get event(){return this.emitter.event}add(e){let t={event:e,listener:null};return this.events.push(t),this.hasListeners&&this.hook(t),be(wa(()=>{this.hasListeners&&this.unhook(t);let o=this.events.indexOf(t);this.events.splice(o,1)}))}onFirstListenerAdd(){this.hasListeners=!0,this.events.forEach(e=>this.hook(e))}onLastListenerRemove(){this.hasListeners=!1,this.events.forEach(e=>this.unhook(e))}hook(e){e.listener=e.event(t=>this.emitter.fire(t))}unhook(e){var t;(t=e.listener)===null||t===void 0||t.dispose(),e.listener=null}dispose(){var e;this.emitter.dispose();for(let t of this.events)(e=t.listener)===null||e===void 0||e.dispose();this.events=[]}},kd=class{constructor(){this.buffers=[]}wrapEvent(e){return(t,i,o)=>e(s=>{let r=this.buffers[this.buffers.length-1];r?r.push(()=>t.call(i,s)):t.call(i,s)},void 0,o)}bufferEvents(e){let t=[];this.buffers.push(t);let i=e();return this.buffers.pop(),t.forEach(o=>o()),i}},B_=class{constructor(){this.listening=!1,this.inputEvent=ie.None,this.inputEventListener=H.None,this.emitter=new B({onDidAddFirstListener:()=>{this.listening=!0,this.inputEventListener=this.inputEvent(this.emitter.fire,this.emitter)},onDidRemoveLastListener:()=>{this.listening=!1,this.inputEventListener.dispose()}}),this.event=this.emitter.event}set input(e){this.inputEvent=e,this.listening&&(this.inputEventListener.dispose(),this.inputEventListener=e(this.emitter.fire,this.emitter))}dispose(){this.inputEventListener.dispose(),this.emitter.dispose()}}});function tne(n){let e=new un;return n.add({dispose(){e.cancel()}}),e.token}var T9,Mo,yg,un,fs=J(()=>{"use strict";_();v();b();ye();T9=Object.freeze(function(n,e){let t=setTimeout(n.bind(e),0);return{dispose(){clearTimeout(t)}}});(function(n){function e(t){return t===n.None||t===n.Cancelled||t instanceof yg?!0:!t||typeof t!="object"?!1:typeof t.isCancellationRequested=="boolean"&&typeof t.onCancellationRequested=="function"}n.isCancellationToken=e,n.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:ie.None}),n.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:T9})})(Mo||(Mo={}));yg=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?T9:(this._emitter||(this._emitter=new B),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},un=class{constructor(e){this._token=void 0,this._parentListener=void 0,this._parentListener=e&&e.onCancellationRequested(this.cancel,this)}get token(){return this._token||(this._token=new yg),this._token}cancel(){this._token?this._token instanceof yg&&this._token.cancel():this._token=Mo.Cancelled}dispose(e=!1){var t;e&&this.cancel(),(t=this._parentListener)===null||t===void 0||t.dispose(),this._token?this._token instanceof yg&&this._token.dispose():this._token=Mo.None}}});function N9(n,e){let t=(e&65535)<<16>>>0;return(n|t)>>>0}var W_,hC,hT,uT,gT,g$,m$,p$,_$,uC,fT,Ir,z_=J(()=>{"use strict";_();v();b();W_=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},hC=new W_,hT=new W_,uT=new W_,gT=new Array(230),g$={},m$=[],p$=Object.create(null),_$=Object.create(null),uC=[],fT=[];for(let n=0;n<=193;n++)uC[n]=-1;for(let n=0;n<=132;n++)fT[n]=-1;(function(){let n="",e=[[1,0,"None",0,"unknown",0,"VK_UNKNOWN",n,n],[1,1,"Hyper",0,n,0,n,n,n],[1,2,"Super",0,n,0,n,n,n],[1,3,"Fn",0,n,0,n,n,n],[1,4,"FnLock",0,n,0,n,n,n],[1,5,"Suspend",0,n,0,n,n,n],[1,6,"Resume",0,n,0,n,n,n],[1,7,"Turbo",0,n,0,n,n,n],[1,8,"Sleep",0,n,0,"VK_SLEEP",n,n],[1,9,"WakeUp",0,n,0,n,n,n],[0,10,"KeyA",31,"A",65,"VK_A",n,n],[0,11,"KeyB",32,"B",66,"VK_B",n,n],[0,12,"KeyC",33,"C",67,"VK_C",n,n],[0,13,"KeyD",34,"D",68,"VK_D",n,n],[0,14,"KeyE",35,"E",69,"VK_E",n,n],[0,15,"KeyF",36,"F",70,"VK_F",n,n],[0,16,"KeyG",37,"G",71,"VK_G",n,n],[0,17,"KeyH",38,"H",72,"VK_H",n,n],[0,18,"KeyI",39,"I",73,"VK_I",n,n],[0,19,"KeyJ",40,"J",74,"VK_J",n,n],[0,20,"KeyK",41,"K",75,"VK_K",n,n],[0,21,"KeyL",42,"L",76,"VK_L",n,n],[0,22,"KeyM",43,"M",77,"VK_M",n,n],[0,23,"KeyN",44,"N",78,"VK_N",n,n],[0,24,"KeyO",45,"O",79,"VK_O",n,n],[0,25,"KeyP",46,"P",80,"VK_P",n,n],[0,26,"KeyQ",47,"Q",81,"VK_Q",n,n],[0,27,"KeyR",48,"R",82,"VK_R",n,n],[0,28,"KeyS",49,"S",83,"VK_S",n,n],[0,29,"KeyT",50,"T",84,"VK_T",n,n],[0,30,"KeyU",51,"U",85,"VK_U",n,n],[0,31,"KeyV",52,"V",86,"VK_V",n,n],[0,32,"KeyW",53,"W",87,"VK_W",n,n],[0,33,"KeyX",54,"X",88,"VK_X",n,n],[0,34,"KeyY",55,"Y",89,"VK_Y",n,n],[0,35,"KeyZ",56,"Z",90,"VK_Z",n,n],[0,36,"Digit1",22,"1",49,"VK_1",n,n],[0,37,"Digit2",23,"2",50,"VK_2",n,n],[0,38,"Digit3",24,"3",51,"VK_3",n,n],[0,39,"Digit4",25,"4",52,"VK_4",n,n],[0,40,"Digit5",26,"5",53,"VK_5",n,n],[0,41,"Digit6",27,"6",54,"VK_6",n,n],[0,42,"Digit7",28,"7",55,"VK_7",n,n],[0,43,"Digit8",29,"8",56,"VK_8",n,n],[0,44,"Digit9",30,"9",57,"VK_9",n,n],[0,45,"Digit0",21,"0",48,"VK_0",n,n],[1,46,"Enter",3,"Enter",13,"VK_RETURN",n,n],[1,47,"Escape",9,"Escape",27,"VK_ESCAPE",n,n],[1,48,"Backspace",1,"Backspace",8,"VK_BACK",n,n],[1,49,"Tab",2,"Tab",9,"VK_TAB",n,n],[1,50,"Space",10,"Space",32,"VK_SPACE",n,n],[0,51,"Minus",88,"-",189,"VK_OEM_MINUS","-","OEM_MINUS"],[0,52,"Equal",86,"=",187,"VK_OEM_PLUS","=","OEM_PLUS"],[0,53,"BracketLeft",92,"[",219,"VK_OEM_4","[","OEM_4"],[0,54,"BracketRight",94,"]",221,"VK_OEM_6","]","OEM_6"],[0,55,"Backslash",93,"\\",220,"VK_OEM_5","\\","OEM_5"],[0,56,"IntlHash",0,n,0,n,n,n],[0,57,"Semicolon",85,";",186,"VK_OEM_1",";","OEM_1"],[0,58,"Quote",95,"'",222,"VK_OEM_7","'","OEM_7"],[0,59,"Backquote",91,"`",192,"VK_OEM_3","`","OEM_3"],[0,60,"Comma",87,",",188,"VK_OEM_COMMA",",","OEM_COMMA"],[0,61,"Period",89,".",190,"VK_OEM_PERIOD",".","OEM_PERIOD"],[0,62,"Slash",90,"/",191,"VK_OEM_2","/","OEM_2"],[1,63,"CapsLock",8,"CapsLock",20,"VK_CAPITAL",n,n],[1,64,"F1",59,"F1",112,"VK_F1",n,n],[1,65,"F2",60,"F2",113,"VK_F2",n,n],[1,66,"F3",61,"F3",114,"VK_F3",n,n],[1,67,"F4",62,"F4",115,"VK_F4",n,n],[1,68,"F5",63,"F5",116,"VK_F5",n,n],[1,69,"F6",64,"F6",117,"VK_F6",n,n],[1,70,"F7",65,"F7",118,"VK_F7",n,n],[1,71,"F8",66,"F8",119,"VK_F8",n,n],[1,72,"F9",67,"F9",120,"VK_F9",n,n],[1,73,"F10",68,"F10",121,"VK_F10",n,n],[1,74,"F11",69,"F11",122,"VK_F11",n,n],[1,75,"F12",70,"F12",123,"VK_F12",n,n],[1,76,"PrintScreen",0,n,0,n,n,n],[1,77,"ScrollLock",84,"ScrollLock",145,"VK_SCROLL",n,n],[1,78,"Pause",7,"PauseBreak",19,"VK_PAUSE",n,n],[1,79,"Insert",19,"Insert",45,"VK_INSERT",n,n],[1,80,"Home",14,"Home",36,"VK_HOME",n,n],[1,81,"PageUp",11,"PageUp",33,"VK_PRIOR",n,n],[1,82,"Delete",20,"Delete",46,"VK_DELETE",n,n],[1,83,"End",13,"End",35,"VK_END",n,n],[1,84,"PageDown",12,"PageDown",34,"VK_NEXT",n,n],[1,85,"ArrowRight",17,"RightArrow",39,"VK_RIGHT","Right",n],[1,86,"ArrowLeft",15,"LeftArrow",37,"VK_LEFT","Left",n],[1,87,"ArrowDown",18,"DownArrow",40,"VK_DOWN","Down",n],[1,88,"ArrowUp",16,"UpArrow",38,"VK_UP","Up",n],[1,89,"NumLock",83,"NumLock",144,"VK_NUMLOCK",n,n],[1,90,"NumpadDivide",113,"NumPad_Divide",111,"VK_DIVIDE",n,n],[1,91,"NumpadMultiply",108,"NumPad_Multiply",106,"VK_MULTIPLY",n,n],[1,92,"NumpadSubtract",111,"NumPad_Subtract",109,"VK_SUBTRACT",n,n],[1,93,"NumpadAdd",109,"NumPad_Add",107,"VK_ADD",n,n],[1,94,"NumpadEnter",3,n,0,n,n,n],[1,95,"Numpad1",99,"NumPad1",97,"VK_NUMPAD1",n,n],[1,96,"Numpad2",100,"NumPad2",98,"VK_NUMPAD2",n,n],[1,97,"Numpad3",101,"NumPad3",99,"VK_NUMPAD3",n,n],[1,98,"Numpad4",102,"NumPad4",100,"VK_NUMPAD4",n,n],[1,99,"Numpad5",103,"NumPad5",101,"VK_NUMPAD5",n,n],[1,100,"Numpad6",104,"NumPad6",102,"VK_NUMPAD6",n,n],[1,101,"Numpad7",105,"NumPad7",103,"VK_NUMPAD7",n,n],[1,102,"Numpad8",106,"NumPad8",104,"VK_NUMPAD8",n,n],[1,103,"Numpad9",107,"NumPad9",105,"VK_NUMPAD9",n,n],[1,104,"Numpad0",98,"NumPad0",96,"VK_NUMPAD0",n,n],[1,105,"NumpadDecimal",112,"NumPad_Decimal",110,"VK_DECIMAL",n,n],[0,106,"IntlBackslash",97,"OEM_102",226,"VK_OEM_102",n,n],[1,107,"ContextMenu",58,"ContextMenu",93,n,n,n],[1,108,"Power",0,n,0,n,n,n],[1,109,"NumpadEqual",0,n,0,n,n,n],[1,110,"F13",71,"F13",124,"VK_F13",n,n],[1,111,"F14",72,"F14",125,"VK_F14",n,n],[1,112,"F15",73,"F15",126,"VK_F15",n,n],[1,113,"F16",74,"F16",127,"VK_F16",n,n],[1,114,"F17",75,"F17",128,"VK_F17",n,n],[1,115,"F18",76,"F18",129,"VK_F18",n,n],[1,116,"F19",77,"F19",130,"VK_F19",n,n],[1,117,"F20",78,"F20",131,"VK_F20",n,n],[1,118,"F21",79,"F21",132,"VK_F21",n,n],[1,119,"F22",80,"F22",133,"VK_F22",n,n],[1,120,"F23",81,"F23",134,"VK_F23",n,n],[1,121,"F24",82,"F24",135,"VK_F24",n,n],[1,122,"Open",0,n,0,n,n,n],[1,123,"Help",0,n,0,n,n,n],[1,124,"Select",0,n,0,n,n,n],[1,125,"Again",0,n,0,n,n,n],[1,126,"Undo",0,n,0,n,n,n],[1,127,"Cut",0,n,0,n,n,n],[1,128,"Copy",0,n,0,n,n,n],[1,129,"Paste",0,n,0,n,n,n],[1,130,"Find",0,n,0,n,n,n],[1,131,"AudioVolumeMute",117,"AudioVolumeMute",173,"VK_VOLUME_MUTE",n,n],[1,132,"AudioVolumeUp",118,"AudioVolumeUp",175,"VK_VOLUME_UP",n,n],[1,133,"AudioVolumeDown",119,"AudioVolumeDown",174,"VK_VOLUME_DOWN",n,n],[1,134,"NumpadComma",110,"NumPad_Separator",108,"VK_SEPARATOR",n,n],[0,135,"IntlRo",115,"ABNT_C1",193,"VK_ABNT_C1",n,n],[1,136,"KanaMode",0,n,0,n,n,n],[0,137,"IntlYen",0,n,0,n,n,n],[1,138,"Convert",0,n,0,n,n,n],[1,139,"NonConvert",0,n,0,n,n,n],[1,140,"Lang1",0,n,0,n,n,n],[1,141,"Lang2",0,n,0,n,n,n],[1,142,"Lang3",0,n,0,n,n,n],[1,143,"Lang4",0,n,0,n,n,n],[1,144,"Lang5",0,n,0,n,n,n],[1,145,"Abort",0,n,0,n,n,n],[1,146,"Props",0,n,0,n,n,n],[1,147,"NumpadParenLeft",0,n,0,n,n,n],[1,148,"NumpadParenRight",0,n,0,n,n,n],[1,149,"NumpadBackspace",0,n,0,n,n,n],[1,150,"NumpadMemoryStore",0,n,0,n,n,n],[1,151,"NumpadMemoryRecall",0,n,0,n,n,n],[1,152,"NumpadMemoryClear",0,n,0,n,n,n],[1,153,"NumpadMemoryAdd",0,n,0,n,n,n],[1,154,"NumpadMemorySubtract",0,n,0,n,n,n],[1,155,"NumpadClear",131,"Clear",12,"VK_CLEAR",n,n],[1,156,"NumpadClearEntry",0,n,0,n,n,n],[1,0,n,5,"Ctrl",17,"VK_CONTROL",n,n],[1,0,n,4,"Shift",16,"VK_SHIFT",n,n],[1,0,n,6,"Alt",18,"VK_MENU",n,n],[1,0,n,57,"Meta",91,"VK_COMMAND",n,n],[1,157,"ControlLeft",5,n,0,"VK_LCONTROL",n,n],[1,158,"ShiftLeft",4,n,0,"VK_LSHIFT",n,n],[1,159,"AltLeft",6,n,0,"VK_LMENU",n,n],[1,160,"MetaLeft",57,n,0,"VK_LWIN",n,n],[1,161,"ControlRight",5,n,0,"VK_RCONTROL",n,n],[1,162,"ShiftRight",4,n,0,"VK_RSHIFT",n,n],[1,163,"AltRight",6,n,0,"VK_RMENU",n,n],[1,164,"MetaRight",57,n,0,"VK_RWIN",n,n],[1,165,"BrightnessUp",0,n,0,n,n,n],[1,166,"BrightnessDown",0,n,0,n,n,n],[1,167,"MediaPlay",0,n,0,n,n,n],[1,168,"MediaRecord",0,n,0,n,n,n],[1,169,"MediaFastForward",0,n,0,n,n,n],[1,170,"MediaRewind",0,n,0,n,n,n],[1,171,"MediaTrackNext",124,"MediaTrackNext",176,"VK_MEDIA_NEXT_TRACK",n,n],[1,172,"MediaTrackPrevious",125,"MediaTrackPrevious",177,"VK_MEDIA_PREV_TRACK",n,n],[1,173,"MediaStop",126,"MediaStop",178,"VK_MEDIA_STOP",n,n],[1,174,"Eject",0,n,0,n,n,n],[1,175,"MediaPlayPause",127,"MediaPlayPause",179,"VK_MEDIA_PLAY_PAUSE",n,n],[1,176,"MediaSelect",128,"LaunchMediaPlayer",181,"VK_MEDIA_LAUNCH_MEDIA_SELECT",n,n],[1,177,"LaunchMail",129,"LaunchMail",180,"VK_MEDIA_LAUNCH_MAIL",n,n],[1,178,"LaunchApp2",130,"LaunchApp2",183,"VK_MEDIA_LAUNCH_APP2",n,n],[1,179,"LaunchApp1",0,n,0,"VK_MEDIA_LAUNCH_APP1",n,n],[1,180,"SelectTask",0,n,0,n,n,n],[1,181,"LaunchScreenSaver",0,n,0,n,n,n],[1,182,"BrowserSearch",120,"BrowserSearch",170,"VK_BROWSER_SEARCH",n,n],[1,183,"BrowserHome",121,"BrowserHome",172,"VK_BROWSER_HOME",n,n],[1,184,"BrowserBack",122,"BrowserBack",166,"VK_BROWSER_BACK",n,n],[1,185,"BrowserForward",123,"BrowserForward",167,"VK_BROWSER_FORWARD",n,n],[1,186,"BrowserStop",0,n,0,"VK_BROWSER_STOP",n,n],[1,187,"BrowserRefresh",0,n,0,"VK_BROWSER_REFRESH",n,n],[1,188,"BrowserFavorites",0,n,0,"VK_BROWSER_FAVORITES",n,n],[1,189,"ZoomToggle",0,n,0,n,n,n],[1,190,"MailReply",0,n,0,n,n,n],[1,191,"MailForward",0,n,0,n,n,n],[1,192,"MailSend",0,n,0,n,n,n],[1,0,n,114,"KeyInComposition",229,n,n,n],[1,0,n,116,"ABNT_C2",194,"VK_ABNT_C2",n,n],[1,0,n,96,"OEM_8",223,"VK_OEM_8",n,n],[1,0,n,0,n,0,"VK_KANA",n,n],[1,0,n,0,n,0,"VK_HANGUL",n,n],[1,0,n,0,n,0,"VK_JUNJA",n,n],[1,0,n,0,n,0,"VK_FINAL",n,n],[1,0,n,0,n,0,"VK_HANJA",n,n],[1,0,n,0,n,0,"VK_KANJI",n,n],[1,0,n,0,n,0,"VK_CONVERT",n,n],[1,0,n,0,n,0,"VK_NONCONVERT",n,n],[1,0,n,0,n,0,"VK_ACCEPT",n,n],[1,0,n,0,n,0,"VK_MODECHANGE",n,n],[1,0,n,0,n,0,"VK_SELECT",n,n],[1,0,n,0,n,0,"VK_PRINT",n,n],[1,0,n,0,n,0,"VK_EXECUTE",n,n],[1,0,n,0,n,0,"VK_SNAPSHOT",n,n],[1,0,n,0,n,0,"VK_HELP",n,n],[1,0,n,0,n,0,"VK_APPS",n,n],[1,0,n,0,n,0,"VK_PROCESSKEY",n,n],[1,0,n,0,n,0,"VK_PACKET",n,n],[1,0,n,0,n,0,"VK_DBE_SBCSCHAR",n,n],[1,0,n,0,n,0,"VK_DBE_DBCSCHAR",n,n],[1,0,n,0,n,0,"VK_ATTN",n,n],[1,0,n,0,n,0,"VK_CRSEL",n,n],[1,0,n,0,n,0,"VK_EXSEL",n,n],[1,0,n,0,n,0,"VK_EREOF",n,n],[1,0,n,0,n,0,"VK_PLAY",n,n],[1,0,n,0,n,0,"VK_ZOOM",n,n],[1,0,n,0,n,0,"VK_NONAME",n,n],[1,0,n,0,n,0,"VK_PA1",n,n],[1,0,n,0,n,0,"VK_OEM_CLEAR",n,n]],t=[],i=[];for(let o of e){let[s,r,a,l,c,d,h,u,f]=o;if(i[r]||(i[r]=!0,m$[r]=a,p$[a]=r,_$[a.toLowerCase()]=r,s&&(uC[r]=l,l!==0&&l!==3&&l!==5&&l!==4&&l!==6&&l!==57&&(fT[l]=r))),!t[l]){if(t[l]=!0,!c)throw new Error(`String representation missing for key code ${l} around scan code ${a}`);hC.define(l,c),hT.define(l,u||c),uT.define(l,f||u||c)}d&&(gT[d]=l),h&&(g$[h]=l)}fT[3]=46})();(function(n){function e(a){return hC.keyCodeToStr(a)}n.toString=e;function t(a){return hC.strToKeyCode(a)}n.fromString=t;function i(a){return hT.keyCodeToStr(a)}n.toUserSettingsUS=i;function o(a){return uT.keyCodeToStr(a)}n.toUserSettingsGeneral=o;function s(a){return hT.strToKeyCode(a)||uT.strToKeyCode(a)}n.fromUserSettings=s;function r(a){if(a>=98&&a<=113)return null;switch(a){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return hC.keyCodeToStr(a)}n.toElectronAccelerator=r})(Ir||(Ir={}))});var Sg,mT,V_,H_,A9,pT=J(()=>{"use strict";_();v();b();Lt();mT=globalThis.vscode;if(typeof mT<"u"&&typeof mT.process<"u"){let n=mT.process;Sg={get platform(){return n.platform},get arch(){return n.arch},get env(){return n.env},cwd(){return n.cwd()}}}else typeof D<"u"?Sg={get platform(){return D.platform},get arch(){return D.arch},get env(){return D.env},cwd(){return D.env.VSCODE_CWD||D.cwd()}}:Sg={get platform(){return Li?"win32":Be?"darwin":"linux"},get arch(){},get env(){return{}},cwd(){return"/"}};V_=Sg.cwd,H_=Sg.env,A9=Sg.platform});function x$(n,e){if(n===null||typeof n!="object")throw new fC(e,"Object",n)}function fn(n,e){if(typeof n!="string")throw new fC(e,"string",n)}function Pt(n){return n===bo||n===Ps}function _T(n){return n===bo}function Ed(n){return n>=v$&&n<=w$||n>=C$&&n<=y$}function gC(n,e,t,i){let o="",s=0,r=-1,a=0,l=0;for(let c=0;c<=n.length;++c){if(c2){let d=o.lastIndexOf(t);d===-1?(o="",s=0):(o=o.slice(0,d),s=o.length-1-o.lastIndexOf(t)),r=c,a=0;continue}else if(o.length!==0){o="",s=0,r=c,a=0;continue}}e&&(o+=o.length>0?`${t}..`:"..",s=2)}else o.length>0?o+=`${t}${n.slice(r+1,c)}`:o=n.slice(r+1,c),s=c-r-1;r=c,a=0}else l===Id&&a!==-1?++a:a=-1}return o}function M9(n,e){x$(e,"pathObject");let t=e.dir||e.root,i=e.base||`${e.name||""}${e.ext||""}`;return t?t===e.root?`${t}${i}`:`${t}${n}${i}`:i}var v$,C$,w$,y$,Id,bo,Ps,Dd,S$,fC,Td,Zo,L$,ci,mC,R9,P9,O9,xg,F9,ya,wc=J(()=>{"use strict";_();v();b();pT();v$=65,C$=97,w$=90,y$=122,Id=46,bo=47,Ps=92,Dd=58,S$=63,fC=class extends Error{constructor(e,t,i){let o;typeof t=="string"&&t.indexOf("not ")===0?(o="must not be",t=t.replace(/^not /,"")):o="must be";let s=e.indexOf(".")!==-1?"property":"argument",r=`The "${e}" ${s} ${o} of type ${t}`;r+=`. Received type ${typeof i}`,super(r),this.code="ERR_INVALID_ARG_TYPE"}};Td=A9==="win32";Zo={resolve(...n){let e="",t="",i=!1;for(let o=n.length-1;o>=-1;o--){let s;if(o>=0){if(s=n[o],fn(s,"path"),s.length===0)continue}else e.length===0?s=V_():(s=H_[`=${e}`]||V_(),(s===void 0||s.slice(0,2).toLowerCase()!==e.toLowerCase()&&s.charCodeAt(2)===Ps)&&(s=`${e}\\`));let r=s.length,a=0,l="",c=!1,d=s.charCodeAt(0);if(r===1)Pt(d)&&(a=1,c=!0);else if(Pt(d))if(c=!0,Pt(s.charCodeAt(1))){let h=2,u=h;for(;h2&&Pt(s.charCodeAt(2))&&(c=!0,a=3));if(l.length>0)if(e.length>0){if(l.toLowerCase()!==e.toLowerCase())continue}else e=l;if(i){if(e.length>0)break}else if(t=`${s.slice(a)}\\${t}`,i=c,c&&e.length>0)break}return t=gC(t,!i,"\\",Pt),i?`${e}\\${t}`:`${e}${t}`||"."},normalize(n){fn(n,"path");let e=n.length;if(e===0)return".";let t=0,i,o=!1,s=n.charCodeAt(0);if(e===1)return _T(s)?"\\":n;if(Pt(s))if(o=!0,Pt(n.charCodeAt(1))){let a=2,l=a;for(;a2&&Pt(n.charCodeAt(2))&&(o=!0,t=3));let r=t0&&Pt(n.charCodeAt(e-1))&&(r+="\\"),i===void 0?o?`\\${r}`:r:o?`${i}\\${r}`:`${i}${r}`},isAbsolute(n){fn(n,"path");let e=n.length;if(e===0)return!1;let t=n.charCodeAt(0);return Pt(t)||e>2&&Ed(t)&&n.charCodeAt(1)===Dd&&Pt(n.charCodeAt(2))},join(...n){if(n.length===0)return".";let e,t;for(let s=0;s0&&(e===void 0?e=t=r:e+=`\\${r}`)}if(e===void 0)return".";let i=!0,o=0;if(typeof t=="string"&&Pt(t.charCodeAt(0))){++o;let s=t.length;s>1&&Pt(t.charCodeAt(1))&&(++o,s>2&&(Pt(t.charCodeAt(2))?++o:i=!1))}if(i){for(;o=2&&(e=`\\${e.slice(o)}`)}return Zo.normalize(e)},relative(n,e){if(fn(n,"from"),fn(e,"to"),n===e)return"";let t=Zo.resolve(n),i=Zo.resolve(e);if(t===i||(n=t.toLowerCase(),e=i.toLowerCase(),n===e))return"";let o=0;for(;oo&&n.charCodeAt(s-1)===Ps;)s--;let r=s-o,a=0;for(;aa&&e.charCodeAt(l-1)===Ps;)l--;let c=l-a,d=rd){if(e.charCodeAt(a+u)===Ps)return i.slice(a+u+1);if(u===2)return i.slice(a+u)}r>d&&(n.charCodeAt(o+u)===Ps?h=u:u===2&&(h=3)),h===-1&&(h=0)}let f="";for(u=o+h+1;u<=s;++u)(u===s||n.charCodeAt(u)===Ps)&&(f+=f.length===0?"..":"\\..");return a+=h,f.length>0?`${f}${i.slice(a,l)}`:(i.charCodeAt(a)===Ps&&++a,i.slice(a,l))},toNamespacedPath(n){if(typeof n!="string"||n.length===0)return n;let e=Zo.resolve(n);if(e.length<=2)return n;if(e.charCodeAt(0)===Ps){if(e.charCodeAt(1)===Ps){let t=e.charCodeAt(2);if(t!==S$&&t!==Id)return`\\\\?\\UNC\\${e.slice(2)}`}}else if(Ed(e.charCodeAt(0))&&e.charCodeAt(1)===Dd&&e.charCodeAt(2)===Ps)return`\\\\?\\${e}`;return n},dirname(n){fn(n,"path");let e=n.length;if(e===0)return".";let t=-1,i=0,o=n.charCodeAt(0);if(e===1)return Pt(o)?n:".";if(Pt(o)){if(t=i=1,Pt(n.charCodeAt(1))){let a=2,l=a;for(;a2&&Pt(n.charCodeAt(2))?3:2,i=t);let s=-1,r=!0;for(let a=e-1;a>=i;--a)if(Pt(n.charCodeAt(a))){if(!r){s=a;break}}else r=!1;if(s===-1){if(t===-1)return".";s=t}return n.slice(0,s)},basename(n,e){e!==void 0&&fn(e,"ext"),fn(n,"path");let t=0,i=-1,o=!0,s;if(n.length>=2&&Ed(n.charCodeAt(0))&&n.charCodeAt(1)===Dd&&(t=2),e!==void 0&&e.length>0&&e.length<=n.length){if(e===n)return"";let r=e.length-1,a=-1;for(s=n.length-1;s>=t;--s){let l=n.charCodeAt(s);if(Pt(l)){if(!o){t=s+1;break}}else a===-1&&(o=!1,a=s+1),r>=0&&(l===e.charCodeAt(r)?--r===-1&&(i=s):(r=-1,i=a))}return t===i?i=a:i===-1&&(i=n.length),n.slice(t,i)}for(s=n.length-1;s>=t;--s)if(Pt(n.charCodeAt(s))){if(!o){t=s+1;break}}else i===-1&&(o=!1,i=s+1);return i===-1?"":n.slice(t,i)},extname(n){fn(n,"path");let e=0,t=-1,i=0,o=-1,s=!0,r=0;n.length>=2&&n.charCodeAt(1)===Dd&&Ed(n.charCodeAt(0))&&(e=i=2);for(let a=n.length-1;a>=e;--a){let l=n.charCodeAt(a);if(Pt(l)){if(!s){i=a+1;break}continue}o===-1&&(s=!1,o=a+1),l===Id?t===-1?t=a:r!==1&&(r=1):t!==-1&&(r=-1)}return t===-1||o===-1||r===0||r===1&&t===o-1&&t===i+1?"":n.slice(t,o)},format:M9.bind(null,"\\"),parse(n){fn(n,"path");let e={root:"",dir:"",base:"",ext:"",name:""};if(n.length===0)return e;let t=n.length,i=0,o=n.charCodeAt(0);if(t===1)return Pt(o)?(e.root=e.dir=n,e):(e.base=e.name=n,e);if(Pt(o)){if(i=1,Pt(n.charCodeAt(1))){let h=2,u=h;for(;h0&&(e.root=n.slice(0,i));let s=-1,r=i,a=-1,l=!0,c=n.length-1,d=0;for(;c>=i;--c){if(o=n.charCodeAt(c),Pt(o)){if(!l){r=c+1;break}continue}a===-1&&(l=!1,a=c+1),o===Id?s===-1?s=c:d!==1&&(d=1):s!==-1&&(d=-1)}return a!==-1&&(s===-1||d===0||d===1&&s===a-1&&s===r+1?e.base=e.name=n.slice(r,a):(e.name=n.slice(r,s),e.base=n.slice(r,a),e.ext=n.slice(s,a))),r>0&&r!==i?e.dir=n.slice(0,r-1):e.dir=e.root,e},sep:"\\",delimiter:";",win32:null,posix:null},L$=(()=>{if(Td){let n=/\\/g;return()=>{let e=V_().replace(n,"/");return e.slice(e.indexOf("/"))}}return()=>V_()})(),ci={resolve(...n){let e="",t=!1;for(let i=n.length-1;i>=-1&&!t;i--){let o=i>=0?n[i]:L$();fn(o,"path"),o.length!==0&&(e=`${o}/${e}`,t=o.charCodeAt(0)===bo)}return e=gC(e,!t,"/",_T),t?`/${e}`:e.length>0?e:"."},normalize(n){if(fn(n,"path"),n.length===0)return".";let e=n.charCodeAt(0)===bo,t=n.charCodeAt(n.length-1)===bo;return n=gC(n,!e,"/",_T),n.length===0?e?"/":t?"./":".":(t&&(n+="/"),e?`/${n}`:n)},isAbsolute(n){return fn(n,"path"),n.length>0&&n.charCodeAt(0)===bo},join(...n){if(n.length===0)return".";let e;for(let t=0;t0&&(e===void 0?e=i:e+=`/${i}`)}return e===void 0?".":ci.normalize(e)},relative(n,e){if(fn(n,"from"),fn(e,"to"),n===e||(n=ci.resolve(n),e=ci.resolve(e),n===e))return"";let t=1,i=n.length,o=i-t,s=1,r=e.length-s,a=oa){if(e.charCodeAt(s+c)===bo)return e.slice(s+c+1);if(c===0)return e.slice(s+c)}else o>a&&(n.charCodeAt(t+c)===bo?l=c:c===0&&(l=0));let d="";for(c=t+l+1;c<=i;++c)(c===i||n.charCodeAt(c)===bo)&&(d+=d.length===0?"..":"/..");return`${d}${e.slice(s+l)}`},toNamespacedPath(n){return n},dirname(n){if(fn(n,"path"),n.length===0)return".";let e=n.charCodeAt(0)===bo,t=-1,i=!0;for(let o=n.length-1;o>=1;--o)if(n.charCodeAt(o)===bo){if(!i){t=o;break}}else i=!1;return t===-1?e?"/":".":e&&t===1?"//":n.slice(0,t)},basename(n,e){e!==void 0&&fn(e,"ext"),fn(n,"path");let t=0,i=-1,o=!0,s;if(e!==void 0&&e.length>0&&e.length<=n.length){if(e===n)return"";let r=e.length-1,a=-1;for(s=n.length-1;s>=0;--s){let l=n.charCodeAt(s);if(l===bo){if(!o){t=s+1;break}}else a===-1&&(o=!1,a=s+1),r>=0&&(l===e.charCodeAt(r)?--r===-1&&(i=s):(r=-1,i=a))}return t===i?i=a:i===-1&&(i=n.length),n.slice(t,i)}for(s=n.length-1;s>=0;--s)if(n.charCodeAt(s)===bo){if(!o){t=s+1;break}}else i===-1&&(o=!1,i=s+1);return i===-1?"":n.slice(t,i)},extname(n){fn(n,"path");let e=-1,t=0,i=-1,o=!0,s=0;for(let r=n.length-1;r>=0;--r){let a=n.charCodeAt(r);if(a===bo){if(!o){t=r+1;break}continue}i===-1&&(o=!1,i=r+1),a===Id?e===-1?e=r:s!==1&&(s=1):e!==-1&&(s=-1)}return e===-1||i===-1||s===0||s===1&&e===i-1&&e===t+1?"":n.slice(e,i)},format:M9.bind(null,"/"),parse(n){fn(n,"path");let e={root:"",dir:"",base:"",ext:"",name:""};if(n.length===0)return e;let t=n.charCodeAt(0)===bo,i;t?(e.root="/",i=1):i=0;let o=-1,s=0,r=-1,a=!0,l=n.length-1,c=0;for(;l>=i;--l){let d=n.charCodeAt(l);if(d===bo){if(!a){s=l+1;break}continue}r===-1&&(a=!1,r=l+1),d===Id?o===-1?o=l:c!==1&&(c=1):o!==-1&&(c=-1)}if(r!==-1){let d=s===0&&t?1:s;o===-1||c===0||c===1&&o===r-1&&o===s+1?e.base=e.name=n.slice(d,r):(e.name=n.slice(d,o),e.base=n.slice(d,r),e.ext=n.slice(o,r))}return s>0?e.dir=n.slice(0,s-1):t&&(e.dir="/"),e},sep:"/",delimiter:":",win32:null,posix:null};ci.win32=Zo.win32=Zo;ci.posix=Zo.posix=ci;mC=Td?Zo.normalize:ci.normalize,R9=Td?Zo.resolve:ci.resolve,P9=Td?Zo.relative:ci.relative,O9=Td?Zo.dirname:ci.dirname,xg=Td?Zo.basename:ci.basename,F9=Td?Zo.extname:ci.extname,ya=Td?Zo.sep:ci.sep});function I$(n,e){if(!n.scheme&&e)throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${n.authority}", path: "${n.path}", query: "${n.query}", fragment: "${n.fragment}"}`);if(n.scheme&&!k$.test(n.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if(n.path){if(n.authority){if(!D$.test(n.path))throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character')}else if(E$.test(n.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}}function T$(n,e){return!n&&!e?"file":n}function N$(n,e){switch(n){case"https":case"http":case"file":e?e[0]!==Sa&&(e=Sa+e):e=Sa;break}return e}function B9(n,e,t){let i,o=-1;for(let s=0;s=97&&r<=122||r>=65&&r<=90||r>=48&&r<=57||r===45||r===46||r===95||r===126||e&&r===47||t&&r===91||t&&r===93||t&&r===58)o!==-1&&(i+=encodeURIComponent(n.substring(o,s)),o=-1),i!==void 0&&(i+=n.charAt(s));else{i===void 0&&(i=n.substr(0,s));let a=V9[r];a!==void 0?(o!==-1&&(i+=encodeURIComponent(n.substring(o,s)),o=-1),i+=a):o===-1&&(o=s)}}return o!==-1&&(i+=encodeURIComponent(n.substring(o))),i!==void 0?i:n}function M$(n){let e;for(let t=0;t1&&n.scheme==="file"?t=`//${n.authority}${n.path}`:n.path.charCodeAt(0)===47&&(n.path.charCodeAt(1)>=65&&n.path.charCodeAt(1)<=90||n.path.charCodeAt(1)>=97&&n.path.charCodeAt(1)<=122)&&n.path.charCodeAt(2)===58?e?t=n.path.substr(1):t=n.path[1].toLowerCase()+n.path.substr(2):t=n.path,Li&&(t=t.replace(/\//g,"\\")),t}function vT(n,e){let t=e?M$:B9,i="",{scheme:o,authority:s,path:r,query:a,fragment:l}=n;if(o&&(i+=o,i+=":"),(s||o==="file")&&(i+=Sa,i+=Sa),s){let c=s.indexOf("@");if(c!==-1){let d=s.substr(0,c);s=s.substr(c+1),c=d.lastIndexOf(":"),c===-1?i+=t(d,!1,!1):(i+=t(d.substr(0,c),!1,!1),i+=":",i+=t(d.substr(c+1),!1,!0)),i+="@"}s=s.toLowerCase(),c=s.lastIndexOf(":"),c===-1?i+=t(s,!1,!0):(i+=t(s.substr(0,c),!1,!0),i+=s.substr(c))}if(r){if(r.length>=3&&r.charCodeAt(0)===47&&r.charCodeAt(2)===58){let c=r.charCodeAt(1);c>=65&&c<=90&&(r=`/${String.fromCharCode(c+32)}:${r.substr(3)}`)}else if(r.length>=2&&r.charCodeAt(1)===58){let c=r.charCodeAt(0);c>=65&&c<=90&&(r=`${String.fromCharCode(c+32)}:${r.substr(2)}`)}i+=t(r,!0,!1)}return a&&(i+="?",i+=t(a,!1,!1)),l&&(i+="#",i+=e?l:B9(l,!1,!1)),i}function H9(n){try{return decodeURIComponent(n)}catch{return n.length>3?n.substr(0,3)+H9(n.substr(3)):n}}function pC(n){return n.match(W9)?n.replace(W9,e=>H9(e)):n}var k$,D$,E$,Mi,Sa,A$,Oe,z9,Nd,V9,W9,sn=J(()=>{"use strict";_();v();b();wc();Lt();k$=/^\w[\w\d+.-]*$/,D$=/^\//,E$=/^\/\//;Mi="",Sa="/",A$=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/,Oe=class n{static isUri(e){return e instanceof n?!0:e?typeof e.authority=="string"&&typeof e.fragment=="string"&&typeof e.path=="string"&&typeof e.query=="string"&&typeof e.scheme=="string"&&typeof e.fsPath=="string"&&typeof e.with=="function"&&typeof e.toString=="function":!1}constructor(e,t,i,o,s,r=!1){typeof e=="object"?(this.scheme=e.scheme||Mi,this.authority=e.authority||Mi,this.path=e.path||Mi,this.query=e.query||Mi,this.fragment=e.fragment||Mi):(this.scheme=T$(e,r),this.authority=t||Mi,this.path=N$(this.scheme,i||Mi),this.query=o||Mi,this.fragment=s||Mi,I$(this,r))}get fsPath(){return U_(this,!1)}with(e){if(!e)return this;let{scheme:t,authority:i,path:o,query:s,fragment:r}=e;return t===void 0?t=this.scheme:t===null&&(t=Mi),i===void 0?i=this.authority:i===null&&(i=Mi),o===void 0?o=this.path:o===null&&(o=Mi),s===void 0?s=this.query:s===null&&(s=Mi),r===void 0?r=this.fragment:r===null&&(r=Mi),t===this.scheme&&i===this.authority&&o===this.path&&s===this.query&&r===this.fragment?this:new Nd(t,i,o,s,r)}static parse(e,t=!1){let i=A$.exec(e);return i?new Nd(i[2]||Mi,pC(i[4]||Mi),pC(i[5]||Mi),pC(i[7]||Mi),pC(i[9]||Mi),t):new Nd(Mi,Mi,Mi,Mi,Mi)}static file(e){let t=Mi;if(Li&&(e=e.replace(/\\/g,Sa)),e[0]===Sa&&e[1]===Sa){let i=e.indexOf(Sa,2);i===-1?(t=e.substring(2),e=Sa):(t=e.substring(2,i),e=e.substring(i)||Sa)}return new Nd("file",t,e,Mi,Mi)}static from(e,t){return new Nd(e.scheme,e.authority,e.path,e.query,e.fragment,t)}static joinPath(e,...t){if(!e.path)throw new Error("[UriError]: cannot call joinPath on URI without path");let i;return Li&&e.scheme==="file"?i=n.file(Zo.join(U_(e,!0),...t)).path:i=ci.join(e.path,...t),e.with({path:i})}toString(e=!1){return vT(this,e)}toJSON(){return this}static revive(e){var t,i;if(e){if(e instanceof n)return e;{let o=new Nd(e);return o._formatted=(t=e.external)!==null&&t!==void 0?t:null,o._fsPath=e._sep===z9&&(i=e.fsPath)!==null&&i!==void 0?i:null,o}}else return e}},z9=Li?1:void 0,Nd=class extends Oe{constructor(){super(...arguments),this._formatted=null,this._fsPath=null}get fsPath(){return this._fsPath||(this._fsPath=U_(this,!1)),this._fsPath}toString(e=!1){return e?vT(this,!0):(this._formatted||(this._formatted=vT(this,!1)),this._formatted)}toJSON(){let e={$mid:1};return this._fsPath&&(e.fsPath=this._fsPath,e._sep=z9),this._formatted&&(e.external=this._formatted),this.path&&(e.path=this.path),this.scheme&&(e.scheme=this.scheme),this.authority&&(e.authority=this.authority),this.query&&(e.query=this.query),this.fragment&&(e.fragment=this.fragment),e}},V9={58:"%3A",47:"%2F",63:"%3F",35:"%23",91:"%5B",93:"%5D",64:"%40",33:"%21",36:"%24",38:"%26",39:"%27",40:"%28",41:"%29",42:"%2A",43:"%2B",44:"%2C",59:"%3B",61:"%3D",32:"%20"};W9=/(%[0-9A-Za-z][0-9A-Za-z])+/g});var U,ft=J(()=>{"use strict";_();v();b();U=class n{constructor(e,t){this.lineNumber=e,this.column=t}with(e=this.lineNumber,t=this.column){return e===this.lineNumber&&t===this.column?this:new n(e,t)}delta(e=0,t=0){return this.with(this.lineNumber+e,this.column+t)}equals(e){return n.equals(this,e)}static equals(e,t){return!e&&!t?!0:!!e&&!!t&&e.lineNumber===t.lineNumber&&e.column===t.column}isBefore(e){return n.isBefore(this,e)}static isBefore(e,t){return e.lineNumber{"use strict";_();v();b();ft();P=class n{constructor(e,t,i,o){e>i||e===i&&t>o?(this.startLineNumber=i,this.startColumn=o,this.endLineNumber=e,this.endColumn=t):(this.startLineNumber=e,this.startColumn=t,this.endLineNumber=i,this.endColumn=o)}isEmpty(){return n.isEmpty(this)}static isEmpty(e){return e.startLineNumber===e.endLineNumber&&e.startColumn===e.endColumn}containsPosition(e){return n.containsPosition(this,e)}static containsPosition(e,t){return!(t.lineNumbere.endLineNumber||t.lineNumber===e.startLineNumber&&t.columne.endColumn)}static strictContainsPosition(e,t){return!(t.lineNumbere.endLineNumber||t.lineNumber===e.startLineNumber&&t.column<=e.startColumn||t.lineNumber===e.endLineNumber&&t.column>=e.endColumn)}containsRange(e){return n.containsRange(this,e)}static containsRange(e,t){return!(t.startLineNumbere.endLineNumber||t.endLineNumber>e.endLineNumber||t.startLineNumber===e.startLineNumber&&t.startColumne.endColumn)}strictContainsRange(e){return n.strictContainsRange(this,e)}static strictContainsRange(e,t){return!(t.startLineNumbere.endLineNumber||t.endLineNumber>e.endLineNumber||t.startLineNumber===e.startLineNumber&&t.startColumn<=e.startColumn||t.endLineNumber===e.endLineNumber&&t.endColumn>=e.endColumn)}plusRange(e){return n.plusRange(this,e)}static plusRange(e,t){let i,o,s,r;return t.startLineNumbere.endLineNumber?(s=t.endLineNumber,r=t.endColumn):t.endLineNumber===e.endLineNumber?(s=t.endLineNumber,r=Math.max(t.endColumn,e.endColumn)):(s=e.endLineNumber,r=e.endColumn),new n(i,o,s,r)}intersectRanges(e){return n.intersectRanges(this,e)}static intersectRanges(e,t){let i=e.startLineNumber,o=e.startColumn,s=e.endLineNumber,r=e.endColumn,a=t.startLineNumber,l=t.startColumn,c=t.endLineNumber,d=t.endColumn;return ic?(s=c,r=d):s===c&&(r=Math.min(r,d)),i>s||i===s&&o>r?null:new n(i,o,s,r)}equalsRange(e){return n.equalsRange(this,e)}static equalsRange(e,t){return!e&&!t?!0:!!e&&!!t&&e.startLineNumber===t.startLineNumber&&e.startColumn===t.startColumn&&e.endLineNumber===t.endLineNumber&&e.endColumn===t.endColumn}getEndPosition(){return n.getEndPosition(this)}static getEndPosition(e){return new U(e.endLineNumber,e.endColumn)}getStartPosition(){return n.getStartPosition(this)}static getStartPosition(e){return new U(e.startLineNumber,e.startColumn)}toString(){return"["+this.startLineNumber+","+this.startColumn+" -> "+this.endLineNumber+","+this.endColumn+"]"}setEndPosition(e,t){return new n(this.startLineNumber,this.startColumn,e,t)}setStartPosition(e,t){return new n(e,t,this.endLineNumber,this.endColumn)}collapseToStart(){return n.collapseToStart(this)}static collapseToStart(e){return new n(e.startLineNumber,e.startColumn,e.startLineNumber,e.startColumn)}collapseToEnd(){return n.collapseToEnd(this)}static collapseToEnd(e){return new n(e.endLineNumber,e.endColumn,e.endLineNumber,e.endColumn)}delta(e){return new n(this.startLineNumber+e,this.startColumn,this.endLineNumber+e,this.endColumn)}static fromPositions(e,t=e){return new n(e.lineNumber,e.column,t.lineNumber,t.column)}static lift(e){return e?new n(e.startLineNumber,e.startColumn,e.endLineNumber,e.endColumn):null}static isIRange(e){return e&&typeof e.startLineNumber=="number"&&typeof e.startColumn=="number"&&typeof e.endLineNumber=="number"&&typeof e.endColumn=="number"}static areIntersectingOrTouching(e,t){return!(e.endLineNumbere.startLineNumber}toJSON(){return this}}});var nt,Kn=J(()=>{"use strict";_();v();b();ft();Ke();nt=class n extends P{constructor(e,t,i,o){super(e,t,i,o),this.selectionStartLineNumber=e,this.selectionStartColumn=t,this.positionLineNumber=i,this.positionColumn=o}toString(){return"["+this.selectionStartLineNumber+","+this.selectionStartColumn+" -> "+this.positionLineNumber+","+this.positionColumn+"]"}equalsSelection(e){return n.selectionsEqual(this,e)}static selectionsEqual(e,t){return e.selectionStartLineNumber===t.selectionStartLineNumber&&e.selectionStartColumn===t.selectionStartColumn&&e.positionLineNumber===t.positionLineNumber&&e.positionColumn===t.positionColumn}getDirection(){return this.selectionStartLineNumber===this.startLineNumber&&this.selectionStartColumn===this.startColumn?0:1}setEndPosition(e,t){return this.getDirection()===0?new n(this.startLineNumber,this.startColumn,e,t):new n(e,t,this.startLineNumber,this.startColumn)}getPosition(){return new U(this.positionLineNumber,this.positionColumn)}getSelectionStart(){return new U(this.selectionStartLineNumber,this.selectionStartColumn)}setStartPosition(e,t){return this.getDirection()===0?new n(e,t,this.endLineNumber,this.endColumn):new n(this.endLineNumber,this.endColumn,e,t)}static fromPositions(e,t=e){return new n(e.lineNumber,e.column,t.lineNumber,t.column)}static fromRange(e,t){return t===0?new n(e.startLineNumber,e.startColumn,e.endLineNumber,e.endColumn):new n(e.endLineNumber,e.endColumn,e.startLineNumber,e.startColumn)}static liftSelection(e){return new n(e.selectionStartLineNumber,e.selectionStartColumn,e.positionLineNumber,e.positionColumn)}static selectionsArrEqual(e,t){if(e&&!t||!e&&t)return!1;if(!e&&!t)return!0;if(e.length!==t.length)return!1;for(let i=0,o=e.length;i{"use strict";_();v();b();xi();CT=Object.create(null)});var U9,K9=J(()=>{"use strict";_();v();b();K_();U9={add:L("add",6e4),plus:L("plus",6e4),gistNew:L("gist-new",6e4),repoCreate:L("repo-create",6e4),lightbulb:L("lightbulb",60001),lightBulb:L("light-bulb",60001),repo:L("repo",60002),repoDelete:L("repo-delete",60002),gistFork:L("gist-fork",60003),repoForked:L("repo-forked",60003),gitPullRequest:L("git-pull-request",60004),gitPullRequestAbandoned:L("git-pull-request-abandoned",60004),recordKeys:L("record-keys",60005),keyboard:L("keyboard",60005),tag:L("tag",60006),gitPullRequestLabel:L("git-pull-request-label",60006),tagAdd:L("tag-add",60006),tagRemove:L("tag-remove",60006),person:L("person",60007),personFollow:L("person-follow",60007),personOutline:L("person-outline",60007),personFilled:L("person-filled",60007),gitBranch:L("git-branch",60008),gitBranchCreate:L("git-branch-create",60008),gitBranchDelete:L("git-branch-delete",60008),sourceControl:L("source-control",60008),mirror:L("mirror",60009),mirrorPublic:L("mirror-public",60009),star:L("star",60010),starAdd:L("star-add",60010),starDelete:L("star-delete",60010),starEmpty:L("star-empty",60010),comment:L("comment",60011),commentAdd:L("comment-add",60011),alert:L("alert",60012),warning:L("warning",60012),search:L("search",60013),searchSave:L("search-save",60013),logOut:L("log-out",60014),signOut:L("sign-out",60014),logIn:L("log-in",60015),signIn:L("sign-in",60015),eye:L("eye",60016),eyeUnwatch:L("eye-unwatch",60016),eyeWatch:L("eye-watch",60016),circleFilled:L("circle-filled",60017),primitiveDot:L("primitive-dot",60017),closeDirty:L("close-dirty",60017),debugBreakpoint:L("debug-breakpoint",60017),debugBreakpointDisabled:L("debug-breakpoint-disabled",60017),debugHint:L("debug-hint",60017),terminalDecorationSuccess:L("terminal-decoration-success",60017),primitiveSquare:L("primitive-square",60018),edit:L("edit",60019),pencil:L("pencil",60019),info:L("info",60020),issueOpened:L("issue-opened",60020),gistPrivate:L("gist-private",60021),gitForkPrivate:L("git-fork-private",60021),lock:L("lock",60021),mirrorPrivate:L("mirror-private",60021),close:L("close",60022),removeClose:L("remove-close",60022),x:L("x",60022),repoSync:L("repo-sync",60023),sync:L("sync",60023),clone:L("clone",60024),desktopDownload:L("desktop-download",60024),beaker:L("beaker",60025),microscope:L("microscope",60025),vm:L("vm",60026),deviceDesktop:L("device-desktop",60026),file:L("file",60027),fileText:L("file-text",60027),more:L("more",60028),ellipsis:L("ellipsis",60028),kebabHorizontal:L("kebab-horizontal",60028),mailReply:L("mail-reply",60029),reply:L("reply",60029),organization:L("organization",60030),organizationFilled:L("organization-filled",60030),organizationOutline:L("organization-outline",60030),newFile:L("new-file",60031),fileAdd:L("file-add",60031),newFolder:L("new-folder",60032),fileDirectoryCreate:L("file-directory-create",60032),trash:L("trash",60033),trashcan:L("trashcan",60033),history:L("history",60034),clock:L("clock",60034),folder:L("folder",60035),fileDirectory:L("file-directory",60035),symbolFolder:L("symbol-folder",60035),logoGithub:L("logo-github",60036),markGithub:L("mark-github",60036),github:L("github",60036),terminal:L("terminal",60037),console:L("console",60037),repl:L("repl",60037),zap:L("zap",60038),symbolEvent:L("symbol-event",60038),error:L("error",60039),stop:L("stop",60039),variable:L("variable",60040),symbolVariable:L("symbol-variable",60040),array:L("array",60042),symbolArray:L("symbol-array",60042),symbolModule:L("symbol-module",60043),symbolPackage:L("symbol-package",60043),symbolNamespace:L("symbol-namespace",60043),symbolObject:L("symbol-object",60043),symbolMethod:L("symbol-method",60044),symbolFunction:L("symbol-function",60044),symbolConstructor:L("symbol-constructor",60044),symbolBoolean:L("symbol-boolean",60047),symbolNull:L("symbol-null",60047),symbolNumeric:L("symbol-numeric",60048),symbolNumber:L("symbol-number",60048),symbolStructure:L("symbol-structure",60049),symbolStruct:L("symbol-struct",60049),symbolParameter:L("symbol-parameter",60050),symbolTypeParameter:L("symbol-type-parameter",60050),symbolKey:L("symbol-key",60051),symbolText:L("symbol-text",60051),symbolReference:L("symbol-reference",60052),goToFile:L("go-to-file",60052),symbolEnum:L("symbol-enum",60053),symbolValue:L("symbol-value",60053),symbolRuler:L("symbol-ruler",60054),symbolUnit:L("symbol-unit",60054),activateBreakpoints:L("activate-breakpoints",60055),archive:L("archive",60056),arrowBoth:L("arrow-both",60057),arrowDown:L("arrow-down",60058),arrowLeft:L("arrow-left",60059),arrowRight:L("arrow-right",60060),arrowSmallDown:L("arrow-small-down",60061),arrowSmallLeft:L("arrow-small-left",60062),arrowSmallRight:L("arrow-small-right",60063),arrowSmallUp:L("arrow-small-up",60064),arrowUp:L("arrow-up",60065),bell:L("bell",60066),bold:L("bold",60067),book:L("book",60068),bookmark:L("bookmark",60069),debugBreakpointConditionalUnverified:L("debug-breakpoint-conditional-unverified",60070),debugBreakpointConditional:L("debug-breakpoint-conditional",60071),debugBreakpointConditionalDisabled:L("debug-breakpoint-conditional-disabled",60071),debugBreakpointDataUnverified:L("debug-breakpoint-data-unverified",60072),debugBreakpointData:L("debug-breakpoint-data",60073),debugBreakpointDataDisabled:L("debug-breakpoint-data-disabled",60073),debugBreakpointLogUnverified:L("debug-breakpoint-log-unverified",60074),debugBreakpointLog:L("debug-breakpoint-log",60075),debugBreakpointLogDisabled:L("debug-breakpoint-log-disabled",60075),briefcase:L("briefcase",60076),broadcast:L("broadcast",60077),browser:L("browser",60078),bug:L("bug",60079),calendar:L("calendar",60080),caseSensitive:L("case-sensitive",60081),check:L("check",60082),checklist:L("checklist",60083),chevronDown:L("chevron-down",60084),chevronLeft:L("chevron-left",60085),chevronRight:L("chevron-right",60086),chevronUp:L("chevron-up",60087),chromeClose:L("chrome-close",60088),chromeMaximize:L("chrome-maximize",60089),chromeMinimize:L("chrome-minimize",60090),chromeRestore:L("chrome-restore",60091),circleOutline:L("circle-outline",60092),circle:L("circle",60092),debugBreakpointUnverified:L("debug-breakpoint-unverified",60092),terminalDecorationIncomplete:L("terminal-decoration-incomplete",60092),circleSlash:L("circle-slash",60093),circuitBoard:L("circuit-board",60094),clearAll:L("clear-all",60095),clippy:L("clippy",60096),closeAll:L("close-all",60097),cloudDownload:L("cloud-download",60098),cloudUpload:L("cloud-upload",60099),code:L("code",60100),collapseAll:L("collapse-all",60101),colorMode:L("color-mode",60102),commentDiscussion:L("comment-discussion",60103),creditCard:L("credit-card",60105),dash:L("dash",60108),dashboard:L("dashboard",60109),database:L("database",60110),debugContinue:L("debug-continue",60111),debugDisconnect:L("debug-disconnect",60112),debugPause:L("debug-pause",60113),debugRestart:L("debug-restart",60114),debugStart:L("debug-start",60115),debugStepInto:L("debug-step-into",60116),debugStepOut:L("debug-step-out",60117),debugStepOver:L("debug-step-over",60118),debugStop:L("debug-stop",60119),debug:L("debug",60120),deviceCameraVideo:L("device-camera-video",60121),deviceCamera:L("device-camera",60122),deviceMobile:L("device-mobile",60123),diffAdded:L("diff-added",60124),diffIgnored:L("diff-ignored",60125),diffModified:L("diff-modified",60126),diffRemoved:L("diff-removed",60127),diffRenamed:L("diff-renamed",60128),diff:L("diff",60129),diffSidebyside:L("diff-sidebyside",60129),discard:L("discard",60130),editorLayout:L("editor-layout",60131),emptyWindow:L("empty-window",60132),exclude:L("exclude",60133),extensions:L("extensions",60134),eyeClosed:L("eye-closed",60135),fileBinary:L("file-binary",60136),fileCode:L("file-code",60137),fileMedia:L("file-media",60138),filePdf:L("file-pdf",60139),fileSubmodule:L("file-submodule",60140),fileSymlinkDirectory:L("file-symlink-directory",60141),fileSymlinkFile:L("file-symlink-file",60142),fileZip:L("file-zip",60143),files:L("files",60144),filter:L("filter",60145),flame:L("flame",60146),foldDown:L("fold-down",60147),foldUp:L("fold-up",60148),fold:L("fold",60149),folderActive:L("folder-active",60150),folderOpened:L("folder-opened",60151),gear:L("gear",60152),gift:L("gift",60153),gistSecret:L("gist-secret",60154),gist:L("gist",60155),gitCommit:L("git-commit",60156),gitCompare:L("git-compare",60157),compareChanges:L("compare-changes",60157),gitMerge:L("git-merge",60158),githubAction:L("github-action",60159),githubAlt:L("github-alt",60160),globe:L("globe",60161),grabber:L("grabber",60162),graph:L("graph",60163),gripper:L("gripper",60164),heart:L("heart",60165),home:L("home",60166),horizontalRule:L("horizontal-rule",60167),hubot:L("hubot",60168),inbox:L("inbox",60169),issueReopened:L("issue-reopened",60171),issues:L("issues",60172),italic:L("italic",60173),jersey:L("jersey",60174),json:L("json",60175),kebabVertical:L("kebab-vertical",60176),key:L("key",60177),law:L("law",60178),lightbulbAutofix:L("lightbulb-autofix",60179),linkExternal:L("link-external",60180),link:L("link",60181),listOrdered:L("list-ordered",60182),listUnordered:L("list-unordered",60183),liveShare:L("live-share",60184),loading:L("loading",60185),location:L("location",60186),mailRead:L("mail-read",60187),mail:L("mail",60188),markdown:L("markdown",60189),megaphone:L("megaphone",60190),mention:L("mention",60191),milestone:L("milestone",60192),gitPullRequestMilestone:L("git-pull-request-milestone",60192),mortarBoard:L("mortar-board",60193),move:L("move",60194),multipleWindows:L("multiple-windows",60195),mute:L("mute",60196),noNewline:L("no-newline",60197),note:L("note",60198),octoface:L("octoface",60199),openPreview:L("open-preview",60200),package:L("package",60201),paintcan:L("paintcan",60202),pin:L("pin",60203),play:L("play",60204),run:L("run",60204),plug:L("plug",60205),preserveCase:L("preserve-case",60206),preview:L("preview",60207),project:L("project",60208),pulse:L("pulse",60209),question:L("question",60210),quote:L("quote",60211),radioTower:L("radio-tower",60212),reactions:L("reactions",60213),references:L("references",60214),refresh:L("refresh",60215),regex:L("regex",60216),remoteExplorer:L("remote-explorer",60217),remote:L("remote",60218),remove:L("remove",60219),replaceAll:L("replace-all",60220),replace:L("replace",60221),repoClone:L("repo-clone",60222),repoForcePush:L("repo-force-push",60223),repoPull:L("repo-pull",60224),repoPush:L("repo-push",60225),report:L("report",60226),requestChanges:L("request-changes",60227),rocket:L("rocket",60228),rootFolderOpened:L("root-folder-opened",60229),rootFolder:L("root-folder",60230),rss:L("rss",60231),ruby:L("ruby",60232),saveAll:L("save-all",60233),saveAs:L("save-as",60234),save:L("save",60235),screenFull:L("screen-full",60236),screenNormal:L("screen-normal",60237),searchStop:L("search-stop",60238),server:L("server",60240),settingsGear:L("settings-gear",60241),settings:L("settings",60242),shield:L("shield",60243),smiley:L("smiley",60244),sortPrecedence:L("sort-precedence",60245),splitHorizontal:L("split-horizontal",60246),splitVertical:L("split-vertical",60247),squirrel:L("squirrel",60248),starFull:L("star-full",60249),starHalf:L("star-half",60250),symbolClass:L("symbol-class",60251),symbolColor:L("symbol-color",60252),symbolConstant:L("symbol-constant",60253),symbolEnumMember:L("symbol-enum-member",60254),symbolField:L("symbol-field",60255),symbolFile:L("symbol-file",60256),symbolInterface:L("symbol-interface",60257),symbolKeyword:L("symbol-keyword",60258),symbolMisc:L("symbol-misc",60259),symbolOperator:L("symbol-operator",60260),symbolProperty:L("symbol-property",60261),wrench:L("wrench",60261),wrenchSubaction:L("wrench-subaction",60261),symbolSnippet:L("symbol-snippet",60262),tasklist:L("tasklist",60263),telescope:L("telescope",60264),textSize:L("text-size",60265),threeBars:L("three-bars",60266),thumbsdown:L("thumbsdown",60267),thumbsup:L("thumbsup",60268),tools:L("tools",60269),triangleDown:L("triangle-down",60270),triangleLeft:L("triangle-left",60271),triangleRight:L("triangle-right",60272),triangleUp:L("triangle-up",60273),twitter:L("twitter",60274),unfold:L("unfold",60275),unlock:L("unlock",60276),unmute:L("unmute",60277),unverified:L("unverified",60278),verified:L("verified",60279),versions:L("versions",60280),vmActive:L("vm-active",60281),vmOutline:L("vm-outline",60282),vmRunning:L("vm-running",60283),watch:L("watch",60284),whitespace:L("whitespace",60285),wholeWord:L("whole-word",60286),window:L("window",60287),wordWrap:L("word-wrap",60288),zoomIn:L("zoom-in",60289),zoomOut:L("zoom-out",60290),listFilter:L("list-filter",60291),listFlat:L("list-flat",60292),listSelection:L("list-selection",60293),selection:L("selection",60293),listTree:L("list-tree",60294),debugBreakpointFunctionUnverified:L("debug-breakpoint-function-unverified",60295),debugBreakpointFunction:L("debug-breakpoint-function",60296),debugBreakpointFunctionDisabled:L("debug-breakpoint-function-disabled",60296),debugStackframeActive:L("debug-stackframe-active",60297),circleSmallFilled:L("circle-small-filled",60298),debugStackframeDot:L("debug-stackframe-dot",60298),terminalDecorationMark:L("terminal-decoration-mark",60298),debugStackframe:L("debug-stackframe",60299),debugStackframeFocused:L("debug-stackframe-focused",60299),debugBreakpointUnsupported:L("debug-breakpoint-unsupported",60300),symbolString:L("symbol-string",60301),debugReverseContinue:L("debug-reverse-continue",60302),debugStepBack:L("debug-step-back",60303),debugRestartFrame:L("debug-restart-frame",60304),debugAlt:L("debug-alt",60305),callIncoming:L("call-incoming",60306),callOutgoing:L("call-outgoing",60307),menu:L("menu",60308),expandAll:L("expand-all",60309),feedback:L("feedback",60310),gitPullRequestReviewer:L("git-pull-request-reviewer",60310),groupByRefType:L("group-by-ref-type",60311),ungroupByRefType:L("ungroup-by-ref-type",60312),account:L("account",60313),gitPullRequestAssignee:L("git-pull-request-assignee",60313),bellDot:L("bell-dot",60314),debugConsole:L("debug-console",60315),library:L("library",60316),output:L("output",60317),runAll:L("run-all",60318),syncIgnored:L("sync-ignored",60319),pinned:L("pinned",60320),githubInverted:L("github-inverted",60321),serverProcess:L("server-process",60322),serverEnvironment:L("server-environment",60323),pass:L("pass",60324),issueClosed:L("issue-closed",60324),stopCircle:L("stop-circle",60325),playCircle:L("play-circle",60326),record:L("record",60327),debugAltSmall:L("debug-alt-small",60328),vmConnect:L("vm-connect",60329),cloud:L("cloud",60330),merge:L("merge",60331),export:L("export",60332),graphLeft:L("graph-left",60333),magnet:L("magnet",60334),notebook:L("notebook",60335),redo:L("redo",60336),checkAll:L("check-all",60337),pinnedDirty:L("pinned-dirty",60338),passFilled:L("pass-filled",60339),circleLargeFilled:L("circle-large-filled",60340),circleLarge:L("circle-large",60341),circleLargeOutline:L("circle-large-outline",60341),combine:L("combine",60342),gather:L("gather",60342),table:L("table",60343),variableGroup:L("variable-group",60344),typeHierarchy:L("type-hierarchy",60345),typeHierarchySub:L("type-hierarchy-sub",60346),typeHierarchySuper:L("type-hierarchy-super",60347),gitPullRequestCreate:L("git-pull-request-create",60348),runAbove:L("run-above",60349),runBelow:L("run-below",60350),notebookTemplate:L("notebook-template",60351),debugRerun:L("debug-rerun",60352),workspaceTrusted:L("workspace-trusted",60353),workspaceUntrusted:L("workspace-untrusted",60354),workspaceUnknown:L("workspace-unknown",60355),terminalCmd:L("terminal-cmd",60356),terminalDebian:L("terminal-debian",60357),terminalLinux:L("terminal-linux",60358),terminalPowershell:L("terminal-powershell",60359),terminalTmux:L("terminal-tmux",60360),terminalUbuntu:L("terminal-ubuntu",60361),terminalBash:L("terminal-bash",60362),arrowSwap:L("arrow-swap",60363),copy:L("copy",60364),personAdd:L("person-add",60365),filterFilled:L("filter-filled",60366),wand:L("wand",60367),debugLineByLine:L("debug-line-by-line",60368),inspect:L("inspect",60369),layers:L("layers",60370),layersDot:L("layers-dot",60371),layersActive:L("layers-active",60372),compass:L("compass",60373),compassDot:L("compass-dot",60374),compassActive:L("compass-active",60375),azure:L("azure",60376),issueDraft:L("issue-draft",60377),gitPullRequestClosed:L("git-pull-request-closed",60378),gitPullRequestDraft:L("git-pull-request-draft",60379),debugAll:L("debug-all",60380),debugCoverage:L("debug-coverage",60381),runErrors:L("run-errors",60382),folderLibrary:L("folder-library",60383),debugContinueSmall:L("debug-continue-small",60384),beakerStop:L("beaker-stop",60385),graphLine:L("graph-line",60386),graphScatter:L("graph-scatter",60387),pieChart:L("pie-chart",60388),bracket:L("bracket",60175),bracketDot:L("bracket-dot",60389),bracketError:L("bracket-error",60390),lockSmall:L("lock-small",60391),azureDevops:L("azure-devops",60392),verifiedFilled:L("verified-filled",60393),newline:L("newline",60394),layout:L("layout",60395),layoutActivitybarLeft:L("layout-activitybar-left",60396),layoutActivitybarRight:L("layout-activitybar-right",60397),layoutPanelLeft:L("layout-panel-left",60398),layoutPanelCenter:L("layout-panel-center",60399),layoutPanelJustify:L("layout-panel-justify",60400),layoutPanelRight:L("layout-panel-right",60401),layoutPanel:L("layout-panel",60402),layoutSidebarLeft:L("layout-sidebar-left",60403),layoutSidebarRight:L("layout-sidebar-right",60404),layoutStatusbar:L("layout-statusbar",60405),layoutMenubar:L("layout-menubar",60406),layoutCentered:L("layout-centered",60407),target:L("target",60408),indent:L("indent",60409),recordSmall:L("record-small",60410),errorSmall:L("error-small",60411),terminalDecorationError:L("terminal-decoration-error",60411),arrowCircleDown:L("arrow-circle-down",60412),arrowCircleLeft:L("arrow-circle-left",60413),arrowCircleRight:L("arrow-circle-right",60414),arrowCircleUp:L("arrow-circle-up",60415),layoutSidebarRightOff:L("layout-sidebar-right-off",60416),layoutPanelOff:L("layout-panel-off",60417),layoutSidebarLeftOff:L("layout-sidebar-left-off",60418),blank:L("blank",60419),heartFilled:L("heart-filled",60420),map:L("map",60421),mapHorizontal:L("map-horizontal",60421),foldHorizontal:L("fold-horizontal",60421),mapFilled:L("map-filled",60422),mapHorizontalFilled:L("map-horizontal-filled",60422),foldHorizontalFilled:L("fold-horizontal-filled",60422),circleSmall:L("circle-small",60423),bellSlash:L("bell-slash",60424),bellSlashDot:L("bell-slash-dot",60425),commentUnresolved:L("comment-unresolved",60426),gitPullRequestGoToChanges:L("git-pull-request-go-to-changes",60427),gitPullRequestNewChanges:L("git-pull-request-new-changes",60428),searchFuzzy:L("search-fuzzy",60429),commentDraft:L("comment-draft",60430),send:L("send",60431),sparkle:L("sparkle",60432),insert:L("insert",60433),mic:L("mic",60434),thumbsdownFilled:L("thumbsdown-filled",60435),thumbsupFilled:L("thumbsup-filled",60436),coffee:L("coffee",60437),snake:L("snake",60438),game:L("game",60439),vr:L("vr",60440),chip:L("chip",60441),piano:L("piano",60442),music:L("music",60443),micFilled:L("mic-filled",60444),repoFetch:L("repo-fetch",60445),copilot:L("copilot",60446),lightbulbSparkle:L("lightbulb-sparkle",60447),robot:L("robot",60448),sparkleFilled:L("sparkle-filled",60449),diffSingle:L("diff-single",60450),diffMultiple:L("diff-multiple",60451),surroundWith:L("surround-with",60452),share:L("share",60453),gitStash:L("git-stash",60454),gitStashApply:L("git-stash-apply",60455),gitStashPop:L("git-stash-pop",60456),vscode:L("vscode",60457),vscodeInsiders:L("vscode-insiders",60458),codeOss:L("code-oss",60459),runCoverage:L("run-coverage",60460),runAllCoverage:L("run-all-coverage",60461),coverage:L("coverage",60462),githubProject:L("github-project",60463),mapVertical:L("map-vertical",60464),foldVertical:L("fold-vertical",60464),mapVerticalFilled:L("map-vertical-filled",60465),foldVerticalFilled:L("fold-vertical-filled",60465),goToSearch:L("go-to-search",60466),percentage:L("percentage",60467),sortPercentage:L("sort-percentage",60467)}});var R$,ue,$n=J(()=>{"use strict";_();v();b();K_();K9();R$={dialogError:L("dialog-error","error"),dialogWarning:L("dialog-warning","warning"),dialogInfo:L("dialog-info","info"),dialogClose:L("dialog-close","close"),treeItemExpanded:L("tree-item-expanded","chevron-down"),treeFilterOnTypeOn:L("tree-filter-on-type-on","list-filter"),treeFilterOnTypeOff:L("tree-filter-on-type-off","list-selection"),treeFilterClear:L("tree-filter-clear","close"),treeItemLoading:L("tree-item-loading","loading"),menuSelection:L("menu-selection","check"),menuSubmenu:L("menu-submenu","chevron-right"),menuBarMore:L("menubar-more","more"),scrollbarButtonLeft:L("scrollbar-button-left","triangle-left"),scrollbarButtonRight:L("scrollbar-button-right","triangle-right"),scrollbarButtonUp:L("scrollbar-button-up","triangle-up"),scrollbarButtonDown:L("scrollbar-button-down","triangle-down"),toolBarMore:L("toolbar-more","more"),quickInputBack:L("quick-input-back","arrow-left"),dropDownButton:L("drop-down-button",60084),symbolCustomColor:L("symbol-customcolor",60252),exportIcon:L("export",60332),workspaceUnspecified:L("workspace-unspecified",60355),newLine:L("newline",60394),thumbsDownFilled:L("thumbsdown-filled",60435),thumbsUpFilled:L("thumbsup-filled",60436),gitFetch:L("git-fetch",60445),lightbulbSparkleAutofix:L("lightbulb-sparkle-autofix",60447),debugBreakpointPending:L("debug-breakpoint-pending",60377)},ue={...U9,...R$}});var bC,wT,$9=J(()=>{"use strict";_();v();b();ye();le();bC=class{constructor(){this._tokenizationSupports=new Map,this._factories=new Map,this._onDidChange=new B,this.onDidChange=this._onDidChange.event,this._colorMap=null}handleChange(e){this._onDidChange.fire({changedLanguages:e,changedColorMap:!1})}register(e,t){return this._tokenizationSupports.set(e,t),this.handleChange([e]),be(()=>{this._tokenizationSupports.get(e)===t&&(this._tokenizationSupports.delete(e),this.handleChange([e]))})}get(e){return this._tokenizationSupports.get(e)||null}registerFactory(e,t){var i;(i=this._factories.get(e))===null||i===void 0||i.dispose();let o=new wT(this,e,t);return this._factories.set(e,o),be(()=>{let s=this._factories.get(e);!s||s!==o||(this._factories.delete(e),s.dispose())})}async getOrCreate(e){let t=this.get(e);if(t)return t;let i=this._factories.get(e);return!i||i.isResolved?null:(await i.resolve(),this.get(e))}isResolved(e){if(this.get(e))return!0;let i=this._factories.get(e);return!!(!i||i.isResolved)}setColorMap(e){this._colorMap=e,this._onDidChange.fire({changedLanguages:Array.from(this._tokenizationSupports.keys()),changedColorMap:!0})}getColorMap(){return this._colorMap}getDefaultBackground(){return this._colorMap&&this._colorMap.length>2?this._colorMap[2]:null}},wT=class extends H{get isResolved(){return this._isResolved}constructor(e,t,i){super(),this._registry=e,this._languageId=t,this._factory=i,this._isDisposed=!1,this._resolvePromise=null,this._isResolved=!1}dispose(){this._isDisposed=!0,super.dispose()}async resolve(){return this._resolvePromise||(this._resolvePromise=this._create()),this._resolvePromise}async _create(){let e=await this._factory.tokenizationSupport;this._isResolved=!0,e&&!this._isDisposed&&this._register(this._registry.register(this._languageId,e))}}});function doe(n){return n&&Oe.isUri(n.uri)&&P.isIRange(n.range)&&(P.isIRange(n.originSelectionRange)||P.isIRange(n.targetSelectionRange))}function hoe(n,e){return p("symbolAriaLabel","{0} ({1})",n,P$[e])}var xa,Ad,yc,q9,j9,G9,vC,Z9,Y9,X9,P$,CC,fl,Q9,J9,e7,t7,wC,Bt,i7,Yo=J(()=>{"use strict";_();v();b();$n();sn();Ke();$9();Ge();xa=class{constructor(e,t,i){this.offset=e,this.type=t,this.language=i,this._tokenBrand=void 0}toString(){return"("+this.offset+", "+this.type+")"}},Ad=class{constructor(e,t){this.tokens=e,this.endState=t,this._tokenizationResultBrand=void 0}},yc=class{constructor(e,t){this.tokens=e,this.endState=t,this._encodedTokenizationResultBrand=void 0}};(function(n){n[n.Increase=0]="Increase",n[n.Decrease=1]="Decrease"})(q9||(q9={}));(function(n){let e=new Map;e.set(0,ue.symbolMethod),e.set(1,ue.symbolFunction),e.set(2,ue.symbolConstructor),e.set(3,ue.symbolField),e.set(4,ue.symbolVariable),e.set(5,ue.symbolClass),e.set(6,ue.symbolStruct),e.set(7,ue.symbolInterface),e.set(8,ue.symbolModule),e.set(9,ue.symbolProperty),e.set(10,ue.symbolEvent),e.set(11,ue.symbolOperator),e.set(12,ue.symbolUnit),e.set(13,ue.symbolValue),e.set(15,ue.symbolEnum),e.set(14,ue.symbolConstant),e.set(15,ue.symbolEnum),e.set(16,ue.symbolEnumMember),e.set(17,ue.symbolKeyword),e.set(27,ue.symbolSnippet),e.set(18,ue.symbolText),e.set(19,ue.symbolColor),e.set(20,ue.symbolFile),e.set(21,ue.symbolReference),e.set(22,ue.symbolCustomColor),e.set(23,ue.symbolFolder),e.set(24,ue.symbolTypeParameter),e.set(25,ue.account),e.set(26,ue.issues);function t(s){let r=e.get(s);return r||(console.info("No codicon found for CompletionItemKind "+s),r=ue.symbolProperty),r}n.toIcon=t;let i=new Map;i.set("method",0),i.set("function",1),i.set("constructor",2),i.set("field",3),i.set("variable",4),i.set("class",5),i.set("struct",6),i.set("interface",7),i.set("module",8),i.set("property",9),i.set("event",10),i.set("operator",11),i.set("unit",12),i.set("value",13),i.set("constant",14),i.set("enum",15),i.set("enum-member",16),i.set("enumMember",16),i.set("keyword",17),i.set("snippet",27),i.set("text",18),i.set("color",19),i.set("file",20),i.set("reference",21),i.set("customcolor",22),i.set("folder",23),i.set("type-parameter",24),i.set("typeParameter",24),i.set("account",25),i.set("issue",26);function o(s,r){let a=i.get(s);return typeof a>"u"&&!r&&(a=9),a}n.fromString=o})(j9||(j9={}));(function(n){n[n.Automatic=0]="Automatic",n[n.Explicit=1]="Explicit"})(G9||(G9={}));vC=class{constructor(e,t,i,o){this.range=e,this.text=t,this.completionKind=i,this.isSnippetText=o}equals(e){return P.lift(this.range).equalsRange(e.range)&&this.text===e.text&&this.completionKind===e.completionKind&&this.isSnippetText===e.isSnippetText}};(function(n){n[n.Automatic=0]="Automatic",n[n.PasteAs=1]="PasteAs"})(Z9||(Z9={}));(function(n){n[n.Invoke=1]="Invoke",n[n.TriggerCharacter=2]="TriggerCharacter",n[n.ContentChange=3]="ContentChange"})(Y9||(Y9={}));(function(n){n[n.Text=0]="Text",n[n.Read=1]="Read",n[n.Write=2]="Write"})(X9||(X9={}));P$={17:p("Array","array"),16:p("Boolean","boolean"),4:p("Class","class"),13:p("Constant","constant"),8:p("Constructor","constructor"),9:p("Enum","enumeration"),21:p("EnumMember","enumeration member"),23:p("Event","event"),7:p("Field","field"),0:p("File","file"),11:p("Function","function"),10:p("Interface","interface"),19:p("Key","key"),5:p("Method","method"),1:p("Module","module"),2:p("Namespace","namespace"),20:p("Null","null"),15:p("Number","number"),18:p("Object","object"),24:p("Operator","operator"),3:p("Package","package"),6:p("Property","property"),14:p("String","string"),22:p("Struct","struct"),25:p("TypeParameter","type parameter"),12:p("Variable","variable")};(function(n){let e=new Map;e.set(0,ue.symbolFile),e.set(1,ue.symbolModule),e.set(2,ue.symbolNamespace),e.set(3,ue.symbolPackage),e.set(4,ue.symbolClass),e.set(5,ue.symbolMethod),e.set(6,ue.symbolProperty),e.set(7,ue.symbolField),e.set(8,ue.symbolConstructor),e.set(9,ue.symbolEnum),e.set(10,ue.symbolInterface),e.set(11,ue.symbolFunction),e.set(12,ue.symbolVariable),e.set(13,ue.symbolConstant),e.set(14,ue.symbolString),e.set(15,ue.symbolNumber),e.set(16,ue.symbolBoolean),e.set(17,ue.symbolArray),e.set(18,ue.symbolObject),e.set(19,ue.symbolKey),e.set(20,ue.symbolNull),e.set(21,ue.symbolEnumMember),e.set(22,ue.symbolStruct),e.set(23,ue.symbolEvent),e.set(24,ue.symbolOperator),e.set(25,ue.symbolTypeParameter);function t(i){let o=e.get(i);return o||(console.info("No codicon found for SymbolKind "+i),o=ue.symbolProperty),o}n.toIcon=t})(CC||(CC={}));fl=class n{static fromValue(e){switch(e){case"comment":return n.Comment;case"imports":return n.Imports;case"region":return n.Region}return new n(e)}constructor(e){this.value=e}};fl.Comment=new fl("comment");fl.Imports=new fl("imports");fl.Region=new fl("region");(function(n){n[n.AIGenerated=1]="AIGenerated"})(Q9||(Q9={}));(function(n){n[n.Invoke=0]="Invoke",n[n.Automatic=1]="Automatic"})(J9||(J9={}));(function(n){function e(t){return!t||typeof t!="object"?!1:typeof t.id=="string"&&typeof t.title=="string"}n.is=e})(e7||(e7={}));(function(n){n[n.Type=1]="Type",n[n.Parameter=2]="Parameter"})(t7||(t7={}));wC=class{constructor(e){this.createSupport=e,this._tokenizationSupport=null}dispose(){this._tokenizationSupport&&this._tokenizationSupport.then(e=>{e&&e.dispose()})}get tokenizationSupport(){return this._tokenizationSupport||(this._tokenizationSupport=this.createSupport()),this._tokenizationSupport}},Bt=new bC;(function(n){n[n.Invoke=0]="Invoke",n[n.Automatic=1]="Automatic"})(i7||(i7={}))});function n7(n,e){let t=n;typeof t.vscodeWindowId!="number"&&Object.defineProperty(t,"vscodeWindowId",{get:()=>e})}var gt,vo=J(()=>{"use strict";_();v();b();gt=window});function o7(n){return n}var mw,$_,xT=J(()=>{"use strict";_();v();b();mw=class{constructor(e,t){this.lastCache=void 0,this.lastArgKey=void 0,typeof e=="function"?(this._fn=e,this._computeKey=o7):(this._fn=t,this._computeKey=e.getCacheKey)}get(e){let t=this._computeKey(e);return this.lastArgKey!==t&&(this.lastArgKey=t,this.lastCache=this._fn(e)),this.lastCache}},$_=class{get cachedValues(){return this._map}constructor(e,t){this._map=new Map,this._map2=new Map,typeof e=="function"?(this._fn=e,this._computeKey=o7):(this._fn=t,this._computeKey=e.getCacheKey)}get(e){let t=this._computeKey(e);if(this._map2.has(t))return this._map2.get(t);let i=this._fn(e);return this._map.set(e,i),this._map2.set(t,i),i}}});var qn,Md=J(()=>{"use strict";_();v();b();qn=class{constructor(e){this.executor=e,this._didRun=!1}get value(){if(!this._didRun)try{this._value=this.executor()}catch(e){this._error=e}finally{this._didRun=!0}if(this._error)throw this._error;return this._value}get rawValue(){return this._value}}});function r7(n){return!n||typeof n!="string"?!0:n.trim().length===0}function du(n,...e){return e.length===0?n:n.replace(O$,function(t,i){let o=parseInt(i,10);return isNaN(o)||o<0||o>=e.length?t:e[o]})}function a7(n){return n.replace(/[<>"'&]/g,e=>{switch(e){case"<":return"<";case">":return">";case'"':return""";case"'":return"'";case"&":return"&"}return e})}function hu(n){return n.replace(/[<>&]/g,function(e){switch(e){case"<":return"<";case">":return">";case"&":return"&";default:return e}})}function gs(n){return n.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g,"\\$&")}function Koe(n,e=" "){let t=Sc(n,e);return kT(t,e)}function Sc(n,e){if(!n||!e)return n;let t=e.length;if(t===0||n.length===0)return n;let i=0;for(;n.indexOf(e,i)===i;)i=i+t;return n.substring(i)}function kT(n,e){if(!n||!e)return n;let t=e.length,i=n.length;if(t===0||i===0)return n;let o=i,s=-1;for(;s=n.lastIndexOf(e,o-1),!(s===-1||s+t!==o);){if(s===0)return"";o=s}return n.substring(0,o)}function l7(n){return n.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&").replace(/[\*]/g,".*")}function $oe(n){return n.replace(/\*/g,"")}function pw(n,e,t={}){if(!n)throw new Error("Cannot create regex from empty string");e||(n=gs(n)),t.wholeWord&&(/\B/.test(n.charAt(0))||(n="\\b"+n),/\B/.test(n.charAt(n.length-1))||(n=n+"\\b"));let i="";return t.global&&(i+="g"),t.matchCase||(i+="i"),t.multiline&&(i+="m"),t.unicode&&(i+="u"),new RegExp(n,i)}function c7(n){return n.source==="^"||n.source==="^$"||n.source==="$"||n.source==="^\\s*$"?!1:!!(n.exec("")&&n.lastIndex===0)}function Tr(n){return n.split(/\r\n|\r|\n/)}function qoe(n){var e;let t=[],i=n.split(/(\r\n|\r|\n)/);for(let o=0;o=0;t--){let i=n.charCodeAt(t);if(i!==32&&i!==9)return t}return-1}function G_(n,e){return ne?1:0}function _w(n,e,t=0,i=n.length,o=0,s=e.length){for(;tc)return 1}let r=i-t,a=s-o;return ra?1:0}function DT(n,e){return kg(n,e,0,n.length,0,e.length)}function kg(n,e,t=0,i=n.length,o=0,s=e.length){for(;t=128||c>=128)return _w(n.toLowerCase(),e.toLowerCase(),t,i,o,s);au(l)&&(l-=32),au(c)&&(c-=32);let d=l-c;if(d!==0)return d}let r=i-t,a=s-o;return ra?1:0}function Z_(n){return n>=48&&n<=57}function au(n){return n>=97&&n<=122}function ml(n){return n>=65&&n<=90}function xc(n,e){return n.length===e.length&&kg(n,e)===0}function Dg(n,e){let t=e.length;return e.length>n.length?!1:kg(n,e,0,t)===0}function Y_(n,e){let t=Math.min(n.length,e.length),i;for(i=0;i1){let i=n.charCodeAt(e-2);if(pi(i))return bw(i,t)}return t}function Q_(n,e){return new lu(n,e).nextGraphemeLength()}function ET(n,e){return new lu(n,e).prevGraphemeLength()}function d7(n,e){e>0&&Rd(n.charCodeAt(e))&&e--;let t=e+Q_(n,e);return[t-ET(n,t),t]}function B$(){return/(?:[\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])/}function Lc(n){return LT||(LT=B$()),LT.test(n)}function Ig(n){return W$.test(n)}function vw(n){return IT.test(n)}function Ys(n){return n>=11904&&n<=55215||n>=63744&&n<=64255||n>=65281&&n<=65374}function J_(n){return n>=127462&&n<=127487||n===8986||n===8987||n===9200||n===9203||n>=9728&&n<=10175||n===11088||n===11093||n>=127744&&n<=128591||n>=128640&&n<=128764||n>=128992&&n<=129008||n>=129280&&n<=129535||n>=129648&&n<=129782}function Tg(n){return!!(n&&n.length>0&&n.charCodeAt(0)===65279)}function joe(n,e=!1){return n?(e&&(n=n.replace(/\\./g,"")),n.toLowerCase()!==n):!1}function Cw(n){return n=n%(2*26),n<26?String.fromCharCode(97+n):String.fromCharCode(65+n-26)}function s7(n,e){return n===0?e!==5&&e!==7:n===2&&e===3?!1:n===4||n===2||n===3||e===4||e===2||e===3?!0:!(n===8&&(e===8||e===9||e===11||e===12)||(n===11||n===9)&&(e===9||e===10)||(n===12||n===10)&&e===10||e===5||e===13||e===7||n===1||n===13&&e===14||n===6&&e===6)}function z$(){return 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]")}function u7(n,e){if(n===0)return 0;let t=V$(n,e);if(t!==void 0)return t;let i=new q_(e,n);return i.prevCodePoint(),i.offset}function V$(n,e){let t=new q_(e,n),i=t.prevCodePoint();for(;H$(i)||i===65039||i===8419;){if(t.offset===0)return;i=t.prevCodePoint()}if(!J_(i))return;let o=t.offset;return o>0&&t.prevCodePoint()===8205&&(o=t.offset),o}function H$(n){return 127995<=n&&n<=127999}var Lg,O$,q_,lu,LT,W$,IT,h7,j_,Goe,gl,cu,ot=J(()=>{"use strict";_();v();b();xT();Md();O$=/{(\d+)}/g;q_=class{get offset(){return this._offset}constructor(e,t=0){this._str=e,this._len=e.length,this._offset=t}setOffset(e){this._offset=e}prevCodePoint(){let e=F$(this._str,this._offset);return this._offset-=e>=65536?2:1,e}nextCodePoint(){let e=Eg(this._str,this._len,this._offset);return this._offset+=e>=65536?2:1,e}eol(){return this._offset>=this._len}},lu=class{get offset(){return this._iterator.offset}constructor(e,t=0){this._iterator=new q_(e,t)}nextGraphemeLength(){let e=j_.getInstance(),t=this._iterator,i=t.offset,o=e.getGraphemeBreakType(t.nextCodePoint());for(;!t.eol();){let s=t.offset,r=e.getGraphemeBreakType(t.nextCodePoint());if(s7(o,r)){t.setOffset(s);break}o=r}return t.offset-i}prevGraphemeLength(){let e=j_.getInstance(),t=this._iterator,i=t.offset,o=e.getGraphemeBreakType(t.prevCodePoint());for(;t.offset>0;){let s=t.offset,r=e.getGraphemeBreakType(t.prevCodePoint());if(s7(r,o)){t.setOffset(s);break}o=r}return i-t.offset}eol(){return this._iterator.eol()}};W$=/^[\t\n\r\x20-\x7E]*$/;IT=/[\u2028\u2029]/;h7="\uFEFF";j_=class n{static getInstance(){return n._INSTANCE||(n._INSTANCE=new n),n._INSTANCE}constructor(){this._data=z$()}getGraphemeBreakType(e){if(e<32)return e===10?3:e===13?2:4;if(e<127)return 0;let t=this._data,i=t.length/3,o=1;for(;o<=i;)if(et[3*o+1])o=2*o+1;else return t[3*o+2];return 0}};j_._INSTANCE=null;Goe="\xA0",gl=class{static getInstance(e){return Lg.cache.get(Array.from(e))}static getLocales(){return Lg._locales.value}constructor(e){this.confusableDictionary=e}isAmbiguous(e){return this.confusableDictionary.has(e)}getPrimaryConfusable(e){return this.confusableDictionary.get(e)}getConfusableCodePoints(){return new Set(this.confusableDictionary.keys())}};Lg=gl;gl.ambiguousCharacterData=new qn(()=>JSON.parse('{"_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,8218,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,8242,96,1370,96,1523,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,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,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,120786,52,120796,52,120806,52,120816,52,120826,52,130036,52,5070,52,71855,52,120787,53,120797,53,120807,53,120817,53,120827,53,130037,53,444,53,71867,53,120788,54,120798,54,120808,54,120818,54,120828,54,130038,54,11474,54,5102,54,71893,54,119314,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,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,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,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,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,71922,67,71913,67,65315,67,8557,67,8450,67,8493,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,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,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,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,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,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,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,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,120783,73,120793,73,120803,73,120813,73,120823,73,130033,73,65321,73,8544,73,8464,73,8465,73,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,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,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,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,120782,79,120792,79,120802,79,120812,79,120822,79,130032,79,65327,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,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,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,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,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,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,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,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,71919,87,71910,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,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,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,66293,90,71909,90,65338,90,8484,90,8488,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,65284,36,65285,37,65286,38,65290,42,65291,43,65294,46,65295,47,65296,48,65297,49,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,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,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],"cs":[65374,126,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,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],"de":[65374,126,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,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],"es":[8211,45,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,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,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],"fr":[65374,126,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,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],"it":[160,32,8211,45,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,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],"ja":[8211,45,65306,58,65281,33,8216,96,8217,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,65283,35,65292,44,65307,59],"ko":[8211,45,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,215,120,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],"pl":[65374,126,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,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],"pt-BR":[65374,126,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,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],"qps-ploc":[160,32,8211,45,65374,126,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,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],"ru":[65374,126,65306,58,65281,33,8216,96,8217,96,8245,96,180,96,12494,47,305,105,921,73,1009,112,215,120,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],"tr":[160,32,8211,45,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,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,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],"zh-hans":[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,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41],"zh-hant":[8211,45,65374,126,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,65283,35,65307,59]}'));gl.cache=new mw({getCacheKey:JSON.stringify},n=>{function e(c){let d=new Map;for(let h=0;h!c.startsWith("_")&&c in o);s.length===0&&(s=["_default"]);let r;for(let c of s){let d=e(o[c]);r=i(r,d)}let a=e(o._common),l=t(a,r);return new Lg(l)});gl._locales=new qn(()=>Object.keys(Lg.ambiguousCharacterData.value).filter(n=>!n.startsWith("_")));cu=class n{static getRawData(){return JSON.parse("[9,10,11,12,13,32,127,160,173,847,1564,4447,4448,6068,6069,6155,6156,6157,6158,7355,7356,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8203,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,12288,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]")}static getData(){return this._data||(this._data=new Set(n.getRawData())),this._data}static isInvisibleCharacter(e){return n.getData().has(e)}static get codePoints(){return n.getData()}};cu._data=void 0});function TT(n,e,t){typeof e=="string"&&(e=n.matchMedia(e)),e.addEventListener("change",t)}function f7(n){return e0.INSTANCE.getZoomFactor(n)}function g7(){return ww}var e0,Ng,wn,La,Pd,ms,yw,tse,NT,ww,ps=J(()=>{"use strict";_();v();b();vo();e0=class{constructor(){this.mapWindowIdToZoomFactor=new Map}getZoomFactor(e){var t;return(t=this.mapWindowIdToZoomFactor.get(this.getWindowId(e)))!==null&&t!==void 0?t:1}getWindowId(e){return e.vscodeWindowId}};e0.INSTANCE=new e0;Ng=navigator.userAgent,wn=Ng.indexOf("Firefox")>=0,La=Ng.indexOf("AppleWebKit")>=0,Pd=Ng.indexOf("Chrome")>=0,ms=!Pd&&Ng.indexOf("Safari")>=0,yw=!Pd&&!ms&&La,tse=Ng.indexOf("Electron/")>=0,NT=Ng.indexOf("Android")>=0,ww=!1;if(typeof gt.matchMedia=="function"){let n=gt.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),e=gt.matchMedia("(display-mode: fullscreen)");ww=n.matches,TT(gt,n,({matches:t})=>{ww&&e.matches||(ww=t)})}});var Ag,Sw=J(()=>{"use strict";_();v();b();ps();vo();Lt();Ag={clipboard:{writeText:md||document.queryCommandSupported&&document.queryCommandSupported("copy")||!!(navigator&&navigator.clipboard&&navigator.clipboard.writeText),readText:md||!!(navigator&&navigator.clipboard&&navigator.clipboard.readText)},keyboard:md||g7()?0:navigator.keyboard||ms?1:2,touch:"ontouchstart"in gt||navigator.maxTouchPoints>0,pointerEvents:gt.PointerEvent&&("ontouchstart"in gt||navigator.maxTouchPoints>0)}});function i0(n,e){if(typeof n=="number"){if(n===0)return null;let t=(n&65535)>>>0,i=(n&4294901760)>>>16;return i!==0?new t0([xw(t,e),xw(i,e)]):new t0([xw(t,e)])}else{let t=[];for(let i=0;i{"use strict";_();v();b();xt();pl=class n{constructor(e,t,i,o,s){this.ctrlKey=e,this.shiftKey=t,this.altKey=i,this.metaKey=o,this.keyCode=s}equals(e){return e instanceof n&&this.ctrlKey===e.ctrlKey&&this.shiftKey===e.shiftKey&&this.altKey===e.altKey&&this.metaKey===e.metaKey&&this.keyCode===e.keyCode}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},t0=class{constructor(e){if(e.length===0)throw Sd("chords");this.chords=e}},Lw=class{constructor(e,t,i,o,s,r){this.ctrlKey=e,this.shiftKey=t,this.altKey=i,this.metaKey=o,this.keyLabel=s,this.keyAriaLabel=r}},kw=class{}});function U$(n){if(n.charCode){let t=String.fromCharCode(n.charCode).toUpperCase();return Ir.fromString(t)}let e=n.keyCode;if(e===3)return 7;if(wn)switch(e){case 59:return 85;case 60:if(mi)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Be)return 57;break}else if(La){if(Be&&e===93)return 57;if(!Be&&e===92)return 57}return gT[e]||0}var K$,$$,q$,j$,bt,oo=J(()=>{"use strict";_();v();b();ps();z_();Mg();Lt();K$=Be?256:2048,$$=512,q$=1024,j$=Be?2048:256,bt=class{constructor(e){var t;this._standardKeyboardEventBrand=!0;let i=e;this.browserEvent=i,this.target=i.target,this.ctrlKey=i.ctrlKey,this.shiftKey=i.shiftKey,this.altKey=i.altKey,this.metaKey=i.metaKey,this.altGraphKey=(t=i.getModifierState)===null||t===void 0?void 0:t.call(i,"AltGraph"),this.keyCode=U$(i),this.code=i.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=K$),this.altKey&&(t|=$$),this.shiftKey&&(t|=q$),this.metaKey&&(t|=j$),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new pl(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}}});function G$(n){if(!n.parent||n.parent===n)return null;try{let e=n.location,t=n.parent.location;if(e.origin!=="null"&&t.origin!=="null"&&e.origin!==t.origin)return null}catch{return null}return n.parent}var m7,Dw,p7=J(()=>{"use strict";_();v();b();m7=new WeakMap;Dw=class{static getSameOriginWindowChain(e){let t=m7.get(e);if(!t){t=[],m7.set(e,t);let i=e,o;do o=G$(i),o?t.push({window:new WeakRef(i),iframeElement:i.frameElement||null}):t.push({window:new WeakRef(i),iframeElement:null}),i=o;while(i)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){var i,o;if(!t||e===t)return{top:0,left:0};let s=0,r=0,a=this.getSameOriginWindowChain(e);for(let l of a){let c=l.window.deref();if(s+=(i=c?.scrollY)!==null&&i!==void 0?i:0,r+=(o=c?.scrollX)!==null&&o!==void 0?o:0,c===t||!l.iframeElement)break;let d=l.iframeElement.getBoundingClientRect();s+=d.top,r+=d.left}return{top:s,left:r}}}});var yn,Xs,Qs=J(()=>{"use strict";_();v();b();ps();p7();Lt();yn=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type==="dblclick"&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX=="number"?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let i=Dw.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=i.left,this.posy-=i.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},Xs=class{constructor(e,t=0,i=0){var o;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=i,this.deltaX=t;let s=!1;if(Pd){let r=navigator.userAgent.match(/Chrome\/(\d+)/);s=(r?parseInt(r[1]):123)<=122}if(e){let r=e,a=e,l=((o=e.view)===null||o===void 0?void 0:o.devicePixelRatio)||1;if(typeof r.wheelDeltaY<"u")s?this.deltaY=r.wheelDeltaY/(120*l):this.deltaY=r.wheelDeltaY/120;else if(typeof a.VERTICAL_AXIS<"u"&&a.axis===a.VERTICAL_AXIS)this.deltaY=-a.detail/3;else if(e.type==="wheel"){let c=e;c.deltaMode===c.DOM_DELTA_LINE?wn&&!Be?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof r.wheelDeltaX<"u")ms&&Li?this.deltaX=-(r.wheelDeltaX/120):s?this.deltaX=r.wheelDeltaX/(120*l):this.deltaX=r.wheelDeltaX/120;else if(typeof a.HORIZONTAL_AXIS<"u"&&a.axis===a.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let c=e;c.deltaMode===c.DOM_DELTA_LINE?wn&&!Be?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(s?this.deltaY=e.wheelDelta/(120*l):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)===null||e===void 0||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)===null||e===void 0||e.stopPropagation()}}});var Ew,AT=J(()=>{"use strict";_();v();b();Ew=Symbol("MicrotaskDelay")});function Nw(n){return!!n&&typeof n.then=="function"}function PT(n){let e=new un,t=n(e.token),i=new Promise((o,s)=>{let r=e.token.onCancellationRequested(()=>{r.dispose(),s(new Dr)});Promise.resolve(t).then(a=>{r.dispose(),e.dispose(),o(a)},a=>{r.dispose(),e.dispose(),s(a)})});return new class{cancel(){e.cancel(),e.dispose()}then(o,s){return i.then(o,s)}catch(o){return this.then(void 0,o)}finally(o){return i.finally(o)}}}function zse(n,e,t){return new Promise((i,o)=>{let s=e.onCancellationRequested(()=>{s.dispose(),i(t)});n.then(i,o).finally(()=>s.dispose())})}function kc(n,e){return e?new Promise((t,i)=>{let o=setTimeout(()=>{s.dispose(),t()},n),s=e.onCancellationRequested(()=>{clearTimeout(o),s.dispose(),i(new Dr)})}):PT(t=>kc(n,t))}function s0(n,e=0,t){let i=setTimeout(()=>{n(),t&&o.dispose()},e),o=be(()=>{clearTimeout(i),t?.deleteAndLeak(o)});return t?.add(o),o}function Vse(n,e=i=>!!i,t=null){let i=0,o=n.length,s=()=>{if(i>=o)return Promise.resolve(t);let r=n[i++];return Promise.resolve(r()).then(l=>e(l)?Promise.resolve(l):s())};return s()}function Hse(n){let e=new un,t=n(e.token);return new RT(e,async i=>{let o=e.token.onCancellationRequested(()=>{o.dispose(),e.dispose(),i.reject(new Dr)});try{for await(let s of t){if(e.token.isCancellationRequested)return;i.emitOne(s)}o.dispose(),e.dispose()}catch(s){o.dispose(),e.dispose(),i.reject(s)}})}var MT,Z$,Y$,ka,Pg,Xo,Fd,di,OT,Rg,n0,Iw,Og,Tw,o0,RT,Gt=J(()=>{"use strict";_();v();b();fs();xt();ye();le();Lt();AT();MT=class{constructor(){this.isDisposed=!1,this.activePromise=null,this.queuedPromise=null,this.queuedPromiseFactory=null}queue(e){if(this.isDisposed)return Promise.reject(new Error("Throttler is disposed"));if(this.activePromise){if(this.queuedPromiseFactory=e,!this.queuedPromise){let t=()=>{if(this.queuedPromise=null,this.isDisposed)return;let i=this.queue(this.queuedPromiseFactory);return this.queuedPromiseFactory=null,i};this.queuedPromise=new Promise(i=>{this.activePromise.then(t,t).then(i)})}return new Promise((t,i)=>{this.queuedPromise.then(t,i)})}return this.activePromise=e(),new Promise((t,i)=>{this.activePromise.then(o=>{this.activePromise=null,t(o)},o=>{this.activePromise=null,i(o)})})}dispose(){this.isDisposed=!0}},Z$=(n,e)=>{let t=!0,i=setTimeout(()=>{t=!1,e()},n);return{isTriggered:()=>t,dispose:()=>{clearTimeout(i),t=!1}}},Y$=n=>{let e=!0;return queueMicrotask(()=>{e&&(e=!1,n())}),{isTriggered:()=>e,dispose:()=>{e=!1}}},ka=class{constructor(e){this.defaultDelay=e,this.deferred=null,this.completionPromise=null,this.doResolve=null,this.doReject=null,this.task=null}trigger(e,t=this.defaultDelay){this.task=e,this.cancelTimeout(),this.completionPromise||(this.completionPromise=new Promise((o,s)=>{this.doResolve=o,this.doReject=s}).then(()=>{if(this.completionPromise=null,this.doResolve=null,this.task){let o=this.task;return this.task=null,o()}}));let i=()=>{var o;this.deferred=null,(o=this.doResolve)===null||o===void 0||o.call(this,null)};return this.deferred=t===Ew?Y$(i):Z$(t,i),this.completionPromise}isTriggered(){var e;return!!(!((e=this.deferred)===null||e===void 0)&&e.isTriggered())}cancel(){var e;this.cancelTimeout(),this.completionPromise&&((e=this.doReject)===null||e===void 0||e.call(this,new Dr),this.completionPromise=null)}cancelTimeout(){var e;(e=this.deferred)===null||e===void 0||e.dispose(),this.deferred=null}dispose(){this.cancel()}},Pg=class{constructor(e){this.delayer=new ka(e),this.throttler=new MT}trigger(e,t){return this.delayer.trigger(()=>this.throttler.queue(e),t)}cancel(){this.delayer.cancel()}dispose(){this.delayer.dispose(),this.throttler.dispose()}};Xo=class{constructor(e,t){this._token=-1,typeof e=="function"&&typeof t=="number"&&this.setIfNotSet(e,t)}dispose(){this.cancel()}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},Fd=class{constructor(){this.disposable=void 0}cancel(){var e;(e=this.disposable)===null||e===void 0||e.dispose(),this.disposable=void 0}cancelAndSet(e,t,i=globalThis){this.cancel();let o=i.setInterval(()=>{e()},t);this.disposable=be(()=>{i.clearInterval(o),this.disposable=void 0})}dispose(){this.cancel()}},di=class{constructor(e,t){this.timeoutToken=-1,this.runner=e,this.timeout=t,this.timeoutHandler=this.onTimeout.bind(this)}dispose(){this.cancel(),this.runner=null}cancel(){this.isScheduled()&&(clearTimeout(this.timeoutToken),this.timeoutToken=-1)}schedule(e=this.timeout){this.cancel(),this.timeoutToken=setTimeout(this.timeoutHandler,e)}get delay(){return this.timeout}set delay(e){this.timeout=e}isScheduled(){return this.timeoutToken!==-1}onTimeout(){this.timeoutToken=-1,this.runner&&this.doRun()}doRun(){var e;(e=this.runner)===null||e===void 0||e.call(this)}};(function(){typeof globalThis.requestIdleCallback!="function"||typeof globalThis.cancelIdleCallback!="function"?Rg=(n,e)=>{eC(()=>{if(t)return;let i=Date.now()+15;e(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,i-Date.now())}}))});let t=!1;return{dispose(){t||(t=!0)}}}:Rg=(n,e,t)=>{let i=n.requestIdleCallback(e,typeof t=="number"?{timeout:t}:void 0),o=!1;return{dispose(){o||(o=!0,n.cancelIdleCallback(i))}}},OT=n=>Rg(globalThis,n)})();n0=class{constructor(e,t){this._didRun=!1,this._executor=()=>{try{this._value=t()}catch(i){this._error=i}finally{this._didRun=!0}},this._handle=Rg(e,()=>this._executor())}dispose(){this._handle.dispose()}get value(){if(this._didRun||(this._handle.dispose(),this._executor()),this._error)throw this._error;return this._value}get isInitialized(){return this._didRun}},Iw=class extends n0{constructor(e){super(globalThis,e)}},Og=class{get isRejected(){var e;return((e=this.outcome)===null||e===void 0?void 0:e.outcome)===1}get isSettled(){return!!this.outcome}constructor(){this.p=new Promise((e,t)=>{this.completeCallback=e,this.errorCallback=t})}complete(e){return new Promise(t=>{this.completeCallback(e),this.outcome={outcome:0,value:e},t()})}error(e){return new Promise(t=>{this.errorCallback(e),this.outcome={outcome:1,value:e},t()})}cancel(){return this.error(new Dr)}};(function(n){async function e(i){let o,s=await Promise.all(i.map(r=>r.then(a=>a,a=>{o||(o=a)})));if(typeof o<"u")throw o;return s}n.settled=e;function t(i){return new Promise(async(o,s)=>{try{await i(o,s)}catch(r){s(r)}})}n.withAsyncBody=t})(Tw||(Tw={}));o0=class n{static fromArray(e){return new n(t=>{t.emitMany(e)})}static fromPromise(e){return new n(async t=>{t.emitMany(await e)})}static fromPromises(e){return new n(async t=>{await Promise.all(e.map(async i=>t.emitOne(await i)))})}static merge(e){return new n(async t=>{await Promise.all(e.map(async i=>{for await(let o of i)t.emitOne(o)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new B,queueMicrotask(async()=>{let i={emitOne:o=>this.emitOne(o),emitMany:o=>this.emitMany(o),reject:o=>this.reject(o)};try{await Promise.resolve(e(i)),this.resolve()}catch(o){this.reject(o)}finally{i.emitOne=void 0,i.emitMany=void 0,i.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e{var t;return(t=this._onReturn)===null||t===void 0||t.call(this),{done:!0,value:void 0}}}}static map(e,t){return new n(async i=>{for await(let o of e)i.emitOne(t(o))})}map(e){return n.map(this,e)}static filter(e,t){return new n(async i=>{for await(let o of e)t(o)&&i.emitOne(o)})}filter(e){return n.filter(this,e)}static coalesce(e){return n.filter(e,t=>!!t)}coalesce(){return n.coalesce(this)}static async toPromise(e){let t=[];for await(let i of e)t.push(i);return t}toPromise(){return n.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};o0.EMPTY=o0.fromArray([]);RT=class extends o0{constructor(e,t){super(t),this._source=e}cancel(){this._source.cancel()}}});function Nr(n){return function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),o=1;o0&&arguments[0]!==void 0?arguments[0]:mq(),e=dt=>D7(dt);if(e.version="3.0.5",e.removed=[],!n||!n.document||n.document.nodeType!==9)return e.isSupported=!1,e;let t=n.document,i=t.currentScript,{document:o}=n,{DocumentFragment:s,HTMLTemplateElement:r,Node:a,Element:l,NodeFilter:c,NamedNodeMap:d=n.NamedNodeMap||n.MozNamedAttrMap,HTMLFormElement:h,DOMParser:u,trustedTypes:f}=n,g=l.prototype,m=Aw(g,"cloneNode"),C=Aw(g,"nextSibling"),S=Aw(g,"childNodes"),w=Aw(g,"parentNode");if(typeof r=="function"){let dt=o.createElement("template");dt.content&&dt.content.ownerDocument&&(o=dt.content.ownerDocument)}let y,x="",{implementation:k,createNodeIterator:T,createDocumentFragment:N,getElementsByTagName:M}=o,{importNode:W}=t,j={};e.isSupported=typeof x7=="function"&&typeof w=="function"&&k&&k.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:G,ERB_EXPR:V,TMPLIT_EXPR:z,DATA_ATTR:te,ARIA_ATTR:ee,IS_SCRIPT_OR_DATA:ce,ATTR_WHITESPACE:Ce}=S7,{IS_ALLOWED_URI:Se}=S7,pe=null,Pe=Ft({},[...v7,...BT,...WT,...zT,...C7]),Qe=null,Te=Ft({},[...w7,...VT,...y7,...Mw]),de=Object.seal(Object.create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ki=null,Vn=null,Gi=!0,Ns=!0,Ot=!1,Cn=!0,Ni=!1,tt=!1,vr=!1,Cr=!1,cs=!1,wr=!1,pc=!1,Hn=!0,ua=!1,uI="user-content-",ne=!0,X=!1,Y={},R=null,O=Ft({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),q=null,K=Ft({},["audio","video","img","source","image","track"]),re=null,fe=Ft({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ie="http://www.w3.org/1998/Math/MathML",Me="http://www.w3.org/2000/svg",st="http://www.w3.org/1999/xhtml",it=st,qt=!1,Wt=null,Ue=Ft({},[Ie,Me,st],FT),ki,Di=["application/xhtml+xml","text/html"],yr="text/html",Nt,Zi=null,Zh=o.createElement("form"),Yh=function(Q){return Q instanceof RegExp||Q instanceof Function},fa=function(Q){if(!(Zi&&Zi===Q)){if((!Q||typeof Q!="object")&&(Q={}),Q=Fg(Q),ki=Di.indexOf(Q.PARSER_MEDIA_TYPE)===-1?ki=yr:ki=Q.PARSER_MEDIA_TYPE,Nt=ki==="application/xhtml+xml"?FT:Rw,pe="ALLOWED_TAGS"in Q?Ft({},Q.ALLOWED_TAGS,Nt):Pe,Qe="ALLOWED_ATTR"in Q?Ft({},Q.ALLOWED_ATTR,Nt):Te,Wt="ALLOWED_NAMESPACES"in Q?Ft({},Q.ALLOWED_NAMESPACES,FT):Ue,re="ADD_URI_SAFE_ATTR"in Q?Ft(Fg(fe),Q.ADD_URI_SAFE_ATTR,Nt):fe,q="ADD_DATA_URI_TAGS"in Q?Ft(Fg(K),Q.ADD_DATA_URI_TAGS,Nt):K,R="FORBID_CONTENTS"in Q?Ft({},Q.FORBID_CONTENTS,Nt):O,Ki="FORBID_TAGS"in Q?Ft({},Q.FORBID_TAGS,Nt):{},Vn="FORBID_ATTR"in Q?Ft({},Q.FORBID_ATTR,Nt):{},Y="USE_PROFILES"in Q?Q.USE_PROFILES:!1,Gi=Q.ALLOW_ARIA_ATTR!==!1,Ns=Q.ALLOW_DATA_ATTR!==!1,Ot=Q.ALLOW_UNKNOWN_PROTOCOLS||!1,Cn=Q.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Ni=Q.SAFE_FOR_TEMPLATES||!1,tt=Q.WHOLE_DOCUMENT||!1,cs=Q.RETURN_DOM||!1,wr=Q.RETURN_DOM_FRAGMENT||!1,pc=Q.RETURN_TRUSTED_TYPE||!1,Cr=Q.FORCE_BODY||!1,Hn=Q.SANITIZE_DOM!==!1,ua=Q.SANITIZE_NAMED_PROPS||!1,ne=Q.KEEP_CONTENT!==!1,X=Q.IN_PLACE||!1,Se=Q.ALLOWED_URI_REGEXP||L7,it=Q.NAMESPACE||st,de=Q.CUSTOM_ELEMENT_HANDLING||{},Q.CUSTOM_ELEMENT_HANDLING&&Yh(Q.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(de.tagNameCheck=Q.CUSTOM_ELEMENT_HANDLING.tagNameCheck),Q.CUSTOM_ELEMENT_HANDLING&&Yh(Q.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(de.attributeNameCheck=Q.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),Q.CUSTOM_ELEMENT_HANDLING&&typeof Q.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(de.allowCustomizedBuiltInElements=Q.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Ni&&(Ns=!1),wr&&(cs=!0),Y&&(pe=Ft({},[...C7]),Qe=[],Y.html===!0&&(Ft(pe,v7),Ft(Qe,w7)),Y.svg===!0&&(Ft(pe,BT),Ft(Qe,VT),Ft(Qe,Mw)),Y.svgFilters===!0&&(Ft(pe,WT),Ft(Qe,VT),Ft(Qe,Mw)),Y.mathMl===!0&&(Ft(pe,zT),Ft(Qe,y7),Ft(Qe,Mw))),Q.ADD_TAGS&&(pe===Pe&&(pe=Fg(pe)),Ft(pe,Q.ADD_TAGS,Nt)),Q.ADD_ATTR&&(Qe===Te&&(Qe=Fg(Qe)),Ft(Qe,Q.ADD_ATTR,Nt)),Q.ADD_URI_SAFE_ATTR&&Ft(re,Q.ADD_URI_SAFE_ATTR,Nt),Q.FORBID_CONTENTS&&(R===O&&(R=Fg(R)),Ft(R,Q.FORBID_CONTENTS,Nt)),ne&&(pe["#text"]=!0),tt&&Ft(pe,["html","head","body"]),pe.table&&(Ft(pe,["tbody"]),delete Ki.tbody),Q.TRUSTED_TYPES_POLICY){if(typeof Q.TRUSTED_TYPES_POLICY.createHTML!="function")throw a0('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof Q.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw a0('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');y=Q.TRUSTED_TYPES_POLICY,x=y.createHTML("")}else y===void 0&&(y=pq(f,i)),y!==null&&typeof x=="string"&&(x=y.createHTML(""));_s&&_s(Q),Zi=Q}},ud=Ft({},["mi","mo","mn","ms","mtext"]),Xh=Ft({},["foreignobject","desc","title","annotation-xml"]),Qh=Ft({},["title","style","font","a","script"]),rg=Ft({},BT);Ft(rg,WT),Ft(rg,rq);let Jh=Ft({},zT);Ft(Jh,aq);let fI=function(Q){let Le=w(Q);(!Le||!Le.tagName)&&(Le={namespaceURI:it,tagName:"template"});let Fe=Rw(Q.tagName),Ei=Rw(Le.tagName);return Wt[Q.namespaceURI]?Q.namespaceURI===Me?Le.namespaceURI===st?Fe==="svg":Le.namespaceURI===Ie?Fe==="svg"&&(Ei==="annotation-xml"||ud[Ei]):!!rg[Fe]:Q.namespaceURI===Ie?Le.namespaceURI===st?Fe==="math":Le.namespaceURI===Me?Fe==="math"&&Xh[Ei]:!!Jh[Fe]:Q.namespaceURI===st?Le.namespaceURI===Me&&!Xh[Ei]||Le.namespaceURI===Ie&&!ud[Ei]?!1:!Jh[Fe]&&(Qh[Fe]||!rg[Fe]):!!(ki==="application/xhtml+xml"&&Wt[Q.namespaceURI]):!1},al=function(Q){r0(e.removed,{element:Q});try{Q.parentNode.removeChild(Q)}catch{Q.remove()}},w_=function(Q,Le){try{r0(e.removed,{attribute:Le.getAttributeNode(Q),from:Le})}catch{r0(e.removed,{attribute:null,from:Le})}if(Le.removeAttribute(Q),Q==="is"&&!Qe[Q])if(cs||wr)try{al(Le)}catch{}else try{Le.setAttribute(Q,"")}catch{}},y_=function(Q){let Le,Fe;if(Cr)Q=""+Q;else{let Sr=iq(Q,/^[\r\n\t ]+/);Fe=Sr&&Sr[0]}ki==="application/xhtml+xml"&&it===st&&(Q=''+Q+"");let Ei=y?y.createHTML(Q):Q;if(it===st)try{Le=new u().parseFromString(Ei,ki)}catch{}if(!Le||!Le.documentElement){Le=k.createDocument(it,"template",null);try{Le.documentElement.innerHTML=qt?x:Ei}catch{}}let go=Le.body||Le.documentElement;return Q&&Fe&&go.insertBefore(o.createTextNode(Fe),go.childNodes[0]||null),it===st?M.call(Le,tt?"html":"body")[0]:tt?Le.documentElement:go},H1=function(Q){return T.call(Q.ownerDocument||Q,Q,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT,null,!1)},MK=function(Q){return Q instanceof h&&(typeof Q.nodeName!="string"||typeof Q.textContent!="string"||typeof Q.removeChild!="function"||!(Q.attributes instanceof d)||typeof Q.removeAttribute!="function"||typeof Q.setAttribute!="function"||typeof Q.namespaceURI!="string"||typeof Q.insertBefore!="function"||typeof Q.hasChildNodes!="function")},U1=function(Q){return typeof a=="object"?Q instanceof a:Q&&typeof Q=="object"&&typeof Q.nodeType=="number"&&typeof Q.nodeName=="string"},_c=function(Q,Le,Fe){j[Q]&&tq(j[Q],Ei=>{Ei.call(e,Le,Fe,Zi)})},zF=function(Q){let Le;if(_c("beforeSanitizeElements",Q,null),MK(Q))return al(Q),!0;let Fe=Nt(Q.nodeName);if(_c("uponSanitizeElement",Q,{tagName:Fe,allowedTags:pe}),Q.hasChildNodes()&&!U1(Q.firstElementChild)&&(!U1(Q.content)||!U1(Q.content.firstElementChild))&&Js(/<[/\w]/g,Q.innerHTML)&&Js(/<[/\w]/g,Q.textContent))return al(Q),!0;if(!pe[Fe]||Ki[Fe]){if(!Ki[Fe]&&HF(Fe)&&(de.tagNameCheck instanceof RegExp&&Js(de.tagNameCheck,Fe)||de.tagNameCheck instanceof Function&&de.tagNameCheck(Fe)))return!1;if(ne&&!R[Fe]){let Ei=w(Q)||Q.parentNode,go=S(Q)||Q.childNodes;if(go&&Ei){let Sr=go.length;for(let en=Sr-1;en>=0;--en)Ei.insertBefore(m(go[en],!0),C(Q))}}return al(Q),!0}return Q instanceof l&&!fI(Q)||(Fe==="noscript"||Fe==="noembed"||Fe==="noframes")&&Js(/<\/no(script|embed|frames)/i,Q.innerHTML)?(al(Q),!0):(Ni&&Q.nodeType===3&&(Le=Q.textContent,Le=Da(Le,G," "),Le=Da(Le,V," "),Le=Da(Le,z," "),Q.textContent!==Le&&(r0(e.removed,{element:Q.cloneNode()}),Q.textContent=Le)),_c("afterSanitizeElements",Q,null),!1)},VF=function(Q,Le,Fe){if(Hn&&(Le==="id"||Le==="name")&&(Fe in o||Fe in Zh))return!1;if(!(Ns&&!Vn[Le]&&Js(te,Le))){if(!(Gi&&Js(ee,Le))){if(!Qe[Le]||Vn[Le]){if(!(HF(Q)&&(de.tagNameCheck instanceof RegExp&&Js(de.tagNameCheck,Q)||de.tagNameCheck instanceof Function&&de.tagNameCheck(Q))&&(de.attributeNameCheck instanceof RegExp&&Js(de.attributeNameCheck,Le)||de.attributeNameCheck instanceof Function&&de.attributeNameCheck(Le))||Le==="is"&&de.allowCustomizedBuiltInElements&&(de.tagNameCheck instanceof RegExp&&Js(de.tagNameCheck,Fe)||de.tagNameCheck instanceof Function&&de.tagNameCheck(Fe))))return!1}else if(!re[Le]){if(!Js(Se,Da(Fe,Ce,""))){if(!((Le==="src"||Le==="xlink:href"||Le==="href")&&Q!=="script"&&nq(Fe,"data:")===0&&q[Q])){if(!(Ot&&!Js(ce,Da(Fe,Ce,"")))){if(Fe)return!1}}}}}}return!0},HF=function(Q){return Q.indexOf("-")>0},UF=function(Q){let Le,Fe,Ei,go;_c("beforeSanitizeAttributes",Q,null);let{attributes:Sr}=Q;if(!Sr)return;let en={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Qe};for(go=Sr.length;go--;){Le=Sr[go];let{name:ll,namespaceURI:gI}=Le;if(Fe=ll==="value"?Le.value:oq(Le.value),Ei=Nt(ll),en.attrName=Ei,en.attrValue=Fe,en.keepAttr=!0,en.forceKeepAttr=void 0,_c("uponSanitizeAttribute",Q,en),Fe=en.attrValue,en.forceKeepAttr||(w_(ll,Q),!en.keepAttr))continue;if(!Cn&&Js(/\/>/i,Fe)){w_(ll,Q);continue}Ni&&(Fe=Da(Fe,G," "),Fe=Da(Fe,V," "),Fe=Da(Fe,z," "));let KF=Nt(Q.nodeName);if(VF(KF,Ei,Fe)){if(ua&&(Ei==="id"||Ei==="name")&&(w_(ll,Q),Fe=uI+Fe),y&&typeof f=="object"&&typeof f.getAttributeType=="function"&&!gI)switch(f.getAttributeType(KF,Ei)){case"TrustedHTML":{Fe=y.createHTML(Fe);break}case"TrustedScriptURL":{Fe=y.createScriptURL(Fe);break}}try{gI?Q.setAttributeNS(gI,ll,Fe):Q.setAttribute(ll,Fe),b7(e.removed)}catch{}}}_c("afterSanitizeAttributes",Q,null)},RK=function dt(Q){let Le,Fe=H1(Q);for(_c("beforeSanitizeShadowDOM",Q,null);Le=Fe.nextNode();)_c("uponSanitizeShadowNode",Le,null),!zF(Le)&&(Le.content instanceof s&&dt(Le.content),UF(Le));_c("afterSanitizeShadowDOM",Q,null)};return e.sanitize=function(dt){let Q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Le,Fe,Ei,go;if(qt=!dt,qt&&(dt=""),typeof dt!="string"&&!U1(dt))if(typeof dt.toString=="function"){if(dt=dt.toString(),typeof dt!="string")throw a0("dirty is not a string, aborting")}else throw a0("toString is not a function");if(!e.isSupported)return dt;if(vr||fa(Q),e.removed=[],typeof dt=="string"&&(X=!1),X){if(dt.nodeName){let ll=Nt(dt.nodeName);if(!pe[ll]||Ki[ll])throw a0("root node is forbidden and cannot be sanitized in-place")}}else if(dt instanceof a)Le=y_(""),Fe=Le.ownerDocument.importNode(dt,!0),Fe.nodeType===1&&Fe.nodeName==="BODY"||Fe.nodeName==="HTML"?Le=Fe:Le.appendChild(Fe);else{if(!cs&&!Ni&&!tt&&dt.indexOf("<")===-1)return y&&pc?y.createHTML(dt):dt;if(Le=y_(dt),!Le)return cs?null:pc?x:""}Le&&Cr&&al(Le.firstChild);let Sr=H1(X?dt:Le);for(;Ei=Sr.nextNode();)zF(Ei)||(Ei.content instanceof s&&RK(Ei.content),UF(Ei));if(X)return dt;if(cs){if(wr)for(go=N.call(Le.ownerDocument);Le.firstChild;)go.appendChild(Le.firstChild);else go=Le;return(Qe.shadowroot||Qe.shadowrootmode)&&(go=W.call(t,go,!0)),go}let en=tt?Le.outerHTML:Le.innerHTML;return tt&&pe["!doctype"]&&Le.ownerDocument&&Le.ownerDocument.doctype&&Le.ownerDocument.doctype.name&&Js(k7,Le.ownerDocument.doctype.name)&&(en=" +`+en),Ni&&(en=Da(en,G," "),en=Da(en,V," "),en=Da(en,z," ")),y&&pc?y.createHTML(en):en},e.setConfig=function(dt){fa(dt),vr=!0},e.clearConfig=function(){Zi=null,vr=!1},e.isValidAttribute=function(dt,Q,Le){Zi||fa({});let Fe=Nt(dt),Ei=Nt(Q);return VF(Fe,Ei,Le)},e.addHook=function(dt,Q){typeof Q=="function"&&(j[dt]=j[dt]||[],r0(j[dt],Q))},e.removeHook=function(dt){if(j[dt])return b7(j[dt])},e.removeHooks=function(dt){j[dt]&&(j[dt]=[])},e.removeAllHooks=function(){j={}},e}var x7,_7,X$,Q$,J$,_s,Ea,eq,HT,UT,tq,b7,r0,Rw,FT,iq,Da,nq,oq,Js,a0,v7,BT,WT,rq,zT,aq,C7,w7,VT,y7,Mw,lq,cq,dq,hq,uq,L7,fq,gq,k7,S7,mq,pq,_l,Gse,Zse,Pw,Yse,Xse,Qse,l0,Ow,Jse,ere,Fw=J(()=>{"use strict";_();v();b();({entries:x7,setPrototypeOf:_7,isFrozen:X$,getPrototypeOf:Q$,getOwnPropertyDescriptor:J$}=Object),{freeze:_s,seal:Ea,create:eq}=Object,{apply:HT,construct:UT}=typeof Reflect<"u"&&Reflect;HT||(HT=function(e,t,i){return e.apply(t,i)});_s||(_s=function(e){return e});Ea||(Ea=function(e){return e});UT||(UT=function(e,t){return new e(...t)});tq=Nr(Array.prototype.forEach),b7=Nr(Array.prototype.pop),r0=Nr(Array.prototype.push),Rw=Nr(String.prototype.toLowerCase),FT=Nr(String.prototype.toString),iq=Nr(String.prototype.match),Da=Nr(String.prototype.replace),nq=Nr(String.prototype.indexOf),oq=Nr(String.prototype.trim),Js=Nr(RegExp.prototype.test),a0=sq(TypeError);v7=_s(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),BT=_s(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),WT=_s(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),rq=_s(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),zT=_s(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),aq=_s(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),C7=_s(["#text"]),w7=_s(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","xmlns","slot"]),VT=_s(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),y7=_s(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Mw=_s(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),lq=Ea(/\{\{[\w\W]*|[\w\W]*\}\}/gm),cq=Ea(/<%[\w\W]*|[\w\W]*%>/gm),dq=Ea(/\${[\w\W]*}/gm),hq=Ea(/^data-[\-\w.\u00B7-\uFFFF]/),uq=Ea(/^aria-[\-\w]+$/),L7=Ea(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),fq=Ea(/^(?:\w+script|data):/i),gq=Ea(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),k7=Ea(/^html$/i),S7=Object.freeze({__proto__:null,MUSTACHE_EXPR:lq,ERB_EXPR:cq,TMPLIT_EXPR:dq,DATA_ATTR:hq,ARIA_ATTR:uq,IS_ALLOWED_URI:L7,IS_SCRIPT_OR_DATA:fq,ATTR_WHITESPACE:gq,DOCTYPE_NAME:k7}),mq=()=>typeof window>"u"?null:window,pq=function(e,t){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let i=null,o="data-tt-policy-suffix";t&&t.hasAttribute(o)&&(i=t.getAttribute(o));let s="dompurify"+(i?"#"+i:"");try{return e.createPolicy(s,{createHTML(r){return r},createScriptURL(r){return r}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}};_l=D7(),Gse=_l.version,Zse=_l.isSupported,Pw=_l.sanitize,Yse=_l.setConfig,Xse=_l.clearConfig,Qse=_l.isValidAttribute,l0=_l.addHook,Ow=_l.removeHook,Jse=_l.removeHooks,ere=_l.removeAllHooks});function c0(n,e){return Oe.isUri(n)?xc(n.scheme,e):Dg(n,e+":")}function $T(n,...e){return e.some(t=>c0(n,t))}var Ze,_q,KT,qT,bq,Bw,Ww,I7,er=J(()=>{"use strict";_();v();b();xt();Lt();ot();sn();wc();(function(n){n.inMemory="inmemory",n.vscode="vscode",n.internal="private",n.walkThrough="walkThrough",n.walkThroughSnippet="walkThroughSnippet",n.http="http",n.https="https",n.file="file",n.mailto="mailto",n.untitled="untitled",n.data="data",n.command="command",n.vscodeRemote="vscode-remote",n.vscodeRemoteResource="vscode-remote-resource",n.vscodeManagedRemoteResource="vscode-managed-remote-resource",n.vscodeUserData="vscode-userdata",n.vscodeCustomEditor="vscode-custom-editor",n.vscodeNotebookCell="vscode-notebook-cell",n.vscodeNotebookCellMetadata="vscode-notebook-cell-metadata",n.vscodeNotebookCellOutput="vscode-notebook-cell-output",n.vscodeInteractiveInput="vscode-interactive-input",n.vscodeSettings="vscode-settings",n.vscodeWorkspaceTrust="vscode-workspace-trust",n.vscodeTerminal="vscode-terminal",n.vscodeChatCodeBlock="vscode-chat-code-block",n.vscodeChatCodeCompreBlock="vscode-chat-code-compare-block",n.vscodeChatSesssion="vscode-chat-editor",n.webviewPanel="webview-panel",n.vscodeWebview="vscode-webview",n.extension="extension",n.vscodeFileResource="vscode-file",n.tmp="tmp",n.vsls="vsls",n.vscodeSourceControl="vscode-scm",n.commentsInput="comment",n.codeSetting="code-setting"})(Ze||(Ze={}));_q="tkn",KT=class{constructor(){this._hosts=Object.create(null),this._ports=Object.create(null),this._connectionTokens=Object.create(null),this._preferredWebSchema="http",this._delegate=null,this._serverRootPath="/"}setPreferredWebSchema(e){this._preferredWebSchema=e}get _remoteResourcesPath(){return ci.join(this._serverRootPath,Ze.vscodeRemoteResource)}rewrite(e){if(this._delegate)try{return this._delegate(e)}catch(a){return ut(a),e}let t=e.authority,i=this._hosts[t];i&&i.indexOf(":")!==-1&&i.indexOf("[")===-1&&(i=`[${i}]`);let o=this._ports[t],s=this._connectionTokens[t],r=`path=${encodeURIComponent(e.path)}`;return typeof s=="string"&&(r+=`&${_q}=${encodeURIComponent(s)}`),Oe.from({scheme:hl?this._preferredWebSchema:Ze.vscodeRemoteResource,authority:`${i}:${o}`,path:this._remoteResourcesPath,query:r})}},qT=new KT,bq="vscode-app",Bw=class n{uriToBrowserUri(e){return e.scheme===Ze.vscodeRemote?qT.rewrite(e):e.scheme===Ze.file&&(md||m9===`${Ze.vscodeFileResource}://${n.FALLBACK_AUTHORITY}`)?e.with({scheme:Ze.vscodeFileResource,authority:e.authority||n.FALLBACK_AUTHORITY,query:null,fragment:null}):e}};Bw.FALLBACK_AUTHORITY=bq;Ww=new Bw;(function(n){let e=new Map([["1",{"Cross-Origin-Opener-Policy":"same-origin"}],["2",{"Cross-Origin-Embedder-Policy":"require-corp"}],["3",{"Cross-Origin-Opener-Policy":"same-origin","Cross-Origin-Embedder-Policy":"require-corp"}]]);n.CoopAndCoep=Object.freeze(e.get("3"));let t="vscode-coi";function i(s){let r;typeof s=="string"?r=new URL(s).searchParams:s instanceof URL?r=s.searchParams:Oe.isUri(s)&&(r=new URL(s.toString(!0)).searchParams);let a=r?.get(t);if(a)return e.get(a)}n.getHeadersFromQuery=i;function o(s,r,a){if(!globalThis.crossOriginIsolated)return;let l=r&&a?"3":a?"2":"1";s instanceof URLSearchParams?s.set(t,l):s[t]=l}n.addSearchParam=o})(I7||(I7={}))});function zw(n){return u0(n,0)}function u0(n,e){switch(typeof n){case"object":return n===null?Dc(349,e):Array.isArray(n)?Cq(n,e):wq(n,e);case"string":return Vw(n,e);case"boolean":return vq(n,e);case"number":return Dc(n,e);case"undefined":return Dc(937,e);default:return Dc(617,e)}}function Dc(n,e){return(e<<5)-e+n|0}function vq(n,e){return Dc(n?433:863,e)}function Vw(n,e){e=Dc(149417,e);for(let t=0,i=n.length;tu0(i,t),e)}function wq(n,e){return e=Dc(181387,e),Object.keys(n).sort().reduce((t,i)=>(t=Vw(i,t),u0(n[i],t)),e)}function jT(n,e,t=32){let i=t-e,o=~((1<>>i)>>>0}function T7(n,e=0,t=n.byteLength,i=0){for(let o=0;ot.toString(16).padStart(2,"0")).join(""):yq((n>>>0).toString(16),e/4)}var h0,Bg=J(()=>{"use strict";_();v();b();ot();h0=class n{constructor(){this._h0=1732584193,this._h1=4023233417,this._h2=2562383102,this._h3=271733878,this._h4=3285377520,this._buff=new Uint8Array(67),this._buffDV=new DataView(this._buff.buffer),this._buffLen=0,this._totalLen=0,this._leftoverHighSurrogate=0,this._finished=!1}update(e){let t=e.length;if(t===0)return;let i=this._buff,o=this._buffLen,s=this._leftoverHighSurrogate,r,a;for(s!==0?(r=s,a=-1,s=0):(r=e.charCodeAt(0),a=0);;){let l=r;if(pi(r))if(a+1>>6,e[t++]=128|(i&63)>>>0):i<65536?(e[t++]=224|(i&61440)>>>12,e[t++]=128|(i&4032)>>>6,e[t++]=128|(i&63)>>>0):(e[t++]=240|(i&1835008)>>>18,e[t++]=128|(i&258048)>>>12,e[t++]=128|(i&4032)>>>6,e[t++]=128|(i&63)>>>0),t>=64&&(this._step(),t-=64,this._totalLen+=64,e[0]=e[64],e[1]=e[65],e[2]=e[66]),t}digest(){return this._finished||(this._finished=!0,this._leftoverHighSurrogate&&(this._leftoverHighSurrogate=0,this._buffLen=this._push(this._buff,this._buffLen,65533)),this._totalLen+=this._buffLen,this._wrapUp()),d0(this._h0)+d0(this._h1)+d0(this._h2)+d0(this._h3)+d0(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,T7(this._buff,this._buffLen),this._buffLen>56&&(this._step(),T7(this._buff));let e=8*this._totalLen;this._buffDV.setUint32(56,Math.floor(e/4294967296),!1),this._buffDV.setUint32(60,e%4294967296,!1),this._step()}_step(){let e=n._bigBlock32,t=this._buffDV;for(let h=0;h<64;h+=4)e.setUint32(h,t.getUint32(h,!1),!1);for(let h=64;h<320;h+=4)e.setUint32(h,jT(e.getUint32(h-12,!1)^e.getUint32(h-32,!1)^e.getUint32(h-56,!1)^e.getUint32(h-64,!1),1),!1);let i=this._h0,o=this._h1,s=this._h2,r=this._h3,a=this._h4,l,c,d;for(let h=0;h<80;h++)h<20?(l=o&s|~o&r,c=1518500249):h<40?(l=o^s^r,c=1859775393):h<60?(l=o&s|o&r|s&r,c=2400959708):(l=o^s^r,c=3395469782),d=jT(i,5)+l+a+c+e.getUint32(h*4,!1)&4294967295,a=r,r=s,s=jT(o,30),o=i,i=d;this._h0=this._h0+i&4294967295,this._h1=this._h1+o&4294967295,this._h2=this._h2+s&4294967295,this._h3=this._h3+r&4294967295,this._h4=this._h4+a&4294967295}};h0._bigBlock32=new DataView(new ArrayBuffer(320))});function Co(n){for(;n.firstChild;)n.firstChild.remove()}function $(n,e,t,i){return new ZT(n,e,t,i)}function O7(n,e){return function(t){return e(new yn(n,t))}}function xq(n){return function(e){return n(new bt(e))}}function Lq(n,e,t){return $(n,Rs&&Ag.pointerEvents?se.POINTER_DOWN:se.MOUSE_DOWN,e,t)}function m0(n,e,t){return Rg(n,e,t)}function eN(n){return ge(n).getComputedStyle(n,null)}function zg(n,e){let t=ge(n),i=t.document;if(n!==i.body)return new Ar(n.clientWidth,n.clientHeight);if(Rs&&t?.visualViewport)return new Ar(t.visualViewport.width,t.visualViewport.height);if(t?.innerWidth&&t.innerHeight)return new Ar(t.innerWidth,t.innerHeight);if(i.body&&i.body.clientWidth&&i.body.clientHeight)return new Ar(i.body.clientWidth,i.body.clientHeight);if(i.documentElement&&i.documentElement.clientWidth&&i.documentElement.clientHeight)return new Ar(i.documentElement.clientWidth,i.documentElement.clientHeight);if(e)return zg(e);throw new Error("Unable to figure out browser width and height")}function F7(n){let e=n.offsetParent,t=n.offsetTop,i=n.offsetLeft;for(;(n=n.parentNode)!==null&&n!==n.ownerDocument.body&&n!==n.ownerDocument.documentElement;){t-=n.scrollTop;let o=W7(n)?null:eN(n);o&&(i-=o.direction!=="rtl"?n.scrollLeft:-n.scrollLeft),n===e&&(i+=Qo.getBorderLeftWidth(n),t+=Qo.getBorderTopWidth(n),t+=n.offsetTop,i+=n.offsetLeft,e=n.offsetParent)}return{left:i,top:t}}function Dre(n,e,t){typeof e=="number"&&(n.style.width=`${e}px`),typeof t=="number"&&(n.style.height=`${t}px`)}function Sn(n){let e=n.getBoundingClientRect(),t=ge(n);return{left:e.left+t.scrollX,top:e.top+t.scrollY,width:e.width,height:e.height}}function Uw(n){let e=n,t=1;do{let i=eN(e).zoom;i!=null&&i!=="1"&&(t*=i),e=e.parentElement}while(e!==null&&e!==e.ownerDocument.documentElement);return t}function Vg(n){let e=Qo.getMarginLeft(n)+Qo.getMarginRight(n);return n.offsetWidth+e}function Kw(n){let e=Qo.getBorderLeftWidth(n)+Qo.getBorderRightWidth(n),t=Qo.getPaddingLeft(n)+Qo.getPaddingRight(n);return n.offsetWidth-e-t}function B7(n){let e=Qo.getBorderTopWidth(n)+Qo.getBorderBottomWidth(n),t=Qo.getPaddingTop(n)+Qo.getPaddingBottom(n);return n.offsetHeight-e-t}function p0(n){let e=Qo.getMarginTop(n)+Qo.getMarginBottom(n);return n.offsetHeight+e}function yi(n,e){return!!e?.contains(n)}function kq(n,e,t){for(;n&&n.nodeType===n.ELEMENT_NODE;){if(n.classList.contains(e))return n;if(t){if(typeof t=="string"){if(n.classList.contains(t))return null}else if(n===t)return null}n=n.parentNode}return null}function $w(n,e,t){return!!kq(n,e,t)}function W7(n){return n&&!!n.host&&!!n.mode}function gu(n){return!!Ec(n)}function Ec(n){for(var e;n.parentNode;){if(n===((e=n.ownerDocument)===null||e===void 0?void 0:e.body))return null;n=n.parentNode}return W7(n)?n:null}function Bi(){let n=jw().activeElement;for(;n?.shadowRoot;)n=n.shadowRoot.activeElement;return n}function _0(n){return Bi()===n}function qw(n){return yi(Bi(),n)}function jw(){var n;return Sq()<=1?gt.document:(n=Array.from(M7()).map(({window:t})=>t.document).find(t=>t.hasFocus()))!==null&&n!==void 0?n:gt.document}function z7(){var n,e;return(e=(n=jw().defaultView)===null||n===void 0?void 0:n.window)!==null&&e!==void 0?e:gt}function Ere(){return new YT}function Xi(n=gt.document.head,e,t){let i=document.createElement("style");if(i.type="text/css",i.media="screen",e?.(i),n.appendChild(i),t&&t.add(be(()=>n.removeChild(i))),n===gt.document.head){let o=new Set;tN.set(i,o);for(let{window:s,disposables:r}of M7()){if(s===gt)continue;let a=r.add(Dq(i,o,s));t?.add(a)}}return i}function Dq(n,e,t){var i,o;let s=new ae,r=n.cloneNode(!0);t.document.head.appendChild(r),s.add(be(()=>t.document.head.removeChild(r)));for(let a of H7(n))(i=r.sheet)===null||i===void 0||i.insertRule(a.cssText,(o=r.sheet)===null||o===void 0?void 0:o.cssRules.length);return s.add(Eq.observe(n,s,{childList:!0})(()=>{r.textContent=n.textContent})),e.add(r),s.add(be(()=>e.delete(r))),s}function V7(){return GT||(GT=Xi()),GT}function H7(n){var e,t;return!((e=n?.sheet)===null||e===void 0)&&e.rules?n.sheet.rules:!((t=n?.sheet)===null||t===void 0)&&t.cssRules?n.sheet.cssRules:[]}function Gw(n,e,t=V7()){var i,o;if(!(!t||!e)){(i=t.sheet)===null||i===void 0||i.insertRule(`${n} {${e}}`,0);for(let s of(o=tN.get(t))!==null&&o!==void 0?o:[])Gw(n,e,s)}}function Iq(n,e=V7()){var t,i;if(!e)return;let o=H7(e),s=[];for(let r=0;r=0;r--)(t=e.sheet)===null||t===void 0||t.deleteRule(s[r]);for(let r of(i=tN.get(e))!==null&&i!==void 0?i:[])Iq(n,r)}function Tq(n){return typeof n.selectorText=="string"}function Hg(n){return n instanceof MouseEvent||n instanceof ge(n).MouseEvent}function Ia(n){return n instanceof KeyboardEvent||n instanceof ge(n).KeyboardEvent}function U7(n){let e=n;return!!(e&&typeof e.preventDefault=="function"&&typeof e.stopPropagation=="function")}function K7(n){let e=[];for(let t=0;n&&n.nodeType===n.ELEMENT_NODE;t++)e[t]=n.scrollTop,n=n.parentNode;return e}function $7(n,e){for(let t=0;n&&n.nodeType===n.ELEMENT_NODE;t++)n.scrollTop!==e[t]&&(n.scrollTop=e[t]),n=n.parentNode}function Ic(n){return new XT(n)}function q7(n,e){return n.after(e),e}function me(n,...e){if(n.append(...e),e.length===1&&typeof e[0]!="string")return e[0]}function Ug(n,e){return n.insertBefore(e,n.firstChild),e}function Wi(n,...e){n.innerText="",me(n,...e)}function j7(n,e,t,...i){let o=Nq.exec(e);if(!o)throw new Error("Bad use of emmet");let s=o[1]||"div",r;return n!==g0.HTML?r=document.createElementNS(n,s):r=document.createElement(s),o[3]&&(r.id=o[3]),o[4]&&(r.className=o[4].replace(/\./g," ").trim()),t&&Object.entries(t).forEach(([a,l])=>{typeof l>"u"||(/^on\w+$/.test(a)?r[a]=l:a==="selected"?l&&r.setAttribute(a,"true"):r.setAttribute(a,l))}),r.append(...i),r}function ve(n,e,...t){return j7(g0.HTML,n,e,...t)}function Ire(n,...e){n?b0(...e):Zw(...e)}function b0(...n){for(let e of n)e.style.display="",e.removeAttribute("aria-hidden")}function Zw(...n){for(let e of n)e.style.display="none",e.setAttribute("aria-hidden","true")}function iN(n,e){let t=n.devicePixelRatio*e;return Math.max(1,Math.floor(t))/n.devicePixelRatio}function Yw(n){gt.open(n,"_blank","noopener")}function G7(n,e){let t=()=>{e(),i=rn(n,t)},i=rn(n,t);return be(()=>i.dispose())}function Mr(n){return n?`url('${Ww.uriToBrowserUri(n).toString(!0).replace(/'/g,"%27")}')`:"url('')"}function Xw(n){return`'${n.replace(/'/g,"%27")}'`}function tr(n,e){if(n!==void 0){let t=n.match(/^\s*var\((.+)\)$/);if(t){let i=t[1].split(",",2);return i.length===2&&(e=tr(i[1].trim(),e)),`var(${i[0]}, ${e})`}return n}return e}function Z7(n,e=!1){let t=document.createElement("a");return l0("afterSanitizeAttributes",i=>{for(let o of["href","src"])if(i.hasAttribute(o)){let s=i.getAttribute(o);if(o==="href"&&s.startsWith("#"))continue;if(t.href=s,!n.includes(t.protocol.replace(/:$/,""))){if(e&&o==="src"&&t.href.startsWith("data:"))continue;i.removeAttribute(o)}}}),be(()=>{Ow("afterSanitizeAttributes")})}function kt(n,...e){let t,i;Array.isArray(e[0])?(t={},i=e[0]):(t=e[0]||{},i=e[1]);let o=Aq.exec(n);if(!o||!o.groups)throw new Error("Bad use of h");let s=o.groups.tag||"div",r=document.createElement(s);o.groups.id&&(r.id=o.groups.id);let a=[];if(o.groups.class)for(let c of o.groups.class.split("."))c!==""&&a.push(c);if(t.className!==void 0)for(let c of t.className.split("."))c!==""&&a.push(c);a.length>0&&(r.className=a.join(" "));let l={};if(o.groups.name&&(l[o.groups.name]=r),i)for(let c of i)c instanceof HTMLElement?r.appendChild(c):typeof c=="string"?r.append(c):"root"in c&&(Object.assign(l,c),r.appendChild(c.root));for(let[c,d]of Object.entries(t))if(c!=="className")if(c==="style")for(let[h,u]of Object.entries(d))r.style.setProperty(A7(h),typeof u=="number"?u+"px":""+u);else c==="tabIndex"?r.tabIndex=d:r.setAttribute(A7(c),d.toString());return l.root=r,l}function A7(n){return n.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}var Sre,ge,xre,M7,Sq,Wg,QT,Lre,fu,R7,P7,ZT,Ut,kre,N7,JT,rn,Bd,f0,Qo,Ar,tN,YT,Eq,GT,se,He,XT,Nq,g0,Y7,Tre,uu,Hw,Aq,ke=J(()=>{"use strict";_();v();b();ps();Sw();oo();Qs();Gt();xt();ye();Fw();le();er();Lt();Bg();vo();({registerWindow:Sre,getWindow:ge,getDocument:xre,getWindows:M7,getWindowsCount:Sq,getWindowId:Wg,getWindowById:QT,hasWindow:Lre,onDidRegisterWindow:fu,onWillUnregisterWindow:R7,onDidUnregisterWindow:P7}=function(){let n=new Map;n7(gt,1);let e={window:gt,disposables:new ae};n.set(gt.vscodeWindowId,e);let t=new B,i=new B,o=new B;function s(r,a){let l=typeof r=="number"?n.get(r):void 0;return l??(a?e:void 0)}return{onDidRegisterWindow:t.event,onWillUnregisterWindow:o.event,onDidUnregisterWindow:i.event,registerWindow(r){if(n.has(r.vscodeWindowId))return H.None;let a=new ae,l={window:r,disposables:a.add(new ae)};return n.set(r.vscodeWindowId,l),a.add(be(()=>{n.delete(r.vscodeWindowId),i.fire(r)})),a.add($(r,se.BEFORE_UNLOAD,()=>{o.fire(r)})),t.fire(l),a},getWindows(){return n.values()},getWindowsCount(){return n.size},getWindowId(r){return r.vscodeWindowId},hasWindow(r){return n.has(r)},getWindowById:s,getWindow(r){var a;let l=r;if(!((a=l?.ownerDocument)===null||a===void 0)&&a.defaultView)return l.ownerDocument.defaultView.window;let c=r;return c?.view?c.view.window:gt},getDocument(r){return ge(r).document}}}());ZT=class{constructor(e,t,i,o){this._node=e,this._type=t,this._handler=i,this._options=o||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};Ut=function(e,t,i,o){let s=i;return t==="click"||t==="mousedown"?s=O7(ge(e),i):(t==="keydown"||t==="keypress"||t==="keyup")&&(s=xq(i)),$(e,t,s,o)},kre=function(e,t,i){let o=O7(ge(e),t);return Lq(e,o,i)};N7=class extends n0{constructor(e,t){super(e,t)}},Bd=class extends Fd{constructor(e){super(),this.defaultTarget=e&&ge(e)}cancelAndSet(e,t,i){return super.cancelAndSet(e,t,i??this.defaultTarget)}},f0=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){ut(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let n=new Map,e=new Map,t=new Map,i=new Map,o=s=>{var r;t.set(s,!1);let a=(r=n.get(s))!==null&&r!==void 0?r:[];for(e.set(s,a),n.set(s,[]),i.set(s,!0);a.length>0;)a.sort(f0.sort),a.shift().execute();i.set(s,!1)};rn=(s,r,a=0)=>{let l=Wg(s),c=new f0(r,a),d=n.get(l);return d||(d=[],n.set(l,d)),d.push(c),t.get(l)||(t.set(l,!0),s.requestAnimationFrame(()=>o(l))),c},JT=(s,r,a)=>{let l=Wg(s);if(i.get(l)){let c=new f0(r,a),d=e.get(l);return d||(d=[],e.set(l,d)),d.push(c),c}else return rn(s,r,a)}})();Qo=class n{static convertToPixels(e,t){return parseFloat(t)||0}static getDimension(e,t,i){let o=eN(e),s=o?o.getPropertyValue(t):"0";return n.convertToPixels(e,s)}static getBorderLeftWidth(e){return n.getDimension(e,"border-left-width","borderLeftWidth")}static getBorderRightWidth(e){return n.getDimension(e,"border-right-width","borderRightWidth")}static getBorderTopWidth(e){return n.getDimension(e,"border-top-width","borderTopWidth")}static getBorderBottomWidth(e){return n.getDimension(e,"border-bottom-width","borderBottomWidth")}static getPaddingLeft(e){return n.getDimension(e,"padding-left","paddingLeft")}static getPaddingRight(e){return n.getDimension(e,"padding-right","paddingRight")}static getPaddingTop(e){return n.getDimension(e,"padding-top","paddingTop")}static getPaddingBottom(e){return n.getDimension(e,"padding-bottom","paddingBottom")}static getMarginLeft(e){return n.getDimension(e,"margin-left","marginLeft")}static getMarginTop(e){return n.getDimension(e,"margin-top","marginTop")}static getMarginRight(e){return n.getDimension(e,"margin-right","marginRight")}static getMarginBottom(e){return n.getDimension(e,"margin-bottom","marginBottom")}},Ar=class n{constructor(e,t){this.width=e,this.height=t}with(e=this.width,t=this.height){return e!==this.width||t!==this.height?new n(e,t):this}static is(e){return typeof e=="object"&&typeof e.height=="number"&&typeof e.width=="number"}static lift(e){return e instanceof n?e:new n(e.width,e.height)}static equals(e,t){return e===t?!0:!e||!t?!1:e.width===t.width&&e.height===t.height}};Ar.None=new Ar(0,0);tN=new Map;YT=class{constructor(){this._currentCssStyle="",this._styleSheet=void 0}setStyle(e){e!==this._currentCssStyle&&(this._currentCssStyle=e,this._styleSheet?this._styleSheet.innerText=e:this._styleSheet=Xi(gt.document.head,t=>t.innerText=e))}dispose(){this._styleSheet&&(this._styleSheet.remove(),this._styleSheet=void 0)}};Eq=new class{constructor(){this.mutationObservers=new Map}observe(n,e,t){let i=this.mutationObservers.get(n);i||(i=new Map,this.mutationObservers.set(n,i));let o=zw(t),s=i.get(o);if(s)s.users+=1;else{let r=new B,a=new MutationObserver(c=>r.fire(c));a.observe(n,t);let l=s={users:1,observer:a,onDidMutate:r.event};e.add(be(()=>{l.users-=1,l.users===0&&(r.dispose(),a.disconnect(),i?.delete(o),i?.size===0&&this.mutationObservers.delete(n))})),i.set(o,s)}return s.onDidMutate}},GT=null;se={CLICK:"click",AUXCLICK:"auxclick",DBLCLICK:"dblclick",MOUSE_UP:"mouseup",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_MOVE:"mousemove",MOUSE_OUT:"mouseout",MOUSE_ENTER:"mouseenter",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",POINTER_LEAVE:"pointerleave",CONTEXT_MENU:"contextmenu",WHEEL:"wheel",KEY_DOWN:"keydown",KEY_PRESS:"keypress",KEY_UP:"keyup",LOAD:"load",BEFORE_UNLOAD:"beforeunload",UNLOAD:"unload",PAGE_SHOW:"pageshow",PAGE_HIDE:"pagehide",PASTE:"paste",ABORT:"abort",ERROR:"error",RESIZE:"resize",SCROLL:"scroll",FULLSCREEN_CHANGE:"fullscreenchange",WK_FULLSCREEN_CHANGE:"webkitfullscreenchange",SELECT:"select",CHANGE:"change",SUBMIT:"submit",RESET:"reset",FOCUS:"focus",FOCUS_IN:"focusin",FOCUS_OUT:"focusout",BLUR:"blur",INPUT:"input",STORAGE:"storage",DRAG_START:"dragstart",DRAG:"drag",DRAG_ENTER:"dragenter",DRAG_LEAVE:"dragleave",DRAG_OVER:"dragover",DROP:"drop",DRAG_END:"dragend",ANIMATION_START:La?"webkitAnimationStart":"animationstart",ANIMATION_END:La?"webkitAnimationEnd":"animationend",ANIMATION_ITERATION:La?"webkitAnimationIteration":"animationiteration"};He={stop:(n,e)=>(n.preventDefault(),e&&n.stopPropagation(),n)};XT=class n extends H{static hasFocusWithin(e){if(e instanceof HTMLElement){let t=Ec(e),i=t?t.activeElement:e.ownerDocument.activeElement;return yi(i,e)}else{let t=e;return yi(t.document.activeElement,t.document)}}constructor(e){super(),this._onDidFocus=this._register(new B),this.onDidFocus=this._onDidFocus.event,this._onDidBlur=this._register(new B),this.onDidBlur=this._onDidBlur.event;let t=n.hasFocusWithin(e),i=!1,o=()=>{i=!1,t||(t=!0,this._onDidFocus.fire())},s=()=>{t&&(i=!0,(e instanceof HTMLElement?ge(e):e).setTimeout(()=>{i&&(i=!1,t=!1,this._onDidBlur.fire())},0))};this._refreshStateHandler=()=>{n.hasFocusWithin(e)!==t&&(t?s():o())},this._register($(e,se.FOCUS,o,!0)),this._register($(e,se.BLUR,s,!0)),e instanceof HTMLElement&&(this._register($(e,se.FOCUS_IN,()=>this._refreshStateHandler())),this._register($(e,se.FOCUS_OUT,()=>this._refreshStateHandler())))}};Nq=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;(function(n){n.HTML="http://www.w3.org/1999/xhtml",n.SVG="http://www.w3.org/2000/svg"})(g0||(g0={}));ve.SVG=function(n,e,...t){return j7(g0.SVG,n,e,...t)};qT.setPreferredWebSchema(/^https:/.test(gt.location.href)?"https":"http");Y7=Object.freeze(["a","abbr","b","bdo","blockquote","br","caption","cite","code","col","colgroup","dd","del","details","dfn","div","dl","dt","em","figcaption","figure","h1","h2","h3","h4","h5","h6","hr","i","img","input","ins","kbd","label","li","mark","ol","p","pre","q","rp","rt","ruby","samp","small","small","source","span","strike","strong","sub","summary","sup","table","tbody","td","tfoot","th","thead","time","tr","tt","u","ul","var","video","wbr"]),Tre=Object.freeze({ALLOWED_TAGS:["a","button","blockquote","code","div","h1","h2","h3","h4","h5","h6","hr","input","label","li","p","pre","select","small","span","strong","textarea","ul","ol"],ALLOWED_ATTR:["href","data-href","data-command","target","title","name","src","alt","class","id","role","tabindex","style","data-code","width","height","align","x-dispatch","required","checked","placeholder","type","start"],RETURN_DOM:!1,RETURN_DOM_FRAGMENT:!1,RETURN_TRUSTED_TYPE:!0}),uu=class n extends B{constructor(){super(),this._subscriptions=new ae,this._keyStatus={altKey:!1,shiftKey:!1,ctrlKey:!1,metaKey:!1},this._subscriptions.add(ie.runAndSubscribe(fu,({window:e,disposables:t})=>this.registerListeners(e,t),{window:gt,disposables:this._subscriptions}))}registerListeners(e,t){t.add($(e,"keydown",i=>{if(i.defaultPrevented)return;let o=new bt(i);if(!(o.keyCode===6&&i.repeat)){if(i.altKey&&!this._keyStatus.altKey)this._keyStatus.lastKeyPressed="alt";else if(i.ctrlKey&&!this._keyStatus.ctrlKey)this._keyStatus.lastKeyPressed="ctrl";else if(i.metaKey&&!this._keyStatus.metaKey)this._keyStatus.lastKeyPressed="meta";else if(i.shiftKey&&!this._keyStatus.shiftKey)this._keyStatus.lastKeyPressed="shift";else if(o.keyCode!==6)this._keyStatus.lastKeyPressed=void 0;else return;this._keyStatus.altKey=i.altKey,this._keyStatus.ctrlKey=i.ctrlKey,this._keyStatus.metaKey=i.metaKey,this._keyStatus.shiftKey=i.shiftKey,this._keyStatus.lastKeyPressed&&(this._keyStatus.event=i,this.fire(this._keyStatus))}},!0)),t.add($(e,"keyup",i=>{i.defaultPrevented||(!i.altKey&&this._keyStatus.altKey?this._keyStatus.lastKeyReleased="alt":!i.ctrlKey&&this._keyStatus.ctrlKey?this._keyStatus.lastKeyReleased="ctrl":!i.metaKey&&this._keyStatus.metaKey?this._keyStatus.lastKeyReleased="meta":!i.shiftKey&&this._keyStatus.shiftKey?this._keyStatus.lastKeyReleased="shift":this._keyStatus.lastKeyReleased=void 0,this._keyStatus.lastKeyPressed!==this._keyStatus.lastKeyReleased&&(this._keyStatus.lastKeyPressed=void 0),this._keyStatus.altKey=i.altKey,this._keyStatus.ctrlKey=i.ctrlKey,this._keyStatus.metaKey=i.metaKey,this._keyStatus.shiftKey=i.shiftKey,this._keyStatus.lastKeyReleased&&(this._keyStatus.event=i,this.fire(this._keyStatus)))},!0)),t.add($(e.document.body,"mousedown",()=>{this._keyStatus.lastKeyPressed=void 0},!0)),t.add($(e.document.body,"mouseup",()=>{this._keyStatus.lastKeyPressed=void 0},!0)),t.add($(e.document.body,"mousemove",i=>{i.buttons&&(this._keyStatus.lastKeyPressed=void 0)},!0)),t.add($(e,"blur",()=>{this.resetKeyStatus()}))}get keyStatus(){return this._keyStatus}resetKeyStatus(){this.doResetKeyStatus(),this.fire(this._keyStatus)}doResetKeyStatus(){this._keyStatus={altKey:!1,shiftKey:!1,ctrlKey:!1,metaKey:!1}}static getInstance(){return n.instance||(n.instance=new n),n.instance}dispose(){super.dispose(),this._subscriptions.dispose()}},Hw=class extends H{constructor(e,t){super(),this.element=e,this.callbacks=t,this.counter=0,this.dragStartTime=0,this.registerListeners()}registerListeners(){this.callbacks.onDragStart&&this._register($(this.element,se.DRAG_START,e=>{var t,i;(i=(t=this.callbacks).onDragStart)===null||i===void 0||i.call(t,e)})),this.callbacks.onDrag&&this._register($(this.element,se.DRAG,e=>{var t,i;(i=(t=this.callbacks).onDrag)===null||i===void 0||i.call(t,e)})),this._register($(this.element,se.DRAG_ENTER,e=>{var t,i;this.counter++,this.dragStartTime=e.timeStamp,(i=(t=this.callbacks).onDragEnter)===null||i===void 0||i.call(t,e)})),this._register($(this.element,se.DRAG_OVER,e=>{var t,i;e.preventDefault(),(i=(t=this.callbacks).onDragOver)===null||i===void 0||i.call(t,e,e.timeStamp-this.dragStartTime)})),this._register($(this.element,se.DRAG_LEAVE,e=>{var t,i;this.counter--,this.counter===0&&(this.dragStartTime=0,(i=(t=this.callbacks).onDragLeave)===null||i===void 0||i.call(t,e))})),this._register($(this.element,se.DRAG_END,e=>{var t,i;this.counter=0,this.dragStartTime=0,(i=(t=this.callbacks).onDragEnd)===null||i===void 0||i.call(t,e)})),this._register($(this.element,se.DROP,e=>{var t,i;this.counter=0,this.dragStartTime=0,(i=(t=this.callbacks).onDrop)===null||i===void 0||i.call(t,e)}))}},Aq=/(?[\w\-]+)?(?:#(?[\w\-]+))?(?(?:\.(?:[\w\-]+))*)(?:@(?(?:[\w\_])+))?/});function Pq(n,e,t){e[Pr.DI_TARGET]===e?e[Pr.DI_DEPENDENCIES].push({id:n,index:t}):(e[Pr.DI_DEPENDENCIES]=[{id:n,index:t}],e[Pr.DI_TARGET]=e)}function De(n){if(Pr.serviceIds.has(n))return Pr.serviceIds.get(n);let e=function(t,i,o){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");Pq(e,t,o)};return e.toString=()=>n,Pr.serviceIds.set(n,e),e}var Pr,Ye,qe=J(()=>{"use strict";_();v();b();(function(n){n.serviceIds=new Map,n.DI_TARGET="$di$target",n.DI_DEPENDENCIES="$di$dependencies";function e(t){return t[n.DI_DEPENDENCIES]||[]}n.getServiceDependencies=e})(Pr||(Pr={}));Ye=De("instantiationService")});var Zt,Or=J(()=>{"use strict";_();v();b();qe();Zt=De("codeEditorService")});var xn,_u=J(()=>{"use strict";_();v();b();qe();xn=De("modelService")});var Wd,Jw=J(()=>{"use strict";_();v();b();qe();Wd=De("textModelService")});function zd(n){var e;return{id:n.id,label:n.label,class:n.class,enabled:(e=n.enabled)!==null&&e!==void 0?e:!0,checked:n.checked,run:async(...t)=>n.run(...t),tooltip:n.label}}var Ro,bs,zi,bl,w0,Po=J(()=>{"use strict";_();v();b();ye();le();Ge();Ro=class extends H{constructor(e,t="",i="",o=!0,s){super(),this._onDidChange=this._register(new B),this.onDidChange=this._onDidChange.event,this._enabled=!0,this._id=e,this._label=t,this._cssClass=i,this._enabled=o,this._actionCallback=s}get id(){return this._id}get label(){return this._label}set label(e){this._setLabel(e)}_setLabel(e){this._label!==e&&(this._label=e,this._onDidChange.fire({label:e}))}get tooltip(){return this._tooltip||""}set tooltip(e){this._setTooltip(e)}_setTooltip(e){this._tooltip!==e&&(this._tooltip=e,this._onDidChange.fire({tooltip:e}))}get class(){return this._cssClass}set class(e){this._setClass(e)}_setClass(e){this._cssClass!==e&&(this._cssClass=e,this._onDidChange.fire({class:e}))}get enabled(){return this._enabled}set enabled(e){this._setEnabled(e)}_setEnabled(e){this._enabled!==e&&(this._enabled=e,this._onDidChange.fire({enabled:e}))}get checked(){return this._checked}set checked(e){this._setChecked(e)}_setChecked(e){this._checked!==e&&(this._checked=e,this._onDidChange.fire({checked:e}))}async run(e,t){this._actionCallback&&await this._actionCallback(e)}},bs=class extends H{constructor(){super(...arguments),this._onWillRun=this._register(new B),this.onWillRun=this._onWillRun.event,this._onDidRun=this._register(new B),this.onDidRun=this._onDidRun.event}async run(e,t){if(!e.enabled)return;this._onWillRun.fire({action:e});let i;try{await this.runAction(e,t)}catch(o){i=o}this._onDidRun.fire({action:e,error:i})}async runAction(e,t){await e.run(t)}},zi=class n{constructor(){this.id=n.ID,this.label="",this.tooltip="",this.class="separator",this.enabled=!1,this.checked=!1}static join(...e){let t=[];for(let i of e)i.length&&(t.length?t=[...t,new n,...i]:t=i);return t}async run(){}};zi.ID="vs.actions.separator";bl=class{get actions(){return this._actions}constructor(e,t,i,o){this.tooltip="",this.enabled=!0,this.checked=void 0,this.id=e,this.label=t,this.class=o,this._actions=i}async run(){}},w0=class n extends Ro{constructor(){super(n.ID,p("submenu.empty","(empty)"),void 0,!1)}};w0.ID="vs.actions.empty"});var dN,Xe,Ln=J(()=>{"use strict";_();v();b();$n();(function(n){function e(t){return t&&typeof t=="object"&&typeof t.id=="string"}n.isThemeColor=e})(dN||(dN={}));(function(n){n.iconNameSegment="[A-Za-z0-9]+",n.iconNameExpression="[A-Za-z0-9-]+",n.iconModifierExpression="~[A-Za-z]+",n.iconNameCharacter="[A-Za-z0-9~-]";let e=new RegExp(`^(${n.iconNameExpression})(${n.iconModifierExpression})?$`);function t(u){let f=e.exec(u.id);if(!f)return t(ue.error);let[,g,m]=f,C=["codicon","codicon-"+g];return m&&C.push("codicon-modifier-"+m.substring(1)),C}n.asClassNameArray=t;function i(u){return t(u).join(" ")}n.asClassName=i;function o(u){return"."+t(u).join(".")}n.asCSSSelector=o;function s(u){return u&&typeof u=="object"&&typeof u.id=="string"&&(typeof u.color>"u"||dN.isThemeColor(u.color))}n.isThemeIcon=s;let r=new RegExp(`^\\$\\((${n.iconNameExpression}(?:${n.iconModifierExpression})?)\\)$`);function a(u){let f=r.exec(u);if(!f)return;let[,g]=f;return{id:g}}n.fromString=a;function l(u){return{id:u}}n.fromId=l;function c(u,f){let g=u.id,m=g.lastIndexOf("~");return m!==-1&&(g=g.substring(0,m)),f&&(g=`${g}~${f}`),{id:g}}n.modify=c;function d(u){let f=u.id.lastIndexOf("~");if(f!==-1)return u.id.substring(f+1)}n.getModifier=d;function h(u,f){var g,m;return u.id===f.id&&((g=u.color)===null||g===void 0?void 0:g.id)===((m=f.color)===null||m===void 0?void 0:m.id)}n.isEqual=h})(Xe||(Xe={}))});var kn,Pi,ir=J(()=>{"use strict";_();v();b();ye();js();le();kr();xi();qe();kn=De("commandService"),Pi=new class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new B,this.onDidRegisterCommand=this._onDidRegisterCommand.event}registerCommand(n,e){if(!n)throw new Error("invalid command");if(typeof n=="string"){if(!e)throw new Error("invalid command");return this.registerCommand({id:n,handler:e})}if(n.metadata&&Array.isArray(n.metadata.args)){let r=[];for(let l of n.metadata.args)r.push(l.constraint);let a=n.handler;n.handler=function(l,...c){return o9(c,r),a(l,...c)}}let{id:t}=n,i=this._commands.get(t);i||(i=new Ii,this._commands.set(t,i));let o=i.unshift(n),s=be(()=>{o();let r=this._commands.get(t);r?.isEmpty()&&this._commands.delete(t)});return this._onDidRegisterCommand.fire(t),s}registerCommandAlias(n,e){return Pi.registerCommand(n,(t,...i)=>t.get(kn).executeCommand(e,...i))}getCommand(n){let e=this._commands.get(n);if(!(!e||e.isEmpty()))return ht.first(e)}getCommands(){let n=new Map;for(let e of this._commands.keys()){let t=this.getCommand(e);t&&n.set(e,t)}return n}};Pi.registerCommand("noop",()=>{})});function hN(...n){switch(n.length){case 1:return p("contextkey.scanner.hint.didYouMean1","Did you mean {0}?",n[0]);case 2:return p("contextkey.scanner.hint.didYouMean2","Did you mean {0} or {1}?",n[0],n[1]);case 3:return p("contextkey.scanner.hint.didYouMean3","Did you mean {0}, {1} or {2}?",n[0],n[1],n[2]);default:return}}var Oq,Fq,vl,Q7=J(()=>{"use strict";_();v();b();xt();Ge();Oq=p("contextkey.scanner.hint.didYouForgetToOpenOrCloseQuote","Did you forget to open or close the quote?"),Fq=p("contextkey.scanner.hint.didYouForgetToEscapeSlash","Did you forget to escape the '/' (slash) character? Put two backslashes before it to escape, e.g., '\\\\/'."),vl=class n{constructor(){this._input="",this._start=0,this._current=0,this._tokens=[],this._errors=[],this.stringRe=/[a-zA-Z0-9_<>\-\./\\:\*\?\+\[\]\^,#@;"%\$\p{L}-]+/uy}static getLexeme(e){switch(e.type){case 0:return"(";case 1:return")";case 2:return"!";case 3:return e.isTripleEq?"===":"==";case 4:return e.isTripleEq?"!==":"!=";case 5:return"<";case 6:return"<=";case 7:return">=";case 8:return">=";case 9:return"=~";case 10:return e.lexeme;case 11:return"true";case 12:return"false";case 13:return"in";case 14:return"not";case 15:return"&&";case 16:return"||";case 17:return e.lexeme;case 18:return e.lexeme;case 19:return e.lexeme;case 20:return"EOF";default:throw _g(`unhandled token type: ${JSON.stringify(e)}; have you forgotten to add a case?`)}}reset(e){return this._input=e,this._start=0,this._current=0,this._tokens=[],this._errors=[],this}scan(){for(;!this._isAtEnd();)switch(this._start=this._current,this._advance()){case 40:this._addToken(0);break;case 41:this._addToken(1);break;case 33:if(this._match(61)){let t=this._match(61);this._tokens.push({type:4,offset:this._start,isTripleEq:t})}else this._addToken(2);break;case 39:this._quotedString();break;case 47:this._regex();break;case 61:if(this._match(61)){let t=this._match(61);this._tokens.push({type:3,offset:this._start,isTripleEq:t})}else this._match(126)?this._addToken(9):this._error(hN("==","=~"));break;case 60:this._addToken(this._match(61)?6:5);break;case 62:this._addToken(this._match(61)?8:7);break;case 38:this._match(38)?this._addToken(15):this._error(hN("&&"));break;case 124:this._match(124)?this._addToken(16):this._error(hN("||"));break;case 32:case 13:case 9:case 10:case 160:break;default:this._string()}return this._start=this._current,this._addToken(20),Array.from(this._tokens)}_match(e){return this._isAtEnd()||this._input.charCodeAt(this._current)!==e?!1:(this._current++,!0)}_advance(){return this._input.charCodeAt(this._current++)}_peek(){return this._isAtEnd()?0:this._input.charCodeAt(this._current)}_addToken(e){this._tokens.push({type:e,offset:this._start})}_error(e){let t=this._start,i=this._input.substring(this._start,this._current),o={type:19,offset:this._start,lexeme:i};this._errors.push({offset:t,lexeme:i,additionalInfo:e}),this._tokens.push(o)}_string(){this.stringRe.lastIndex=this._start;let e=this.stringRe.exec(this._input);if(e){this._current=this._start+e[0].length;let t=this._input.substring(this._start,this._current),i=n._keywords.get(t);i?this._addToken(i):this._tokens.push({type:17,lexeme:t,offset:this._start})}}_quotedString(){for(;this._peek()!==39&&!this._isAtEnd();)this._advance();if(this._isAtEnd()){this._error(Oq);return}this._advance(),this._tokens.push({type:18,lexeme:this._input.substring(this._start+1,this._current-1),offset:this._start+1})}_regex(){let e=this._current,t=!1,i=!1;for(;;){if(e>=this._input.length){this._current=e,this._error(Fq);return}let s=this._input.charCodeAt(e);if(t)t=!1;else if(s===47&&!i){e++;break}else s===91?i=!0:s===92?t=!0:s===93&&(i=!1);e++}for(;e=this._input.length}};vl._regexFlags=new Set(["i","g","s","m","y","u"].map(n=>n.charCodeAt(0)));vl._keywords=new Map([["not",14],["in",13],["false",12],["true",11]])});function i3(n,e){let t=n?n.substituteConstants():void 0,i=e?e.substituteConstants():void 0;return!t&&!i?!0:!t||!i?!1:t.equals(i)}function y0(n,e){return n.cmp(e)}function dy(n,e){if(typeof n=="string"){let t=parseFloat(n);isNaN(t)||(n=t)}return typeof n=="string"||typeof n=="number"?e(n):ro.INSTANCE}function n3(n){let e=null;for(let t=0,i=n.length;te?1:0}function Cu(n,e,t,i){return nt?1:ei?1:0}function cy(n,e){if(n.type===0||e.type===1)return!0;if(n.type===9)return e.type===9?e3(n.expr,e.expr):!1;if(e.type===9){for(let t of e.expr)if(cy(n,t))return!0;return!1}if(n.type===6){if(e.type===6)return e3(e.expr,n.expr);for(let t of n.expr)if(cy(t,e))return!0;return!1}return n.equals(e)}function e3(n,e){let t=0,i=0;for(;t{"use strict";_();v();b();Lt();ot();Q7();qe();Ge();so=new Map;so.set("false",!1);so.set("true",!0);so.set("isMac",Be);so.set("isLinux",mi);so.set("isWindows",Li);so.set("isWeb",hl);so.set("isMacNative",Be&&!hl);so.set("isEdge",v9);so.set("isFirefox",_9);so.set("isChrome",xI);so.set("isSafari",b9);Bq=Object.prototype.hasOwnProperty,Wq={regexParsingWithErrorRecovery:!0},zq=p("contextkey.parser.error.emptyString","Empty context key expression"),Vq=p("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."),Hq=p("contextkey.parser.error.noInAfterNot","'in' after 'not'."),J7=p("contextkey.parser.error.closingParenthesis","closing parenthesis ')'"),Uq=p("contextkey.parser.error.unexpectedToken","Unexpected token"),Kq=p("contextkey.parser.error.unexpectedToken.hint","Did you forget to put && or || before the token?"),$q=p("contextkey.parser.error.unexpectedEOF","Unexpected end of expression"),qq=p("contextkey.parser.error.unexpectedEOF.hint","Did you forget to put a context key?"),ey=class n{constructor(e=Wq){this._config=e,this._scanner=new vl,this._tokens=[],this._current=0,this._parsingErrors=[],this._flagsGYRe=/g|y/g}parse(e){if(e===""){this._parsingErrors.push({message:zq,offset:0,lexeme:"",additionalInfo:Vq});return}this._tokens=this._scanner.reset(e).scan(),this._current=0,this._parsingErrors=[];try{let t=this._expr();if(!this._isAtEnd()){let i=this._peek(),o=i.type===17?Kq:void 0;throw this._parsingErrors.push({message:Uq,offset:i.offset,lexeme:vl.getLexeme(i),additionalInfo:o}),n._parseError}return t}catch(t){if(t!==n._parseError)throw t;return}}_expr(){return this._or()}_or(){let e=[this._and()];for(;this._matchOne(16);){let t=this._and();e.push(t)}return e.length===1?e[0]:Dt.or(...e)}_and(){let e=[this._term()];for(;this._matchOne(15);){let t=this._term();e.push(t)}return e.length===1?e[0]:Dt.and(...e)}_term(){if(this._matchOne(2)){let e=this._peek();switch(e.type){case 11:return this._advance(),ro.INSTANCE;case 12:return this._advance(),wo.INSTANCE;case 0:{this._advance();let t=this._expr();return this._consume(1,J7),t?.negate()}case 17:return this._advance(),vu.create(e.lexeme);default:throw this._errExpectedButGot("KEY | true | false | '(' expression ')'",e)}}return this._primary()}_primary(){let e=this._peek();switch(e.type){case 11:return this._advance(),Dt.true();case 12:return this._advance(),Dt.false();case 0:{this._advance();let t=this._expr();return this._consume(1,J7),t}case 17:{let t=e.lexeme;if(this._advance(),this._matchOne(9)){let o=this._peek();if(!this._config.regexParsingWithErrorRecovery){if(this._advance(),o.type!==10)throw this._errExpectedButGot("REGEX",o);let s=o.lexeme,r=s.lastIndexOf("/"),a=r===s.length-1?void 0:this._removeFlagsGY(s.substring(r+1)),l;try{l=new RegExp(s.substring(1,r),a)}catch{throw this._errExpectedButGot("REGEX",o)}return x0.create(t,l)}switch(o.type){case 10:case 19:{let s=[o.lexeme];this._advance();let r=this._peek(),a=0;for(let u=0;u=0){let c=s.slice(a+1,l),d=s[l+1]==="i"?"i":"";try{r=new RegExp(c,d)}catch{throw this._errExpectedButGot("REGEX",o)}}}if(r===null)throw this._errExpectedButGot("REGEX",o);return x0.create(t,r)}default:throw this._errExpectedButGot("REGEX",this._peek())}}if(this._matchOne(14)){this._consume(13,Hq);let o=this._value();return Dt.notIn(t,o)}switch(this._peek().type){case 3:{this._advance();let o=this._value();if(this._previous().type===18)return Dt.equals(t,o);switch(o){case"true":return Dt.has(t);case"false":return Dt.not(t);default:return Dt.equals(t,o)}}case 4:{this._advance();let o=this._value();if(this._previous().type===18)return Dt.notEquals(t,o);switch(o){case"true":return Dt.not(t);case"false":return Dt.has(t);default:return Dt.notEquals(t,o)}}case 5:return this._advance(),ry.create(t,this._value());case 6:return this._advance(),ay.create(t,this._value());case 7:return this._advance(),oy.create(t,this._value());case 8:return this._advance(),sy.create(t,this._value());case 13:return this._advance(),Dt.in(t,this._value());default:return Dt.has(t)}}case 20:throw this._parsingErrors.push({message:$q,offset:e.offset,lexeme:"",additionalInfo:qq}),n._parseError;default:throw this._errExpectedButGot(`true | false | KEY + | KEY '=~' REGEX + | KEY ('==' | '!=' | '<' | '<=' | '>' | '>=' | 'in' | 'not' 'in') value`,this._peek())}}_value(){let e=this._peek();switch(e.type){case 17:case 18:return this._advance(),e.lexeme;case 11:return this._advance(),"true";case 12:return this._advance(),"false";case 13:return this._advance(),"in";default:return""}}_removeFlagsGY(e){return e.replaceAll(this._flagsGYRe,"")}_previous(){return this._tokens[this._current-1]}_matchOne(e){return this._check(e)?(this._advance(),!0):!1}_advance(){return this._isAtEnd()||this._current++,this._previous()}_consume(e,t){if(this._check(e))return this._advance();throw this._errExpectedButGot(t,this._peek())}_errExpectedButGot(e,t,i){let o=p("contextkey.parser.error.expectedButGot",`Expected: {0} +Received: '{1}'.`,e,vl.getLexeme(t)),s=t.offset,r=vl.getLexeme(t);return this._parsingErrors.push({message:o,offset:s,lexeme:r,additionalInfo:i}),n._parseError}_check(e){return this._peek().type===e}_peek(){return this._tokens[this._current]}_isAtEnd(){return this._peek().type===20}};ey._parseError=new Error;Dt=class{static false(){return ro.INSTANCE}static true(){return wo.INSTANCE}static has(e){return bu.create(e)}static equals(e,t){return S0.create(e,t)}static notEquals(e,t){return ny.create(e,t)}static regex(e,t){return x0.create(e,t)}static in(e,t){return ty.create(e,t)}static notIn(e,t){return iy.create(e,t)}static not(e){return vu.create(e)}static and(...e){return ly.create(e,null,!0)}static or(...e){return L0.create(e,null,!0)}static deserialize(e){return e==null?void 0:this._parser.parse(e)}};Dt._parser=new ey({regexParsingWithErrorRecovery:!1});ro=class{constructor(){this.type=0}cmp(e){return this.type-e.type}equals(e){return e.type===this.type}substituteConstants(){return this}evaluate(e){return!1}serialize(){return"false"}keys(){return[]}negate(){return wo.INSTANCE}};ro.INSTANCE=new ro;wo=class{constructor(){this.type=1}cmp(e){return this.type-e.type}equals(e){return e.type===this.type}substituteConstants(){return this}evaluate(e){return!0}serialize(){return"true"}keys(){return[]}negate(){return ro.INSTANCE}};wo.INSTANCE=new wo;bu=class n{static create(e,t=null){let i=so.get(e);return typeof i=="boolean"?i?wo.INSTANCE:ro.INSTANCE:new n(e,t)}constructor(e,t){this.key=e,this.negated=t,this.type=2}cmp(e){return e.type!==this.type?this.type-e.type:o3(this.key,e.key)}equals(e){return e.type===this.type?this.key===e.key:!1}substituteConstants(){let e=so.get(this.key);return typeof e=="boolean"?e?wo.INSTANCE:ro.INSTANCE:this}evaluate(e){return!!e.getValue(this.key)}serialize(){return this.key}keys(){return[this.key]}negate(){return this.negated||(this.negated=vu.create(this.key,this)),this.negated}},S0=class n{static create(e,t,i=null){if(typeof t=="boolean")return t?bu.create(e,i):vu.create(e,i);let o=so.get(e);return typeof o=="boolean"?t===(o?"true":"false")?wo.INSTANCE:ro.INSTANCE:new n(e,t,i)}constructor(e,t,i){this.key=e,this.value=t,this.negated=i,this.type=4}cmp(e){return e.type!==this.type?this.type-e.type:Cu(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}substituteConstants(){let e=so.get(this.key);if(typeof e=="boolean"){let t=e?"true":"false";return this.value===t?wo.INSTANCE:ro.INSTANCE}return this}evaluate(e){return e.getValue(this.key)==this.value}serialize(){return`${this.key} == '${this.value}'`}keys(){return[this.key]}negate(){return this.negated||(this.negated=ny.create(this.key,this.value,this)),this.negated}},ty=class n{static create(e,t){return new n(e,t)}constructor(e,t){this.key=e,this.valueKey=t,this.type=10,this.negated=null}cmp(e){return e.type!==this.type?this.type-e.type:Cu(this.key,this.valueKey,e.key,e.valueKey)}equals(e){return e.type===this.type?this.key===e.key&&this.valueKey===e.valueKey:!1}substituteConstants(){return this}evaluate(e){let t=e.getValue(this.valueKey),i=e.getValue(this.key);return Array.isArray(t)?t.includes(i):typeof i=="string"&&typeof t=="object"&&t!==null?Bq.call(t,i):!1}serialize(){return`${this.key} in '${this.valueKey}'`}keys(){return[this.key,this.valueKey]}negate(){return this.negated||(this.negated=iy.create(this.key,this.valueKey)),this.negated}},iy=class n{static create(e,t){return new n(e,t)}constructor(e,t){this.key=e,this.valueKey=t,this.type=11,this._negated=ty.create(e,t)}cmp(e){return e.type!==this.type?this.type-e.type:this._negated.cmp(e._negated)}equals(e){return e.type===this.type?this._negated.equals(e._negated):!1}substituteConstants(){return this}evaluate(e){return!this._negated.evaluate(e)}serialize(){return`${this.key} not in '${this.valueKey}'`}keys(){return this._negated.keys()}negate(){return this._negated}},ny=class n{static create(e,t,i=null){if(typeof t=="boolean")return t?vu.create(e,i):bu.create(e,i);let o=so.get(e);return typeof o=="boolean"?t===(o?"true":"false")?ro.INSTANCE:wo.INSTANCE:new n(e,t,i)}constructor(e,t,i){this.key=e,this.value=t,this.negated=i,this.type=5}cmp(e){return e.type!==this.type?this.type-e.type:Cu(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}substituteConstants(){let e=so.get(this.key);if(typeof e=="boolean"){let t=e?"true":"false";return this.value===t?ro.INSTANCE:wo.INSTANCE}return this}evaluate(e){return e.getValue(this.key)!=this.value}serialize(){return`${this.key} != '${this.value}'`}keys(){return[this.key]}negate(){return this.negated||(this.negated=S0.create(this.key,this.value,this)),this.negated}},vu=class n{static create(e,t=null){let i=so.get(e);return typeof i=="boolean"?i?ro.INSTANCE:wo.INSTANCE:new n(e,t)}constructor(e,t){this.key=e,this.negated=t,this.type=3}cmp(e){return e.type!==this.type?this.type-e.type:o3(this.key,e.key)}equals(e){return e.type===this.type?this.key===e.key:!1}substituteConstants(){let e=so.get(this.key);return typeof e=="boolean"?e?ro.INSTANCE:wo.INSTANCE:this}evaluate(e){return!e.getValue(this.key)}serialize(){return`!${this.key}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=bu.create(this.key,this)),this.negated}};oy=class n{static create(e,t,i=null){return dy(t,o=>new n(e,o,i))}constructor(e,t,i){this.key=e,this.value=t,this.negated=i,this.type=12}cmp(e){return e.type!==this.type?this.type-e.type:Cu(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}substituteConstants(){return this}evaluate(e){return typeof this.value=="string"?!1:parseFloat(e.getValue(this.key))>this.value}serialize(){return`${this.key} > ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=ay.create(this.key,this.value,this)),this.negated}},sy=class n{static create(e,t,i=null){return dy(t,o=>new n(e,o,i))}constructor(e,t,i){this.key=e,this.value=t,this.negated=i,this.type=13}cmp(e){return e.type!==this.type?this.type-e.type:Cu(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}substituteConstants(){return this}evaluate(e){return typeof this.value=="string"?!1:parseFloat(e.getValue(this.key))>=this.value}serialize(){return`${this.key} >= ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=ry.create(this.key,this.value,this)),this.negated}},ry=class n{static create(e,t,i=null){return dy(t,o=>new n(e,o,i))}constructor(e,t,i){this.key=e,this.value=t,this.negated=i,this.type=14}cmp(e){return e.type!==this.type?this.type-e.type:Cu(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}substituteConstants(){return this}evaluate(e){return typeof this.value=="string"?!1:parseFloat(e.getValue(this.key))new n(e,o,i))}constructor(e,t,i){this.key=e,this.value=t,this.negated=i,this.type=15}cmp(e){return e.type!==this.type?this.type-e.type:Cu(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}substituteConstants(){return this}evaluate(e){return typeof this.value=="string"?!1:parseFloat(e.getValue(this.key))<=this.value}serialize(){return`${this.key} <= ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=oy.create(this.key,this.value,this)),this.negated}},x0=class n{static create(e,t){return new n(e,t)}constructor(e,t){this.key=e,this.regexp=t,this.type=7,this.negated=null}cmp(e){if(e.type!==this.type)return this.type-e.type;if(this.keye.key)return 1;let t=this.regexp?this.regexp.source:"",i=e.regexp?e.regexp.source:"";return ti?1:0}equals(e){if(e.type===this.type){let t=this.regexp?this.regexp.source:"",i=e.regexp?e.regexp.source:"";return this.key===e.key&&t===i}return!1}substituteConstants(){return this}evaluate(e){let t=e.getValue(this.key);return this.regexp?this.regexp.test(t):!1}serialize(){let e=this.regexp?`/${this.regexp.source}/${this.regexp.flags}`:"/invalid/";return`${this.key} =~ ${e}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=uN.create(this)),this.negated}},uN=class n{static create(e){return new n(e)}constructor(e){this._actual=e,this.type=8}cmp(e){return e.type!==this.type?this.type-e.type:this._actual.cmp(e._actual)}equals(e){return e.type===this.type?this._actual.equals(e._actual):!1}substituteConstants(){return this}evaluate(e){return!this._actual.evaluate(e)}serialize(){return`!(${this._actual.serialize()})`}keys(){return this._actual.keys()}negate(){return this._actual}};ly=class n{static create(e,t,i){return n._normalizeArr(e,t,i)}constructor(e,t){this.expr=e,this.negated=t,this.type=6}cmp(e){if(e.type!==this.type)return this.type-e.type;if(this.expr.lengthe.expr.length)return 1;for(let t=0,i=this.expr.length;t1;){let r=o[o.length-1];if(r.type!==9)break;o.pop();let a=o.pop(),l=o.length===0,c=L0.create(r.expr.map(d=>n.create([d,a],null,i)),null,l);c&&(o.push(c),o.sort(y0))}if(o.length===1)return o[0];if(i){for(let r=0;re.serialize()).join(" && ")}keys(){let e=[];for(let t of this.expr)e.push(...t.keys());return e}negate(){if(!this.negated){let e=[];for(let t of this.expr)e.push(t.negate());this.negated=L0.create(e,this,!0)}return this.negated}},L0=class n{static create(e,t,i){return n._normalizeArr(e,t,i)}constructor(e,t){this.expr=e,this.negated=t,this.type=9}cmp(e){if(e.type!==this.type)return this.type-e.type;if(this.expr.lengthe.expr.length)return 1;for(let t=0,i=this.expr.length;te.serialize()).join(" || ")}keys(){let e=[];for(let t of this.expr)e.push(...t.keys());return e}negate(){if(!this.negated){let e=[];for(let t of this.expr)e.push(t.negate());for(;e.length>1;){let t=e.shift(),i=e.shift(),o=[];for(let s of t3(t))for(let r of t3(i))o.push(ly.create([s,r],null,!1));e.unshift(n.create(o,null,!1))}this.negated=n.create(e,this,!0)}return this.negated}},xe=class n extends bu{static all(){return n._info.values()}constructor(e,t,i){super(e,null),this._defaultValue=t,typeof i=="object"?n._info.push({...i,key:e}):i!==!0&&n._info.push({key:e,description:i,type:t!=null?typeof t:void 0})}bindTo(e){return e.createKey(this.key,this._defaultValue)}getValue(e){return e.getContextKeyValue(this.key)}toNegated(){return this.negate()}isEqualTo(e){return S0.create(this.key,e)}};xe._info=[];rt=De("contextKeyService")});function hy(n,e){if(!n)throw new Error(e?`Assertion failed (${e})`:"Assertion Failed")}function $g(n,e="Unreachable"){throw new Error(e)}function fN(n){n||ut(new St("Soft Assertion Failed"))}function Fr(n){if(!n()){debugger;n(),ut(new St("Assertion Failed"))}}function qg(n,e){let t=0;for(;t{"use strict";_();v();b();xt()});var gN,Vt,Oo=J(()=>{"use strict";_();v();b();Na();xi();gN=class{constructor(){this.data=new Map}add(e,t){hy(tn(e)),hy(dn(t)),hy(!this.data.has(e),"There is already an extension with this id"),this.data.set(e,t)}as(e){return this.data.get(e)||null}},Vt=new gN});function Zq(n,e){if(n.weight1!==e.weight1)return n.weight1-e.weight1;if(n.command&&e.command){if(n.commande.command)return 1}return n.weight2-e.weight2}var mN,Cl,Gq,k0=J(()=>{"use strict";_();v();b();Mg();Lt();ir();Oo();le();kr();mN=class n{constructor(){this._coreKeybindings=new Ii,this._extensionKeybindings=[],this._cachedMergedKeybindings=null}static bindToCurrentPlatform(e){if(po===1){if(e&&e.win)return e.win}else if(po===2){if(e&&e.mac)return e.mac}else if(e&&e.linux)return e.linux;return e}registerKeybindingRule(e){let t=n.bindToCurrentPlatform(e),i=new ae;if(t&&t.primary){let o=i0(t.primary,po);o&&i.add(this._registerDefaultKeybinding(o,e.id,e.args,e.weight,0,e.when))}if(t&&Array.isArray(t.secondary))for(let o=0,s=t.secondary.length;o{a(),this._cachedMergedKeybindings=null})}getDefaultKeybindings(){return this._cachedMergedKeybindings||(this._cachedMergedKeybindings=Array.from(this._coreKeybindings).concat(this._extensionKeybindings),this._cachedMergedKeybindings.sort(Zq)),this._cachedMergedKeybindings.slice(0)}},Cl=new mN,Gq={EditorModes:"platform.keybindingsRegistry"};Vt.add(Gq.EditorModes,Cl)});function jg(n){return n.command!==void 0}function r3(n){return n.submenu!==void 0}function ece(n){let e=new ae,t=new n,{f1:i,menu:o,keybinding:s,...r}=t.desc;if(Pi.getCommand(r.id))throw new Error(`Cannot register two commands with the same id: ${r.id}`);if(e.add(Pi.registerCommand({id:r.id,handler:(a,...l)=>t.run(a,...l),metadata:r.metadata})),Array.isArray(o))for(let a of o)e.add(Fs.appendMenuItem(a.id,{command:{...r,precondition:a.precondition===null?void 0:r.precondition},...a}));else o&&e.add(Fs.appendMenuItem(o.id,{command:{...r,precondition:o.precondition===null?void 0:r.precondition},...o}));if(i&&(e.add(Fs.appendMenuItem(A.CommandPalette,{command:r,when:r.precondition})),e.add(Fs.addCommand(r))),Array.isArray(s))for(let a of s)e.add(Cl.registerKeybindingRule({...a,id:r.id,when:r.precondition?Dt.and(r.precondition,a.when):a.when}));else s&&e.add(Cl.registerKeybindingRule({...s,id:r.id,when:r.precondition?Dt.and(r.precondition,s.when):s.when}));return e}var Yq,s3,fy,A,Wr,Vd,Fs,wl,Br,gy,zr=J(()=>{"use strict";_();v();b();Po();Ln();ye();le();kr();ir();Oi();qe();k0();Yq=function(n,e,t,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},s3=function(n,e){return function(t,i){e(t,i,n)}};A=class n{constructor(e){if(n._instances.has(e))throw new TypeError(`MenuId with identifier '${e}' already exists. Use MenuId.for(ident) or a unique identifier`);n._instances.set(e,this),this.id=e}};A._instances=new Map;A.CommandPalette=new A("CommandPalette");A.DebugBreakpointsContext=new A("DebugBreakpointsContext");A.DebugCallStackContext=new A("DebugCallStackContext");A.DebugConsoleContext=new A("DebugConsoleContext");A.DebugVariablesContext=new A("DebugVariablesContext");A.NotebookVariablesContext=new A("NotebookVariablesContext");A.DebugHoverContext=new A("DebugHoverContext");A.DebugWatchContext=new A("DebugWatchContext");A.DebugToolBar=new A("DebugToolBar");A.DebugToolBarStop=new A("DebugToolBarStop");A.EditorContext=new A("EditorContext");A.SimpleEditorContext=new A("SimpleEditorContext");A.EditorContent=new A("EditorContent");A.EditorLineNumberContext=new A("EditorLineNumberContext");A.EditorContextCopy=new A("EditorContextCopy");A.EditorContextPeek=new A("EditorContextPeek");A.EditorContextShare=new A("EditorContextShare");A.EditorTitle=new A("EditorTitle");A.EditorTitleRun=new A("EditorTitleRun");A.EditorTitleContext=new A("EditorTitleContext");A.EditorTitleContextShare=new A("EditorTitleContextShare");A.EmptyEditorGroup=new A("EmptyEditorGroup");A.EmptyEditorGroupContext=new A("EmptyEditorGroupContext");A.EditorTabsBarContext=new A("EditorTabsBarContext");A.EditorTabsBarShowTabsSubmenu=new A("EditorTabsBarShowTabsSubmenu");A.EditorTabsBarShowTabsZenModeSubmenu=new A("EditorTabsBarShowTabsZenModeSubmenu");A.EditorActionsPositionSubmenu=new A("EditorActionsPositionSubmenu");A.ExplorerContext=new A("ExplorerContext");A.ExplorerContextShare=new A("ExplorerContextShare");A.ExtensionContext=new A("ExtensionContext");A.GlobalActivity=new A("GlobalActivity");A.CommandCenter=new A("CommandCenter");A.CommandCenterCenter=new A("CommandCenterCenter");A.LayoutControlMenuSubmenu=new A("LayoutControlMenuSubmenu");A.LayoutControlMenu=new A("LayoutControlMenu");A.MenubarMainMenu=new A("MenubarMainMenu");A.MenubarAppearanceMenu=new A("MenubarAppearanceMenu");A.MenubarDebugMenu=new A("MenubarDebugMenu");A.MenubarEditMenu=new A("MenubarEditMenu");A.MenubarCopy=new A("MenubarCopy");A.MenubarFileMenu=new A("MenubarFileMenu");A.MenubarGoMenu=new A("MenubarGoMenu");A.MenubarHelpMenu=new A("MenubarHelpMenu");A.MenubarLayoutMenu=new A("MenubarLayoutMenu");A.MenubarNewBreakpointMenu=new A("MenubarNewBreakpointMenu");A.PanelAlignmentMenu=new A("PanelAlignmentMenu");A.PanelPositionMenu=new A("PanelPositionMenu");A.ActivityBarPositionMenu=new A("ActivityBarPositionMenu");A.MenubarPreferencesMenu=new A("MenubarPreferencesMenu");A.MenubarRecentMenu=new A("MenubarRecentMenu");A.MenubarSelectionMenu=new A("MenubarSelectionMenu");A.MenubarShare=new A("MenubarShare");A.MenubarSwitchEditorMenu=new A("MenubarSwitchEditorMenu");A.MenubarSwitchGroupMenu=new A("MenubarSwitchGroupMenu");A.MenubarTerminalMenu=new A("MenubarTerminalMenu");A.MenubarViewMenu=new A("MenubarViewMenu");A.MenubarHomeMenu=new A("MenubarHomeMenu");A.OpenEditorsContext=new A("OpenEditorsContext");A.OpenEditorsContextShare=new A("OpenEditorsContextShare");A.ProblemsPanelContext=new A("ProblemsPanelContext");A.SCMInputBox=new A("SCMInputBox");A.SCMChangesSeparator=new A("SCMChangesSeparator");A.SCMIncomingChanges=new A("SCMIncomingChanges");A.SCMIncomingChangesContext=new A("SCMIncomingChangesContext");A.SCMIncomingChangesSetting=new A("SCMIncomingChangesSetting");A.SCMOutgoingChanges=new A("SCMOutgoingChanges");A.SCMOutgoingChangesContext=new A("SCMOutgoingChangesContext");A.SCMOutgoingChangesSetting=new A("SCMOutgoingChangesSetting");A.SCMIncomingChangesAllChangesContext=new A("SCMIncomingChangesAllChangesContext");A.SCMIncomingChangesHistoryItemContext=new A("SCMIncomingChangesHistoryItemContext");A.SCMOutgoingChangesAllChangesContext=new A("SCMOutgoingChangesAllChangesContext");A.SCMOutgoingChangesHistoryItemContext=new A("SCMOutgoingChangesHistoryItemContext");A.SCMChangeContext=new A("SCMChangeContext");A.SCMResourceContext=new A("SCMResourceContext");A.SCMResourceContextShare=new A("SCMResourceContextShare");A.SCMResourceFolderContext=new A("SCMResourceFolderContext");A.SCMResourceGroupContext=new A("SCMResourceGroupContext");A.SCMSourceControl=new A("SCMSourceControl");A.SCMSourceControlInline=new A("SCMSourceControlInline");A.SCMSourceControlTitle=new A("SCMSourceControlTitle");A.SCMTitle=new A("SCMTitle");A.SearchContext=new A("SearchContext");A.SearchActionMenu=new A("SearchActionContext");A.StatusBarWindowIndicatorMenu=new A("StatusBarWindowIndicatorMenu");A.StatusBarRemoteIndicatorMenu=new A("StatusBarRemoteIndicatorMenu");A.StickyScrollContext=new A("StickyScrollContext");A.TestItem=new A("TestItem");A.TestItemGutter=new A("TestItemGutter");A.TestMessageContext=new A("TestMessageContext");A.TestMessageContent=new A("TestMessageContent");A.TestPeekElement=new A("TestPeekElement");A.TestPeekTitle=new A("TestPeekTitle");A.TouchBarContext=new A("TouchBarContext");A.TitleBarContext=new A("TitleBarContext");A.TitleBarTitleContext=new A("TitleBarTitleContext");A.TunnelContext=new A("TunnelContext");A.TunnelPrivacy=new A("TunnelPrivacy");A.TunnelProtocol=new A("TunnelProtocol");A.TunnelPortInline=new A("TunnelInline");A.TunnelTitle=new A("TunnelTitle");A.TunnelLocalAddressInline=new A("TunnelLocalAddressInline");A.TunnelOriginInline=new A("TunnelOriginInline");A.ViewItemContext=new A("ViewItemContext");A.ViewContainerTitle=new A("ViewContainerTitle");A.ViewContainerTitleContext=new A("ViewContainerTitleContext");A.ViewTitle=new A("ViewTitle");A.ViewTitleContext=new A("ViewTitleContext");A.CommentEditorActions=new A("CommentEditorActions");A.CommentThreadTitle=new A("CommentThreadTitle");A.CommentThreadActions=new A("CommentThreadActions");A.CommentThreadAdditionalActions=new A("CommentThreadAdditionalActions");A.CommentThreadTitleContext=new A("CommentThreadTitleContext");A.CommentThreadCommentContext=new A("CommentThreadCommentContext");A.CommentTitle=new A("CommentTitle");A.CommentActions=new A("CommentActions");A.CommentsViewThreadActions=new A("CommentsViewThreadActions");A.InteractiveToolbar=new A("InteractiveToolbar");A.InteractiveCellTitle=new A("InteractiveCellTitle");A.InteractiveCellDelete=new A("InteractiveCellDelete");A.InteractiveCellExecute=new A("InteractiveCellExecute");A.InteractiveInputExecute=new A("InteractiveInputExecute");A.IssueReporter=new A("IssueReporter");A.NotebookToolbar=new A("NotebookToolbar");A.NotebookStickyScrollContext=new A("NotebookStickyScrollContext");A.NotebookCellTitle=new A("NotebookCellTitle");A.NotebookCellDelete=new A("NotebookCellDelete");A.NotebookCellInsert=new A("NotebookCellInsert");A.NotebookCellBetween=new A("NotebookCellBetween");A.NotebookCellListTop=new A("NotebookCellTop");A.NotebookCellExecute=new A("NotebookCellExecute");A.NotebookCellExecuteGoTo=new A("NotebookCellExecuteGoTo");A.NotebookCellExecutePrimary=new A("NotebookCellExecutePrimary");A.NotebookDiffCellInputTitle=new A("NotebookDiffCellInputTitle");A.NotebookDiffCellMetadataTitle=new A("NotebookDiffCellMetadataTitle");A.NotebookDiffCellOutputsTitle=new A("NotebookDiffCellOutputsTitle");A.NotebookOutputToolbar=new A("NotebookOutputToolbar");A.NotebookOutlineFilter=new A("NotebookOutlineFilter");A.NotebookOutlineActionMenu=new A("NotebookOutlineActionMenu");A.NotebookEditorLayoutConfigure=new A("NotebookEditorLayoutConfigure");A.NotebookKernelSource=new A("NotebookKernelSource");A.BulkEditTitle=new A("BulkEditTitle");A.BulkEditContext=new A("BulkEditContext");A.TimelineItemContext=new A("TimelineItemContext");A.TimelineTitle=new A("TimelineTitle");A.TimelineTitleContext=new A("TimelineTitleContext");A.TimelineFilterSubMenu=new A("TimelineFilterSubMenu");A.AccountsContext=new A("AccountsContext");A.SidebarTitle=new A("SidebarTitle");A.PanelTitle=new A("PanelTitle");A.AuxiliaryBarTitle=new A("AuxiliaryBarTitle");A.AuxiliaryBarHeader=new A("AuxiliaryBarHeader");A.TerminalInstanceContext=new A("TerminalInstanceContext");A.TerminalEditorInstanceContext=new A("TerminalEditorInstanceContext");A.TerminalNewDropdownContext=new A("TerminalNewDropdownContext");A.TerminalTabContext=new A("TerminalTabContext");A.TerminalTabEmptyAreaContext=new A("TerminalTabEmptyAreaContext");A.TerminalStickyScrollContext=new A("TerminalStickyScrollContext");A.WebviewContext=new A("WebviewContext");A.InlineCompletionsActions=new A("InlineCompletionsActions");A.InlineEditActions=new A("InlineEditActions");A.NewFile=new A("NewFile");A.MergeInput1Toolbar=new A("MergeToolbar1Toolbar");A.MergeInput2Toolbar=new A("MergeToolbar2Toolbar");A.MergeBaseToolbar=new A("MergeBaseToolbar");A.MergeInputResultToolbar=new A("MergeToolbarResultToolbar");A.InlineSuggestionToolbar=new A("InlineSuggestionToolbar");A.InlineEditToolbar=new A("InlineEditToolbar");A.ChatContext=new A("ChatContext");A.ChatCodeBlock=new A("ChatCodeblock");A.ChatCompareBlock=new A("ChatCompareBlock");A.ChatMessageTitle=new A("ChatMessageTitle");A.ChatExecute=new A("ChatExecute");A.ChatExecuteSecondary=new A("ChatExecuteSecondary");A.ChatInputSide=new A("ChatInputSide");A.AccessibleView=new A("AccessibleView");A.MultiDiffEditorFileToolbar=new A("MultiDiffEditorFileToolbar");A.DiffEditorHunkToolbar=new A("DiffEditorHunkToolbar");A.DiffEditorSelectionToolbar=new A("DiffEditorSelectionToolbar");Wr=De("menuService"),Vd=class n{static for(e){let t=this._all.get(e);return t||(t=new n(e),this._all.set(e,t)),t}static merge(e){let t=new Set;for(let i of e)i instanceof n&&t.add(i.id);return t}constructor(e){this.id=e,this.has=t=>t===e}};Vd._all=new Map;Fs=new class{constructor(){this._commands=new Map,this._menuItems=new Map,this._onDidChangeMenu=new cC({merge:Vd.merge}),this.onDidChangeMenu=this._onDidChangeMenu.event}addCommand(n){return this._commands.set(n.id,n),this._onDidChangeMenu.fire(Vd.for(A.CommandPalette)),be(()=>{this._commands.delete(n.id)&&this._onDidChangeMenu.fire(Vd.for(A.CommandPalette))})}getCommand(n){return this._commands.get(n)}getCommands(){let n=new Map;return this._commands.forEach((e,t)=>n.set(t,e)),n}appendMenuItem(n,e){let t=this._menuItems.get(n);t||(t=new Ii,this._menuItems.set(n,t));let i=t.push(e);return this._onDidChangeMenu.fire(Vd.for(n)),be(()=>{i(),this._onDidChangeMenu.fire(Vd.for(n))})}appendMenuItems(n){let e=new ae;for(let{id:t,item:i}of n)e.add(this.appendMenuItem(t,i));return e}getMenuItems(n){let e;return this._menuItems.has(n)?e=[...this._menuItems.get(n)]:e=[],n===A.CommandPalette&&this._appendImplicitItems(e),e}_appendImplicitItems(n){let e=new Set;for(let t of n)jg(t)&&(e.add(t.command.id),t.alt&&e.add(t.alt.id));this._commands.forEach((t,i)=>{e.has(i)||n.push({command:t})})}},wl=class extends bl{constructor(e,t,i){super(`submenuitem.${e.submenu.id}`,typeof e.title=="string"?e.title:e.title.value,i,"submenu"),this.item=e,this.hideActions=t}},Br=fy=class{static label(e,t){return t?.renderShortTitle&&e.shortTitle?typeof e.shortTitle=="string"?e.shortTitle:e.shortTitle.value:typeof e.title=="string"?e.title:e.title.value}constructor(e,t,i,o,s,r,a){var l,c;this.hideActions=o,this.menuKeybinding=s,this._commandService=a,this.id=e.id,this.label=fy.label(e,i),this.tooltip=(c=typeof e.tooltip=="string"?e.tooltip:(l=e.tooltip)===null||l===void 0?void 0:l.value)!==null&&c!==void 0?c:"",this.enabled=!e.precondition||r.contextMatchesRules(e.precondition),this.checked=void 0;let d;if(e.toggled){let h=e.toggled.condition?e.toggled:{condition:e.toggled};this.checked=r.contextMatchesRules(h.condition),this.checked&&h.tooltip&&(this.tooltip=typeof h.tooltip=="string"?h.tooltip:h.tooltip.value),this.checked&&Xe.isThemeIcon(h.icon)&&(d=h.icon),this.checked&&h.title&&(this.label=typeof h.title=="string"?h.title:h.title.value)}d||(d=Xe.isThemeIcon(e.icon)?e.icon:void 0),this.item=e,this.alt=t?new fy(t,void 0,i,o,void 0,r,a):void 0,this._options=i,this.class=d&&Xe.asClassName(d)}run(...e){var t,i;let o=[];return!((t=this._options)===null||t===void 0)&&t.arg&&(o=[...o,this._options.arg]),!((i=this._options)===null||i===void 0)&&i.shouldForwardArgs&&(o=[...o,...e]),this._commandService.executeCommand(this.id,...o)}};Br=fy=Yq([s3(5,rt),s3(6,kn)],Br);gy=class{constructor(e){this.desc=e}}});var nr,Gg=J(()=>{"use strict";_();v();b();qe();nr=De("telemetryService")});function Xq(n){switch(n){case Dn.Trace:return"trace";case Dn.Debug:return"debug";case Dn.Info:return"info";case Dn.Warning:return"warn";case Dn.Error:return"error";case Dn.Off:return"off"}}var En,Dn,a3,my,py,_y,mce,Aa=J(()=>{"use strict";_();v();b();ye();le();Oi();qe();En=De("logService");(function(n){n[n.Off=0]="Off",n[n.Trace=1]="Trace",n[n.Debug=2]="Debug",n[n.Info=3]="Info",n[n.Warning=4]="Warning",n[n.Error=5]="Error"})(Dn||(Dn={}));a3=Dn.Info,my=class extends H{constructor(){super(...arguments),this.level=a3,this._onDidChangeLogLevel=this._register(new B),this.onDidChangeLogLevel=this._onDidChangeLogLevel.event}setLevel(e){this.level!==e&&(this.level=e,this._onDidChangeLogLevel.fire(this.level))}getLevel(){return this.level}checkLogLevel(e){return this.level!==Dn.Off&&this.level<=e}},py=class extends my{constructor(e=a3,t=!0){super(),this.useColors=t,this.setLevel(e)}trace(e,...t){this.checkLogLevel(Dn.Trace)&&(this.useColors?console.log("%cTRACE","color: #888",e,...t):console.log(e,...t))}debug(e,...t){this.checkLogLevel(Dn.Debug)&&(this.useColors?console.log("%cDEBUG","background: #eee; color: #888",e,...t):console.log(e,...t))}info(e,...t){this.checkLogLevel(Dn.Info)&&(this.useColors?console.log("%c INFO","color: #33f",e,...t):console.log(e,...t))}warn(e,...t){this.checkLogLevel(Dn.Warning)&&(this.useColors?console.log("%c WARN","color: #993",e,...t):console.log(e,...t))}error(e,...t){this.checkLogLevel(Dn.Error)&&(this.useColors?console.log("%c ERR","color: #f33",e,...t):console.error(e,...t))}},_y=class extends my{constructor(e){super(),this.loggers=e,e.length&&this.setLevel(e[0].getLevel())}setLevel(e){for(let t of this.loggers)t.setLevel(e);super.setLevel(e)}trace(e,...t){for(let i of this.loggers)i.trace(e,...t)}debug(e,...t){for(let i of this.loggers)i.debug(e,...t)}info(e,...t){for(let i of this.loggers)i.info(e,...t)}warn(e,...t){for(let i of this.loggers)i.warn(e,...t)}error(e,...t){for(let i of this.loggers)i.error(e,...t)}dispose(){for(let e of this.loggers)e.dispose();super.dispose()}};mce=new xe("logLevel",Xq(Dn.Info))});function Oce(n,e){Pi.registerCommand(n,function(t,...i){let o=t.get(Ye),[s,r]=i;Ms(Oe.isUri(s)),Ms(U.isIPosition(r));let a=t.get(xn).getModel(s);if(a){let l=U.lift(r);return o.invokeFunction(e,a,l,...i.slice(2))}return t.get(Wd).createModelReference(s).then(l=>new Promise((c,d)=>{try{let h=o.invokeFunction(e,l.object.textEditorModel,U.lift(r),i.slice(2));c(h)}catch(h){d(h)}}).finally(()=>{l.dispose()}))})}function Je(n){return vs.INSTANCE.registerEditorCommand(n),n}function Fce(n){let e=new n;return vs.INSTANCE.registerEditorAction(e),e}function Bce(n){return vs.INSTANCE.registerEditorAction(n),n}function Wce(n){vs.INSTANCE.registerEditorAction(n)}function vy(n,e,t){vs.INSTANCE.registerEditorContribution(n,e,t)}function E0(n){return n.register(),n}var wu,D0,by,yl,pN,l3,c3,Hd,Qq,vs,_N,bN,d3,Ud=J(()=>{"use strict";_();v();b();Ge();sn();Or();ft();_u();Jw();zr();ir();Oi();qe();k0();Oo();Gg();xi();Aa();ke();wu=class{constructor(e){this.id=e.id,this.precondition=e.precondition,this._kbOpts=e.kbOpts,this._menuOpts=e.menuOpts,this.metadata=e.metadata}register(){if(Array.isArray(this._menuOpts)?this._menuOpts.forEach(this._registerMenuItem,this):this._menuOpts&&this._registerMenuItem(this._menuOpts),this._kbOpts){let e=Array.isArray(this._kbOpts)?this._kbOpts:[this._kbOpts];for(let t of e){let i=t.kbExpr;this.precondition&&(i?i=Dt.and(i,this.precondition):i=this.precondition);let o={id:this.id,weight:t.weight,args:t.args,when:i,primary:t.primary,secondary:t.secondary,win:t.win,linux:t.linux,mac:t.mac};Cl.registerKeybindingRule(o)}}Pi.registerCommand({id:this.id,handler:(e,t)=>this.runCommand(e,t),metadata:this.metadata})}_registerMenuItem(e){Fs.appendMenuItem(e.menuId,{group:e.group,command:{id:this.id,title:e.title,icon:e.icon,precondition:this.precondition},when:e.when,order:e.order})}},D0=class extends wu{constructor(){super(...arguments),this._implementations=[]}addImplementation(e,t,i,o){return this._implementations.push({priority:e,name:t,implementation:i,when:o}),this._implementations.sort((s,r)=>r.priority-s.priority),{dispose:()=>{for(let s=0;s{if(a.get(rt).contextMatchesRules(i??void 0))return o(a,r,t)})}runCommand(e,t){return n.runEditorCommand(e,t,this.precondition,(i,o,s)=>this.runEditorCommand(i,o,s))}},pN=class n extends yl{static convertOptions(e){let t;Array.isArray(e.menuOpts)?t=e.menuOpts:e.menuOpts?t=[e.menuOpts]:t=[];function i(o){return o.menuId||(o.menuId=A.EditorContext),o.title||(o.title=e.label),o.when=Dt.and(e.precondition,o.when),o}return Array.isArray(e.contextMenuOpts)?t.push(...e.contextMenuOpts.map(i)):e.contextMenuOpts&&t.push(i(e.contextMenuOpts)),e.menuOpts=t,e}constructor(e){super(n.convertOptions(e)),this.label=e.label,this.alias=e.alias}runEditorCommand(e,t,i){return this.reportTelemetry(e,t),this.run(e,t,i||{})}reportTelemetry(e,t){e.get(nr).publicLog2("editorActionInvoked",{name:this.label,id:this.id})}},l3=class extends pN{constructor(){super(...arguments),this._implementations=[]}addImplementation(e,t){return this._implementations.push([e,t]),this._implementations.sort((i,o)=>o[0]-i[0]),{dispose:()=>{for(let i=0;i{var r,a;let l=s.get(rt),c=s.get(En);if(!l.contextMatchesRules((r=this.desc.precondition)!==null&&r!==void 0?r:void 0)){c.debug("[EditorAction2] NOT running command because its precondition is FALSE",this.desc.id,(a=this.desc.precondition)===null||a===void 0?void 0:a.serialize());return}return this.runEditorCommand(s,o,...t)})}};(function(n){function e(r){return vs.INSTANCE.getEditorCommand(r)}n.getEditorCommand=e;function t(){return vs.INSTANCE.getEditorActions()}n.getEditorActions=t;function i(){return vs.INSTANCE.getEditorContributions()}n.getEditorContributions=i;function o(r){return vs.INSTANCE.getEditorContributions().filter(a=>r.indexOf(a.id)>=0)}n.getSomeEditorContributions=o;function s(){return vs.INSTANCE.getDiffEditorContributions()}n.getDiffEditorContributions=s})(Hd||(Hd={}));Qq={EditorCommonContributions:"editor.contributions"},vs=class{constructor(){this.editorContributions=[],this.diffEditorContributions=[],this.editorActions=[],this.editorCommands=Object.create(null)}registerEditorContribution(e,t,i){this.editorContributions.push({id:e,ctor:t,instantiation:i})}getEditorContributions(){return this.editorContributions.slice(0)}getDiffEditorContributions(){return this.diffEditorContributions.slice(0)}registerEditorAction(e){e.register(),this.editorActions.push(e)}getEditorActions(){return this.editorActions}registerEditorCommand(e){e.register(),this.editorCommands[e.id]=e}getEditorCommand(e){return this.editorCommands[e]||null}};vs.INSTANCE=new vs;Vt.add(Qq.EditorCommonContributions,vs.INSTANCE);_N=E0(new D0({id:"undo",precondition:void 0,kbOpts:{weight:0,primary:2104},menuOpts:[{menuId:A.MenubarEditMenu,group:"1_do",title:p({key:"miUndo",comment:["&& denotes a mnemonic"]},"&&Undo"),order:1},{menuId:A.CommandPalette,group:"",title:p("undo","Undo"),order:1}]}));E0(new by(_N,{id:"default:undo",precondition:void 0}));bN=E0(new D0({id:"redo",precondition:void 0,kbOpts:{weight:0,primary:2103,secondary:[3128],mac:{primary:3128}},menuOpts:[{menuId:A.MenubarEditMenu,group:"1_do",title:p({key:"miRedo",comment:["&& denotes a mnemonic"]},"&&Redo"),order:2},{menuId:A.CommandPalette,group:"",title:p("redo","Redo"),order:1}]}));E0(new by(bN,{id:"default:redo",precondition:void 0}));d3=E0(new D0({id:"editor.action.selectAll",precondition:void 0,kbOpts:{weight:0,kbExpr:null,primary:2079},menuOpts:[{menuId:A.MenubarSelectionMenu,group:"1_basic",title:p({key:"miSelectAll",comment:["&& denotes a mnemonic"]},"&&Select All"),order:1},{menuId:A.CommandPalette,group:"",title:p("selectAll","Select All"),order:1}]}))});function N0(n,e,t){n.has(e)?n.get(e).push(t):n.set(e,[t])}var Vi,Zg,yy,yu=J(()=>{"use strict";_();v();b();(function(n){n[n.None=0]="None",n[n.Indent=1]="Indent",n[n.IndentOutdent=2]="IndentOutdent",n[n.Outdent=3]="Outdent"})(Vi||(Vi={}));Zg=class{constructor(e){if(this._neutralCharacter=null,this._neutralCharacterSearched=!1,this.open=e.open,this.close=e.close,this._inString=!0,this._inComment=!0,this._inRegEx=!0,Array.isArray(e.notIn))for(let t=0,i=e.notIn.length;t0&&n.getLanguageId(r-1)===o;)r--;return new LN(n,o,r,s+1,n.getStartOffset(r),n.getEndOffset(s))}function Vr(n){return(n&3)!==0}var LN,Su=J(()=>{"use strict";_();v();b();LN=class{constructor(e,t,i,o,s,r){this._scopedLineTokensBrand=void 0,this._actual=e,this.languageId=t,this._firstTokenIndex=i,this._lastTokenIndex=o,this.firstCharOffset=s,this._lastCharOffset=r}getLineContent(){return this._actual.getLineContent().substring(this.firstCharOffset,this._lastCharOffset)}getActualLineContentBefore(e){return this._actual.getLineContent().substring(0,this.firstCharOffset+e)}getTokenCount(){return this._lastTokenIndex-this._firstTokenIndex}findTokenIndexAtOffset(e){return this._actual.findTokenIndexAtOffset(e+this.firstCharOffset)-this._firstTokenIndex}getStandardTokenType(e){return this._actual.getStandardTokenType(e+this._firstTokenIndex)}}});var Yg,m3=J(()=>{"use strict";_();v();b();yu();Yg=class n{constructor(e){if(e.autoClosingPairs?this._autoClosingPairs=e.autoClosingPairs.map(t=>new Zg(t)):e.brackets?this._autoClosingPairs=e.brackets.map(t=>new Zg({open:t[0],close:t[1]})):this._autoClosingPairs=[],e.__electricCharacterSupport&&e.__electricCharacterSupport.docComment){let t=e.__electricCharacterSupport.docComment;this._autoClosingPairs.push(new Zg({open:t.open,close:t.close||""}))}this._autoCloseBeforeForQuotes=typeof e.autoCloseBefore=="string"?e.autoCloseBefore:n.DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED_QUOTES,this._autoCloseBeforeForBrackets=typeof e.autoCloseBefore=="string"?e.autoCloseBefore:n.DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED_BRACKETS,this._surroundingPairs=e.surroundingPairs||this._autoClosingPairs}getAutoClosingPairs(){return this._autoClosingPairs}getAutoCloseBeforeSet(e){return e?this._autoCloseBeforeForQuotes:this._autoCloseBeforeForBrackets}getSurroundingPairs(){return this._surroundingPairs}};Yg.DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED_QUOTES=`;:.,=}])> + `;Yg.DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED_BRACKETS=`'"\`;:.,=}])> + `});function _3(n,e){return n[e+0]<<0>>>0|n[e+1]<<8>>>0}function b3(n,e,t){n[t+0]=e&255,e=e>>>8,n[t+1]=e&255}function or(n,e){return n[e]*2**24+n[e+1]*2**16+n[e+2]*2**8+n[e+3]}function sr(n,e,t){n[t+3]=e,e=e>>>8,n[t+2]=e,e=e>>>8,n[t+1]=e,e=e>>>8,n[t]=e}function DN(n,e){return n[e]}function EN(n,e,t){n[t]=e}var p3,Dde,kN,Sy,A0=J(()=>{"use strict";_();v();b();Md();p3=typeof E<"u",Dde=new qn(()=>new Uint8Array(256)),Sy=class n{static wrap(e){return p3&&!E.isBuffer(e)&&(e=E.from(e.buffer,e.byteOffset,e.byteLength)),new n(e)}constructor(e){this.buffer=e,this.byteLength=this.buffer.byteLength}toString(){return p3?this.buffer.toString():(kN||(kN=new TextDecoder),kN.decode(this.buffer))}}});function v3(){return TN||(TN=new TextDecoder("UTF-16LE")),TN}function nj(){return NN||(NN=new TextDecoder("UTF-16BE")),NN}function MN(){return AN||(AN=p9()?v3():nj()),AN}function C3(n,e,t){let i=new Uint16Array(n.buffer,e,t);return t>0&&(i[0]===65279||i[0]===65534)?oj(n,e,t):v3().decode(i)}function oj(n,e,t){let i=[],o=0;for(let s=0;s{"use strict";_();v();b();ot();Lt();A0();Sl=class{constructor(e){this._capacity=e|0,this._buffer=new Uint16Array(this._capacity),this._completedStrings=null,this._bufferLength=0}reset(){this._completedStrings=null,this._bufferLength=0}build(){return this._completedStrings!==null?(this._flushBuffer(),this._completedStrings.join("")):this._buildBuffer()}_buildBuffer(){if(this._bufferLength===0)return"";let e=new Uint16Array(this._buffer.buffer,0,this._bufferLength);return MN().decode(e)}_flushBuffer(){let e=this._buildBuffer();this._bufferLength=0,this._completedStrings===null?this._completedStrings=[e]:this._completedStrings[this._completedStrings.length]=e}appendCharCode(e){let t=this._capacity-this._bufferLength;t<=1&&(t===0||pi(e))&&this._flushBuffer(),this._buffer[this._bufferLength++]=e}appendASCIICharCode(e){this._bufferLength===this._capacity&&this._flushBuffer(),this._buffer[this._bufferLength++]=e}appendString(e){let t=e.length;if(this._bufferLength+t>=this._capacity){this._flushBuffer(),this._completedStrings[this._completedStrings.length]=e;return}for(let i=0;i[r[0].toLowerCase(),r[1].toLowerCase()]);let t=[];for(let r=0;r{let[l,c]=r,[d,h]=a;return l===d||l===h||c===d||c===h},o=(r,a)=>{let l=Math.min(r,a),c=Math.max(r,a);for(let d=0;d0&&s.push({open:a,close:l})}return s}function w3(n,e,t,i){for(let o=0,s=e.length;o=0&&i.push(a);for(let a of r.close)a.indexOf(n)>=0&&i.push(a)}}function y3(n,e){return n.length-e.length}function Ly(n){if(n.length<=1)return n;let e=[],t=new Set;for(let i of n)t.has(i)||(e.push(i),t.add(i));return e}function aj(n,e,t,i){let o=[];o=o.concat(n),o=o.concat(e);for(let s=0,r=o.length;s{"use strict";_();v();b();ot();xu();Ke();RN=class n{constructor(e,t,i,o,s,r){this._richEditBracketBrand=void 0,this.languageId=e,this.index=t,this.open=i,this.close=o,this.forwardRegex=s,this.reversedRegex=r,this._openSet=n._toSet(this.open),this._closeSet=n._toSet(this.close)}isOpen(e){return this._openSet.has(e)}isClose(e){return this._closeSet.has(e)}static _toSet(e){let t=new Set;for(let i of e)t.add(i);return t}};xy=class{constructor(e,t){this._richEditBracketsBrand=void 0;let i=rj(t);this.brackets=i.map((o,s)=>new RN(e,s,o.open,o.close,aj(o.open,o.close,i,s),lj(o.open,o.close,i,s))),this.forwardRegex=cj(this.brackets),this.reversedRegex=dj(this.brackets),this.textIsBracket={},this.textIsOpenBracket={},this.maxBracketLength=0;for(let o of this.brackets){for(let s of o.open)this.textIsBracket[s]=o,this.textIsOpenBracket[s]=!0,this.maxBracketLength=Math.max(this.maxBracketLength,s.length);for(let s of o.close)this.textIsBracket[s]=o,this.textIsOpenBracket[s]=!1,this.maxBracketLength=Math.max(this.maxBracketLength,s.length)}}};PN=function(){function n(i){let o=new Uint16Array(i.length),s=0;for(let r=i.length-1;r>=0;r--)o[s++]=i.charCodeAt(r);return MN().decode(o)}let e=null,t=null;return function(o){return e!==o&&(e=o,t=n(e)),t}}(),Jo=class{static _findPrevBracketInText(e,t,i,o){let s=i.match(e);if(!s)return null;let r=i.length-(s.index||0),a=s[0].length,l=o+r;return new P(t,l-a+1,t,l+1)}static findPrevBracketInRange(e,t,i,o,s){let a=PN(i).substring(i.length-s,i.length-o);return this._findPrevBracketInText(e,t,a,o)}static findNextBracketInText(e,t,i,o){let s=i.match(e);if(!s)return null;let r=s.index||0,a=s[0].length;if(a===0)return null;let l=o+r;return new P(t,l+1,t,l+1+a)}static findNextBracketInRange(e,t,i,o,s){let r=i.substring(o,s);return this.findNextBracketInText(e,t,r,o)}}});var Ey,S3=J(()=>{"use strict";_();v();b();wt();Su();Dy();Ey=class{constructor(e){this._richEditBrackets=e}getElectricCharacters(){let e=[];if(this._richEditBrackets)for(let t of this._richEditBrackets.brackets)for(let i of t.close){let o=i.charAt(i.length-1);e.push(o)}return xr(e)}onElectricCharacter(e,t,i){if(!this._richEditBrackets||this._richEditBrackets.brackets.length===0)return null;let o=t.findTokenIndexAtOffset(i-1);if(Vr(t.getStandardTokenType(o)))return null;let s=this._richEditBrackets.reversedRegex,r=t.getLineContent().substring(0,i-1)+e,a=Jo.findPrevBracketInRange(s,1,r,0,r.length);if(!a)return null;let l=r.substring(a.startColumn-1,a.endColumn-1).toLowerCase();if(this._richEditBrackets.textIsOpenBracket[l])return null;let d=t.getActualLineContentBefore(a.startColumn-1);return/^\s*$/.test(d)?{matchOpenBracket:l}:null}}});function Iy(n){return n.global&&(n.lastIndex=0),!0}var Ty,x3=J(()=>{"use strict";_();v();b();Ty=class{constructor(e){this._indentationRules=e}shouldIncrease(e){return!!(this._indentationRules&&this._indentationRules.increaseIndentPattern&&Iy(this._indentationRules.increaseIndentPattern)&&this._indentationRules.increaseIndentPattern.test(e))}shouldDecrease(e){return!!(this._indentationRules&&this._indentationRules.decreaseIndentPattern&&Iy(this._indentationRules.decreaseIndentPattern)&&this._indentationRules.decreaseIndentPattern.test(e))}shouldIndentNextLine(e){return!!(this._indentationRules&&this._indentationRules.indentNextLinePattern&&Iy(this._indentationRules.indentNextLinePattern)&&this._indentationRules.indentNextLinePattern.test(e))}shouldIgnore(e){return!!(this._indentationRules&&this._indentationRules.unIndentedLinePattern&&Iy(this._indentationRules.unIndentedLinePattern)&&this._indentationRules.unIndentedLinePattern.test(e))}getIndentMetadata(e){let t=0;return this.shouldIncrease(e)&&(t+=1),this.shouldDecrease(e)&&(t+=2),this.shouldIndentNextLine(e)&&(t+=4),this.shouldIgnore(e)&&(t+=8),t}}});var Ny,L3=J(()=>{"use strict";_();v();b();xt();ot();yu();Ny=class n{constructor(e){e=e||{},e.brackets=e.brackets||[["(",")"],["{","}"],["[","]"]],this._brackets=[],e.brackets.forEach(t=>{let i=n._createOpenBracketRegExp(t[0]),o=n._createCloseBracketRegExp(t[1]);i&&o&&this._brackets.push({open:t[0],openRegExp:i,close:t[1],closeRegExp:o})}),this._regExpRules=e.onEnterRules||[]}onEnter(e,t,i,o){if(e>=3)for(let s=0,r=this._regExpRules.length;sc.reg?(c.reg.lastIndex=0,c.reg.test(c.text)):!0))return a.action}if(e>=2&&i.length>0&&o.length>0)for(let s=0,r=this._brackets.length;s=2&&i.length>0){for(let s=0,r=this._brackets.length;s"u"?t:s}function E3(n){return n.replace(/[\[\]]/g,"")}var Rt,Fo=J(()=>{"use strict";_();v();b();qe();Rt=De("configurationService")});var ii,Hr=J(()=>{"use strict";_();v();b();qe();ii=De("languageService")});var Cs,My=J(()=>{"use strict";_();v();b();Cs=class{constructor(e,t=[],i=!1){this.ctor=e,this.staticArguments=t,this.supportsDelayedInstantiation=i}}});function _t(n,e,t){e instanceof Cs||(e=new Cs(e,[],!!t)),I3.push([n,e])}function BN(){return I3}var I3,Ur=J(()=>{"use strict";_();v();b();My();I3=[]});var rr,M0=J(()=>{"use strict";_();v();b();rr=Object.freeze({text:"text/plain",binary:"application/octet-stream",unknown:"application/unknown",markdown:"text/markdown",latex:"text/latex",uriList:"text/uri-list"})});function uj(n){return n.length>0&&n.charAt(n.length-1)==="#"?n.substring(0,n.length-1):n}var Lu,WN,fj,Ry=J(()=>{"use strict";_();v();b();ye();Oo();Lu={JSONContribution:"base.contributions.json"};WN=class{constructor(){this._onDidChangeSchema=new B,this.schemasById={}}registerSchema(e,t){this.schemasById[uj(e)]=t,this._onDidChangeSchema.fire(e)}notifySchemaChanged(e){this._onDidChangeSchema.fire(e)}},fj=new WN;Vt.add(Lu.JSONContribution,fj)});function P0(n){let e=[];if(Tc.test(n)){let t=N3.exec(n);for(;t?.length;){let i=t[1].trim();i&&e.push(i),t=N3.exec(n)}}return xr(e)}function gj(n){switch(Array.isArray(n)?n[0]:n){case"boolean":return!1;case"integer":case"number":return 0;case"string":return"";case"array":return[];case"object":return{};default:return null}}function mj(n,e){var t,i,o,s;return n.trim()?Tc.test(n)?p("config.property.languageDefault","Cannot register '{0}'. This matches property pattern '\\\\[.*\\\\]$' for describing language specific editor settings. Use 'configurationDefaults' contribution.",n):Oy.getConfigurationProperties()[n]!==void 0?p("config.property.duplicate","Cannot register '{0}'. This property is already registered.",n):!((t=e.policy)===null||t===void 0)&&t.name&&Oy.getPolicyConfigurations().get((i=e.policy)===null||i===void 0?void 0:i.name)!==void 0?p("config.policy.duplicate","Cannot register '{0}'. The associated policy {1} is already registered with {2}.",n,(o=e.policy)===null||o===void 0?void 0:o.name,Oy.getPolicyConfigurations().get((s=e.policy)===null||s===void 0?void 0:s.name)):null:p("config.property.empty","Cannot register an empty property")}var ar,zN,VN,HN,UN,KN,Py,R0,T3,$N,A3,N3,ku,Tc,Oy,Du=J(()=>{"use strict";_();v();b();wt();ye();xi();Ge();Fo();Ry();Oo();ar={Configuration:"base.contributions.configuration"},zN={properties:{},patternProperties:{}},VN={properties:{},patternProperties:{}},HN={properties:{},patternProperties:{}},UN={properties:{},patternProperties:{}},KN={properties:{},patternProperties:{}},Py={properties:{},patternProperties:{}},R0="vscode://schemas/settings/resourceLanguage",T3=Vt.as(Lu.JSONContribution),$N=class{constructor(){this.overrideIdentifiers=new Set,this._onDidSchemaChange=new B,this._onDidUpdateConfiguration=new B,this.configurationDefaultsOverrides=new Map,this.defaultLanguageConfigurationOverridesNode={id:"defaultOverrides",title:p("defaultLanguageConfigurationOverrides.title","Default Language Configuration Overrides"),properties:{}},this.configurationContributors=[this.defaultLanguageConfigurationOverridesNode],this.resourceLanguageSettingsSchema={properties:{},patternProperties:{},additionalProperties:!0,allowTrailingCommas:!0,allowComments:!0},this.configurationProperties={},this.policyConfigurations=new Map,this.excludedConfigurationProperties={},T3.registerSchema(R0,this.resourceLanguageSettingsSchema),this.registerOverridePropertyPatternKey()}registerConfiguration(e,t=!0){this.registerConfigurations([e],t)}registerConfigurations(e,t=!0){let i=new Set;this.doRegisterConfigurations(e,t,i),T3.registerSchema(R0,this.resourceLanguageSettingsSchema),this._onDidSchemaChange.fire(),this._onDidUpdateConfiguration.fire({properties:i})}registerDefaultConfigurations(e){let t=new Set;this.doRegisterDefaultConfigurations(e,t),this._onDidSchemaChange.fire(),this._onDidUpdateConfiguration.fire({properties:t,defaultsOverrides:!0})}doRegisterDefaultConfigurations(e,t){var i;let o=[];for(let{overrides:s,source:r}of e)for(let a in s)if(t.add(a),Tc.test(a)){let l=this.configurationDefaultsOverrides.get(a),c=(i=l?.valuesSources)!==null&&i!==void 0?i:new Map;if(r)for(let f of Object.keys(s[a]))c.set(f,r);let d={...l?.value||{},...s[a]};this.configurationDefaultsOverrides.set(a,{source:r,value:d,valuesSources:c});let h=E3(a),u={type:"object",default:d,description:p("defaultLanguageConfiguration.description","Configure settings to be overridden for the {0} language.",h),$ref:R0,defaultDefaultValue:d,source:tn(r)?void 0:r,defaultValueSource:r};o.push(...P0(a)),this.configurationProperties[a]=u,this.defaultLanguageConfigurationOverridesNode.properties[a]=u}else{this.configurationDefaultsOverrides.set(a,{value:s[a],source:r});let l=this.configurationProperties[a];l&&(this.updatePropertyDefaultValue(a,l),this.updateSchema(a,l))}this.doRegisterOverrideIdentifiers(o)}registerOverrideIdentifiers(e){this.doRegisterOverrideIdentifiers(e),this._onDidSchemaChange.fire()}doRegisterOverrideIdentifiers(e){for(let t of e)this.overrideIdentifiers.add(t);this.updateOverridePropertyPatternKey()}doRegisterConfigurations(e,t,i){e.forEach(o=>{this.validateAndRegisterProperties(o,t,o.extensionInfo,o.restrictedProperties,void 0,i),this.configurationContributors.push(o),this.registerJSONConfiguration(o)})}validateAndRegisterProperties(e,t=!0,i,o,s=3,r){var a;s=io(e.scope)?s:e.scope;let l=e.properties;if(l)for(let d in l){let h=l[d];if(t&&mj(d,h)){delete l[d];continue}if(h.source=i,h.defaultDefaultValue=l[d].default,this.updatePropertyDefaultValue(d,h),Tc.test(d)?h.scope=void 0:(h.scope=io(h.scope)?s:h.scope,h.restricted=io(h.restricted)?!!o?.includes(d):h.restricted),l[d].hasOwnProperty("included")&&!l[d].included){this.excludedConfigurationProperties[d]=l[d],delete l[d];continue}else this.configurationProperties[d]=l[d],!((a=l[d].policy)===null||a===void 0)&&a.name&&this.policyConfigurations.set(l[d].policy.name,d);!l[d].deprecationMessage&&l[d].markdownDeprecationMessage&&(l[d].deprecationMessage=l[d].markdownDeprecationMessage),r.add(d)}let c=e.allOf;if(c)for(let d of c)this.validateAndRegisterProperties(d,t,i,o,s,r)}getConfigurationProperties(){return this.configurationProperties}getPolicyConfigurations(){return this.policyConfigurations}registerJSONConfiguration(e){let t=i=>{let o=i.properties;if(o)for(let r in o)this.updateSchema(r,o[r]);let s=i.allOf;s?.forEach(t)};t(e)}updateSchema(e,t){switch(zN.properties[e]=t,t.scope){case 1:VN.properties[e]=t;break;case 2:HN.properties[e]=t;break;case 6:UN.properties[e]=t;break;case 3:KN.properties[e]=t;break;case 4:Py.properties[e]=t;break;case 5:Py.properties[e]=t,this.resourceLanguageSettingsSchema.properties[e]=t;break}}updateOverridePropertyPatternKey(){for(let e of this.overrideIdentifiers.values()){let t=`[${e}]`,i={type:"object",description:p("overrideSettings.defaultDescription","Configure editor settings to be overridden for a language."),errorMessage:p("overrideSettings.errorMessage","This setting does not support per-language configuration."),$ref:R0};this.updatePropertyDefaultValue(t,i),zN.properties[t]=i,VN.properties[t]=i,HN.properties[t]=i,UN.properties[t]=i,KN.properties[t]=i,Py.properties[t]=i}}registerOverridePropertyPatternKey(){let e={type:"object",description:p("overrideSettings.defaultDescription","Configure editor settings to be overridden for a language."),errorMessage:p("overrideSettings.errorMessage","This setting does not support per-language configuration."),$ref:R0};zN.patternProperties[ku]=e,VN.patternProperties[ku]=e,HN.patternProperties[ku]=e,UN.patternProperties[ku]=e,KN.patternProperties[ku]=e,Py.patternProperties[ku]=e,this._onDidSchemaChange.fire()}updatePropertyDefaultValue(e,t){let i=this.configurationDefaultsOverrides.get(e),o=i?.value,s=i?.source;ds(o)&&(o=t.defaultDefaultValue,s=void 0),ds(o)&&(o=gj(t.type)),t.default=o,t.defaultValueSource=s}},A3="\\[([^\\]]+)\\]",N3=new RegExp(A3,"g"),ku=`^(${A3})+$`,Tc=new RegExp(ku);Oy=new $N;Vt.add(ar.Configuration,Oy)});var pj,qN,$d,In,_j,Ma=J(()=>{"use strict";_();v();b();Ge();ye();Oo();M0();Du();pj={ModesRegistry:"editor.modesRegistry"},qN=class{constructor(){this._onDidChangeLanguages=new B,this.onDidChangeLanguages=this._onDidChangeLanguages.event,this._languages=[]}registerLanguage(e){return this._languages.push(e),this._onDidChangeLanguages.fire(void 0),{dispose:()=>{for(let t=0,i=this._languages.length;te!==""&&t!=="")}var Fy,By,jN,GN,R3=J(()=>{"use strict";_();v();b();xT();Fy=class{constructor(e,t){this.languageId=e;let i=t.brackets?M3(t.brackets):[],o=new $_(a=>{let l=new Set;return{info:new jN(this,a,l),closing:l}}),s=new $_(a=>{let l=new Set,c=new Set;return{info:new GN(this,a,l,c),opening:l,openingColorized:c}});for(let[a,l]of i){let c=o.get(a),d=s.get(l);c.closing.add(d.info),d.opening.add(c.info)}let r=t.colorizedBracketPairs?M3(t.colorizedBracketPairs):i.filter(a=>!(a[0]==="<"&&a[1]===">"));for(let[a,l]of r){let c=o.get(a),d=s.get(l);c.closing.add(d.info),d.openingColorized.add(c.info),d.opening.add(c.info)}this._openingBrackets=new Map([...o.cachedValues].map(([a,l])=>[a,l.info])),this._closingBrackets=new Map([...s.cachedValues].map(([a,l])=>[a,l.info]))}get openingBrackets(){return[...this._openingBrackets.values()]}get closingBrackets(){return[...this._closingBrackets.values()]}getOpeningBracketInfo(e){return this._openingBrackets.get(e)}getClosingBracketInfo(e){return this._closingBrackets.get(e)}getBracketInfo(e){return this.getOpeningBracketInfo(e)||this.getClosingBracketInfo(e)}};By=class{constructor(e,t){this.config=e,this.bracketText=t}get languageId(){return this.config.languageId}},jN=class extends By{constructor(e,t,i){super(e,t),this.openedBrackets=i,this.isOpeningBracket=!0}},GN=class extends By{constructor(e,t,i,o){super(e,t),this.openingBrackets=i,this.openingColorizedBrackets=o,this.isOpeningBracket=!1}closes(e){return e.config!==this.config?!1:this.openingBrackets.has(e)}closesColorized(e){return e.config!==this.config?!1:this.openingColorizedBrackets.has(e)}getOpeningBrackets(){return[...this.openingBrackets]}}});function vj(n,e,t,i){let o=e.getLanguageConfiguration(n);if(!o){if(!i.isRegisteredLanguageId(n))return new Xg(n,{});o=new Xg(n,{})}let s=Cj(o.languageId,t),r=F3([o.underlyingConfig,s]);return new Xg(o.languageId,r)}function Cj(n,e){let t=e.getValue(YN.brackets,{overrideIdentifier:n}),i=e.getValue(YN.colorizedBracketPairs,{overrideIdentifier:n});return{brackets:O3(t),colorizedBracketPairs:O3(i)}}function O3(n){if(Array.isArray(n))return n.map(e=>{if(!(!Array.isArray(e)||e.length!==2))return[e[0],e[1]]}).filter(e=>!!e)}function Vy(n,e,t){let i=n.getLineContent(e),o=jn(i);return o.length>t-1&&(o=o.substring(0,t-1)),o}function qd(n,e,t){n.tokenization.forceTokenization(e);let i=n.tokenization.getLineTokens(e),o=typeof t>"u"?n.getLineMaxColumn(e)-1:t-1;return Kd(i,o)}function F3(n){let e={comments:void 0,brackets:void 0,wordPattern:void 0,indentationRules:void 0,onEnterRules:void 0,autoClosingPairs:void 0,surroundingPairs:void 0,autoCloseBefore:void 0,folding:void 0,colorizedBracketPairs:void 0,__electricCharacterSupport:void 0};for(let t of n)e={comments:t.comments||e.comments,brackets:t.brackets||e.brackets,wordPattern:t.wordPattern||e.wordPattern,indentationRules:t.indentationRules||e.indentationRules,onEnterRules:t.onEnterRules||e.onEnterRules,autoClosingPairs:t.autoClosingPairs||e.autoClosingPairs,surroundingPairs:t.surroundingPairs||e.surroundingPairs,autoCloseBefore:t.autoCloseBefore||e.autoCloseBefore,folding:t.folding||e.folding,colorizedBracketPairs:t.colorizedBracketPairs||e.colorizedBracketPairs,__electricCharacterSupport:t.__electricCharacterSupport||e.__electricCharacterSupport};return e}var bj,P3,O0,yo,ZN,YN,XN,Wy,zy,QN,Xg,lr=J(()=>{"use strict";_();v();b();ye();le();ot();ug();yu();Su();m3();S3();x3();L3();Dy();qe();Fo();Hr();Ur();Ma();R3();bj=function(n,e,t,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},P3=function(n,e){return function(t,i){e(t,i,n)}},O0=class{constructor(e){this.languageId=e}affects(e){return this.languageId?this.languageId===e:!0}},yo=De("languageConfigurationService"),ZN=class extends H{constructor(e,t){super(),this.configurationService=e,this.languageService=t,this._registry=this._register(new QN),this.onDidChangeEmitter=this._register(new B),this.onDidChange=this.onDidChangeEmitter.event,this.configurations=new Map;let i=new Set(Object.values(YN));this._register(this.configurationService.onDidChangeConfiguration(o=>{let s=o.change.keys.some(a=>i.has(a)),r=o.change.overrides.filter(([a,l])=>l.some(c=>i.has(c))).map(([a])=>a);if(s)this.configurations.clear(),this.onDidChangeEmitter.fire(new O0(void 0));else for(let a of r)this.languageService.isRegisteredLanguageId(a)&&(this.configurations.delete(a),this.onDidChangeEmitter.fire(new O0(a)))})),this._register(this._registry.onDidChange(o=>{this.configurations.delete(o.languageId),this.onDidChangeEmitter.fire(new O0(o.languageId))}))}register(e,t,i){return this._registry.register(e,t,i)}getLanguageConfiguration(e){let t=this.configurations.get(e);return t||(t=vj(e,this._registry,this.configurationService,this.languageService),this.configurations.set(e,t)),t}};ZN=bj([P3(0,Rt),P3(1,ii)],ZN);YN={brackets:"editor.language.brackets",colorizedBracketPairs:"editor.language.colorizedBracketPairs"};XN=class{constructor(e){this.languageId=e,this._resolved=null,this._entries=[],this._order=0,this._resolved=null}register(e,t){let i=new Wy(e,t,++this._order);return this._entries.push(i),this._resolved=null,be(()=>{for(let o=0;oe.configuration)))}};Wy=class{constructor(e,t,i){this.configuration=e,this.priority=t,this.order=i}static cmp(e,t){return e.priority===t.priority?e.order-t.order:e.priority-t.priority}},zy=class{constructor(e){this.languageId=e}},QN=class extends H{constructor(){super(),this._entries=new Map,this._onDidChange=this._register(new B),this.onDidChange=this._onDidChange.event,this._register(this.register(In,{brackets:[["(",")"],["[","]"],["{","}"]],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:"<",close:">"},{open:'"',close:'"'},{open:"'",close:"'"},{open:"`",close:"`"}],colorizedBracketPairs:[],folding:{offSide:!0}},0))}register(e,t,i=0){let o=this._entries.get(e);o||(o=new XN(e),this._entries.set(e,o));let s=o.register(t,i);return this._onDidChange.fire(new zy(e)),be(()=>{s.dispose(),this._onDidChange.fire(new zy(e))})}getLanguageConfiguration(e){let t=this._entries.get(e);return t?.getResolvedConfiguration()||null}},Xg=class n{constructor(e,t){this.languageId=e,this.underlyingConfig=t,this._brackets=null,this._electricCharacter=null,this._onEnterSupport=this.underlyingConfig.brackets||this.underlyingConfig.indentationRules||this.underlyingConfig.onEnterRules?new Ny(this.underlyingConfig):null,this.comments=n._handleComments(this.underlyingConfig),this.characterPair=new Yg(this.underlyingConfig),this.wordDefinition=this.underlyingConfig.wordPattern||T_,this.indentationRules=this.underlyingConfig.indentationRules,this.underlyingConfig.indentationRules?this.indentRulesSupport=new Ty(this.underlyingConfig.indentationRules):this.indentRulesSupport=null,this.foldingRules=this.underlyingConfig.folding||{},this.bracketsNew=new Fy(e,this.underlyingConfig)}getWordDefinition(){return N_(this.wordDefinition)}get brackets(){return!this._brackets&&this.underlyingConfig.brackets&&(this._brackets=new xy(this.languageId,this.underlyingConfig.brackets)),this._brackets}get electricCharacter(){return this._electricCharacter||(this._electricCharacter=new Ey(this.brackets)),this._electricCharacter}onEnter(e,t,i,o){return this._onEnterSupport?this._onEnterSupport.onEnter(e,t,i,o):null}getAutoClosingPairs(){return new yy(this.characterPair.getAutoClosingPairs())}getAutoCloseBeforeSet(e){return this.characterPair.getAutoCloseBeforeSet(e)}getSurroundingPairs(){return this.characterPair.getSurroundingPairs()}static _handleComments(e){let t=e.comments;if(!t)return null;let i={};if(t.lineComment&&(i.lineCommentToken=t.lineComment),t.blockComment){let[o,s]=t.blockComment;i.blockCommentStartToken=o,i.blockCommentEndToken=s}return i}};_t(yo,ZN,1)});function Iu(n){return n<0?0:n>255?255:n|0}function Tu(n){return n<0?0:n>4294967295?4294967295:n|0}var F0=J(()=>{"use strict";_();v();b()});var Nc,W3,Gy=J(()=>{"use strict";_();v();b();F0();Nc=class n{constructor(e){let t=Iu(e);this._defaultValue=t,this._asciiMap=n._createAsciiMap(t),this._map=new Map}static _createAsciiMap(e){let t=new Uint8Array(256);return t.fill(e),t}set(e,t){let i=Iu(t);e>=0&&e<256?this._asciiMap[e]=i:this._map.set(e,i)}get(e){return e>=0&&e<256?this._asciiMap[e]:this._map.get(e)||this._defaultValue}clear(){this._asciiMap.fill(this._defaultValue),this._map.clear()}},W3=class{constructor(){this._actual=new Nc(0)}add(e){this._actual.set(e,1)}has(e){return this._actual.get(e)===1}clear(){return this._actual.clear()}}});function Sj(n){return Array.isArray(n)}var V3,H3,nA,Gn,oA,sA,Kr,Zy,Jg,cr=J(()=>{"use strict";_();v();b();nA=class{constructor(e,t){this.uri=e,this.value=t}};Gn=class n{constructor(e,t){if(this[V3]="ResourceMap",e instanceof n)this.map=new Map(e.map),this.toKey=t??n.defaultToKey;else if(Sj(e)){this.map=new Map,this.toKey=t??n.defaultToKey;for(let[i,o]of e)this.set(i,o)}else this.map=new Map,this.toKey=e??n.defaultToKey}set(e,t){return this.map.set(this.toKey(e),new nA(e,t)),this}get(e){var t;return(t=this.map.get(this.toKey(e)))===null||t===void 0?void 0:t.value}has(e){return this.map.has(this.toKey(e))}get size(){return this.map.size}clear(){this.map.clear()}delete(e){return this.map.delete(this.toKey(e))}forEach(e,t){typeof t<"u"&&(e=e.bind(t));for(let[i,o]of this.map)e(o.value,o.uri,this)}*values(){for(let e of this.map.values())yield e.value}*keys(){for(let e of this.map.values())yield e.uri}*entries(){for(let e of this.map.values())yield[e.uri,e.value]}*[(V3=Symbol.toStringTag,Symbol.iterator)](){for(let[,e]of this.map)yield[e.uri,e.value]}};Gn.defaultToKey=n=>n.toString();oA=class{constructor(){this[H3]="LinkedMap",this._map=new Map,this._head=void 0,this._tail=void 0,this._size=0,this._state=0}clear(){this._map.clear(),this._head=void 0,this._tail=void 0,this._size=0,this._state++}isEmpty(){return!this._head&&!this._tail}get size(){return this._size}get first(){var e;return(e=this._head)===null||e===void 0?void 0:e.value}get last(){var e;return(e=this._tail)===null||e===void 0?void 0:e.value}has(e){return this._map.has(e)}get(e,t=0){let i=this._map.get(e);if(i)return t!==0&&this.touch(i,t),i.value}set(e,t,i=0){let o=this._map.get(e);if(o)o.value=t,i!==0&&this.touch(o,i);else{switch(o={key:e,value:t,next:void 0,previous:void 0},i){case 0:this.addItemLast(o);break;case 1:this.addItemFirst(o);break;case 2:this.addItemLast(o);break;default:this.addItemLast(o);break}this._map.set(e,o),this._size++}return this}delete(e){return!!this.remove(e)}remove(e){let t=this._map.get(e);if(t)return this._map.delete(e),this.removeItem(t),this._size--,t.value}shift(){if(!this._head&&!this._tail)return;if(!this._head||!this._tail)throw new Error("Invalid list");let e=this._head;return this._map.delete(e.key),this.removeItem(e),this._size--,e.value}forEach(e,t){let i=this._state,o=this._head;for(;o;){if(t?e.bind(t)(o.value,o.key,this):e(o.value,o.key,this),this._state!==i)throw new Error("LinkedMap got modified during iteration.");o=o.next}}keys(){let e=this,t=this._state,i=this._head,o={[Symbol.iterator](){return o},next(){if(e._state!==t)throw new Error("LinkedMap got modified during iteration.");if(i){let s={value:i.key,done:!1};return i=i.next,s}else return{value:void 0,done:!0}}};return o}values(){let e=this,t=this._state,i=this._head,o={[Symbol.iterator](){return o},next(){if(e._state!==t)throw new Error("LinkedMap got modified during iteration.");if(i){let s={value:i.value,done:!1};return i=i.next,s}else return{value:void 0,done:!0}}};return o}entries(){let e=this,t=this._state,i=this._head,o={[Symbol.iterator](){return o},next(){if(e._state!==t)throw new Error("LinkedMap got modified during iteration.");if(i){let s={value:[i.key,i.value],done:!1};return i=i.next,s}else return{value:void 0,done:!0}}};return o}[(H3=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}trimOld(e){if(e>=this.size)return;if(e===0){this.clear();return}let t=this._head,i=this.size;for(;t&&i>e;)this._map.delete(t.key),t=t.next,i--;this._head=t,this._size=i,t&&(t.previous=void 0),this._state++}trimNew(e){if(e>=this.size)return;if(e===0){this.clear();return}let t=this._tail,i=this.size;for(;t&&i>e;)this._map.delete(t.key),t=t.previous,i--;this._tail=t,this._size=i,t&&(t.next=void 0),this._state++}addItemFirst(e){if(!this._head&&!this._tail)this._tail=e;else if(this._head)e.next=this._head,this._head.previous=e;else throw new Error("Invalid list");this._head=e,this._state++}addItemLast(e){if(!this._head&&!this._tail)this._head=e;else if(this._tail)e.previous=this._tail,this._tail.next=e;else throw new Error("Invalid list");this._tail=e,this._state++}removeItem(e){if(e===this._head&&e===this._tail)this._head=void 0,this._tail=void 0;else if(e===this._head){if(!e.next)throw new Error("Invalid list");e.next.previous=void 0,this._head=e.next}else if(e===this._tail){if(!e.previous)throw new Error("Invalid list");e.previous.next=void 0,this._tail=e.previous}else{let t=e.next,i=e.previous;if(!t||!i)throw new Error("Invalid list");t.previous=i,i.next=t}e.next=void 0,e.previous=void 0,this._state++}touch(e,t){if(!this._head||!this._tail)throw new Error("Invalid list");if(!(t!==1&&t!==2)){if(t===1){if(e===this._head)return;let i=e.next,o=e.previous;e===this._tail?(o.next=void 0,this._tail=o):(i.previous=o,o.next=i),e.previous=void 0,e.next=this._head,this._head.previous=e,this._head=e,this._state++}else if(t===2){if(e===this._tail)return;let i=e.next,o=e.previous;e===this._head?(i.previous=void 0,this._head=i):(i.previous=o,o.next=i),e.next=void 0,e.previous=this._tail,this._tail.next=e,this._tail=e,this._state++}}}toJSON(){let e=[];return this.forEach((t,i)=>{e.push([i,t])}),e}fromJSON(e){this.clear();for(let[t,i]of e)this.set(t,i)}},sA=class extends oA{constructor(e,t=1){super(),this._limit=e,this._ratio=Math.min(Math.max(0,t),1)}get limit(){return this._limit}set limit(e){this._limit=e,this.checkTrim()}get(e,t=2){return super.get(e,t)}peek(e){return super.get(e,0)}set(e,t){return super.set(e,t,2),this}checkTrim(){this.size>this._limit&&this.trim(Math.round(this._limit*this._ratio))}},Kr=class extends sA{constructor(e,t=1){super(e,t)}trim(e){this.trimOld(e)}set(e,t){return super.set(e,t),this.checkTrim(),this}},Zy=class{constructor(e){if(this._m1=new Map,this._m2=new Map,e)for(let[t,i]of e)this.set(t,i)}clear(){this._m1.clear(),this._m2.clear()}set(e,t){this._m1.set(e,t),this._m2.set(t,e)}get(e){return this._m1.get(e)}getKey(e){return this._m2.get(e)}delete(e){let t=this._m1.get(e);return t===void 0?!1:(this._m1.delete(e),this._m2.delete(t),!0)}keys(){return this._m1.keys()}values(){return this._m1.values()}},Jg=class{constructor(){this.map=new Map}add(e,t){let i=this.map.get(e);i||(i=new Set,this.map.set(e,i)),i.add(t)}delete(e,t){let i=this.map.get(e);i&&(i.delete(t),i.size===0&&this.map.delete(e))}forEach(e,t){let i=this.map.get(e);i&&i.forEach(t)}get(e){let t=this.map.get(e);return t||new Set}}});function xl(n,e){let t=`${n}/${e.join(",")}`,i=U3.get(t);return i||(i=new rA(n,e),U3.set(t,i)),i}var rA,U3,W0=J(()=>{"use strict";_();v();b();cr();Gy();rA=class extends Nc{constructor(e,t){super(0),this._segmenter=null,this._cachedLine=null,this._cachedSegments=[],this.intlSegmenterLocales=t,this.intlSegmenterLocales.length>0?this._segmenter=new Intl.Segmenter(this.intlSegmenterLocales,{granularity:"word"}):this._segmenter=null;for(let i=0,o=e.length;it)break;i=o}return i}findNextIntlWordAtOrAfterOffset(e,t){for(let i of this._getIntlSegmenterWordsOnLine(e))if(!(i.index{"use strict";_();v();b();hs();(function(n){n[n.Left=1]="Left",n[n.Center=2]="Center",n[n.Right=4]="Right",n[n.Full=7]="Full"})(em||(em={}));(function(n){n[n.Left=1]="Left",n[n.Center=2]="Center",n[n.Right=3]="Right"})(dr||(dr={}));(function(n){n[n.Both=0]="Both",n[n.Right=1]="Right",n[n.Left=2]="Left",n[n.None=3]="None"})(Nu||(Nu={}));Zd=class{get originalIndentSize(){return this._indentSizeIsTabSize?"tabSize":this.indentSize}constructor(e){this._textModelResolvedOptionsBrand=void 0,this.tabSize=Math.max(1,e.tabSize|0),e.indentSize==="tabSize"?(this.indentSize=this.tabSize,this._indentSizeIsTabSize=!0):(this.indentSize=Math.max(1,e.indentSize|0),this._indentSizeIsTabSize=!1),this.insertSpaces=!!e.insertSpaces,this.defaultEOL=e.defaultEOL|0,this.trimAutoWhitespace=!!e.trimAutoWhitespace,this.bracketPairColorizationOptions=e.bracketPairColorizationOptions}equals(e){return this.tabSize===e.tabSize&&this._indentSizeIsTabSize===e._indentSizeIsTabSize&&this.indentSize===e.indentSize&&this.insertSpaces===e.insertSpaces&&this.defaultEOL===e.defaultEOL&&this.trimAutoWhitespace===e.trimAutoWhitespace&&hn(this.bracketPairColorizationOptions,e.bracketPairColorizationOptions)}createChangeEvent(e){return{tabSize:this.tabSize!==e.tabSize,indentSize:this.indentSize!==e.indentSize,insertSpaces:this.insertSpaces!==e.insertSpaces,trimAutoWhitespace:this.trimAutoWhitespace!==e.trimAutoWhitespace}}},Ll=class{constructor(e,t){this._findMatchBrand=void 0,this.range=e,this.matches=t}};tm=class{constructor(e,t,i,o,s,r){this.identifier=e,this.range=t,this.text=i,this.forceMoveMarkers=o,this.isAutoWhitespaceEdit=s,this._isTracked=r}},Yy=class{constructor(e,t,i){this.regex=e,this.wordSeparators=t,this.simpleSearch=i}},Xy=class{constructor(e,t,i){this.reverseEdits=e,this.changes=t,this.trimAutoWhitespaceLineNumbers=i}}});function kj(n){if(!n||n.length===0)return!1;for(let e=0,t=n.length;e=t)break;let o=n.charCodeAt(e);if(o===110||o===114||o===87)return!0}}return!1}function Yd(n,e,t){if(!t)return new Ll(n,null);let i=[];for(let o=0,s=e.length;o0){let r=e.charCodeAt(i);if(n.get(r)!==0)return!0}return!1}function Ej(n,e,t,i,o){if(i+o===t)return!0;let s=e.charCodeAt(i+o);if(n.get(s)!==0||s===13||s===10)return!0;if(o>0){let r=e.charCodeAt(i+o-1);if(n.get(r)!==0)return!0}return!1}function Jy(n,e,t,i,o){return Dj(n,e,t,i,o)&&Ej(n,e,t,i,o)}var Lj,Ac,Qy,Au,kl,eS=J(()=>{"use strict";_();v();b();ot();W0();ft();Ke();hr();Lj=999,Ac=class{constructor(e,t,i,o){this.searchString=e,this.isRegex=t,this.matchCase=i,this.wordSeparators=o}parseSearchRequest(){if(this.searchString==="")return null;let e;this.isRegex?e=kj(this.searchString):e=this.searchString.indexOf(` +`)>=0;let t=null;try{t=pw(this.searchString,this.isRegex,{matchCase:this.matchCase,wholeWord:!1,multiline:e,global:!0,unicode:!0})}catch{return null}if(!t)return null;let i=!this.isRegex&&!e;return i&&this.searchString.toLowerCase()!==this.searchString.toUpperCase()&&(i=this.matchCase),new Yy(t,this.wordSeparators?xl(this.wordSeparators,[]):null,i?this.searchString:null)}};Qy=class{constructor(e){let t=[],i=0;for(let o=0,s=e.length;o>0);t[s]>=e?o=s-1:t[s+1]>=e?(i=s,o=s):i=s+1}return i+1}},Au=class{static findMatches(e,t,i,o,s){let r=t.parseSearchRequest();return r?r.regex.multiline?this._doFindMatchesMultiline(e,i,new kl(r.wordSeparators,r.regex),o,s):this._doFindMatchesLineByLine(e,i,r,o,s):[]}static _getMultilineMatchRange(e,t,i,o,s,r){let a,l=0;o?(l=o.findLineFeedCountBeforeOffset(s),a=t+s+l):a=t+s;let c;if(o){let f=o.findLineFeedCountBeforeOffset(s+r.length)-l;c=a+r.length+f}else c=a+r.length;let d=e.getPositionAt(a),h=e.getPositionAt(c);return new P(d.lineNumber,d.column,h.lineNumber,h.column)}static _doFindMatchesMultiline(e,t,i,o,s){let r=e.getOffsetAt(t.getStartPosition()),a=e.getValueInRange(t,1),l=e.getEOL()===`\r +`?new Qy(a):null,c=[],d=0,h;for(i.reset(0);h=i.next(a);)if(c[d++]=Yd(this._getMultilineMatchRange(e,r,a,l,h.index,h[0]),h,o),d>=s)return c;return c}static _doFindMatchesLineByLine(e,t,i,o,s){let r=[],a=0;if(t.startLineNumber===t.endLineNumber){let c=e.getLineContent(t.startLineNumber).substring(t.startColumn-1,t.endColumn-1);return a=this._findMatchesInLine(i,c,t.startLineNumber,t.startColumn-1,a,r,o,s),r}let l=e.getLineContent(t.startLineNumber).substring(t.startColumn-1);a=this._findMatchesInLine(i,l,t.startLineNumber,t.startColumn-1,a,r,o,s);for(let c=t.startLineNumber+1;c=l))return s;return s}let d=new kl(e.wordSeparators,e.regex),h;d.reset(0);do if(h=d.next(t),h&&(r[s++]=Yd(new P(i,h.index+1+o,i,h.index+1+h[0].length+o),h,a),s>=l))return s;while(h);return s}static findNextMatch(e,t,i,o){let s=t.parseSearchRequest();if(!s)return null;let r=new kl(s.wordSeparators,s.regex);return s.regex.multiline?this._doFindNextMatchMultiline(e,i,r,o):this._doFindNextMatchLineByLine(e,i,r,o)}static _doFindNextMatchMultiline(e,t,i,o){let s=new U(t.lineNumber,1),r=e.getOffsetAt(s),a=e.getLineCount(),l=e.getValueInRange(new P(s.lineNumber,s.column,a,e.getLineMaxColumn(a)),1),c=e.getEOL()===`\r +`?new Qy(l):null;i.reset(t.column-1);let d=i.next(l);return d?Yd(this._getMultilineMatchRange(e,r,l,c,d.index,d[0]),d,o):t.lineNumber!==1||t.column!==1?this._doFindNextMatchMultiline(e,new U(1,1),i,o):null}static _doFindNextMatchLineByLine(e,t,i,o){let s=e.getLineCount(),r=t.lineNumber,a=e.getLineContent(r),l=this._findFirstMatchInLine(i,a,r,t.column,o);if(l)return l;for(let c=1;c<=s;c++){let d=(r+c-1)%s,h=e.getLineContent(d+1),u=this._findFirstMatchInLine(i,h,d+1,1,o);if(u)return u}return null}static _findFirstMatchInLine(e,t,i,o,s){e.reset(o-1);let r=e.next(t);return r?Yd(new P(i,r.index+1,i,r.index+1+r[0].length),r,s):null}static findPreviousMatch(e,t,i,o){let s=t.parseSearchRequest();if(!s)return null;let r=new kl(s.wordSeparators,s.regex);return s.regex.multiline?this._doFindPreviousMatchMultiline(e,i,r,o):this._doFindPreviousMatchLineByLine(e,i,r,o)}static _doFindPreviousMatchMultiline(e,t,i,o){let s=this._doFindMatchesMultiline(e,new P(1,1,t.lineNumber,t.column),i,o,10*Lj);if(s.length>0)return s[s.length-1];let r=e.getLineCount();return t.lineNumber!==r||t.column!==e.getLineMaxColumn(r)?this._doFindPreviousMatchMultiline(e,new U(r,e.getLineMaxColumn(r)),i,o):null}static _doFindPreviousMatchLineByLine(e,t,i,o){let s=e.getLineCount(),r=t.lineNumber,a=e.getLineContent(r).substring(0,t.column-1),l=this._findLastMatchInLine(i,a,r,o);if(l)return l;for(let c=1;c<=s;c++){let d=(s+r-c-1)%s,h=e.getLineContent(d+1),u=this._findLastMatchInLine(i,h,d+1,o);if(u)return u}return null}static _findLastMatchInLine(e,t,i,o){let s=null,r;for(e.reset(0);r=e.next(t);)s=Yd(new P(i,r.index+1,i,r.index+1+r[0].length),r,o);return s}};kl=class{constructor(e,t){this._wordSeparators=e,this._searchRegex=t,this._prevMatchStartIndex=-1,this._prevMatchLength=0}reset(e){this._searchRegex.lastIndex=e,this._prevMatchStartIndex=-1,this._prevMatchLength=0}next(e){let t=e.length,i;do{if(this._prevMatchStartIndex+this._prevMatchLength===t||(i=this._searchRegex.exec(e),!i))return null;let o=i.index,s=i[0].length;if(o===this._prevMatchStartIndex&&s===this._prevMatchLength){if(s===0){Eg(e,t,this._searchRegex.lastIndex)>65535?this._searchRegex.lastIndex+=2:this._searchRegex.lastIndex+=1;continue}return null}if(this._prevMatchStartIndex=o,this._prevMatchLength=s,!this._wordSeparators||Jy(this._wordSeparators,e,t,o,s))return i}while(i);return null}}});var ze,nS,es=J(()=>{"use strict";_();v();b();xt();ze=class n{static addRange(e,t){let i=0;for(;it))return new n(e,t)}static ofLength(e){return new n(0,e)}static ofStartAndLength(e,t){return new n(e,e+t)}constructor(e,t){if(this.start=e,this.endExclusive=t,e>t)throw new St(`Invalid range: ${this.toString()}`)}get isEmpty(){return this.start===this.endExclusive}delta(e){return new n(this.start+e,this.endExclusive+e)}deltaStart(e){return new n(this.start+e,this.endExclusive)}deltaEnd(e){return new n(this.start,this.endExclusive+e)}get length(){return this.endExclusive-this.start}toString(){return`[${this.start}, ${this.endExclusive})`}contains(e){return this.start<=e&&e=e.endExclusive}slice(e){return e.slice(this.start,this.endExclusive)}substring(e){return e.substring(this.start,this.endExclusive)}clip(e){if(this.isEmpty)throw new St(`Invalid clipping range: ${this.toString()}`);return Math.max(this.start,Math.min(this.endExclusive-1,e))}clipCyclic(e){if(this.isEmpty)throw new St(`Invalid clipping range: ${this.toString()}`);return e=this.endExclusive?this.start+(e-this.start)%this.length:e}forEach(e){for(let t=this.start;te.toString()).join(", ")}intersectsStrict(e){let t=0;for(;te+t.length,0)}}});function Mu(n,e){let t=Tj(n,e);if(t!==-1)return n[t]}function Tj(n,e,t=n.length-1){for(let i=t;i>=0;i--){let o=n[i];if(e(o))return i}return-1}function Mc(n,e){let t=Ru(n,e);return t===-1?void 0:n[t]}function Ru(n,e,t=0,i=n.length){let o=t,s=i;for(;o0&&(t=o)}return t}function G3(n,e){if(n.length===0)return;let t=n[0];for(let i=1;i=0&&(t=o)}return t}function Z3(n,e){return aA(n,(t,i)=>-e(t,i))}function Y3(n,e){if(n.length===0)return-1;let t=0;for(let i=1;i0&&(t=i)}return t}function $fe(n,e){for(let t of n){let i=e(t);if(i!==void 0)return i}}var nm,Dl=J(()=>{"use strict";_();v();b();nm=class n{constructor(e){this._array=e,this._findLastMonotonousLastIdx=0}findLastMonotonous(e){if(n.assertInvariants){if(this._prevFindLastPredicate){for(let i of this._array)if(this._prevFindLastPredicate(i)&&!e(i))throw new Error("MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.")}this._prevFindLastPredicate=e}let t=Ru(this._array,e,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=t+1,t===-1?void 0:this._array[t]}};nm.assertInvariants=!1});var Ne,ur,Bo=J(()=>{"use strict";_();v();b();xt();es();Ke();Dl();Ne=class n{static fromRangeInclusive(e){return new n(e.startLineNumber,e.endLineNumber+1)}static joinMany(e){if(e.length===0)return[];let t=new ur(e[0].slice());for(let i=1;it)throw new St(`startLineNumber ${e} cannot be after endLineNumberExclusive ${t}`);this.startLineNumber=e,this.endLineNumberExclusive=t}contains(e){return this.startLineNumber<=e&&eo.endLineNumberExclusive>=e.startLineNumber),i=Ru(this._normalizedRanges,o=>o.startLineNumber<=e.endLineNumberExclusive)+1;if(t===i)this._normalizedRanges.splice(t,0,e);else if(t===i-1){let o=this._normalizedRanges[t];this._normalizedRanges[t]=o.join(e)}else{let o=this._normalizedRanges[t].join(this._normalizedRanges[i-1]).join(e);this._normalizedRanges.splice(t,i-t,o)}}contains(e){let t=Mc(this._normalizedRanges,i=>i.startLineNumber<=e);return!!t&&t.endLineNumberExclusive>e}intersects(e){let t=Mc(this._normalizedRanges,i=>i.startLineNumbere.startLineNumber}getUnion(e){if(this._normalizedRanges.length===0)return e;if(e._normalizedRanges.length===0)return this;let t=[],i=0,o=0,s=null;for(;i=r.startLineNumber?s=new Ne(s.startLineNumber,Math.max(s.endLineNumberExclusive,r.endLineNumberExclusive)):(t.push(s),s=r)}return s!==null&&t.push(s),new n(t)}subtractFrom(e){let t=oS(this._normalizedRanges,r=>r.endLineNumberExclusive>=e.startLineNumber),i=Ru(this._normalizedRanges,r=>r.startLineNumber<=e.endLineNumberExclusive)+1;if(t===i)return new n([e]);let o=[],s=e.startLineNumber;for(let r=t;rs&&o.push(new Ne(s,a.startLineNumber)),s=a.endLineNumberExclusive}return se.toString()).join(", ")}getIntersection(e){let t=[],i=0,o=0;for(;it.delta(e)))}}});var ws,om=J(()=>{"use strict";_();v();b();ft();Ke();ws=class n{static betweenPositions(e,t){return e.lineNumber===t.lineNumber?new n(0,t.column-e.column):new n(t.lineNumber-e.lineNumber,t.column-1)}static ofRange(e){return n.betweenPositions(e.getStartPosition(),e.getEndPosition())}static ofText(e){let t=0,i=0;for(let o of e)o===` +`?(t++,i=0):i++;return new n(t,i)}constructor(e,t){this.lineCount=e,this.columnCount=t}isGreaterThanOrEqualTo(e){return this.lineCount!==e.lineCount?this.lineCount>e.lineCount:this.columnCount>=e.columnCount}createRange(e){return this.lineCount===0?new P(e.lineNumber,e.column,e.lineNumber,e.column+this.columnCount):new P(e.lineNumber,e.column,e.lineNumber+this.lineCount,this.columnCount+1)}addToPosition(e){return this.lineCount===0?new U(e.lineNumber,e.column+this.columnCount):new U(e.lineNumber+this.lineCount,this.columnCount+1)}toString(){return`${this.lineCount},${this.columnCount}`}};ws.zero=new ws(0,0)});function Jd(n,e){let t=Math.pow(10,e);return Math.round(n*t)/t}var vt,Tl,dm,Z,gn=J(()=>{"use strict";_();v();b();vt=class{constructor(e,t,i,o=1){this._rgbaBrand=void 0,this.r=Math.min(255,Math.max(0,e))|0,this.g=Math.min(255,Math.max(0,t))|0,this.b=Math.min(255,Math.max(0,i))|0,this.a=Jd(Math.max(Math.min(1,o),0),3)}static equals(e,t){return e.r===t.r&&e.g===t.g&&e.b===t.b&&e.a===t.a}},Tl=class n{constructor(e,t,i,o){this._hslaBrand=void 0,this.h=Math.max(Math.min(360,e),0)|0,this.s=Jd(Math.max(Math.min(1,t),0),3),this.l=Jd(Math.max(Math.min(1,i),0),3),this.a=Jd(Math.max(Math.min(1,o),0),3)}static equals(e,t){return e.h===t.h&&e.s===t.s&&e.l===t.l&&e.a===t.a}static fromRGBA(e){let t=e.r/255,i=e.g/255,o=e.b/255,s=e.a,r=Math.max(t,i,o),a=Math.min(t,i,o),l=0,c=0,d=(a+r)/2,h=r-a;if(h>0){switch(c=Math.min(d<=.5?h/(2*d):h/(2-2*d),1),r){case t:l=(i-o)/h+(i1&&(i-=1),i<1/6?e+(t-e)*6*i:i<1/2?t:i<2/3?e+(t-e)*(2/3-i)*6:e}static toRGBA(e){let t=e.h/360,{s:i,l:o,a:s}=e,r,a,l;if(i===0)r=a=l=o;else{let c=o<.5?o*(1+i):o+i-o*i,d=2*o-c;r=n._hue2rgb(d,c,t+1/3),a=n._hue2rgb(d,c,t),l=n._hue2rgb(d,c,t-1/3)}return new vt(Math.round(r*255),Math.round(a*255),Math.round(l*255),s)}},dm=class n{constructor(e,t,i,o){this._hsvaBrand=void 0,this.h=Math.max(Math.min(360,e),0)|0,this.s=Jd(Math.max(Math.min(1,t),0),3),this.v=Jd(Math.max(Math.min(1,i),0),3),this.a=Jd(Math.max(Math.min(1,o),0),3)}static equals(e,t){return e.h===t.h&&e.s===t.s&&e.v===t.v&&e.a===t.a}static fromRGBA(e){let t=e.r/255,i=e.g/255,o=e.b/255,s=Math.max(t,i,o),r=Math.min(t,i,o),a=s-r,l=s===0?0:a/s,c;return a===0?c=0:s===t?c=((i-o)/a%6+6)%6:s===i?c=(o-t)/a+2:c=(t-i)/a+4,new n(Math.round(c*60),l,s,e.a)}static toRGBA(e){let{h:t,s:i,v:o,a:s}=e,r=o*i,a=r*(1-Math.abs(t/60%2-1)),l=o-r,[c,d,h]=[0,0,0];return t<60?(c=r,d=a):t<120?(c=a,d=r):t<180?(d=r,h=a):t<240?(d=a,h=r):t<300?(c=a,h=r):t<=360&&(c=r,h=a),c=Math.round((c+l)*255),d=Math.round((d+l)*255),h=Math.round((h+l)*255),new vt(c,d,h,s)}},Z=class n{static fromHex(e){return n.Format.CSS.parseHex(e)||n.red}static equals(e,t){return!e&&!t?!0:!e||!t?!1:e.equals(t)}get hsla(){return this._hsla?this._hsla:Tl.fromRGBA(this.rgba)}get hsva(){return this._hsva?this._hsva:dm.fromRGBA(this.rgba)}constructor(e){if(e)if(e instanceof vt)this.rgba=e;else if(e instanceof Tl)this._hsla=e,this.rgba=Tl.toRGBA(e);else if(e instanceof dm)this._hsva=e,this.rgba=dm.toRGBA(e);else throw new Error("Invalid color ctor argument");else throw new Error("Color needs a value")}equals(e){return!!e&&vt.equals(this.rgba,e.rgba)&&Tl.equals(this.hsla,e.hsla)&&dm.equals(this.hsva,e.hsva)}getRelativeLuminance(){let e=n._relativeLuminanceForComponent(this.rgba.r),t=n._relativeLuminanceForComponent(this.rgba.g),i=n._relativeLuminanceForComponent(this.rgba.b),o=.2126*e+.7152*t+.0722*i;return Jd(o,4)}static _relativeLuminanceForComponent(e){let t=e/255;return t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)}isLighter(){return(this.rgba.r*299+this.rgba.g*587+this.rgba.b*114)/1e3>=128}isLighterThan(e){let t=this.getRelativeLuminance(),i=e.getRelativeLuminance();return t>i}isDarkerThan(e){let t=this.getRelativeLuminance(),i=e.getRelativeLuminance();return t{"use strict";_();v();b();qe();Tt=De("ILanguageFeaturesService")});function _S(n,e){return new Ad([new xa(0,"",n)],e)}function hm(n,e){let t=new Uint32Array(2);return t[0]=0,t[1]=(n<<0|0|0|32768|2<<24)>>>0,new yc(t,e===null?eh:e)}var eh,Y0=J(()=>{"use strict";_();v();b();Yo();eh=new class{clone(){return this}equals(n){return this===n}}});var mn,um=J(()=>{"use strict";_();v();b();mn=class{static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return(e&1024)!==0}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static getClassNameFromMetadata(e){let i="mtk"+this.getForeground(e),o=this.getFontStyle(e);return o&1&&(i+=" mtki"),o&2&&(i+=" mtkb"),o&4&&(i+=" mtku"),o&8&&(i+=" mtks"),i}static getInlineStyleFromMetadata(e,t){let i=this.getForeground(e),o=this.getFontStyle(e),s=`color: ${t[i]};`;o&1&&(s+="font-style: italic;"),o&2&&(s+="font-weight: bold;");let r="";return o&4&&(r+=" underline"),o&8&&(r+=" line-through"),r&&(s+=`text-decoration:${r};`),s}static getPresentationFromMetadata(e){let t=this.getForeground(e),i=this.getFontStyle(e);return{foreground:t,italic:!!(i&1),bold:!!(i&2),underline:!!(i&4),strikethrough:!!(i&8)}}}});var Hi,SA,Pc=J(()=>{"use strict";_();v();b();um();Hi=class n{static createEmpty(e,t){let i=n.defaultTokenMetadata,o=new Uint32Array(2);return o[0]=e.length,o[1]=i,new n(o,e,t)}constructor(e,t,i){this._lineTokensBrand=void 0,this._tokens=e,this._tokensCount=this._tokens.length>>>1,this._text=t,this._languageIdCodec=i}equals(e){return e instanceof n?this.slicedEquals(e,0,this._tokensCount):!1}slicedEquals(e,t,i){if(this._text!==e._text||this._tokensCount!==e._tokensCount)return!1;let o=t<<1,s=o+(i<<1);for(let r=o;r0?this._tokens[e-1<<1]:0}getMetadata(e){return this._tokens[(e<<1)+1]}getLanguageId(e){let t=this._tokens[(e<<1)+1],i=mn.getLanguageId(t);return this._languageIdCodec.decodeLanguageId(i)}getStandardTokenType(e){let t=this._tokens[(e<<1)+1];return mn.getTokenType(t)}getForeground(e){let t=this._tokens[(e<<1)+1];return mn.getForeground(t)}getClassName(e){let t=this._tokens[(e<<1)+1];return mn.getClassNameFromMetadata(t)}getInlineStyle(e,t){let i=this._tokens[(e<<1)+1];return mn.getInlineStyleFromMetadata(i,t)}getPresentation(e){let t=this._tokens[(e<<1)+1];return mn.getPresentationFromMetadata(t)}getEndOffset(e){return this._tokens[e<<1]}findTokenIndexAtOffset(e){return n.findIndexInTokensArray(this._tokens,e)}inflate(){return this}sliceAndInflate(e,t,i){return new SA(this,e,t,i)}static convertToEndOffset(e,t){let o=(e.length>>>1)-1;for(let s=0;s>>1)-1;for(;it&&(o=s)}return i}withInserted(e){if(e.length===0)return this;let t=0,i=0,o="",s=new Array,r=0;for(;;){let a=tr){o+=this._text.substring(r,l.offset);let c=this._tokens[(t<<1)+1];s.push(o.length,c),r=l.offset}o+=l.text,s.push(o.length,l.tokenMetadata),i++}else break}return new n(new Uint32Array(s),o,this._languageIdCodec)}};Hi.defaultTokenMetadata=(32768|2<<24)>>>0;SA=class n{constructor(e,t,i,o){this._source=e,this._startOffset=t,this._endOffset=i,this._deltaOffset=o,this._firstTokenIndex=e.findTokenIndexAtOffset(t),this._tokensCount=0;for(let s=this._firstTokenIndex,r=e.getCount();s=i);s++)this._tokensCount++}getMetadata(e){return this._source.getMetadata(this._firstTokenIndex+e)}getLanguageId(e){return this._source.getLanguageId(this._firstTokenIndex+e)}getLineContent(){return this._source.getLineContent().substring(this._startOffset,this._endOffset)}equals(e){return e instanceof n?this._startOffset===e._startOffset&&this._endOffset===e._endOffset&&this._deltaOffset===e._deltaOffset&&this._source.slicedEquals(e._source,this._firstTokenIndex,this._tokensCount):!1}getCount(){return this._tokensCount}getForeground(e){return this._source.getForeground(this._firstTokenIndex+e)}getEndOffset(e){let t=this._source.getEndOffset(this._firstTokenIndex+e);return Math.min(this._endOffset,t)-this._startOffset+this._deltaOffset}getClassName(e){return this._source.getClassName(this._firstTokenIndex+e)}getInlineStyle(e,t){return this._source.getInlineStyle(this._firstTokenIndex+e,t)}getPresentation(e){return this._source.getPresentation(this._firstTokenIndex+e)}findTokenIndexAtOffset(e){return this._source.findTokenIndexAtOffset(e+this._startOffset-this._deltaOffset)-this._firstTokenIndex}}});var vm,OA=J(()=>{"use strict";_();v();b();le();ye();ke();vm=class extends H{constructor(e,t){super(),this._onDidChange=this._register(new B),this.onDidChange=this._onDidChange.event,this._referenceDomElement=e,this._width=-1,this._height=-1,this._resizeObserver=null,this.measureReferenceDomElement(!1,t)}dispose(){this.stopObserving(),super.dispose()}getWidth(){return this._width}getHeight(){return this._height}startObserving(){if(!this._resizeObserver&&this._referenceDomElement){let e=null,t=()=>{e?this.observe({width:e.width,height:e.height}):this.observe()},i=!1,o=!1,s=()=>{if(i&&!o)try{i=!1,o=!0,t()}finally{rn(ge(this._referenceDomElement),()=>{o=!1,s()})}};this._resizeObserver=new ResizeObserver(r=>{r&&r[0]&&r[0].contentRect?e={width:r[0].contentRect.width,height:r[0].contentRect.height}:e=null,i=!0,s()}),this._resizeObserver.observe(this._referenceDomElement)}}stopObserving(){this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=null)}observe(e){this.measureReferenceDomElement(!0,e)}measureReferenceDomElement(e,t){let i=0,o=0;t?(i=t.width,o=t.height):this._referenceDomElement&&(i=this._referenceDomElement.clientWidth,o=this._referenceDomElement.clientHeight),i=Math.max(5,i),o=Math.max(5,o),(this._width!==i||this._height!==o)&&(this._width=i,this._height=o,e&&this._onDidChange.fire())}}});function DS(n){return`--vscode-${n.replace(/\./g,"-")}`}function he(n){return`var(${DS(n)})`}function B8(n,e){return`var(${DS(n)}, ${e})`}function F(n,e,t,i,o){return ES.registerColor(n,e,t,i,o)}function _G(n,e){var t,i,o,s;switch(n.op){case 0:return(t=Fa(n.value,e))===null||t===void 0?void 0:t.darken(n.factor);case 1:return(i=Fa(n.value,e))===null||i===void 0?void 0:i.lighten(n.factor);case 2:return(o=Fa(n.value,e))===null||o===void 0?void 0:o.transparent(n.factor);case 3:{let r=Fa(n.background,e);return r?(s=Fa(n.value,e))===null||s===void 0?void 0:s.makeOpaque(r):Fa(n.value,e)}case 4:for(let r of n.values){let a=Fa(r,e);if(a)return a}return;case 6:return Fa(e.defines(n.if)?n.then:n.else,e);case 5:{let r=Fa(n.value,e);if(!r)return;let a=Fa(n.background,e);return a?r.isDarkerThan(a)?Z.getLighterColor(r,a,n.factor).transparent(n.transparency):Z.getDarkerColor(r,a,n.factor).transparent(n.transparency):r.transparent(n.factor*n.transparency)}default:throw $g(n)}}function Pl(n,e){return{op:0,value:n,factor:e}}function zs(n,e){return{op:1,value:n,factor:e}}function Ee(n,e){return{op:2,value:n,factor:e}}function HA(...n){return{op:4,values:n}}function W8(n,e,t){return{op:6,if:n,then:e,else:t}}function UA(n,e,t,i){return{op:5,value:n,background:e,factor:t,transparency:i}}function Fa(n,e){if(n!==null){if(typeof n=="string")return n[0]==="#"?Z.fromHex(n):e.getColor(n);if(n instanceof Z)return n;if(typeof n=="object")return _G(n,e)}}var VA,zA,ES,z8,V8,F8,jr=J(()=>{"use strict";_();v();b();Na();Gt();gn();ye();Ry();Oo();VA={ColorContribution:"base.contributions.colors"},zA=class{constructor(){this._onDidChangeSchema=new B,this.onDidChangeSchema=this._onDidChangeSchema.event,this.colorSchema={type:"object",properties:{}},this.colorReferenceSchema={type:"string",enum:[],enumDescriptions:[]},this.colorsById={}}registerColor(e,t,i,o=!1,s){let r={id:e,description:i,defaults:t,needsTransparency:o,deprecationMessage:s};this.colorsById[e]=r;let a={type:"string",description:i,format:"color-hex",defaultSnippets:[{body:"${1:#ff0000}"}]};return s&&(a.deprecationMessage=s),o&&(a.pattern="^#(?:(?[0-9a-fA-f]{3}[0-9a-eA-E])|(?:[0-9a-fA-F]{6}(?:(?![fF]{2})(?:[0-9a-fA-F]{2}))))?$",a.patternErrorMessage="This color must be transparent or it will obscure content"),this.colorSchema.properties[e]=a,this.colorReferenceSchema.enum.push(e),this.colorReferenceSchema.enumDescriptions.push(i),this._onDidChangeSchema.fire(),e}getColors(){return Object.keys(this.colorsById).map(e=>this.colorsById[e])}resolveDefaultColor(e,t){let i=this.colorsById[e];if(i&&i.defaults){let o=i.defaults[t.type];return Fa(o,t)}}getColorSchema(){return this.colorSchema}toString(){let e=(t,i)=>{let o=t.indexOf(".")===-1?0:1,s=i.indexOf(".")===-1?0:1;return o!==s?o-s:t.localeCompare(i)};return Object.keys(this.colorsById).sort(e).map(t=>`- \`${t}\`: ${this.colorsById[t].description}`).join(` +`)}},ES=new zA;Vt.add(VA.ColorContribution,ES);z8="vscode://schemas/workbench-colors",V8=Vt.as(Lu.JSONContribution);V8.registerSchema(z8,ES.getColorSchema());F8=new di(()=>V8.notifySchemaChanged(z8),200);ES.onDidChangeSchema(()=>{F8.isScheduled()||F8.schedule()})});var at,uve,fve,gve,ih,zo,Ct,ni,mve,H8,pve,_ve,bve,vve,Cve,wve,yve,Fc=J(()=>{"use strict";_();v();b();Ge();gn();jr();at=F("foreground",{dark:"#CCCCCC",light:"#616161",hcDark:"#FFFFFF",hcLight:"#292929"},p("foreground","Overall foreground color. This color is only used if not overridden by a component.")),uve=F("disabledForeground",{dark:"#CCCCCC80",light:"#61616180",hcDark:"#A5A5A5",hcLight:"#7F7F7F"},p("disabledForeground","Overall foreground for disabled elements. This color is only used if not overridden by a component.")),fve=F("errorForeground",{dark:"#F48771",light:"#A1260D",hcDark:"#F48771",hcLight:"#B5200D"},p("errorForeground","Overall foreground color for error messages. This color is only used if not overridden by a component.")),gve=F("descriptionForeground",{light:"#717171",dark:Ee(at,.7),hcDark:Ee(at,.7),hcLight:Ee(at,.7)},p("descriptionForeground","Foreground color for description text providing additional information, for example for a label.")),ih=F("icon.foreground",{dark:"#C5C5C5",light:"#424242",hcDark:"#FFFFFF",hcLight:"#292929"},p("iconForeground","The default color for icons in the workbench.")),zo=F("focusBorder",{dark:"#007FD4",light:"#0090F1",hcDark:"#F38518",hcLight:"#006BBD"},p("focusBorder","Overall border color for focused elements. This color is only used if not overridden by a component.")),Ct=F("contrastBorder",{light:null,dark:null,hcDark:"#6FC3DF",hcLight:"#0F4A85"},p("contrastBorder","An extra border around elements to separate them from others for greater contrast.")),ni=F("contrastActiveBorder",{light:null,dark:null,hcDark:zo,hcLight:zo},p("activeContrastBorder","An extra border around active elements to separate them from others for greater contrast.")),mve=F("selection.background",{light:null,dark:null,hcDark:null,hcLight:null},p("selectionBackground","The background color of text selections in the workbench (e.g. for input fields or text areas). Note that this does not apply to selections within the editor.")),H8=F("textLink.foreground",{light:"#006AB1",dark:"#3794FF",hcDark:"#21A6FF",hcLight:"#0F4A85"},p("textLinkForeground","Foreground color for links in text.")),pve=F("textLink.activeForeground",{light:"#006AB1",dark:"#3794FF",hcDark:"#21A6FF",hcLight:"#0F4A85"},p("textLinkActiveForeground","Foreground color for links in text when clicked on and on mouse hover.")),_ve=F("textSeparator.foreground",{light:"#0000002e",dark:"#ffffff2e",hcDark:Z.black,hcLight:"#292929"},p("textSeparatorForeground","Color for text separators.")),bve=F("textPreformat.foreground",{light:"#A31515",dark:"#D7BA7D",hcDark:"#000000",hcLight:"#FFFFFF"},p("textPreformatForeground","Foreground color for preformatted text segments.")),vve=F("textPreformat.background",{light:"#0000001A",dark:"#FFFFFF1A",hcDark:"#FFFFFF",hcLight:"#09345f"},p("textPreformatBackground","Background color for preformatted text segments.")),Cve=F("textBlockQuote.background",{light:"#f2f2f2",dark:"#222222",hcDark:null,hcLight:"#F2F2F2"},p("textBlockQuoteBackground","Background color for block quotes in text.")),wve=F("textBlockQuote.border",{light:"#007acc80",dark:"#007acc80",hcDark:Z.white,hcLight:"#292929"},p("textBlockQuoteBorder","Border color for block quotes in text.")),yve=F("textCodeBlock.background",{light:"#dcdcdc66",dark:"#0a0a0a66",hcDark:Z.black,hcLight:"#F2F2F2"},p("textCodeBlockBackground","Background color for code blocks in text."))});var Tve,ym,U8,$u,qu,ju,Gu,K8,IS=J(()=>{"use strict";_();v();b();Ge();gn();jr();Fc();Tve=F("sash.hoverBorder",{dark:zo,light:zo,hcDark:zo,hcLight:zo},p("sashActiveBorder","Border color of active sashes.")),ym=F("badge.background",{dark:"#4D4D4D",light:"#C4C4C4",hcDark:Z.black,hcLight:"#0F4A85"},p("badgeBackground","Badge background color. Badges are small information labels, e.g. for search results count.")),U8=F("badge.foreground",{dark:Z.white,light:"#333",hcDark:Z.white,hcLight:Z.white},p("badgeForeground","Badge foreground color. Badges are small information labels, e.g. for search results count.")),$u=F("scrollbar.shadow",{dark:"#000000",light:"#DDDDDD",hcDark:null,hcLight:null},p("scrollbarShadow","Scrollbar shadow to indicate that the view is scrolled.")),qu=F("scrollbarSlider.background",{dark:Z.fromHex("#797979").transparent(.4),light:Z.fromHex("#646464").transparent(.4),hcDark:Ee(Ct,.6),hcLight:Ee(Ct,.4)},p("scrollbarSliderBackground","Scrollbar slider background color.")),ju=F("scrollbarSlider.hoverBackground",{dark:Z.fromHex("#646464").transparent(.7),light:Z.fromHex("#646464").transparent(.7),hcDark:Ee(Ct,.8),hcLight:Ee(Ct,.8)},p("scrollbarSliderHoverBackground","Scrollbar slider background color when hovering.")),Gu=F("scrollbarSlider.activeBackground",{dark:Z.fromHex("#BFBFBF").transparent(.4),light:Z.fromHex("#000000").transparent(.6),hcDark:Ct,hcLight:Ct},p("scrollbarSliderActiveBackground","Scrollbar slider background color when clicked on.")),K8=F("progressBar.background",{dark:Z.fromHex("#0E70C0"),light:Z.fromHex("#0E70C0"),hcDark:Ct,hcLight:Ct},p("progressBarBackground","Background color of the progress bar that can show for long running operations."))});var Nn,Zu,Wve,zve,Vve,Hve,Fi,Ba,Sm,Uve,Kve,Wa,$ve,rb,An,Tm,qve,Vo,Nm,Y8,jve,Gve,xm,X8,KA,$A,Zve,Yve,za,Xve,Qve,sh,Jve,e1e,$8,t1e,Q8,i1e,nh,oh,n1e,o1e,s1e,r1e,TS,a1e,l1e,c1e,d1e,h1e,u1e,NS,AS,J8,eB,f1e,g1e,m1e,p1e,tB,iB,_1e,b1e,v1e,C1e,w1e,y1e,S1e,Va,nB,q8,x1e,L1e,oB,sB,qA,rB,k1e,aB,j8,G8,Z8,Gr,Em,Lm,D1e,km,E1e,Dm,I1e,Im,T1e,N1e,A1e,M1e,R1e,lB,cB,dB,rh=J(()=>{"use strict";_();v();b();Ge();gn();jr();Fc();IS();Nn=F("editor.background",{light:"#ffffff",dark:"#1E1E1E",hcDark:Z.black,hcLight:Z.white},p("editorBackground","Editor background color.")),Zu=F("editor.foreground",{light:"#333333",dark:"#BBBBBB",hcDark:Z.white,hcLight:at},p("editorForeground","Editor default foreground color.")),Wve=F("editorStickyScroll.background",{light:Nn,dark:Nn,hcDark:Nn,hcLight:Nn},p("editorStickyScrollBackground","Background color of sticky scroll in the editor")),zve=F("editorStickyScrollHover.background",{dark:"#2A2D2E",light:"#F0F0F0",hcDark:null,hcLight:Z.fromHex("#0F4A85").transparent(.1)},p("editorStickyScrollHoverBackground","Background color of sticky scroll on hover in the editor")),Vve=F("editorStickyScroll.border",{dark:null,light:null,hcDark:Ct,hcLight:Ct},p("editorStickyScrollBorder","Border color of sticky scroll in the editor")),Hve=F("editorStickyScroll.shadow",{dark:$u,light:$u,hcDark:$u,hcLight:$u},p("editorStickyScrollShadow"," Shadow color of sticky scroll in the editor")),Fi=F("editorWidget.background",{dark:"#252526",light:"#F3F3F3",hcDark:"#0C141F",hcLight:Z.white},p("editorWidgetBackground","Background color of editor widgets, such as find/replace.")),Ba=F("editorWidget.foreground",{dark:at,light:at,hcDark:at,hcLight:at},p("editorWidgetForeground","Foreground color of editor widgets, such as find/replace.")),Sm=F("editorWidget.border",{dark:"#454545",light:"#C8C8C8",hcDark:Ct,hcLight:Ct},p("editorWidgetBorder","Border color of editor widgets. The color is only used if the widget chooses to have a border and if the color is not overridden by a widget.")),Uve=F("editorWidget.resizeBorder",{light:null,dark:null,hcDark:null,hcLight:null},p("editorWidgetResizeBorder","Border color of the resize bar of editor widgets. The color is only used if the widget chooses to have a resize border and if the color is not overridden by a widget.")),Kve=F("editorError.background",{dark:null,light:null,hcDark:null,hcLight:null},p("editorError.background","Background color of error text in the editor. The color must not be opaque so as not to hide underlying decorations."),!0),Wa=F("editorError.foreground",{dark:"#F14C4C",light:"#E51400",hcDark:"#F48771",hcLight:"#B5200D"},p("editorError.foreground","Foreground color of error squigglies in the editor.")),$ve=F("editorError.border",{dark:null,light:null,hcDark:Z.fromHex("#E47777").transparent(.8),hcLight:"#B5200D"},p("errorBorder","If set, color of double underlines for errors in the editor.")),rb=F("editorWarning.background",{dark:null,light:null,hcDark:null,hcLight:null},p("editorWarning.background","Background color of warning text in the editor. The color must not be opaque so as not to hide underlying decorations."),!0),An=F("editorWarning.foreground",{dark:"#CCA700",light:"#BF8803",hcDark:"#FFD370",hcLight:"#895503"},p("editorWarning.foreground","Foreground color of warning squigglies in the editor.")),Tm=F("editorWarning.border",{dark:null,light:null,hcDark:Z.fromHex("#FFCC00").transparent(.8),hcLight:Z.fromHex("#FFCC00").transparent(.8)},p("warningBorder","If set, color of double underlines for warnings in the editor.")),qve=F("editorInfo.background",{dark:null,light:null,hcDark:null,hcLight:null},p("editorInfo.background","Background color of info text in the editor. The color must not be opaque so as not to hide underlying decorations."),!0),Vo=F("editorInfo.foreground",{dark:"#3794FF",light:"#1a85ff",hcDark:"#3794FF",hcLight:"#1a85ff"},p("editorInfo.foreground","Foreground color of info squigglies in the editor.")),Nm=F("editorInfo.border",{dark:null,light:null,hcDark:Z.fromHex("#3794FF").transparent(.8),hcLight:"#292929"},p("infoBorder","If set, color of double underlines for infos in the editor.")),Y8=F("editorHint.foreground",{dark:Z.fromHex("#eeeeee").transparent(.7),light:"#6c6c6c",hcDark:null,hcLight:null},p("editorHint.foreground","Foreground color of hint squigglies in the editor.")),jve=F("editorHint.border",{dark:null,light:null,hcDark:Z.fromHex("#eeeeee").transparent(.8),hcLight:"#292929"},p("hintBorder","If set, color of double underlines for hints in the editor.")),Gve=F("editorLink.activeForeground",{dark:"#4E94CE",light:Z.blue,hcDark:Z.cyan,hcLight:"#292929"},p("activeLinkForeground","Color of active links.")),xm=F("editor.selectionBackground",{light:"#ADD6FF",dark:"#264F78",hcDark:"#f3f518",hcLight:"#0F4A85"},p("editorSelectionBackground","Color of the editor selection.")),X8=F("editor.selectionForeground",{light:null,dark:null,hcDark:"#000000",hcLight:Z.white},p("editorSelectionForeground","Color of the selected text for high contrast.")),KA=F("editor.inactiveSelectionBackground",{light:Ee(xm,.5),dark:Ee(xm,.5),hcDark:Ee(xm,.7),hcLight:Ee(xm,.5)},p("editorInactiveSelection","Color of the selection in an inactive editor. The color must not be opaque so as not to hide underlying decorations."),!0),$A=F("editor.selectionHighlightBackground",{light:UA(xm,Nn,.3,.6),dark:UA(xm,Nn,.3,.6),hcDark:null,hcLight:null},p("editorSelectionHighlight","Color for regions with the same content as the selection. The color must not be opaque so as not to hide underlying decorations."),!0),Zve=F("editor.selectionHighlightBorder",{light:null,dark:null,hcDark:ni,hcLight:ni},p("editorSelectionHighlightBorder","Border color for regions with the same content as the selection.")),Yve=F("editor.findMatchBackground",{light:"#A8AC94",dark:"#515C6A",hcDark:null,hcLight:null},p("editorFindMatch","Color of the current search match.")),za=F("editor.findMatchHighlightBackground",{light:"#EA5C0055",dark:"#EA5C0055",hcDark:null,hcLight:null},p("findMatchHighlight","Color of the other search matches. The color must not be opaque so as not to hide underlying decorations."),!0),Xve=F("editor.findRangeHighlightBackground",{dark:"#3a3d4166",light:"#b4b4b44d",hcDark:null,hcLight:null},p("findRangeHighlight","Color of the range limiting the search. The color must not be opaque so as not to hide underlying decorations."),!0),Qve=F("editor.findMatchBorder",{light:null,dark:null,hcDark:ni,hcLight:ni},p("editorFindMatchBorder","Border color of the current search match.")),sh=F("editor.findMatchHighlightBorder",{light:null,dark:null,hcDark:ni,hcLight:ni},p("findMatchHighlightBorder","Border color of the other search matches.")),Jve=F("editor.findRangeHighlightBorder",{dark:null,light:null,hcDark:Ee(ni,.4),hcLight:Ee(ni,.4)},p("findRangeHighlightBorder","Border color of the range limiting the search. The color must not be opaque so as not to hide underlying decorations."),!0),e1e=F("editor.hoverHighlightBackground",{light:"#ADD6FF26",dark:"#264f7840",hcDark:"#ADD6FF26",hcLight:null},p("hoverHighlight","Highlight below the word for which a hover is shown. The color must not be opaque so as not to hide underlying decorations."),!0),$8=F("editorHoverWidget.background",{light:Fi,dark:Fi,hcDark:Fi,hcLight:Fi},p("hoverBackground","Background color of the editor hover.")),t1e=F("editorHoverWidget.foreground",{light:Ba,dark:Ba,hcDark:Ba,hcLight:Ba},p("hoverForeground","Foreground color of the editor hover.")),Q8=F("editorHoverWidget.border",{light:Sm,dark:Sm,hcDark:Sm,hcLight:Sm},p("hoverBorder","Border color of the editor hover.")),i1e=F("editorHoverWidget.statusBarBackground",{dark:zs($8,.2),light:Pl($8,.05),hcDark:Fi,hcLight:Fi},p("statusBarBackground","Background color of the editor hover status bar.")),nh=F("editorInlayHint.foreground",{dark:"#969696",light:"#969696",hcDark:Z.white,hcLight:Z.black},p("editorInlayHintForeground","Foreground color of inline hints")),oh=F("editorInlayHint.background",{dark:Ee(ym,.1),light:Ee(ym,.1),hcDark:Ee(Z.white,.1),hcLight:Ee(ym,.1)},p("editorInlayHintBackground","Background color of inline hints")),n1e=F("editorInlayHint.typeForeground",{dark:nh,light:nh,hcDark:nh,hcLight:nh},p("editorInlayHintForegroundTypes","Foreground color of inline hints for types")),o1e=F("editorInlayHint.typeBackground",{dark:oh,light:oh,hcDark:oh,hcLight:oh},p("editorInlayHintBackgroundTypes","Background color of inline hints for types")),s1e=F("editorInlayHint.parameterForeground",{dark:nh,light:nh,hcDark:nh,hcLight:nh},p("editorInlayHintForegroundParameter","Foreground color of inline hints for parameters")),r1e=F("editorInlayHint.parameterBackground",{dark:oh,light:oh,hcDark:oh,hcLight:oh},p("editorInlayHintBackgroundParameter","Background color of inline hints for parameters")),TS=F("editorLightBulb.foreground",{dark:"#FFCC00",light:"#DDB100",hcDark:"#FFCC00",hcLight:"#007ACC"},p("editorLightBulbForeground","The color used for the lightbulb actions icon.")),a1e=F("editorLightBulbAutoFix.foreground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},p("editorLightBulbAutoFixForeground","The color used for the lightbulb auto fix actions icon.")),l1e=F("editorLightBulbAi.foreground",{dark:TS,light:TS,hcDark:TS,hcLight:TS},p("editorLightBulbAiForeground","The color used for the lightbulb AI icon.")),c1e=F("editor.snippetTabstopHighlightBackground",{dark:new Z(new vt(124,124,124,.3)),light:new Z(new vt(10,50,100,.2)),hcDark:new Z(new vt(124,124,124,.3)),hcLight:new Z(new vt(10,50,100,.2))},p("snippetTabstopHighlightBackground","Highlight background color of a snippet tabstop.")),d1e=F("editor.snippetTabstopHighlightBorder",{dark:null,light:null,hcDark:null,hcLight:null},p("snippetTabstopHighlightBorder","Highlight border color of a snippet tabstop.")),h1e=F("editor.snippetFinalTabstopHighlightBackground",{dark:null,light:null,hcDark:null,hcLight:null},p("snippetFinalTabstopHighlightBackground","Highlight background color of the final tabstop of a snippet.")),u1e=F("editor.snippetFinalTabstopHighlightBorder",{dark:"#525252",light:new Z(new vt(10,50,100,.5)),hcDark:"#525252",hcLight:"#292929"},p("snippetFinalTabstopHighlightBorder","Highlight border color of the final tabstop of a snippet.")),NS=new Z(new vt(155,185,85,.2)),AS=new Z(new vt(255,0,0,.2)),J8=F("diffEditor.insertedTextBackground",{dark:"#9ccc2c33",light:"#9ccc2c40",hcDark:null,hcLight:null},p("diffEditorInserted","Background color for text that got inserted. The color must not be opaque so as not to hide underlying decorations."),!0),eB=F("diffEditor.removedTextBackground",{dark:"#ff000033",light:"#ff000033",hcDark:null,hcLight:null},p("diffEditorRemoved","Background color for text that got removed. The color must not be opaque so as not to hide underlying decorations."),!0),f1e=F("diffEditor.insertedLineBackground",{dark:NS,light:NS,hcDark:null,hcLight:null},p("diffEditorInsertedLines","Background color for lines that got inserted. The color must not be opaque so as not to hide underlying decorations."),!0),g1e=F("diffEditor.removedLineBackground",{dark:AS,light:AS,hcDark:null,hcLight:null},p("diffEditorRemovedLines","Background color for lines that got removed. The color must not be opaque so as not to hide underlying decorations."),!0),m1e=F("diffEditorGutter.insertedLineBackground",{dark:null,light:null,hcDark:null,hcLight:null},p("diffEditorInsertedLineGutter","Background color for the margin where lines got inserted.")),p1e=F("diffEditorGutter.removedLineBackground",{dark:null,light:null,hcDark:null,hcLight:null},p("diffEditorRemovedLineGutter","Background color for the margin where lines got removed.")),tB=F("diffEditorOverview.insertedForeground",{dark:null,light:null,hcDark:null,hcLight:null},p("diffEditorOverviewInserted","Diff overview ruler foreground for inserted content.")),iB=F("diffEditorOverview.removedForeground",{dark:null,light:null,hcDark:null,hcLight:null},p("diffEditorOverviewRemoved","Diff overview ruler foreground for removed content.")),_1e=F("diffEditor.insertedTextBorder",{dark:null,light:null,hcDark:"#33ff2eff",hcLight:"#374E06"},p("diffEditorInsertedOutline","Outline color for the text that got inserted.")),b1e=F("diffEditor.removedTextBorder",{dark:null,light:null,hcDark:"#FF008F",hcLight:"#AD0707"},p("diffEditorRemovedOutline","Outline color for text that got removed.")),v1e=F("diffEditor.border",{dark:null,light:null,hcDark:Ct,hcLight:Ct},p("diffEditorBorder","Border color between the two text editors.")),C1e=F("diffEditor.diagonalFill",{dark:"#cccccc33",light:"#22222233",hcDark:null,hcLight:null},p("diffDiagonalFill","Color of the diff editor's diagonal fill. The diagonal fill is used in side-by-side diff views.")),w1e=F("diffEditor.unchangedRegionBackground",{dark:"sideBar.background",light:"sideBar.background",hcDark:"sideBar.background",hcLight:"sideBar.background"},p("diffEditor.unchangedRegionBackground","The background color of unchanged blocks in the diff editor.")),y1e=F("diffEditor.unchangedRegionForeground",{dark:"foreground",light:"foreground",hcDark:"foreground",hcLight:"foreground"},p("diffEditor.unchangedRegionForeground","The foreground color of unchanged blocks in the diff editor.")),S1e=F("diffEditor.unchangedCodeBackground",{dark:"#74747429",light:"#b8b8b829",hcDark:null,hcLight:null},p("diffEditor.unchangedCodeBackground","The background color of unchanged code in the diff editor.")),Va=F("widget.shadow",{dark:Ee(Z.black,.36),light:Ee(Z.black,.16),hcDark:null,hcLight:null},p("widgetShadow","Shadow color of widgets such as find/replace inside the editor.")),nB=F("widget.border",{dark:null,light:null,hcDark:Ct,hcLight:Ct},p("widgetBorder","Border color of widgets such as find/replace inside the editor.")),q8=F("toolbar.hoverBackground",{dark:"#5a5d5e50",light:"#b8b8b850",hcDark:null,hcLight:null},p("toolbarHoverBackground","Toolbar background when hovering over actions using the mouse")),x1e=F("toolbar.hoverOutline",{dark:null,light:null,hcDark:ni,hcLight:ni},p("toolbarHoverOutline","Toolbar outline when hovering over actions using the mouse")),L1e=F("toolbar.activeBackground",{dark:zs(q8,.1),light:Pl(q8,.1),hcDark:null,hcLight:null},p("toolbarActiveBackground","Toolbar background when holding the mouse over actions")),oB=F("breadcrumb.foreground",{light:Ee(at,.8),dark:Ee(at,.8),hcDark:Ee(at,.8),hcLight:Ee(at,.8)},p("breadcrumbsFocusForeground","Color of focused breadcrumb items.")),sB=F("breadcrumb.background",{light:Nn,dark:Nn,hcDark:Nn,hcLight:Nn},p("breadcrumbsBackground","Background color of breadcrumb items.")),qA=F("breadcrumb.focusForeground",{light:Pl(at,.2),dark:zs(at,.1),hcDark:zs(at,.1),hcLight:zs(at,.1)},p("breadcrumbsFocusForeground","Color of focused breadcrumb items.")),rB=F("breadcrumb.activeSelectionForeground",{light:Pl(at,.2),dark:zs(at,.1),hcDark:zs(at,.1),hcLight:zs(at,.1)},p("breadcrumbsSelectedForeground","Color of selected breadcrumb items.")),k1e=F("breadcrumbPicker.background",{light:Fi,dark:Fi,hcDark:Fi,hcLight:Fi},p("breadcrumbsSelectedBackground","Background color of breadcrumb item picker.")),aB=.5,j8=Z.fromHex("#40C8AE").transparent(aB),G8=Z.fromHex("#40A6FF").transparent(aB),Z8=Z.fromHex("#606060").transparent(.4),Gr=.4,Em=1,Lm=F("merge.currentHeaderBackground",{dark:j8,light:j8,hcDark:null,hcLight:null},p("mergeCurrentHeaderBackground","Current header background in inline merge-conflicts. The color must not be opaque so as not to hide underlying decorations."),!0),D1e=F("merge.currentContentBackground",{dark:Ee(Lm,Gr),light:Ee(Lm,Gr),hcDark:Ee(Lm,Gr),hcLight:Ee(Lm,Gr)},p("mergeCurrentContentBackground","Current content background in inline merge-conflicts. The color must not be opaque so as not to hide underlying decorations."),!0),km=F("merge.incomingHeaderBackground",{dark:G8,light:G8,hcDark:null,hcLight:null},p("mergeIncomingHeaderBackground","Incoming header background in inline merge-conflicts. The color must not be opaque so as not to hide underlying decorations."),!0),E1e=F("merge.incomingContentBackground",{dark:Ee(km,Gr),light:Ee(km,Gr),hcDark:Ee(km,Gr),hcLight:Ee(km,Gr)},p("mergeIncomingContentBackground","Incoming content background in inline merge-conflicts. The color must not be opaque so as not to hide underlying decorations."),!0),Dm=F("merge.commonHeaderBackground",{dark:Z8,light:Z8,hcDark:null,hcLight:null},p("mergeCommonHeaderBackground","Common ancestor header background in inline merge-conflicts. The color must not be opaque so as not to hide underlying decorations."),!0),I1e=F("merge.commonContentBackground",{dark:Ee(Dm,Gr),light:Ee(Dm,Gr),hcDark:Ee(Dm,Gr),hcLight:Ee(Dm,Gr)},p("mergeCommonContentBackground","Common ancestor content background in inline merge-conflicts. The color must not be opaque so as not to hide underlying decorations."),!0),Im=F("merge.border",{dark:null,light:null,hcDark:"#C3DF6F",hcLight:"#007ACC"},p("mergeBorder","Border color on headers and the splitter in inline merge-conflicts.")),T1e=F("editorOverviewRuler.currentContentForeground",{dark:Ee(Lm,Em),light:Ee(Lm,Em),hcDark:Im,hcLight:Im},p("overviewRulerCurrentContentForeground","Current overview ruler foreground for inline merge-conflicts.")),N1e=F("editorOverviewRuler.incomingContentForeground",{dark:Ee(km,Em),light:Ee(km,Em),hcDark:Im,hcLight:Im},p("overviewRulerIncomingContentForeground","Incoming overview ruler foreground for inline merge-conflicts.")),A1e=F("editorOverviewRuler.commonContentForeground",{dark:Ee(Dm,Em),light:Ee(Dm,Em),hcDark:Im,hcLight:Im},p("overviewRulerCommonContentForeground","Common ancestor overview ruler foreground for inline merge-conflicts.")),M1e=F("editorOverviewRuler.findMatchForeground",{dark:"#d186167e",light:"#d186167e",hcDark:"#AB5A00",hcLight:""},p("overviewRulerFindMatchForeground","Overview ruler marker color for find matches. The color must not be opaque so as not to hide underlying decorations."),!0),R1e=F("editorOverviewRuler.selectionHighlightForeground",{dark:"#A0A0A0CC",light:"#A0A0A0CC",hcDark:"#A0A0A0CC",hcLight:"#A0A0A0CC"},p("overviewRulerSelectionHighlightForeground","Overview ruler marker color for selection highlights. The color must not be opaque so as not to hide underlying decorations."),!0),lB=F("problemsErrorIcon.foreground",{dark:Wa,light:Wa,hcDark:Wa,hcLight:Wa},p("problemsErrorIconForeground","The color used for the problems error icon.")),cB=F("problemsWarningIcon.foreground",{dark:An,light:An,hcDark:An,hcLight:An},p("problemsWarningIconForeground","The color used for the problems warning icon.")),dB=F("problemsInfoIcon.foreground",{dark:Vo,light:Vo,hcDark:Vo,hcLight:Vo},p("problemsInfoIconForeground","The color used for the problems info icon."))});var ab,U1e,jA,hB,uB,fB,gB,mB,K1e,$1e,q1e,GA=J(()=>{"use strict";_();v();b();Ge();gn();jr();rh();IS();ab=F("minimap.findMatchHighlight",{light:"#d18616",dark:"#d18616",hcDark:"#AB5A00",hcLight:"#0F4A85"},p("minimapFindMatchHighlight","Minimap marker color for find matches."),!0),U1e=F("minimap.selectionOccurrenceHighlight",{light:"#c9c9c9",dark:"#676767",hcDark:"#ffffff",hcLight:"#0F4A85"},p("minimapSelectionOccurrenceHighlight","Minimap marker color for repeating editor selections."),!0),jA=F("minimap.selectionHighlight",{light:"#ADD6FF",dark:"#264F78",hcDark:"#ffffff",hcLight:"#0F4A85"},p("minimapSelectionHighlight","Minimap marker color for the editor selection."),!0),hB=F("minimap.infoHighlight",{dark:Vo,light:Vo,hcDark:Nm,hcLight:Nm},p("minimapInfo","Minimap marker color for infos.")),uB=F("minimap.warningHighlight",{dark:An,light:An,hcDark:Tm,hcLight:Tm},p("overviewRuleWarning","Minimap marker color for warnings.")),fB=F("minimap.errorHighlight",{dark:new Z(new vt(255,18,18,.7)),light:new Z(new vt(255,18,18,.7)),hcDark:new Z(new vt(255,50,50,1)),hcLight:"#B5200D"},p("minimapError","Minimap marker color for errors.")),gB=F("minimap.background",{dark:null,light:null,hcDark:null,hcLight:null},p("minimapBackground","Minimap background color.")),mB=F("minimap.foregroundOpacity",{dark:Z.fromHex("#000f"),light:Z.fromHex("#000f"),hcDark:Z.fromHex("#000f"),hcLight:Z.fromHex("#000f")},p("minimapForegroundOpacity",'Opacity of foreground elements rendered in the minimap. For example, "#000000c0" will render the elements with 75% opacity.')),K1e=F("minimapSlider.background",{light:Ee(qu,.5),dark:Ee(qu,.5),hcDark:Ee(qu,.5),hcLight:Ee(qu,.5)},p("minimapSliderBackground","Minimap slider background color.")),$1e=F("minimapSlider.hoverBackground",{light:Ee(ju,.5),dark:Ee(ju,.5),hcDark:Ee(ju,.5),hcLight:Ee(ju,.5)},p("minimapSliderHoverBackground","Minimap slider background color when hovering.")),q1e=F("minimapSlider.activeBackground",{light:Ee(Gu,.5),dark:Ee(Gu,.5),hcDark:Ee(Gu,.5),hcLight:Ee(Gu,.5)},p("minimapSliderActiveBackground","Minimap slider background color when clicked on."))});var tCe,iCe,nCe,oCe,sCe,rCe,aCe,lCe,pB=J(()=>{"use strict";_();v();b();Ge();jr();Fc();rh();GA();tCe=F("charts.foreground",{dark:at,light:at,hcDark:at,hcLight:at},p("chartsForeground","The foreground color used in charts.")),iCe=F("charts.lines",{dark:Ee(at,.5),light:Ee(at,.5),hcDark:Ee(at,.5),hcLight:Ee(at,.5)},p("chartsLines","The color used for horizontal lines in charts.")),nCe=F("charts.red",{dark:Wa,light:Wa,hcDark:Wa,hcLight:Wa},p("chartsRed","The red color used in chart visualizations.")),oCe=F("charts.blue",{dark:Vo,light:Vo,hcDark:Vo,hcLight:Vo},p("chartsBlue","The blue color used in chart visualizations.")),sCe=F("charts.yellow",{dark:An,light:An,hcDark:An,hcLight:An},p("chartsYellow","The yellow color used in chart visualizations.")),rCe=F("charts.orange",{dark:ab,light:ab,hcDark:ab,hcLight:ab},p("chartsOrange","The orange color used in chart visualizations.")),aCe=F("charts.green",{dark:"#89D185",light:"#388A34",hcDark:"#89D185",hcLight:"#374e06"},p("chartsGreen","The green color used in chart visualizations.")),lCe=F("charts.purple",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},p("chartsPurple","The purple color used in chart visualizations."))});var _B,bB,vB,CB,_Ce,wB,yB,bCe,SB,xB,LB,kB,DB,EB,IB,TB,NB,Zr,AB,Ha,ah,Am,MB,Mm,RB,PB,OB,MS,FB,BB,vCe,WB,zB,CCe,VB,HB,UB,KB,ZA=J(()=>{"use strict";_();v();b();Ge();gn();jr();Fc();rh();_B=F("input.background",{dark:"#3C3C3C",light:Z.white,hcDark:Z.black,hcLight:Z.white},p("inputBoxBackground","Input box background.")),bB=F("input.foreground",{dark:at,light:at,hcDark:at,hcLight:at},p("inputBoxForeground","Input box foreground.")),vB=F("input.border",{dark:null,light:null,hcDark:Ct,hcLight:Ct},p("inputBoxBorder","Input box border.")),CB=F("inputOption.activeBorder",{dark:"#007ACC",light:"#007ACC",hcDark:Ct,hcLight:Ct},p("inputBoxActiveOptionBorder","Border color of activated options in input fields.")),_Ce=F("inputOption.hoverBackground",{dark:"#5a5d5e80",light:"#b8b8b850",hcDark:null,hcLight:null},p("inputOption.hoverBackground","Background color of activated options in input fields.")),wB=F("inputOption.activeBackground",{dark:Ee(zo,.4),light:Ee(zo,.2),hcDark:Z.transparent,hcLight:Z.transparent},p("inputOption.activeBackground","Background hover color of options in input fields.")),yB=F("inputOption.activeForeground",{dark:Z.white,light:Z.black,hcDark:at,hcLight:at},p("inputOption.activeForeground","Foreground color of activated options in input fields.")),bCe=F("input.placeholderForeground",{light:Ee(at,.5),dark:Ee(at,.5),hcDark:Ee(at,.7),hcLight:Ee(at,.7)},p("inputPlaceholderForeground","Input box foreground color for placeholder text.")),SB=F("inputValidation.infoBackground",{dark:"#063B49",light:"#D6ECF2",hcDark:Z.black,hcLight:Z.white},p("inputValidationInfoBackground","Input validation background color for information severity.")),xB=F("inputValidation.infoForeground",{dark:null,light:null,hcDark:null,hcLight:at},p("inputValidationInfoForeground","Input validation foreground color for information severity.")),LB=F("inputValidation.infoBorder",{dark:"#007acc",light:"#007acc",hcDark:Ct,hcLight:Ct},p("inputValidationInfoBorder","Input validation border color for information severity.")),kB=F("inputValidation.warningBackground",{dark:"#352A05",light:"#F6F5D2",hcDark:Z.black,hcLight:Z.white},p("inputValidationWarningBackground","Input validation background color for warning severity.")),DB=F("inputValidation.warningForeground",{dark:null,light:null,hcDark:null,hcLight:at},p("inputValidationWarningForeground","Input validation foreground color for warning severity.")),EB=F("inputValidation.warningBorder",{dark:"#B89500",light:"#B89500",hcDark:Ct,hcLight:Ct},p("inputValidationWarningBorder","Input validation border color for warning severity.")),IB=F("inputValidation.errorBackground",{dark:"#5A1D1D",light:"#F2DEDE",hcDark:Z.black,hcLight:Z.white},p("inputValidationErrorBackground","Input validation background color for error severity.")),TB=F("inputValidation.errorForeground",{dark:null,light:null,hcDark:null,hcLight:at},p("inputValidationErrorForeground","Input validation foreground color for error severity.")),NB=F("inputValidation.errorBorder",{dark:"#BE1100",light:"#BE1100",hcDark:Ct,hcLight:Ct},p("inputValidationErrorBorder","Input validation border color for error severity.")),Zr=F("dropdown.background",{dark:"#3C3C3C",light:Z.white,hcDark:Z.black,hcLight:Z.white},p("dropdownBackground","Dropdown background.")),AB=F("dropdown.listBackground",{dark:null,light:null,hcDark:Z.black,hcLight:Z.white},p("dropdownListBackground","Dropdown list background.")),Ha=F("dropdown.foreground",{dark:"#F0F0F0",light:at,hcDark:Z.white,hcLight:at},p("dropdownForeground","Dropdown foreground.")),ah=F("dropdown.border",{dark:Zr,light:"#CECECE",hcDark:Ct,hcLight:Ct},p("dropdownBorder","Dropdown border.")),Am=F("button.foreground",{dark:Z.white,light:Z.white,hcDark:Z.white,hcLight:Z.white},p("buttonForeground","Button foreground color.")),MB=F("button.separator",{dark:Ee(Am,.4),light:Ee(Am,.4),hcDark:Ee(Am,.4),hcLight:Ee(Am,.4)},p("buttonSeparator","Button separator color.")),Mm=F("button.background",{dark:"#0E639C",light:"#007ACC",hcDark:null,hcLight:"#0F4A85"},p("buttonBackground","Button background color.")),RB=F("button.hoverBackground",{dark:zs(Mm,.2),light:Pl(Mm,.2),hcDark:Mm,hcLight:Mm},p("buttonHoverBackground","Button background color when hovering.")),PB=F("button.border",{dark:Ct,light:Ct,hcDark:Ct,hcLight:Ct},p("buttonBorder","Button border color.")),OB=F("button.secondaryForeground",{dark:Z.white,light:Z.white,hcDark:Z.white,hcLight:at},p("buttonSecondaryForeground","Secondary button foreground color.")),MS=F("button.secondaryBackground",{dark:"#3A3D41",light:"#5F6A79",hcDark:null,hcLight:Z.white},p("buttonSecondaryBackground","Secondary button background color.")),FB=F("button.secondaryHoverBackground",{dark:zs(MS,.2),light:Pl(MS,.2),hcDark:null,hcLight:null},p("buttonSecondaryHoverBackground","Secondary button background color when hovering.")),BB=F("checkbox.background",{dark:Zr,light:Zr,hcDark:Zr,hcLight:Zr},p("checkbox.background","Background color of checkbox widget.")),vCe=F("checkbox.selectBackground",{dark:Fi,light:Fi,hcDark:Fi,hcLight:Fi},p("checkbox.select.background","Background color of checkbox widget when the element it's in is selected.")),WB=F("checkbox.foreground",{dark:Ha,light:Ha,hcDark:Ha,hcLight:Ha},p("checkbox.foreground","Foreground color of checkbox widget.")),zB=F("checkbox.border",{dark:ah,light:ah,hcDark:ah,hcLight:ah},p("checkbox.border","Border color of checkbox widget.")),CCe=F("checkbox.selectBorder",{dark:ih,light:ih,hcDark:ih,hcLight:ih},p("checkbox.select.border","Border color of checkbox widget when the element it's in is selected.")),VB=F("keybindingLabel.background",{dark:new Z(new vt(128,128,128,.17)),light:new Z(new vt(221,221,221,.4)),hcDark:Z.transparent,hcLight:Z.transparent},p("keybindingLabelBackground","Keybinding label background color. The keybinding label is used to represent a keyboard shortcut.")),HB=F("keybindingLabel.foreground",{dark:Z.fromHex("#CCCCCC"),light:Z.fromHex("#555555"),hcDark:Z.white,hcLight:at},p("keybindingLabelForeground","Keybinding label foreground color. The keybinding label is used to represent a keyboard shortcut.")),UB=F("keybindingLabel.border",{dark:new Z(new vt(51,51,51,.6)),light:new Z(new vt(204,204,204,.4)),hcDark:new Z(new vt(111,195,223)),hcLight:Ct},p("keybindingLabelBorder","Keybinding label border color. The keybinding label is used to represent a keyboard shortcut.")),KB=F("keybindingLabel.bottomBorder",{dark:new Z(new vt(68,68,68,.6)),light:new Z(new vt(187,187,187,.4)),hcDark:new Z(new vt(111,195,223)),hcLight:at},p("keybindingLabelBottomBorder","Keybinding label border bottom color. The keybinding label is used to represent a keyboard shortcut."))});var $B,qB,jB,GB,Yr,fr,Yu,ZB,YB,XB,QB,JB,YA,XA,e6,t6,RS,ICe,TCe,NCe,ACe,i6,n6,o6,s6,MCe,RCe,PCe,Rm,r6,a6,l6,PS=J(()=>{"use strict";_();v();b();Ge();gn();jr();Fc();rh();$B=F("list.focusBackground",{dark:null,light:null,hcDark:null,hcLight:null},p("listFocusBackground","List/Tree background color for the focused item when the list/tree is active. An active list/tree has keyboard focus, an inactive does not.")),qB=F("list.focusForeground",{dark:null,light:null,hcDark:null,hcLight:null},p("listFocusForeground","List/Tree foreground color for the focused item when the list/tree is active. An active list/tree has keyboard focus, an inactive does not.")),jB=F("list.focusOutline",{dark:zo,light:zo,hcDark:ni,hcLight:ni},p("listFocusOutline","List/Tree outline color for the focused item when the list/tree is active. An active list/tree has keyboard focus, an inactive does not.")),GB=F("list.focusAndSelectionOutline",{dark:null,light:null,hcDark:null,hcLight:null},p("listFocusAndSelectionOutline","List/Tree outline color for the focused item when the list/tree is active and selected. An active list/tree has keyboard focus, an inactive does not.")),Yr=F("list.activeSelectionBackground",{dark:"#04395E",light:"#0060C0",hcDark:null,hcLight:Z.fromHex("#0F4A85").transparent(.1)},p("listActiveSelectionBackground","List/Tree background color for the selected item when the list/tree is active. An active list/tree has keyboard focus, an inactive does not.")),fr=F("list.activeSelectionForeground",{dark:Z.white,light:Z.white,hcDark:null,hcLight:null},p("listActiveSelectionForeground","List/Tree foreground color for the selected item when the list/tree is active. An active list/tree has keyboard focus, an inactive does not.")),Yu=F("list.activeSelectionIconForeground",{dark:null,light:null,hcDark:null,hcLight:null},p("listActiveSelectionIconForeground","List/Tree icon foreground color for the selected item when the list/tree is active. An active list/tree has keyboard focus, an inactive does not.")),ZB=F("list.inactiveSelectionBackground",{dark:"#37373D",light:"#E4E6F1",hcDark:null,hcLight:Z.fromHex("#0F4A85").transparent(.1)},p("listInactiveSelectionBackground","List/Tree background color for the selected item when the list/tree is inactive. An active list/tree has keyboard focus, an inactive does not.")),YB=F("list.inactiveSelectionForeground",{dark:null,light:null,hcDark:null,hcLight:null},p("listInactiveSelectionForeground","List/Tree foreground color for the selected item when the list/tree is inactive. An active list/tree has keyboard focus, an inactive does not.")),XB=F("list.inactiveSelectionIconForeground",{dark:null,light:null,hcDark:null,hcLight:null},p("listInactiveSelectionIconForeground","List/Tree icon foreground color for the selected item when the list/tree is inactive. An active list/tree has keyboard focus, an inactive does not.")),QB=F("list.inactiveFocusBackground",{dark:null,light:null,hcDark:null,hcLight:null},p("listInactiveFocusBackground","List/Tree background color for the focused item when the list/tree is inactive. An active list/tree has keyboard focus, an inactive does not.")),JB=F("list.inactiveFocusOutline",{dark:null,light:null,hcDark:null,hcLight:null},p("listInactiveFocusOutline","List/Tree outline color for the focused item when the list/tree is inactive. An active list/tree has keyboard focus, an inactive does not.")),YA=F("list.hoverBackground",{dark:"#2A2D2E",light:"#F0F0F0",hcDark:Z.white.transparent(.1),hcLight:Z.fromHex("#0F4A85").transparent(.1)},p("listHoverBackground","List/Tree background when hovering over items using the mouse.")),XA=F("list.hoverForeground",{dark:null,light:null,hcDark:null,hcLight:null},p("listHoverForeground","List/Tree foreground when hovering over items using the mouse.")),e6=F("list.dropBackground",{dark:"#062F4A",light:"#D6EBFF",hcDark:null,hcLight:null},p("listDropBackground","List/Tree drag and drop background when moving items over other items when using the mouse.")),t6=F("list.dropBetweenBackground",{dark:ih,light:ih,hcDark:null,hcLight:null},p("listDropBetweenBackground","List/Tree drag and drop border color when moving items between items when using the mouse.")),RS=F("list.highlightForeground",{dark:"#2AAAFF",light:"#0066BF",hcDark:zo,hcLight:zo},p("highlight","List/Tree foreground color of the match highlights when searching inside the list/tree.")),ICe=F("list.focusHighlightForeground",{dark:RS,light:W8(Yr,RS,"#BBE7FF"),hcDark:RS,hcLight:RS},p("listFocusHighlightForeground","List/Tree foreground color of the match highlights on actively focused items when searching inside the list/tree.")),TCe=F("list.invalidItemForeground",{dark:"#B89500",light:"#B89500",hcDark:"#B89500",hcLight:"#B5200D"},p("invalidItemForeground","List/Tree foreground color for invalid items, for example an unresolved root in explorer.")),NCe=F("list.errorForeground",{dark:"#F88070",light:"#B01011",hcDark:null,hcLight:null},p("listErrorForeground","Foreground color of list items containing errors.")),ACe=F("list.warningForeground",{dark:"#CCA700",light:"#855F00",hcDark:null,hcLight:null},p("listWarningForeground","Foreground color of list items containing warnings.")),i6=F("listFilterWidget.background",{light:Pl(Fi,0),dark:zs(Fi,0),hcDark:Fi,hcLight:Fi},p("listFilterWidgetBackground","Background color of the type filter widget in lists and trees.")),n6=F("listFilterWidget.outline",{dark:Z.transparent,light:Z.transparent,hcDark:"#f38518",hcLight:"#007ACC"},p("listFilterWidgetOutline","Outline color of the type filter widget in lists and trees.")),o6=F("listFilterWidget.noMatchesOutline",{dark:"#BE1100",light:"#BE1100",hcDark:Ct,hcLight:Ct},p("listFilterWidgetNoMatchesOutline","Outline color of the type filter widget in lists and trees, when there are no matches.")),s6=F("listFilterWidget.shadow",{dark:Va,light:Va,hcDark:Va,hcLight:Va},p("listFilterWidgetShadow","Shadow color of the type filter widget in lists and trees.")),MCe=F("list.filterMatchBackground",{dark:za,light:za,hcDark:null,hcLight:null},p("listFilterMatchHighlight","Background color of the filtered match.")),RCe=F("list.filterMatchBorder",{dark:sh,light:sh,hcDark:Ct,hcLight:ni},p("listFilterMatchHighlightBorder","Border color of the filtered match.")),PCe=F("list.deemphasizedForeground",{dark:"#8C8C8C",light:"#8E8E90",hcDark:"#A7A8A9",hcLight:"#666666"},p("listDeemphasizedForeground","List/Tree foreground color for items that are deemphasized.")),Rm=F("tree.indentGuidesStroke",{dark:"#585858",light:"#a9a9a9",hcDark:"#a9a9a9",hcLight:"#a5a5a5"},p("treeIndentGuidesStroke","Tree stroke color for the indentation guides.")),r6=F("tree.inactiveIndentGuidesStroke",{dark:Ee(Rm,.4),light:Ee(Rm,.4),hcDark:Ee(Rm,.4),hcLight:Ee(Rm,.4)},p("treeInactiveIndentGuidesStroke","Tree stroke color for the indentation guides that are not active.")),a6=F("tree.tableColumnsBorder",{dark:"#CCCCCC20",light:"#61616120",hcDark:null,hcLight:null},p("tableColumnsBorder","Table border color between columns.")),l6=F("tree.tableOddRowsBackground",{dark:Ee(at,.04),light:Ee(at,.04),hcDark:null,hcLight:null},p("tableOddRowsBackgroundColor","Background color for odd table rows."))});var c6,d6,h6,u6,f6,g6,m6,p6=J(()=>{"use strict";_();v();b();Ge();jr();Fc();ZA();PS();c6=F("menu.border",{dark:null,light:null,hcDark:Ct,hcLight:Ct},p("menuBorder","Border color of menus.")),d6=F("menu.foreground",{dark:Ha,light:Ha,hcDark:Ha,hcLight:Ha},p("menuForeground","Foreground color of menu items.")),h6=F("menu.background",{dark:Zr,light:Zr,hcDark:Zr,hcLight:Zr},p("menuBackground","Background color of menu items.")),u6=F("menu.selectionForeground",{dark:fr,light:fr,hcDark:fr,hcLight:fr},p("menuSelectionForeground","Foreground color of the selected menu item in menus.")),f6=F("menu.selectionBackground",{dark:Yr,light:Yr,hcDark:Yr,hcLight:Yr},p("menuSelectionBackground","Background color of the selected menu item in menus.")),g6=F("menu.selectionBorder",{dark:null,light:null,hcDark:ni,hcLight:ni},p("menuSelectionBorder","Border color of the selected menu item in menus.")),m6=F("menu.separatorBackground",{dark:"#606060",light:"#D4D4D4",hcDark:Ct,hcLight:Ct},p("menuSeparatorBackground","Color of a separator menu item in menus."))});var QA,b6,v6,OS,C6,_6,lb,FS,cb,w6=J(()=>{"use strict";_();v();b();Ge();gn();jr();rh();PS();QA=F("quickInput.background",{dark:Fi,light:Fi,hcDark:Fi,hcLight:Fi},p("pickerBackground","Quick picker background color. The quick picker widget is the container for pickers like the command palette.")),b6=F("quickInput.foreground",{dark:Ba,light:Ba,hcDark:Ba,hcLight:Ba},p("pickerForeground","Quick picker foreground color. The quick picker widget is the container for pickers like the command palette.")),v6=F("quickInputTitle.background",{dark:new Z(new vt(255,255,255,.105)),light:new Z(new vt(0,0,0,.06)),hcDark:"#000000",hcLight:Z.white},p("pickerTitleBackground","Quick picker title background color. The quick picker widget is the container for pickers like the command palette.")),OS=F("pickerGroup.foreground",{dark:"#3794FF",light:"#0066BF",hcDark:Z.white,hcLight:"#0F4A85"},p("pickerGroupForeground","Quick picker color for grouping labels.")),C6=F("pickerGroup.border",{dark:"#3F3F46",light:"#CCCEDB",hcDark:Z.white,hcLight:"#0F4A85"},p("pickerGroupBorder","Quick picker color for grouping borders.")),_6=F("quickInput.list.focusBackground",{dark:null,light:null,hcDark:null,hcLight:null},"",void 0,p("quickInput.list.focusBackground deprecation","Please use quickInputList.focusBackground instead")),lb=F("quickInputList.focusForeground",{dark:fr,light:fr,hcDark:fr,hcLight:fr},p("quickInput.listFocusForeground","Quick picker foreground color for the focused item.")),FS=F("quickInputList.focusIconForeground",{dark:Yu,light:Yu,hcDark:Yu,hcLight:Yu},p("quickInput.listFocusIconForeground","Quick picker icon foreground color for the focused item.")),cb=F("quickInputList.focusBackground",{dark:HA(_6,Yr),light:HA(_6,Yr),hcDark:null,hcLight:null},p("quickInput.listFocusBackground","Quick picker background color for the focused item."))});var swe,rwe,awe,y6=J(()=>{"use strict";_();v();b();Ge();jr();Fc();rh();swe=F("search.resultsInfoForeground",{light:at,dark:Ee(at,.65),hcDark:at,hcLight:at},p("search.resultsInfoForeground","Color of the text in the search viewlet's completion message.")),rwe=F("searchEditor.findMatchBackground",{light:Ee(za,.66),dark:Ee(za,.66),hcDark:za,hcLight:za},p("searchEditor.queryMatch","Color of the Search Editor query matches.")),awe=F("searchEditor.findMatchBorder",{light:Ee(sh,.66),dark:Ee(sh,.66),hcDark:sh,hcLight:sh},p("searchEditor.editorFindMatchBorder","Border color of the Search Editor query matches."))});var is=J(()=>{"use strict";_();v();b();jr();Fc();pB();rh();ZA();PS();p6();GA();IS();w6();y6()});function Ol(n){return n===Ss.HIGH_CONTRAST_DARK||n===Ss.HIGH_CONTRAST_LIGHT}function Qu(n){return n===Ss.DARK||n===Ss.HIGH_CONTRAST_DARK}var Ss,ch=J(()=>{"use strict";_();v();b();(function(n){n.DARK="dark",n.LIGHT="light",n.HIGH_CONTRAST_DARK="hcDark",n.HIGH_CONTRAST_LIGHT="hcLight"})(Ss||(Ss={}))});var oi,Ka=J(()=>{"use strict";_();v();b();ot();oi=class n{static _nextVisibleColumn(e,t,i){return e===9?n.nextRenderTabStop(t,i):Ys(e)||J_(e)?t+2:t+1}static visibleColumnFromColumn(e,t,i){let o=Math.min(t-1,e.length),s=e.substring(0,o),r=new lu(s),a=0;for(;!r.eol();){let l=Eg(s,o,r.offset);r.nextGraphemeLength(),a=this._nextVisibleColumn(l,a,i)}return a}static columnFromVisibleColumn(e,t,i){if(t<=0)return 1;let o=e.length,s=new lu(e),r=0,a=1;for(;!s.eol();){let l=Eg(e,o,s.offset);s.nextGraphemeLength();let c=this._nextVisibleColumn(l,r,i),d=s.offset+1;if(c>=t){let h=t-r;return c-t{"use strict";_();v();b();ye();le();qe();Oo();ch();an=De("themeService");bM={ThemingContribution:"base.contributions.theming"},_M=class{constructor(){this.themingParticipants=[],this.themingParticipants=[],this.onThemingParticipantAddedEmitter=new B}onColorThemeChange(e){return this.themingParticipants.push(e),this.onThemingParticipantAddedEmitter.fire(e),be(()=>{let t=this.themingParticipants.indexOf(e);this.themingParticipants.splice(t,1)})}getThemingParticipants(){return this.themingParticipants}},N6=new _M;Vt.add(bM.ThemingContribution,N6);lx=class extends H{constructor(e){super(),this.themeService=e,this.theme=e.getColorTheme(),this._register(this.themeService.onDidColorThemeChange(t=>this.onThemeChange(t)))}onThemeChange(e){this.theme=e,this.updateStyles()}updateStyles(){}}});var vM,CM,RLe,PLe,OLe,FLe,ea,Wl,fx,A6,gx,M6,zl,R6,cx,dx,of,P6,O6,F6,B6,W6,sf,z6,V6,H6,U6,K6,hx,BLe,$6,WLe,zLe,VLe,HLe,q6,j6,ULe,KLe,G6,$Le,qLe,jLe,ux,GLe,Z6,Y6,X6,mx,px,_x,bx,vx,Cx,Q6,J6,eW,tW,iW,nW,oW,sW,rW,aW,lW,cW,dW,ZLe,YLe,$a=J(()=>{"use strict";_();v();b();Ge();gn();is();Qi();vM=F("editor.lineHighlightBackground",{dark:null,light:null,hcDark:null,hcLight:null},p("lineHighlight","Background color for the highlight of line at the cursor position.")),CM=F("editor.lineHighlightBorder",{dark:"#282828",light:"#eeeeee",hcDark:"#f38518",hcLight:Ct},p("lineHighlightBorderBox","Background color for the border around the line at the cursor position.")),RLe=F("editor.rangeHighlightBackground",{dark:"#ffffff0b",light:"#fdff0033",hcDark:null,hcLight:null},p("rangeHighlight","Background color of highlighted ranges, like by quick open and find features. The color must not be opaque so as not to hide underlying decorations."),!0),PLe=F("editor.rangeHighlightBorder",{dark:null,light:null,hcDark:ni,hcLight:ni},p("rangeHighlightBorder","Background color of the border around highlighted ranges.")),OLe=F("editor.symbolHighlightBackground",{dark:za,light:za,hcDark:null,hcLight:null},p("symbolHighlight","Background color of highlighted symbol, like for go to definition or go next/previous symbol. The color must not be opaque so as not to hide underlying decorations."),!0),FLe=F("editor.symbolHighlightBorder",{dark:null,light:null,hcDark:ni,hcLight:ni},p("symbolHighlightBorder","Background color of the border around highlighted symbols.")),ea=F("editorCursor.foreground",{dark:"#AEAFAD",light:Z.black,hcDark:Z.white,hcLight:"#0F4A85"},p("caret","Color of the editor cursor.")),Wl=F("editorCursor.background",null,p("editorCursorBackground","The background color of the editor cursor. Allows customizing the color of a character overlapped by a block cursor.")),fx=F("editorMultiCursor.primary.foreground",{dark:ea,light:ea,hcDark:ea,hcLight:ea},p("editorMultiCursorPrimaryForeground","Color of the primary editor cursor when multiple cursors are present.")),A6=F("editorMultiCursor.primary.background",{dark:Wl,light:Wl,hcDark:Wl,hcLight:Wl},p("editorMultiCursorPrimaryBackground","The background color of the primary editor cursor when multiple cursors are present. Allows customizing the color of a character overlapped by a block cursor.")),gx=F("editorMultiCursor.secondary.foreground",{dark:ea,light:ea,hcDark:ea,hcLight:ea},p("editorMultiCursorSecondaryForeground","Color of secondary editor cursors when multiple cursors are present.")),M6=F("editorMultiCursor.secondary.background",{dark:Wl,light:Wl,hcDark:Wl,hcLight:Wl},p("editorMultiCursorSecondaryBackground","The background color of secondary editor cursors when multiple cursors are present. Allows customizing the color of a character overlapped by a block cursor.")),zl=F("editorWhitespace.foreground",{dark:"#e3e4e229",light:"#33333333",hcDark:"#e3e4e229",hcLight:"#CCCCCC"},p("editorWhitespaces","Color of whitespace characters in the editor.")),R6=F("editorLineNumber.foreground",{dark:"#858585",light:"#237893",hcDark:Z.white,hcLight:"#292929"},p("editorLineNumbers","Color of editor line numbers.")),cx=F("editorIndentGuide.background",{dark:zl,light:zl,hcDark:zl,hcLight:zl},p("editorIndentGuides","Color of the editor indentation guides."),!1,p("deprecatedEditorIndentGuides","'editorIndentGuide.background' is deprecated. Use 'editorIndentGuide.background1' instead.")),dx=F("editorIndentGuide.activeBackground",{dark:zl,light:zl,hcDark:zl,hcLight:zl},p("editorActiveIndentGuide","Color of the active editor indentation guides."),!1,p("deprecatedEditorActiveIndentGuide","'editorIndentGuide.activeBackground' is deprecated. Use 'editorIndentGuide.activeBackground1' instead.")),of=F("editorIndentGuide.background1",{dark:cx,light:cx,hcDark:cx,hcLight:cx},p("editorIndentGuides1","Color of the editor indentation guides (1).")),P6=F("editorIndentGuide.background2",{dark:"#00000000",light:"#00000000",hcDark:"#00000000",hcLight:"#00000000"},p("editorIndentGuides2","Color of the editor indentation guides (2).")),O6=F("editorIndentGuide.background3",{dark:"#00000000",light:"#00000000",hcDark:"#00000000",hcLight:"#00000000"},p("editorIndentGuides3","Color of the editor indentation guides (3).")),F6=F("editorIndentGuide.background4",{dark:"#00000000",light:"#00000000",hcDark:"#00000000",hcLight:"#00000000"},p("editorIndentGuides4","Color of the editor indentation guides (4).")),B6=F("editorIndentGuide.background5",{dark:"#00000000",light:"#00000000",hcDark:"#00000000",hcLight:"#00000000"},p("editorIndentGuides5","Color of the editor indentation guides (5).")),W6=F("editorIndentGuide.background6",{dark:"#00000000",light:"#00000000",hcDark:"#00000000",hcLight:"#00000000"},p("editorIndentGuides6","Color of the editor indentation guides (6).")),sf=F("editorIndentGuide.activeBackground1",{dark:dx,light:dx,hcDark:dx,hcLight:dx},p("editorActiveIndentGuide1","Color of the active editor indentation guides (1).")),z6=F("editorIndentGuide.activeBackground2",{dark:"#00000000",light:"#00000000",hcDark:"#00000000",hcLight:"#00000000"},p("editorActiveIndentGuide2","Color of the active editor indentation guides (2).")),V6=F("editorIndentGuide.activeBackground3",{dark:"#00000000",light:"#00000000",hcDark:"#00000000",hcLight:"#00000000"},p("editorActiveIndentGuide3","Color of the active editor indentation guides (3).")),H6=F("editorIndentGuide.activeBackground4",{dark:"#00000000",light:"#00000000",hcDark:"#00000000",hcLight:"#00000000"},p("editorActiveIndentGuide4","Color of the active editor indentation guides (4).")),U6=F("editorIndentGuide.activeBackground5",{dark:"#00000000",light:"#00000000",hcDark:"#00000000",hcLight:"#00000000"},p("editorActiveIndentGuide5","Color of the active editor indentation guides (5).")),K6=F("editorIndentGuide.activeBackground6",{dark:"#00000000",light:"#00000000",hcDark:"#00000000",hcLight:"#00000000"},p("editorActiveIndentGuide6","Color of the active editor indentation guides (6).")),hx=F("editorActiveLineNumber.foreground",{dark:"#c6c6c6",light:"#0B216F",hcDark:ni,hcLight:ni},p("editorActiveLineNumber","Color of editor active line number"),!1,p("deprecatedEditorActiveLineNumber","Id is deprecated. Use 'editorLineNumber.activeForeground' instead.")),BLe=F("editorLineNumber.activeForeground",{dark:hx,light:hx,hcDark:hx,hcLight:hx},p("editorActiveLineNumber","Color of editor active line number")),$6=F("editorLineNumber.dimmedForeground",{dark:null,light:null,hcDark:null,hcLight:null},p("editorDimmedLineNumber","Color of the final editor line when editor.renderFinalNewline is set to dimmed.")),WLe=F("editorRuler.foreground",{dark:"#5A5A5A",light:Z.lightgrey,hcDark:Z.white,hcLight:"#292929"},p("editorRuler","Color of the editor rulers.")),zLe=F("editorCodeLens.foreground",{dark:"#999999",light:"#919191",hcDark:"#999999",hcLight:"#292929"},p("editorCodeLensForeground","Foreground color of editor CodeLens")),VLe=F("editorBracketMatch.background",{dark:"#0064001a",light:"#0064001a",hcDark:"#0064001a",hcLight:"#0000"},p("editorBracketMatchBackground","Background color behind matching brackets")),HLe=F("editorBracketMatch.border",{dark:"#888",light:"#B9B9B9",hcDark:Ct,hcLight:Ct},p("editorBracketMatchBorder","Color for matching brackets boxes")),q6=F("editorOverviewRuler.border",{dark:"#7f7f7f4d",light:"#7f7f7f4d",hcDark:"#7f7f7f4d",hcLight:"#666666"},p("editorOverviewRulerBorder","Color of the overview ruler border.")),j6=F("editorOverviewRuler.background",null,p("editorOverviewRulerBackground","Background color of the editor overview ruler.")),ULe=F("editorGutter.background",{dark:Nn,light:Nn,hcDark:Nn,hcLight:Nn},p("editorGutter","Background color of the editor gutter. The gutter contains the glyph margins and the line numbers.")),KLe=F("editorUnnecessaryCode.border",{dark:null,light:null,hcDark:Z.fromHex("#fff").transparent(.8),hcLight:Ct},p("unnecessaryCodeBorder","Border color of unnecessary (unused) source code in the editor.")),G6=F("editorUnnecessaryCode.opacity",{dark:Z.fromHex("#000a"),light:Z.fromHex("#0007"),hcDark:null,hcLight:null},p("unnecessaryCodeOpacity",`Opacity of unnecessary (unused) source code in the editor. For example, "#000000c0" will render the code with 75% opacity. For high contrast themes, use the 'editorUnnecessaryCode.border' theme color to underline unnecessary code instead of fading it out.`)),$Le=F("editorGhostText.border",{dark:null,light:null,hcDark:Z.fromHex("#fff").transparent(.8),hcLight:Z.fromHex("#292929").transparent(.8)},p("editorGhostTextBorder","Border color of ghost text in the editor.")),qLe=F("editorGhostText.foreground",{dark:Z.fromHex("#ffffff56"),light:Z.fromHex("#0007"),hcDark:null,hcLight:null},p("editorGhostTextForeground","Foreground color of the ghost text in the editor.")),jLe=F("editorGhostText.background",{dark:null,light:null,hcDark:null,hcLight:null},p("editorGhostTextBackground","Background color of the ghost text in the editor.")),ux=new Z(new vt(0,122,204,.6)),GLe=F("editorOverviewRuler.rangeHighlightForeground",{dark:ux,light:ux,hcDark:ux,hcLight:ux},p("overviewRulerRangeHighlight","Overview ruler marker color for range highlights. The color must not be opaque so as not to hide underlying decorations."),!0),Z6=F("editorOverviewRuler.errorForeground",{dark:new Z(new vt(255,18,18,.7)),light:new Z(new vt(255,18,18,.7)),hcDark:new Z(new vt(255,50,50,1)),hcLight:"#B5200D"},p("overviewRuleError","Overview ruler marker color for errors.")),Y6=F("editorOverviewRuler.warningForeground",{dark:An,light:An,hcDark:Tm,hcLight:Tm},p("overviewRuleWarning","Overview ruler marker color for warnings.")),X6=F("editorOverviewRuler.infoForeground",{dark:Vo,light:Vo,hcDark:Nm,hcLight:Nm},p("overviewRuleInfo","Overview ruler marker color for infos.")),mx=F("editorBracketHighlight.foreground1",{dark:"#FFD700",light:"#0431FAFF",hcDark:"#FFD700",hcLight:"#0431FAFF"},p("editorBracketHighlightForeground1","Foreground color of brackets (1). Requires enabling bracket pair colorization.")),px=F("editorBracketHighlight.foreground2",{dark:"#DA70D6",light:"#319331FF",hcDark:"#DA70D6",hcLight:"#319331FF"},p("editorBracketHighlightForeground2","Foreground color of brackets (2). Requires enabling bracket pair colorization.")),_x=F("editorBracketHighlight.foreground3",{dark:"#179FFF",light:"#7B3814FF",hcDark:"#87CEFA",hcLight:"#7B3814FF"},p("editorBracketHighlightForeground3","Foreground color of brackets (3). Requires enabling bracket pair colorization.")),bx=F("editorBracketHighlight.foreground4",{dark:"#00000000",light:"#00000000",hcDark:"#00000000",hcLight:"#00000000"},p("editorBracketHighlightForeground4","Foreground color of brackets (4). Requires enabling bracket pair colorization.")),vx=F("editorBracketHighlight.foreground5",{dark:"#00000000",light:"#00000000",hcDark:"#00000000",hcLight:"#00000000"},p("editorBracketHighlightForeground5","Foreground color of brackets (5). Requires enabling bracket pair colorization.")),Cx=F("editorBracketHighlight.foreground6",{dark:"#00000000",light:"#00000000",hcDark:"#00000000",hcLight:"#00000000"},p("editorBracketHighlightForeground6","Foreground color of brackets (6). Requires enabling bracket pair colorization.")),Q6=F("editorBracketHighlight.unexpectedBracket.foreground",{dark:new Z(new vt(255,18,18,.8)),light:new Z(new vt(255,18,18,.8)),hcDark:new Z(new vt(255,50,50,1)),hcLight:""},p("editorBracketHighlightUnexpectedBracketForeground","Foreground color of unexpected brackets.")),J6=F("editorBracketPairGuide.background1",{dark:"#00000000",light:"#00000000",hcDark:"#00000000",hcLight:"#00000000"},p("editorBracketPairGuide.background1","Background color of inactive bracket pair guides (1). Requires enabling bracket pair guides.")),eW=F("editorBracketPairGuide.background2",{dark:"#00000000",light:"#00000000",hcDark:"#00000000",hcLight:"#00000000"},p("editorBracketPairGuide.background2","Background color of inactive bracket pair guides (2). Requires enabling bracket pair guides.")),tW=F("editorBracketPairGuide.background3",{dark:"#00000000",light:"#00000000",hcDark:"#00000000",hcLight:"#00000000"},p("editorBracketPairGuide.background3","Background color of inactive bracket pair guides (3). Requires enabling bracket pair guides.")),iW=F("editorBracketPairGuide.background4",{dark:"#00000000",light:"#00000000",hcDark:"#00000000",hcLight:"#00000000"},p("editorBracketPairGuide.background4","Background color of inactive bracket pair guides (4). Requires enabling bracket pair guides.")),nW=F("editorBracketPairGuide.background5",{dark:"#00000000",light:"#00000000",hcDark:"#00000000",hcLight:"#00000000"},p("editorBracketPairGuide.background5","Background color of inactive bracket pair guides (5). Requires enabling bracket pair guides.")),oW=F("editorBracketPairGuide.background6",{dark:"#00000000",light:"#00000000",hcDark:"#00000000",hcLight:"#00000000"},p("editorBracketPairGuide.background6","Background color of inactive bracket pair guides (6). Requires enabling bracket pair guides.")),sW=F("editorBracketPairGuide.activeBackground1",{dark:"#00000000",light:"#00000000",hcDark:"#00000000",hcLight:"#00000000"},p("editorBracketPairGuide.activeBackground1","Background color of active bracket pair guides (1). Requires enabling bracket pair guides.")),rW=F("editorBracketPairGuide.activeBackground2",{dark:"#00000000",light:"#00000000",hcDark:"#00000000",hcLight:"#00000000"},p("editorBracketPairGuide.activeBackground2","Background color of active bracket pair guides (2). Requires enabling bracket pair guides.")),aW=F("editorBracketPairGuide.activeBackground3",{dark:"#00000000",light:"#00000000",hcDark:"#00000000",hcLight:"#00000000"},p("editorBracketPairGuide.activeBackground3","Background color of active bracket pair guides (3). Requires enabling bracket pair guides.")),lW=F("editorBracketPairGuide.activeBackground4",{dark:"#00000000",light:"#00000000",hcDark:"#00000000",hcLight:"#00000000"},p("editorBracketPairGuide.activeBackground4","Background color of active bracket pair guides (4). Requires enabling bracket pair guides.")),cW=F("editorBracketPairGuide.activeBackground5",{dark:"#00000000",light:"#00000000",hcDark:"#00000000",hcLight:"#00000000"},p("editorBracketPairGuide.activeBackground5","Background color of active bracket pair guides (5). Requires enabling bracket pair guides.")),dW=F("editorBracketPairGuide.activeBackground6",{dark:"#00000000",light:"#00000000",hcDark:"#00000000",hcLight:"#00000000"},p("editorBracketPairGuide.activeBackground6","Background color of active bracket pair guides (6). Requires enabling bracket pair guides.")),ZLe=F("editorUnicodeHighlight.border",{dark:An,light:An,hcDark:An,hcLight:An},p("editorUnicodeHighlight.border","Border color used to highlight unicode characters.")),YLe=F("editorUnicodeHighlight.background",{dark:rb,light:rb,hcDark:rb,hcLight:rb},p("editorUnicodeHighlight.background","Background color used to highlight unicode characters."));Lo((n,e)=>{let t=n.getColor(Nn),i=n.getColor(vM),o=i&&!i.isTransparent()?i:t;o&&e.addRule(`.monaco-editor .inputarea.ime-input { background-color: ${o}; }`)})});function MG(n,e,t){let i=0;for(let s=0;s{"use strict";_();v();b();ot();Ka()});var _e,wb=J(()=>{"use strict";_();v();b();Ge();Oi();(function(n){n.editorSimpleInput=new xe("editorSimpleInput",!1,!0),n.editorTextFocus=new xe("editorTextFocus",!1,p("editorTextFocus","Whether the editor text has focus (cursor is blinking)")),n.focus=new xe("editorFocus",!1,p("editorFocus","Whether the editor or an editor widget has focus (e.g. focus is in the find widget)")),n.textInputFocus=new xe("textInputFocus",!1,p("textInputFocus","Whether an editor or a rich text input has focus (cursor is blinking)")),n.readOnly=new xe("editorReadonly",!1,p("editorReadonly","Whether the editor is read-only")),n.inDiffEditor=new xe("inDiffEditor",!1,p("inDiffEditor","Whether the context is a diff editor")),n.isEmbeddedDiffEditor=new xe("isEmbeddedDiffEditor",!1,p("isEmbeddedDiffEditor","Whether the context is an embedded diff editor")),n.inMultiDiffEditor=new xe("inMultiDiffEditor",!1,p("inMultiDiffEditor","Whether the context is a multi diff editor")),n.multiDiffEditorAllCollapsed=new xe("multiDiffEditorAllCollapsed",void 0,p("multiDiffEditorAllCollapsed","Whether all files in multi diff editor are collapsed")),n.hasChanges=new xe("diffEditorHasChanges",!1,p("diffEditorHasChanges","Whether the diff editor has changes")),n.comparingMovedCode=new xe("comparingMovedCode",!1,p("comparingMovedCode","Whether a moved code block is selected for comparison")),n.accessibleDiffViewerVisible=new xe("accessibleDiffViewerVisible",!1,p("accessibleDiffViewerVisible","Whether the accessible diff viewer is visible")),n.diffEditorRenderSideBySideInlineBreakpointReached=new xe("diffEditorRenderSideBySideInlineBreakpointReached",!1,p("diffEditorRenderSideBySideInlineBreakpointReached","Whether the diff editor render side by side inline breakpoint is reached")),n.diffEditorInlineMode=new xe("diffEditorInlineMode",!1,p("diffEditorInlineMode","Whether inline mode is active")),n.diffEditorOriginalWritable=new xe("diffEditorOriginalWritable",!1,p("diffEditorOriginalWritable","Whether modified is writable in the diff editor")),n.diffEditorModifiedWritable=new xe("diffEditorModifiedWritable",!1,p("diffEditorModifiedWritable","Whether modified is writable in the diff editor")),n.diffEditorOriginalUri=new xe("diffEditorOriginalUri","",p("diffEditorOriginalUri","The uri of the original document")),n.diffEditorModifiedUri=new xe("diffEditorModifiedUri","",p("diffEditorModifiedUri","The uri of the modified document")),n.columnSelection=new xe("editorColumnSelection",!1,p("editorColumnSelection","Whether `editor.columnSelection` is enabled")),n.writable=n.readOnly.toNegated(),n.hasNonEmptySelection=new xe("editorHasSelection",!1,p("editorHasSelection","Whether the editor has text selected")),n.hasOnlyEmptySelection=n.hasNonEmptySelection.toNegated(),n.hasMultipleSelections=new xe("editorHasMultipleSelections",!1,p("editorHasMultipleSelections","Whether the editor has multiple selections")),n.hasSingleSelection=n.hasMultipleSelections.toNegated(),n.tabMovesFocus=new xe("editorTabMovesFocus",!1,p("editorTabMovesFocus","Whether `Tab` will move focus out of the editor")),n.tabDoesNotMoveFocus=n.tabMovesFocus.toNegated(),n.isInEmbeddedEditor=new xe("isInEmbeddedEditor",!1,!0),n.canUndo=new xe("canUndo",!1,!0),n.canRedo=new xe("canRedo",!1,!0),n.hoverVisible=new xe("editorHoverVisible",!1,p("editorHoverVisible","Whether the editor hover is visible")),n.hoverFocused=new xe("editorHoverFocused",!1,p("editorHoverFocused","Whether the editor hover is focused")),n.stickyScrollFocused=new xe("stickyScrollFocused",!1,p("stickyScrollFocused","Whether the sticky scroll is focused")),n.stickyScrollVisible=new xe("stickyScrollVisible",!1,p("stickyScrollVisible","Whether the sticky scroll is visible")),n.standaloneColorPickerVisible=new xe("standaloneColorPickerVisible",!1,p("standaloneColorPickerVisible","Whether the standalone color picker is visible")),n.standaloneColorPickerFocused=new xe("standaloneColorPickerFocused",!1,p("standaloneColorPickerFocused","Whether the standalone color picker is focused")),n.inCompositeEditor=new xe("inCompositeEditor",void 0,p("inCompositeEditor","Whether the editor is part of a larger editor (e.g. notebooks)")),n.notInCompositeEditor=n.inCompositeEditor.toNegated(),n.languageId=new xe("editorLangId","",p("editorLangId","The language identifier of the editor")),n.hasCompletionItemProvider=new xe("editorHasCompletionItemProvider",!1,p("editorHasCompletionItemProvider","Whether the editor has a completion item provider")),n.hasCodeActionsProvider=new xe("editorHasCodeActionsProvider",!1,p("editorHasCodeActionsProvider","Whether the editor has a code actions provider")),n.hasCodeLensProvider=new xe("editorHasCodeLensProvider",!1,p("editorHasCodeLensProvider","Whether the editor has a code lens provider")),n.hasDefinitionProvider=new xe("editorHasDefinitionProvider",!1,p("editorHasDefinitionProvider","Whether the editor has a definition provider")),n.hasDeclarationProvider=new xe("editorHasDeclarationProvider",!1,p("editorHasDeclarationProvider","Whether the editor has a declaration provider")),n.hasImplementationProvider=new xe("editorHasImplementationProvider",!1,p("editorHasImplementationProvider","Whether the editor has an implementation provider")),n.hasTypeDefinitionProvider=new xe("editorHasTypeDefinitionProvider",!1,p("editorHasTypeDefinitionProvider","Whether the editor has a type definition provider")),n.hasHoverProvider=new xe("editorHasHoverProvider",!1,p("editorHasHoverProvider","Whether the editor has a hover provider")),n.hasDocumentHighlightProvider=new xe("editorHasDocumentHighlightProvider",!1,p("editorHasDocumentHighlightProvider","Whether the editor has a document highlight provider")),n.hasDocumentSymbolProvider=new xe("editorHasDocumentSymbolProvider",!1,p("editorHasDocumentSymbolProvider","Whether the editor has a document symbol provider")),n.hasReferenceProvider=new xe("editorHasReferenceProvider",!1,p("editorHasReferenceProvider","Whether the editor has a reference provider")),n.hasRenameProvider=new xe("editorHasRenameProvider",!1,p("editorHasRenameProvider","Whether the editor has a rename provider")),n.hasSignatureHelpProvider=new xe("editorHasSignatureHelpProvider",!1,p("editorHasSignatureHelpProvider","Whether the editor has a signature help provider")),n.hasInlayHintsProvider=new xe("editorHasInlayHintsProvider",!1,p("editorHasInlayHintsProvider","Whether the editor has an inline hints provider")),n.hasDocumentFormattingProvider=new xe("editorHasDocumentFormattingProvider",!1,p("editorHasDocumentFormattingProvider","Whether the editor has a document formatting provider")),n.hasDocumentSelectionFormattingProvider=new xe("editorHasDocumentSelectionFormattingProvider",!1,p("editorHasDocumentSelectionFormattingProvider","Whether the editor has a document selection formatting provider")),n.hasMultipleDocumentFormattingProvider=new xe("editorHasMultipleDocumentFormattingProvider",!1,p("editorHasMultipleDocumentFormattingProvider","Whether the editor has multiple document formatting providers")),n.hasMultipleDocumentSelectionFormattingProvider=new xe("editorHasMultipleDocumentSelectionFormattingProvider",!1,p("editorHasMultipleDocumentSelectionFormattingProvider","Whether the editor has multiple document selection formatting providers"))})(_e||(_e={}))});var Gm,FM=J(()=>{"use strict";_();v();b();le();Gm=class extends H{constructor(){super(...arguments),this._isDisposed=!1}dispose(){super.dispose(),this._isDisposed=!0}assertNotDisposed(){if(this._isDisposed)throw new Error("TextModelPart is disposed!")}}});function CW(n,e){let t=0,i=0,o=n.length;for(;i{"use strict";_();v();b()});var Vc,ia,Hc,Kx=J(()=>{"use strict";_();v();b();(function(n){n[n.Disabled=0]="Disabled",n[n.EnabledForActive=1]="EnabledForActive",n[n.Enabled=2]="Enabled"})(Vc||(Vc={}));ia=class{constructor(e,t,i,o,s,r){if(this.visibleColumn=e,this.column=t,this.className=i,this.horizontalLine=o,this.forWrappedLinesAfterColumn=s,this.forWrappedLinesBeforeOrAtColumn=r,e!==-1==(t!==-1))throw new Error}},Hc=class{constructor(e,t){this.top=e,this.endColumn=t}}});var $x,Lb,BM=J(()=>{"use strict";_();v();b();Dl();ot();Ka();Ke();FM();wW();Kx();xt();$x=class extends Gm{constructor(e,t){super(),this.textModel=e,this.languageConfigurationService=t}getLanguageConfiguration(e){return this.languageConfigurationService.getLanguageConfiguration(e)}_computeIndentLevel(e){return CW(this.textModel.getLineContent(e+1),this.textModel.getOptions().tabSize)}getActiveIndentGuide(e,t,i){this.assertNotDisposed();let o=this.textModel.getLineCount();if(e<1||e>o)throw new St("Illegal value for lineNumber");let s=this.getLanguageConfiguration(this.textModel.getLanguageId()).foldingRules,r=!!(s&&s.offSide),a=-2,l=-1,c=-2,d=-1,h=N=>{if(a!==-1&&(a===-2||a>N-1)){a=-1,l=-1;for(let M=N-2;M>=0;M--){let W=this._computeIndentLevel(M);if(W>=0){a=M,l=W;break}}}if(c===-2){c=-1,d=-1;for(let M=N;M=0){c=M,d=W;break}}}},u=-2,f=-1,g=-2,m=-1,C=N=>{if(u===-2){u=-1,f=-1;for(let M=N-2;M>=0;M--){let W=this._computeIndentLevel(M);if(W>=0){u=M,f=W;break}}}if(g!==-1&&(g===-2||g=0){g=M,m=W;break}}}},S=0,w=!0,y=0,x=!0,k=0,T=0;for(let N=0;w||x;N++){let M=e-N,W=e+N;N>1&&(M<1||M1&&(W>o||W>i)&&(x=!1),N>5e4&&(w=!1,x=!1);let j=-1;if(w&&M>=1){let V=this._computeIndentLevel(M-1);V>=0?(c=M-1,d=V,j=Math.ceil(V/this.textModel.getOptions().indentSize)):(h(M),j=this._getIndentLevelForWhitespaceLine(r,l,d))}let G=-1;if(x&&W<=o){let V=this._computeIndentLevel(W-1);V>=0?(u=W-1,f=V,G=Math.ceil(V/this.textModel.getOptions().indentSize)):(C(W),G=this._getIndentLevelForWhitespaceLine(r,f,m))}if(N===0){T=j;continue}if(N===1){if(W<=o&&G>=0&&T+1===G){w=!1,S=W,y=W,k=G;continue}if(M>=1&&j>=0&&j-1===T){x=!1,S=M,y=M,k=j;continue}if(S=e,y=e,k=T,k===0)return{startLineNumber:S,endLineNumber:y,indent:k}}w&&(j>=k?S=M:w=!1),x&&(G>=k?y=W:x=!1)}return{startLineNumber:S,endLineNumber:y,indent:k}}getLinesBracketGuides(e,t,i,o){var s;let r=[];for(let u=e;u<=t;u++)r.push([]);let a=!0,l=this.textModel.bracketPairs.getBracketPairsInRangeWithMinIndentation(new P(e,1,t,this.textModel.getLineMaxColumn(t))).toArray(),c;if(i&&l.length>0){let u=(e<=i.lineNumber&&i.lineNumber<=t?l:this.textModel.bracketPairs.getBracketPairsInRange(P.fromPositions(i)).toArray()).filter(f=>P.strictContainsPosition(f.range,i));c=(s=Mu(u,f=>a||f.range.startLineNumber!==f.range.endLineNumber))===null||s===void 0?void 0:s.range}let d=this.textModel.getOptions().bracketPairColorizationOptions.independentColorPoolPerBracketType,h=new Lb;for(let u of l){if(!u.closingBracketRange)continue;let f=c&&u.range.equalsRange(c);if(!f&&!o.includeInactive)continue;let g=h.getInlineClassName(u.nestingLevel,u.nestingLevelOfEqualBracketType,d)+(o.highlightActive&&f?" "+h.activeClassName:""),m=u.openingBracketRange.getStartPosition(),C=u.closingBracketRange.getStartPosition(),S=o.horizontalGuides===Vc.Enabled||o.horizontalGuides===Vc.EnabledForActive&&f;if(u.range.startLineNumber===u.range.endLineNumber){a&&S&&r[u.range.startLineNumber-e].push(new ia(-1,u.openingBracketRange.getEndPosition().column,g,new Hc(!1,C.column),-1,-1));continue}let w=this.getVisibleColumnFromPosition(C),y=this.getVisibleColumnFromPosition(u.openingBracketRange.getStartPosition()),x=Math.min(y,w,u.minVisibleColumnIndentation+1),k=!1;Ri(this.textModel.getLineContent(u.closingBracketRange.startLineNumber))=e&&y>x&&r[m.lineNumber-e].push(new ia(x,-1,g,new Hc(!1,m.column),-1,-1)),C.lineNumber<=t&&w>x&&r[C.lineNumber-e].push(new ia(x,-1,g,new Hc(!k,C.column),-1,-1)))}for(let u of r)u.sort((f,g)=>f.visibleColumn-g.visibleColumn);return r}getVisibleColumnFromPosition(e){return oi.visibleColumnFromColumn(this.textModel.getLineContent(e.lineNumber),e.column,this.textModel.getOptions().tabSize)+1}getLinesIndentGuides(e,t){this.assertNotDisposed();let i=this.textModel.getLineCount();if(e<1||e>i)throw new Error("Illegal value for startLineNumber");if(t<1||t>i)throw new Error("Illegal value for endLineNumber");let o=this.textModel.getOptions(),s=this.getLanguageConfiguration(this.textModel.getLanguageId()).foldingRules,r=!!(s&&s.offSide),a=new Array(t-e+1),l=-2,c=-1,d=-2,h=-1;for(let u=e;u<=t;u++){let f=u-e,g=this._computeIndentLevel(u-1);if(g>=0){l=u-1,c=g,a[f]=Math.ceil(g/o.indentSize);continue}if(l===-2){l=-1,c=-1;for(let m=u-2;m>=0;m--){let C=this._computeIndentLevel(m);if(C>=0){l=m,c=C;break}}}if(d!==-1&&(d===-2||d=0){d=m,h=C;break}}}a[f]=this._getIndentLevelForWhitespaceLine(r,c,h)}return a}_getIndentLevelForWhitespaceLine(e,t,i){let o=this.textModel.getOptions();return t===-1||i===-1?0:t{"use strict";_();v();b();_L=class{constructor(){this.changeType=1}},Ls=class n{static applyInjectedText(e,t){if(!t||t.length===0)return e;let i="",o=0;for(let s of t)i+=e.substring(o,s.column-1),o=s.column-1,i+=s.options.content;return i+=e.substring(o),i}static fromDecorations(e){let t=[];for(let i of e)i.options.before&&i.options.before.content.length>0&&t.push(new n(i.ownerId,i.range.startLineNumber,i.range.startColumn,i.options.before,0)),i.options.after&&i.options.after.content.length>0&&t.push(new n(i.ownerId,i.range.endLineNumber,i.range.endColumn,i.options.after,1));return t.sort((i,o)=>i.lineNumber===o.lineNumber?i.column===o.column?i.order-o.order:i.column-o.column:i.lineNumber-o.lineNumber),t}constructor(e,t,i,o,s){this.ownerId=e,this.lineNumber=t,this.column=i,this.options=o,this.order=s}},Ab=class{constructor(e,t,i){this.changeType=2,this.lineNumber=e,this.detail=t,this.injectedText=i}},bL=class{constructor(e,t){this.changeType=3,this.fromLineNumber=e,this.toLineNumber=t}},vL=class{constructor(e,t,i,o){this.changeType=4,this.injectedTexts=o,this.fromLineNumber=e,this.toLineNumber=t,this.detail=i}},CL=class{constructor(){this.changeType=5}},pf=class n{constructor(e,t,i,o){this.changes=e,this.versionId=t,this.isUndoing=i,this.isRedoing=o,this.resultingSelection=null}containsEvent(e){for(let t=0,i=this.changes.length;t{"use strict";_();v();b()});var Mb,JM,SL,IW=J(()=>{"use strict";_();v();b();Mb=class{constructor(e,t,i,o){this.range=e,this.nestingLevel=t,this.nestingLevelOfEqualBracketType=i,this.isInvalid=o}},JM=class{constructor(e,t,i,o,s,r){this.range=e,this.openingBracketRange=t,this.closingBracketRange=i,this.nestingLevel=o,this.nestingLevelOfEqualBracketType=s,this.bracketPairNode=r}get openingBracketInfo(){return this.bracketPairNode.openingBracket.bracketInfo}},SL=class extends JM{constructor(e,t,i,o,s,r,a){super(e,t,i,o,s,r),this.minVisibleColumnIndentation=a}}});function TW(n,e,t,i){return n!==t?bi(t-n,i):bi(0,i-e)}function ip(n){return n===0}function bi(n,e){return n*Vs+e}function Ho(n){let e=n,t=Math.floor(e/Vs),i=e-t*Vs;return new ws(t,i)}function NW(n){return Math.floor(n/Vs)}function vi(n,e){let t=n+e;return e>=Vs&&(t=t-n%Vs),t}function AW(n,e){return n.reduce((t,i)=>vi(t,e(i)),Fn)}function eR(n,e){return n===e}function _f(n,e){let t=n,i=e;if(i-t<=0)return Fn;let s=Math.floor(t/Vs),r=Math.floor(i/Vs),a=i-r*Vs;if(s===r){let l=t-s*Vs;return bi(0,a-l)}else return bi(r-s,a)}function Kc(n,e){return n=e}function Ch(n){return bi(n.lineNumber-1,n.column-1)}function wh(n,e){let t=n,i=Math.floor(t/Vs),o=t-i*Vs,s=e,r=Math.floor(s/Vs),a=s-r*Vs;return new P(i+1,o+1,r+1,a+1)}function MW(n){let e=Tr(n);return bi(e.length-1,e[e.length-1].length)}var Fn,Vs,$c=J(()=>{"use strict";_();v();b();ot();Ke();om();Fn=0;Vs=2**26});var oa,xL,tR,Rb=J(()=>{"use strict";_();v();b();Ke();$c();oa=class n{static fromModelContentChanges(e){return e.map(i=>{let o=P.lift(i.range);return new n(Ch(o.getStartPosition()),Ch(o.getEndPosition()),MW(i.text))}).reverse()}constructor(e,t,i){this.startOffset=e,this.endOffset=t,this.newLength=i}toString(){return`[${Ho(this.startOffset)}...${Ho(this.endOffset)}) -> ${Ho(this.newLength)}`}},xL=class{constructor(e){this.nextEditIdx=0,this.deltaOldToNewLineCount=0,this.deltaOldToNewColumnCount=0,this.deltaLineIdxInOld=-1,this.edits=e.map(t=>tR.from(t))}getOffsetBeforeChange(e){return this.adjustNextEdit(e),this.translateCurToOld(e)}getDistanceToNextChange(e){this.adjustNextEdit(e);let t=this.edits[this.nextEditIdx],i=t?this.translateOldToCur(t.offsetObj):null;return i===null?null:_f(e,i)}translateOldToCur(e){return e.lineCount===this.deltaLineIdxInOld?bi(e.lineCount+this.deltaOldToNewLineCount,e.columnCount+this.deltaOldToNewColumnCount):bi(e.lineCount+this.deltaOldToNewLineCount,e.columnCount)}translateCurToOld(e){let t=Ho(e);return t.lineCount-this.deltaOldToNewLineCount===this.deltaLineIdxInOld?bi(t.lineCount-this.deltaOldToNewLineCount,t.columnCount-this.deltaOldToNewColumnCount):bi(t.lineCount-this.deltaOldToNewLineCount,t.columnCount)}adjustNextEdit(e){for(;this.nextEditIdx{"use strict";_();v();b();LL=[],_n=class n{static create(e,t){if(e<=128&&t.length===0){let i=n.cache[e];return i||(i=new n(e,t),n.cache[e]=i),i}return new n(e,t)}static getEmpty(){return this.empty}constructor(e,t){this.items=e,this.additionalItems=t}add(e,t){let i=t.getKey(e),o=i>>5;if(o===0){let r=1<{"use strict";_();v();b();xt();Ka();$c();op();Pb=class{get length(){return this._length}constructor(e){this._length=e}},Ob=class n extends Pb{static create(e,t,i){let o=e.length;return t&&(o=vi(o,t.length)),i&&(o=vi(o,i.length)),new n(o,e,t,i,t?t.missingOpeningBracketIds:_n.getEmpty())}get kind(){return 2}get listHeight(){return 0}get childrenLength(){return 3}getChild(e){switch(e){case 0:return this.openingBracket;case 1:return this.child;case 2:return this.closingBracket}throw new Error("Invalid child index")}get children(){let e=[];return e.push(this.openingBracket),this.child&&e.push(this.child),this.closingBracket&&e.push(this.closingBracket),e}constructor(e,t,i,o,s){super(e),this.openingBracket=t,this.child=i,this.closingBracket=o,this.missingOpeningBracketIds=s}canBeReused(e){return!(this.closingBracket===null||e.intersects(this.missingOpeningBracketIds))}deepClone(){return new n(this.length,this.openingBracket.deepClone(),this.child&&this.child.deepClone(),this.closingBracket&&this.closingBracket.deepClone(),this.missingOpeningBracketIds)}computeMinIndentation(e,t){return this.child?this.child.computeMinIndentation(vi(e,this.openingBracket.length),t):Number.MAX_SAFE_INTEGER}},Hs=class extends Pb{static create23(e,t,i,o=!1){let s=e.length,r=e.missingOpeningBracketIds;if(e.listHeight!==t.listHeight)throw new Error("Invalid list heights");if(s=vi(s,t.length),r=r.merge(t.missingOpeningBracketIds),i){if(e.listHeight!==i.listHeight)throw new Error("Invalid list heights");s=vi(s,i.length),r=r.merge(i.missingOpeningBracketIds)}return o?new nR(s,e.listHeight+1,e,t,i,r):new Fb(s,e.listHeight+1,e,t,i,r)}static getEmpty(){return new oR(Fn,0,[],_n.getEmpty())}get kind(){return 4}get missingOpeningBracketIds(){return this._missingOpeningBracketIds}constructor(e,t,i){super(e),this.listHeight=t,this._missingOpeningBracketIds=i,this.cachedMinIndentation=-1}throwIfImmutable(){}makeLastElementMutable(){this.throwIfImmutable();let e=this.childrenLength;if(e===0)return;let t=this.getChild(e-1),i=t.kind===4?t.toMutable():t;return t!==i&&this.setChild(e-1,i),i}makeFirstElementMutable(){if(this.throwIfImmutable(),this.childrenLength===0)return;let t=this.getChild(0),i=t.kind===4?t.toMutable():t;return t!==i&&this.setChild(0,i),i}canBeReused(e){if(e.intersects(this.missingOpeningBracketIds)||this.childrenLength===0)return!1;let t=this;for(;t.kind===4;){let i=t.childrenLength;if(i===0)throw new St;t=t.getChild(i-1)}return t.canBeReused(e)}handleChildrenChanged(){this.throwIfImmutable();let e=this.childrenLength,t=this.getChild(0).length,i=this.getChild(0).missingOpeningBracketIds;for(let o=1;o{"use strict";_();v();b();xt();um();zb();$c();op();Ga=class{constructor(e,t,i,o,s){this.length=e,this.kind=t,this.bracketId=i,this.bracketIds=o,this.astNode=s}},IL=class{constructor(e,t){this.textModel=e,this.bracketTokens=t,this.reader=new sR(this.textModel,this.bracketTokens),this._offset=Fn,this.didPeek=!1,this.peeked=null,this.textBufferLineCount=e.getLineCount(),this.textBufferLastLineLength=e.getLineLength(this.textBufferLineCount)}get offset(){return this._offset}get length(){return bi(this.textBufferLineCount-1,this.textBufferLastLineLength)}skip(e){this.didPeek=!1,this._offset=vi(this._offset,e);let t=Ho(this._offset);this.reader.setPosition(t.lineCount,t.columnCount)}read(){let e;return this.peeked?(this.didPeek=!1,e=this.peeked):e=this.reader.read(),e&&(this._offset=vi(this._offset,e.length)),e}peek(){return this.didPeek||(this.peeked=this.reader.read(),this.didPeek=!0),this.peeked}},sR=class{constructor(e,t){this.textModel=e,this.bracketTokens=t,this.lineIdx=0,this.line=null,this.lineCharOffset=0,this.lineTokens=null,this.lineTokenOffset=0,this.peekedToken=null,this.textBufferLineCount=e.getLineCount(),this.textBufferLastLineLength=e.getLineLength(this.textBufferLineCount)}setPosition(e,t){e===this.lineIdx?(this.lineCharOffset=t,this.line!==null&&(this.lineTokenOffset=this.lineCharOffset===0?0:this.lineTokens.findTokenIndexAtOffset(this.lineCharOffset))):(this.lineIdx=e,this.lineCharOffset=t,this.line=null),this.peekedToken=null}read(){if(this.peekedToken){let s=this.peekedToken;return this.peekedToken=null,this.lineCharOffset+=s.length,s}if(this.lineIdx>this.textBufferLineCount-1||this.lineIdx===this.textBufferLineCount-1&&this.lineCharOffset>=this.textBufferLastLineLength)return null;this.line===null&&(this.lineTokens=this.textModel.tokenization.getLineTokens(this.lineIdx+1),this.line=this.lineTokens.getLineContent(),this.lineTokenOffset=this.lineCharOffset===0?0:this.lineTokens.findTokenIndexAtOffset(this.lineCharOffset));let e=this.lineIdx,t=this.lineCharOffset,i=0;for(;;){let s=this.lineTokens,r=s.getCount(),a=null;if(this.lineTokenOffset1e3))break;if(i>1500)break}let o=TW(e,t,this.lineIdx,this.lineCharOffset);return new Ga(o,0,-1,_n.getEmpty(),new ja(o))}},TL=class{constructor(e,t){this.text=e,this._offset=Fn,this.idx=0;let i=t.getRegExpStr(),o=i?new RegExp(i+`| +`,"gi"):null,s=[],r,a=0,l=0,c=0,d=0,h=[];for(let g=0;g<60;g++)h.push(new Ga(bi(0,g),0,-1,_n.getEmpty(),new ja(bi(0,g))));let u=[];for(let g=0;g<60;g++)u.push(new Ga(bi(1,g),0,-1,_n.getEmpty(),new ja(bi(1,g))));if(o)for(o.lastIndex=0;(r=o.exec(e))!==null;){let g=r.index,m=r[0];if(m===` +`)a++,l=g+1;else{if(c!==g){let C;if(d===a){let S=g-c;if(S{"use strict";_();v();b();ot();zb();$c();op();rR();aR=class n{static createFromLanguage(e,t){function i(s){return t.getKey(`${s.languageId}:::${s.bracketText}`)}let o=new Map;for(let s of e.bracketsNew.openingBrackets){let r=bi(0,s.bracketText.length),a=i(s),l=_n.getEmpty().add(a,iR);o.set(s.bracketText,new Ga(r,1,a,l,Wb.create(r,s,l)))}for(let s of e.bracketsNew.closingBrackets){let r=bi(0,s.bracketText.length),a=_n.getEmpty(),l=s.getOpeningBrackets();for(let c of l)a=a.add(i(c),iR);o.set(s.bracketText,new Ga(r,2,i(l[0]),a,Wb.create(r,s,a)))}return new n(o)}constructor(e){this.map=e,this.hasRegExp=!1,this._regExpGlobal=null}getRegExpStr(){if(this.isEmpty)return null;{let e=[...this.map.keys()];return e.sort(),e.reverse(),e.map(t=>JG(t)).join("|")}}get regExpGlobal(){if(!this.hasRegExp){let e=this.getRegExpStr();this._regExpGlobal=e?new RegExp(e,"gi"):null,this.hasRegExp=!0}return this._regExpGlobal}getToken(e){return this.map.get(e.toLowerCase())}findClosingTokenText(e){for(let[t,i]of this.map)if(i.kind===2&&i.bracketIds.intersects(e))return t}get isEmpty(){return this.map.size===0}};NL=class{constructor(e,t){this.denseKeyProvider=e,this.getLanguageConfiguration=t,this.languageIdToBracketTokens=new Map}didLanguageChange(e){return this.languageIdToBracketTokens.has(e)}getSingleLanguageBracketTokens(e){let t=this.languageIdToBracketTokens.get(e);return t||(t=aR.createFromLanguage(this.getLanguageConfiguration(e),this.denseKeyProvider),this.languageIdToBracketTokens.set(e,t)),t}}});function OW(n){if(n.length===0)return null;if(n.length===1)return n[0];let e=0;function t(){if(e>=n.length)return null;let r=e,a=n[r].listHeight;for(e++;e=2?cR(r===0&&e===n.length?n:n.slice(r,e),!1):n[r]}let i=t(),o=t();if(!o)return i;for(let r=t();r;r=t())PW(i,o)<=PW(o,r)?(i=lR(i,o),o=r):o=lR(o,r);return lR(i,o)}function cR(n,e=!1){if(n.length===0)return null;if(n.length===1)return n[0];let t=n.length;for(;t>3;){let i=t>>1;for(let o=0;o=3?n[2]:null,e)}function PW(n,e){return Math.abs(n.listHeight-e.listHeight)}function lR(n,e){return n.listHeight===e.listHeight?Hs.create23(n,e,null,!1):n.listHeight>e.listHeight?eZ(n,e):tZ(e,n)}function eZ(n,e){n=n.toMutable();let t=n,i=[],o;for(;;){if(e.listHeight===t.listHeight){o=e;break}if(t.kind!==4)throw new Error("unexpected");i.push(t),t=t.makeLastElementMutable()}for(let s=i.length-1;s>=0;s--){let r=i[s];o?r.childrenLength>=3?o=Hs.create23(r.unappendChild(),o,null,!1):(r.appendChildOfSameHeight(o),o=void 0):r.handleChildrenChanged()}return o?Hs.create23(n,o,null,!1):n}function tZ(n,e){n=n.toMutable();let t=n,i=[];for(;e.listHeight!==t.listHeight;){if(t.kind!==4)throw new Error("unexpected");i.push(t),t=t.makeFirstElementMutable()}let o=e;for(let s=i.length-1;s>=0;s--){let r=i[s];o?r.childrenLength>=3?o=Hs.create23(o,r.unprependChild(),null,!1):(r.prependChildOfSameHeight(o),o=void 0):r.handleChildrenChanged()}return o?Hs.create23(o,n,null,!1):n}var FW=J(()=>{"use strict";_();v();b();zb()});function dR(n,e=-1){for(;;){if(e++,e>=n.childrenLength)return-1;if(n.getChild(e))return e}}function Vb(n){return n.length>0?n[n.length-1]:void 0}var AL,BW=J(()=>{"use strict";_();v();b();$c();AL=class{constructor(e){this.lastOffset=Fn,this.nextNodes=[e],this.offsets=[Fn],this.idxs=[]}readLongestNodeAt(e,t){if(Kc(e,this.lastOffset))throw new Error("Invalid offset");for(this.lastOffset=e;;){let i=Vb(this.nextNodes);if(!i)return;let o=Vb(this.offsets);if(Kc(e,o))return;if(Kc(o,e))if(vi(o,i.length)<=e)this.nextNodeAfterCurrent();else{let s=dR(i);s!==-1?(this.nextNodes.push(i.getChild(s)),this.offsets.push(o),this.idxs.push(s)):this.nextNodeAfterCurrent()}else{if(t(i))return this.nextNodeAfterCurrent(),i;{let s=dR(i);if(s===-1){this.nextNodeAfterCurrent();return}else this.nextNodes.push(i.getChild(s)),this.offsets.push(o),this.idxs.push(s)}}}}nextNodeAfterCurrent(){for(;;){let e=Vb(this.offsets),t=Vb(this.nextNodes);if(this.nextNodes.pop(),this.offsets.pop(),this.idxs.length===0)break;let i=Vb(this.nextNodes),o=dR(i,this.idxs[this.idxs.length-1]);if(o!==-1){this.nextNodes.push(i.getChild(o)),this.offsets.push(vi(e,t.length)),this.idxs[this.idxs.length-1]=o;break}else this.idxs.pop()}}}});function uR(n,e,t,i){return new hR(n,e,t,i).parseDocument()}var hR,WW=J(()=>{"use strict";_();v();b();zb();Rb();op();$c();FW();BW();hR=class{constructor(e,t,i,o){if(this.tokenizer=e,this.createImmutableLists=o,this._itemsConstructed=0,this._itemsFromCache=0,i&&o)throw new Error("Not supported");this.oldNodeReader=i?new AL(i):void 0,this.positionMapper=new xL(t)}parseDocument(){this._itemsConstructed=0,this._itemsFromCache=0;let e=this.parseList(_n.getEmpty(),0);return e||(e=Hs.getEmpty()),e}parseList(e,t){let i=[];for(;;){let s=this.tryReadChildFromCache(e);if(!s){let r=this.tokenizer.peek();if(!r||r.kind===2&&r.bracketIds.intersects(e))break;s=this.parseChild(e,t+1)}s.kind===4&&s.childrenLength===0||i.push(s)}return this.oldNodeReader?OW(i):cR(i,this.createImmutableLists)}tryReadChildFromCache(e){if(this.oldNodeReader){let t=this.positionMapper.getDistanceToNextChange(this.tokenizer.offset);if(t===null||!ip(t)){let i=this.oldNodeReader.readLongestNodeAt(this.positionMapper.getOffsetBeforeChange(this.tokenizer.offset),o=>t!==null&&!Kc(o.length,t)?!1:o.canBeReused(e));if(i)return this._itemsFromCache++,this.tokenizer.skip(i.length),i}}}parseChild(e,t){this._itemsConstructed++;let i=this.tokenizer.read();switch(i.kind){case 2:return new EL(i.bracketIds,i.length);case 0:return i.astNode;case 1:{if(t>300)return new ja(i.length);let o=e.merge(i.bracketIds),s=this.parseList(o,t+1),r=this.tokenizer.peek();return r&&r.kind===2&&(r.bracketId===i.bracketId||r.bracketIds.intersects(i.bracketIds))?(this.tokenizer.read(),Ob.create(i.astNode,s,r.astNode)):Ob.create(i.astNode,s,null)}default:throw new Error("unexpected")}}}});function sp(n,e){if(n.length===0)return e;if(e.length===0)return n;let t=new mo(zW(n)),i=zW(e);i.push({modified:!1,lengthBefore:void 0,lengthAfter:void 0});let o=t.dequeue();function s(c){if(c===void 0){let h=t.takeWhile(u=>!0)||[];return o&&h.unshift(o),h}let d=[];for(;o&&!ip(c);){let[h,u]=o.splitAt(c);d.push(h),c=_f(h.lengthAfter,c),o=u??t.dequeue()}return ip(c)||d.push(new Hb(!1,c,c)),d}let r=[];function a(c,d,h){if(r.length>0&&eR(r[r.length-1].endOffset,c)){let u=r[r.length-1];r[r.length-1]=new oa(u.startOffset,d,vi(u.newLength,h))}else r.push({startOffset:c,endOffset:d,newLength:h})}let l=Fn;for(let c of i){let d=s(c.lengthBefore);if(c.modified){let h=AW(d,f=>f.lengthBefore),u=vi(l,h);a(l,u,c.lengthAfter),l=u}else for(let h of d){let u=l;l=vi(l,h.lengthBefore),h.modified&&a(u,l,h.lengthAfter)}}return r}function zW(n){let e=[],t=Fn;for(let i of n){let o=_f(t,i.startOffset);ip(o)||e.push(new Hb(!1,o,o));let s=_f(i.startOffset,i.endOffset);e.push(new Hb(!0,s,i.newLength)),t=i.endOffset}return e}var Hb,fR=J(()=>{"use strict";_();v();b();wt();Rb();$c();Hb=class n{constructor(e,t,i){this.modified=e,this.lengthBefore=t,this.lengthAfter=i}splitAt(e){let t=_f(e,this.lengthAfter);return eR(t,Fn)?[this,void 0]:this.modified?[new n(this.modified,this.lengthBefore,e),new n(this.modified,Fn,t)]:[new n(this.modified,e,e),new n(this.modified,t,t)]}toString(){return`${this.modified?"M":"U"}:${Ho(this.lengthBefore)} -> ${Ho(this.lengthAfter)}`}}});function VW(n,e,t,i){if(n.kind===4||n.kind===2){let o=[];for(let s of n.children)t=vi(e,s.length),o.push({nodeOffsetStart:e,nodeOffsetEnd:t}),e=t;for(let s=o.length-1;s>=0;s--){let{nodeOffsetStart:r,nodeOffsetEnd:a}=o[s];if(Kc(r,i)){let l=VW(n.children[s],r,a,i);if(l)return l}}return null}else{if(n.kind===3)return null;if(n.kind===1){let o=wh(e,t);return{bracketInfo:n.bracketInfo,range:o}}}return null}function HW(n,e,t,i){if(n.kind===4||n.kind===2){for(let o of n.children){if(t=vi(e,o.length),Kc(i,t)){let s=HW(o,e,t,i);if(s)return s}e=t}return null}else{if(n.kind===3)return null;if(n.kind===1){let o=wh(e,t);return{bracketInfo:n.bracketInfo,range:o}}}return null}function gR(n,e,t,i,o,s,r,a,l,c,d=!1){if(r>200)return!0;e:for(;;)switch(n.kind){case 4:{let h=n.childrenLength;for(let u=0;u200)return!0;let c=!0;if(n.kind===2){let d=0;if(a){let f=a.get(n.openingBracket.text);f===void 0&&(f=0),d=f,f++,a.set(n.openingBracket.text,f)}let h=vi(e,n.openingBracket.length),u=-1;if(s.includeMinIndentation&&(u=n.computeMinIndentation(e,s.textModel)),c=s.push(new SL(wh(e,t),wh(e,h),n.closingBracket?wh(vi(h,((l=n.child)===null||l===void 0?void 0:l.length)||Fn),t):void 0,r,d,n,u)),e=h,c&&n.child){let f=n.child;if(t=vi(e,f.length),vh(e,o)&&np(t,i)&&(c=pR(f,e,t,i,o,s,r+1,a),!c))return!1}a?.set(n.openingBracket.text,d)}else{let d=e;for(let h of n.children){let u=d;if(d=vi(d,h.length),vh(u,o)&&vh(i,d)&&(c=pR(h,u,d,i,o,s,r,a),!c))return!1}}return c}var ML,mR,UW=J(()=>{"use strict";_();v();b();ye();le();IW();Rb();RW();$c();WW();op();rR();wt();fR();ML=class extends H{didLanguageChange(e){return this.brackets.didLanguageChange(e)}constructor(e,t){if(super(),this.textModel=e,this.getLanguageConfiguration=t,this.didChangeEmitter=new B,this.denseKeyProvider=new kL,this.brackets=new NL(this.denseKeyProvider,this.getLanguageConfiguration),this.onDidChange=this.didChangeEmitter.event,this.queuedTextEditsForInitialAstWithoutTokens=[],this.queuedTextEdits=[],e.tokenization.hasTokens)e.tokenization.backgroundTokenizationState===2?(this.initialAstWithoutTokens=void 0,this.astWithTokens=this.parseDocumentFromTextBuffer([],void 0,!1)):(this.initialAstWithoutTokens=this.parseDocumentFromTextBuffer([],void 0,!0),this.astWithTokens=this.initialAstWithoutTokens);else{let i=this.brackets.getSingleLanguageBracketTokens(this.textModel.getLanguageId()),o=new TL(this.textModel.getValue(),i);this.initialAstWithoutTokens=uR(o,[],void 0,!0),this.astWithTokens=this.initialAstWithoutTokens}}handleDidChangeBackgroundTokenizationState(){if(this.textModel.tokenization.backgroundTokenizationState===2){let e=this.initialAstWithoutTokens===void 0;this.initialAstWithoutTokens=void 0,e||this.didChangeEmitter.fire()}}handleDidChangeTokens({ranges:e}){let t=e.map(i=>new oa(bi(i.fromLineNumber-1,0),bi(i.toLineNumber,0),bi(i.toLineNumber-i.fromLineNumber+1,0)));this.handleEdits(t,!0),this.initialAstWithoutTokens||this.didChangeEmitter.fire()}handleContentChanged(e){let t=oa.fromModelContentChanges(e.changes);this.handleEdits(t,!1)}handleEdits(e,t){let i=sp(this.queuedTextEdits,e);this.queuedTextEdits=i,this.initialAstWithoutTokens&&!t&&(this.queuedTextEditsForInitialAstWithoutTokens=sp(this.queuedTextEditsForInitialAstWithoutTokens,e))}flushQueue(){this.queuedTextEdits.length>0&&(this.astWithTokens=this.parseDocumentFromTextBuffer(this.queuedTextEdits,this.astWithTokens,!1),this.queuedTextEdits=[]),this.queuedTextEditsForInitialAstWithoutTokens.length>0&&(this.initialAstWithoutTokens&&(this.initialAstWithoutTokens=this.parseDocumentFromTextBuffer(this.queuedTextEditsForInitialAstWithoutTokens,this.initialAstWithoutTokens,!1)),this.queuedTextEditsForInitialAstWithoutTokens=[])}parseDocumentFromTextBuffer(e,t,i){let s=t,r=new IL(this.textModel,this.brackets);return uR(r,e,s,i)}getBracketsInRange(e,t){this.flushQueue();let i=bi(e.startLineNumber-1,e.startColumn-1),o=bi(e.endLineNumber-1,e.endColumn-1);return new ga(s=>{let r=this.initialAstWithoutTokens||this.astWithTokens;gR(r,Fn,r.length,i,o,s,0,0,new Map,t)})}getBracketPairsInRange(e,t){this.flushQueue();let i=Ch(e.getStartPosition()),o=Ch(e.getEndPosition());return new ga(s=>{let r=this.initialAstWithoutTokens||this.astWithTokens,a=new mR(s,t,this.textModel);pR(r,Fn,r.length,i,o,a,0,new Map)})}getFirstBracketAfter(e){this.flushQueue();let t=this.initialAstWithoutTokens||this.astWithTokens;return HW(t,Fn,t.length,Ch(e))}getFirstBracketBefore(e){this.flushQueue();let t=this.initialAstWithoutTokens||this.astWithTokens;return VW(t,Fn,t.length,Ch(e))}};mR=class{constructor(e,t,i){this.push=e,this.includeMinIndentation=t,this.textModel=i}}});function iZ(n,e){return{object:n,dispose:()=>e?.dispose()}}function _R(n){if(typeof n>"u")return()=>!0;{let e=Date.now();return()=>Date.now()-e<=n}}function RL(n){return n instanceof Za?null:n}var PL,Za,KW=J(()=>{"use strict";_();v();b();wt();ye();le();Ke();Su();Dy();UW();PL=class extends H{get canBuildAST(){return this.textModel.getValueLength()<=5e6}constructor(e,t){super(),this.textModel=e,this.languageConfigurationService=t,this.bracketPairsTree=this._register(new no),this.onDidChangeEmitter=new B,this.onDidChange=this.onDidChangeEmitter.event,this.bracketsRequested=!1,this._register(this.languageConfigurationService.onDidChange(i=>{var o;(!i.languageId||!((o=this.bracketPairsTree.value)===null||o===void 0)&&o.object.didLanguageChange(i.languageId))&&(this.bracketPairsTree.clear(),this.updateBracketPairsTree())}))}handleDidChangeOptions(e){this.bracketPairsTree.clear(),this.updateBracketPairsTree()}handleDidChangeLanguage(e){this.bracketPairsTree.clear(),this.updateBracketPairsTree()}handleDidChangeContent(e){var t;(t=this.bracketPairsTree.value)===null||t===void 0||t.object.handleContentChanged(e)}handleDidChangeBackgroundTokenizationState(){var e;(e=this.bracketPairsTree.value)===null||e===void 0||e.object.handleDidChangeBackgroundTokenizationState()}handleDidChangeTokens(e){var t;(t=this.bracketPairsTree.value)===null||t===void 0||t.object.handleDidChangeTokens(e)}updateBracketPairsTree(){if(this.bracketsRequested&&this.canBuildAST){if(!this.bracketPairsTree.value){let e=new ae;this.bracketPairsTree.value=iZ(e.add(new ML(this.textModel,t=>this.languageConfigurationService.getLanguageConfiguration(t))),e),e.add(this.bracketPairsTree.value.object.onDidChange(t=>this.onDidChangeEmitter.fire(t))),this.onDidChangeEmitter.fire()}}else this.bracketPairsTree.value&&(this.bracketPairsTree.clear(),this.onDidChangeEmitter.fire())}getBracketPairsInRange(e){var t;return this.bracketsRequested=!0,this.updateBracketPairsTree(),((t=this.bracketPairsTree.value)===null||t===void 0?void 0:t.object.getBracketPairsInRange(e,!1))||ga.empty}getBracketPairsInRangeWithMinIndentation(e){var t;return this.bracketsRequested=!0,this.updateBracketPairsTree(),((t=this.bracketPairsTree.value)===null||t===void 0?void 0:t.object.getBracketPairsInRange(e,!0))||ga.empty}getBracketsInRange(e,t=!1){var i;return this.bracketsRequested=!0,this.updateBracketPairsTree(),((i=this.bracketPairsTree.value)===null||i===void 0?void 0:i.object.getBracketsInRange(e,t))||ga.empty}findMatchingBracketUp(e,t,i){let o=this.textModel.validatePosition(t),s=this.textModel.getLanguageIdAtPosition(o.lineNumber,o.column);if(this.canBuildAST){let r=this.languageConfigurationService.getLanguageConfiguration(s).bracketsNew.getClosingBracketInfo(e);if(!r)return null;let a=this.getBracketPairsInRange(P.fromPositions(t,t)).findLast(l=>r.closes(l.openingBracketInfo));return a?a.openingBracketRange:null}else{let r=e.toLowerCase(),a=this.languageConfigurationService.getLanguageConfiguration(s).brackets;if(!a)return null;let l=a.textIsBracket[r];return l?RL(this._findMatchingBracketUp(l,o,_R(i))):null}}matchBracket(e,t){if(this.canBuildAST){let i=this.getBracketPairsInRange(P.fromPositions(e,e)).filter(o=>o.closingBracketRange!==void 0&&(o.openingBracketRange.containsPosition(e)||o.closingBracketRange.containsPosition(e))).findLastMaxBy(Io(o=>o.openingBracketRange.containsPosition(e)?o.openingBracketRange:o.closingBracketRange,P.compareRangesUsingStarts));return i?[i.openingBracketRange,i.closingBracketRange]:null}else{let i=_R(t);return this._matchBracket(this.textModel.validatePosition(e),i)}}_establishBracketSearchOffsets(e,t,i,o){let s=t.getCount(),r=t.getLanguageId(o),a=Math.max(0,e.column-1-i.maxBracketLength);for(let c=o-1;c>=0;c--){let d=t.getEndOffset(c);if(d<=a)break;if(Vr(t.getStandardTokenType(c))||t.getLanguageId(c)!==r){a=d;break}}let l=Math.min(t.getLineContent().length,e.column-1+i.maxBracketLength);for(let c=o+1;c=l)break;if(Vr(t.getStandardTokenType(c))||t.getLanguageId(c)!==r){l=d;break}}return{searchStartOffset:a,searchEndOffset:l}}_matchBracket(e,t){let i=e.lineNumber,o=this.textModel.tokenization.getLineTokens(i),s=this.textModel.getLineContent(i),r=o.findTokenIndexAtOffset(e.column-1);if(r<0)return null;let a=this.languageConfigurationService.getLanguageConfiguration(o.getLanguageId(r)).brackets;if(a&&!Vr(o.getStandardTokenType(r))){let{searchStartOffset:l,searchEndOffset:c}=this._establishBracketSearchOffsets(e,o,a,r),d=null;for(;;){let h=Jo.findNextBracketInRange(a.forwardRegex,i,s,l,c);if(!h)break;if(h.startColumn<=e.column&&e.column<=h.endColumn){let u=s.substring(h.startColumn-1,h.endColumn-1).toLowerCase(),f=this._matchFoundBracket(h,a.textIsBracket[u],a.textIsOpenBracket[u],t);if(f){if(f instanceof Za)return null;d=f}}l=h.endColumn-1}if(d)return d}if(r>0&&o.getStartOffset(r)===e.column-1){let l=r-1,c=this.languageConfigurationService.getLanguageConfiguration(o.getLanguageId(l)).brackets;if(c&&!Vr(o.getStandardTokenType(l))){let{searchStartOffset:d,searchEndOffset:h}=this._establishBracketSearchOffsets(e,o,c,l),u=Jo.findPrevBracketInRange(c.reversedRegex,i,s,d,h);if(u&&u.startColumn<=e.column&&e.column<=u.endColumn){let f=s.substring(u.startColumn-1,u.endColumn-1).toLowerCase(),g=this._matchFoundBracket(u,c.textIsBracket[f],c.textIsOpenBracket[f],t);if(g)return g instanceof Za?null:g}}}return null}_matchFoundBracket(e,t,i,o){if(!t)return null;let s=i?this._findMatchingBracketDown(t,e.getEndPosition(),o):this._findMatchingBracketUp(t,e.getStartPosition(),o);return s?s instanceof Za?s:[e,s]:null}_findMatchingBracketUp(e,t,i){let o=e.languageId,s=e.reversedRegex,r=-1,a=0,l=(c,d,h,u)=>{for(;;){if(i&&++a%100===0&&!i())return Za.INSTANCE;let f=Jo.findPrevBracketInRange(s,c,d,h,u);if(!f)break;let g=d.substring(f.startColumn-1,f.endColumn-1).toLowerCase();if(e.isOpen(g)?r++:e.isClose(g)&&r--,r===0)return f;u=f.startColumn-1}return null};for(let c=t.lineNumber;c>=1;c--){let d=this.textModel.tokenization.getLineTokens(c),h=d.getCount(),u=this.textModel.getLineContent(c),f=h-1,g=u.length,m=u.length;c===t.lineNumber&&(f=d.findTokenIndexAtOffset(t.column-1),g=t.column-1,m=t.column-1);let C=!0;for(;f>=0;f--){let S=d.getLanguageId(f)===o&&!Vr(d.getStandardTokenType(f));if(S)C?g=d.getStartOffset(f):(g=d.getStartOffset(f),m=d.getEndOffset(f));else if(C&&g!==m){let w=l(c,u,g,m);if(w)return w}C=S}if(C&&g!==m){let S=l(c,u,g,m);if(S)return S}}return null}_findMatchingBracketDown(e,t,i){let o=e.languageId,s=e.forwardRegex,r=1,a=0,l=(d,h,u,f)=>{for(;;){if(i&&++a%100===0&&!i())return Za.INSTANCE;let g=Jo.findNextBracketInRange(s,d,h,u,f);if(!g)break;let m=h.substring(g.startColumn-1,g.endColumn-1).toLowerCase();if(e.isOpen(m)?r++:e.isClose(m)&&r--,r===0)return g;u=g.endColumn-1}return null},c=this.textModel.getLineCount();for(let d=t.lineNumber;d<=c;d++){let h=this.textModel.tokenization.getLineTokens(d),u=h.getCount(),f=this.textModel.getLineContent(d),g=0,m=0,C=0;d===t.lineNumber&&(g=h.findTokenIndexAtOffset(t.column-1),m=t.column-1,C=t.column-1);let S=!0;for(;g=1;a--){let l=this.textModel.tokenization.getLineTokens(a),c=l.getCount(),d=this.textModel.getLineContent(a),h=c-1,u=d.length,f=d.length;if(a===i.lineNumber){h=l.findTokenIndexAtOffset(i.column-1),u=i.column-1,f=i.column-1;let m=l.getLanguageId(h);o!==m&&(o=m,s=this.languageConfigurationService.getLanguageConfiguration(o).brackets,r=this.languageConfigurationService.getLanguageConfiguration(o).bracketsNew)}let g=!0;for(;h>=0;h--){let m=l.getLanguageId(h);if(o!==m){if(s&&r&&g&&u!==f){let S=Jo.findPrevBracketInRange(s.reversedRegex,a,d,u,f);if(S)return this._toFoundBracket(r,S);g=!1}o=m,s=this.languageConfigurationService.getLanguageConfiguration(o).brackets,r=this.languageConfigurationService.getLanguageConfiguration(o).bracketsNew}let C=!!s&&!Vr(l.getStandardTokenType(h));if(C)g?u=l.getStartOffset(h):(u=l.getStartOffset(h),f=l.getEndOffset(h));else if(r&&s&&g&&u!==f){let S=Jo.findPrevBracketInRange(s.reversedRegex,a,d,u,f);if(S)return this._toFoundBracket(r,S)}g=C}if(r&&s&&g&&u!==f){let m=Jo.findPrevBracketInRange(s.reversedRegex,a,d,u,f);if(m)return this._toFoundBracket(r,m)}}return null}findNextBracket(e){var t;let i=this.textModel.validatePosition(e);if(this.canBuildAST)return this.bracketsRequested=!0,this.updateBracketPairsTree(),((t=this.bracketPairsTree.value)===null||t===void 0?void 0:t.object.getFirstBracketAfter(i))||null;let o=this.textModel.getLineCount(),s=null,r=null,a=null;for(let l=i.lineNumber;l<=o;l++){let c=this.textModel.tokenization.getLineTokens(l),d=c.getCount(),h=this.textModel.getLineContent(l),u=0,f=0,g=0;if(l===i.lineNumber){u=c.findTokenIndexAtOffset(i.column-1),f=i.column-1,g=i.column-1;let C=c.getLanguageId(u);s!==C&&(s=C,r=this.languageConfigurationService.getLanguageConfiguration(s).brackets,a=this.languageConfigurationService.getLanguageConfiguration(s).bracketsNew)}let m=!0;for(;um.closingBracketRange!==void 0&&m.range.strictContainsRange(f));return g?[g.openingBracketRange,g.closingBracketRange]:null}let o=_R(t),s=this.textModel.getLineCount(),r=new Map,a=[],l=(f,g)=>{if(!r.has(f)){let m=[];for(let C=0,S=g?g.brackets.length:0;C{for(;;){if(o&&++c%100===0&&!o())return Za.INSTANCE;let w=Jo.findNextBracketInRange(f.forwardRegex,g,m,C,S);if(!w)break;let y=m.substring(w.startColumn-1,w.endColumn-1).toLowerCase(),x=f.textIsBracket[y];if(x&&(x.isOpen(y)?a[x.index]++:x.isClose(y)&&a[x.index]--,a[x.index]===-1))return this._matchFoundBracket(w,x,!1,o);C=w.endColumn-1}return null},h=null,u=null;for(let f=i.lineNumber;f<=s;f++){let g=this.textModel.tokenization.getLineTokens(f),m=g.getCount(),C=this.textModel.getLineContent(f),S=0,w=0,y=0;if(f===i.lineNumber){S=g.findTokenIndexAtOffset(i.column-1),w=i.column-1,y=i.column-1;let k=g.getLanguageId(S);h!==k&&(h=k,u=this.languageConfigurationService.getLanguageConfiguration(h).brackets,l(h,u))}let x=!0;for(;S{"use strict";_();v();b();ye();le();Ke();$a();Qi();OL=class extends H{constructor(e){super(),this.textModel=e,this.colorProvider=new FL,this.onDidChangeEmitter=new B,this.onDidChange=this.onDidChangeEmitter.event,this.colorizationOptions=e.getOptions().bracketPairColorizationOptions,this._register(e.bracketPairs.onDidChange(t=>{this.onDidChangeEmitter.fire()}))}handleDidChangeOptions(e){this.colorizationOptions=this.textModel.getOptions().bracketPairColorizationOptions}getDecorationsInRange(e,t,i,o){return o?[]:t===void 0?[]:this.colorizationOptions.enabled?this.textModel.bracketPairs.getBracketsInRange(e,!0).map(r=>({id:`bracket${r.range.toString()}-${r.nestingLevel}`,options:{description:"BracketPairColorization",inlineClassName:this.colorProvider.getInlineClassName(r,this.colorizationOptions.independentColorPoolPerBracketType)},ownerId:0,range:r.range})).toArray():[]}getAllDecorations(e,t){return e===void 0?[]:this.colorizationOptions.enabled?this.getDecorationsInRange(new P(1,1,this.textModel.getLineCount(),1),e,t):[]}},FL=class{constructor(){this.unexpectedClosingBracketClassName="unexpected-closing-bracket"}getInlineClassName(e,t){return e.isInvalid?this.unexpectedClosingBracketClassName:this.getInlineClassNameOfLevel(t?e.nestingLevelOfEqualBracketType:e.nestingLevel)}getInlineClassNameOfLevel(e){return`bracket-highlighting-${e%30}`}};Lo((n,e)=>{let t=[mx,px,_x,bx,vx,Cx],i=new FL;e.addRule(`.monaco-editor .${i.unexpectedClosingBracketClassName} { color: ${n.getColor(Q6)}; }`);let o=t.map(s=>n.getColor(s)).filter(s=>!!s).filter(s=>!s.isTransparent());for(let s=0;s<30;s++){let r=o[s%o.length];e.addRule(`.monaco-editor .${i.getInlineClassNameOfLevel(s)} { color: ${r}; }`)}})});function BL(n){return n.replace(/\n/g,"\\n").replace(/\r/g,"\\r")}function qW(n,e){return n===null||n.length===0?e:new bR(n,e).compress()}var Us,bR,vR=J(()=>{"use strict";_();v();b();A0();xu();Us=class n{get oldLength(){return this.oldText.length}get oldEnd(){return this.oldPosition+this.oldText.length}get newLength(){return this.newText.length}get newEnd(){return this.newPosition+this.newText.length}constructor(e,t,i,o){this.oldPosition=e,this.oldText=t,this.newPosition=i,this.newText=o}toString(){return this.oldText.length===0?`(insert@${this.oldPosition} "${BL(this.newText)}")`:this.newText.length===0?`(delete@${this.oldPosition} "${BL(this.oldText)}")`:`(replace@${this.oldPosition} "${BL(this.oldText)}" with "${BL(this.newText)}")`}static _writeStringSize(e){return 4+2*e.length}static _writeString(e,t,i){let o=t.length;sr(e,o,i),i+=4;for(let s=0;sn.length)return!1;if(t){if(!Dg(n,e))return!1;if(e.length===n.length)return!0;let s=e.length;return e.charAt(e.length-1)===i&&s--,n.charAt(s)===i}return e.charAt(e.length-1)!==i&&(e+=i),n.indexOf(e)===0}function GW(n){return n>=65&&n<=90||n>=97&&n<=122}function fFe(n,e=Li){return e?GW(n.charCodeAt(0))&&n.charCodeAt(1)===58:!1}var yR=J(()=>{"use strict";_();v();b();wc();Lt();ot()});function qc(n){return U_(n,!0)}var Kb,gi,wFe,yFe,XW,SFe,xFe,LFe,qb,kFe,QW,DFe,JW,EFe,SR,IFe,ZW,YW,TFe,NFe,$b,bf=J(()=>{"use strict";_();v();b();yR();er();wc();Lt();ot();sn();Kb=class{constructor(e){this._ignorePathCasing=e}compare(e,t,i=!1){return e===t?0:G_(this.getComparisonKey(e,i),this.getComparisonKey(t,i))}isEqual(e,t,i=!1){return e===t?!0:!e||!t?!1:this.getComparisonKey(e,i)===this.getComparisonKey(t,i)}getComparisonKey(e,t=!1){return e.with({path:this._ignorePathCasing(e)?e.path.toLowerCase():void 0,fragment:t?null:void 0}).toString()}isEqualOrParent(e,t,i=!1){if(e.scheme===t.scheme){if(e.scheme===Ze.file)return Ub(qc(e),qc(t),this._ignorePathCasing(e))&&e.query===t.query&&(i||e.fragment===t.fragment);if(ZW(e.authority,t.authority))return Ub(e.path,t.path,this._ignorePathCasing(e),"/")&&e.query===t.query&&(i||e.fragment===t.fragment)}return!1}joinPath(e,...t){return Oe.joinPath(e,...t)}basenameOrAuthority(e){return qb(e)||e.authority}basename(e){return ci.basename(e.path)}extname(e){return ci.extname(e.path)}dirname(e){if(e.path.length===0)return e;let t;return e.scheme===Ze.file?t=Oe.file(O9(qc(e))).path:(t=ci.dirname(e.path),e.authority&&t.length&&t.charCodeAt(0)!==47&&(console.error(`dirname("${e.toString})) resulted in a relative path`),t="/")),e.with({path:t})}normalizePath(e){if(!e.path.length)return e;let t;return e.scheme===Ze.file?t=Oe.file(mC(qc(e))).path:t=ci.normalize(e.path),e.with({path:t})}relativePath(e,t){if(e.scheme!==t.scheme||!ZW(e.authority,t.authority))return;if(e.scheme===Ze.file){let s=P9(qc(e),qc(t));return Li?CR(s):s}let i=e.path||"/",o=t.path||"/";if(this._ignorePathCasing(e)){let s=0;for(let r=Math.min(i.length,o.length);swR(i).length&&i[i.length-1]===t}else{let i=e.path;return i.length>1&&i.charCodeAt(i.length-1)===47&&!/^[a-zA-Z]:(\/$|\\$)/.test(e.fsPath)}}removeTrailingPathSeparator(e,t=ya){return YW(e,t)?e.with({path:e.path.substr(0,e.path.length-1)}):e}addTrailingPathSeparator(e,t=ya){let i=!1;if(e.scheme===Ze.file){let o=qc(e);i=o!==void 0&&o.length===wR(o).length&&o[o.length-1]===t}else{t="/";let o=e.path;i=o.length===1&&o.charCodeAt(o.length-1)===47}return!i&&!YW(e,t)?e.with({path:e.path+"/"}):e}},gi=new Kb(()=>!1),wFe=new Kb(n=>n.scheme===Ze.file?!mi:!0),yFe=new Kb(n=>!0),XW=gi.isEqual.bind(gi),SFe=gi.isEqualOrParent.bind(gi),xFe=gi.getComparisonKey.bind(gi),LFe=gi.basenameOrAuthority.bind(gi),qb=gi.basename.bind(gi),kFe=gi.extname.bind(gi),QW=gi.dirname.bind(gi),DFe=gi.joinPath.bind(gi),JW=gi.normalizePath.bind(gi),EFe=gi.relativePath.bind(gi),SR=gi.resolvePath.bind(gi),IFe=gi.isAbsolutePath.bind(gi),ZW=gi.isEqualAuthority.bind(gi),YW=gi.hasTrailingPathSeparator.bind(gi),TFe=gi.removeTrailingPathSeparator.bind(gi),NFe=gi.addTrailingPathSeparator.bind(gi);(function(n){n.META_DATA_LABEL="label",n.META_DATA_DESCRIPTION="description",n.META_DATA_SIZE="size",n.META_DATA_MIME="mime";function e(t){let i=new Map;t.path.substring(t.path.indexOf(";")+1,t.path.lastIndexOf(";")).split(";").forEach(r=>{let[a,l]=r.split(":");a&&l&&i.set(a,l)});let s=t.path.substring(0,t.path.indexOf(";"));return s&&i.set(n.META_DATA_MIME,s),i}n.parseMetaData=e})($b||($b={}))});function rp(n){return n.toString()}function LR(n){return n.getEOL()===` +`?0:1}function Ul(n){return n?n instanceof WL||n instanceof xR:!1}var ks,WL,xR,zL,kR=J(()=>{"use strict";_();v();b();Ge();xt();Kn();sn();vR();A0();bf();ks=class n{static create(e,t){let i=e.getAlternativeVersionId(),o=LR(e);return new n(i,i,o,o,t,t,[])}constructor(e,t,i,o,s,r,a){this.beforeVersionId=e,this.afterVersionId=t,this.beforeEOL=i,this.afterEOL=o,this.beforeCursorState=s,this.afterCursorState=r,this.changes=a}append(e,t,i,o,s){t.length>0&&(this.changes=qW(this.changes,t)),this.afterEOL=i,this.afterVersionId=o,this.afterCursorState=s}static _writeSelectionsSize(e){return 4+4*4*(e?e.length:0)}static _writeSelections(e,t,i){if(sr(e,t?t.length:0,i),i+=4,t)for(let o of t)sr(e,o.selectionStartLineNumber,i),i+=4,sr(e,o.selectionStartColumn,i),i+=4,sr(e,o.positionLineNumber,i),i+=4,sr(e,o.positionColumn,i),i+=4;return i}static _readSelections(e,t,i){let o=or(e,t);t+=4;for(let s=0;st.toString()).join(", ")}matchesResource(e){return(Oe.isUri(this.model)?this.model:this.model.uri).toString()===e.toString()}setModel(e){this.model=e}canAppend(e){return this.model===e&&this._data instanceof ks}append(e,t,i,o,s){this._data instanceof ks&&this._data.append(e,t,i,o,s)}close(){this._data instanceof ks&&(this._data=this._data.serialize())}open(){this._data instanceof ks||(this._data=ks.deserialize(this._data))}undo(){if(Oe.isUri(this.model))throw new Error("Invalid SingleModelEditStackElement");this._data instanceof ks&&(this._data=this._data.serialize());let e=ks.deserialize(this._data);this.model._applyUndo(e.changes,e.beforeEOL,e.beforeVersionId,e.beforeCursorState)}redo(){if(Oe.isUri(this.model))throw new Error("Invalid SingleModelEditStackElement");this._data instanceof ks&&(this._data=this._data.serialize());let e=ks.deserialize(this._data);this.model._applyRedo(e.changes,e.afterEOL,e.afterVersionId,e.afterCursorState)}heapSize(){return this._data instanceof ks&&(this._data=this._data.serialize()),this._data.byteLength+168}},xR=class{get resources(){return this._editStackElementsArr.map(e=>e.resource)}constructor(e,t,i){this.label=e,this.code=t,this.type=1,this._isOpen=!0,this._editStackElementsArr=i.slice(0),this._editStackElementsMap=new Map;for(let o of this._editStackElementsArr){let s=rp(o.resource);this._editStackElementsMap.set(s,o)}this._delegate=null}prepareUndoRedo(){if(this._delegate)return this._delegate.prepareUndoRedo(this)}matchesResource(e){let t=rp(e);return this._editStackElementsMap.has(t)}setModel(e){let t=rp(Oe.isUri(e)?e:e.uri);this._editStackElementsMap.has(t)&&this._editStackElementsMap.get(t).setModel(e)}canAppend(e){if(!this._isOpen)return!1;let t=rp(e.uri);return this._editStackElementsMap.has(t)?this._editStackElementsMap.get(t).canAppend(e):!1}append(e,t,i,o,s){let r=rp(e.uri);this._editStackElementsMap.get(r).append(e,t,i,o,s)}close(){this._isOpen=!1}open(){}undo(){this._isOpen=!1;for(let e of this._editStackElementsArr)e.undo()}redo(){for(let e of this._editStackElementsArr)e.redo()}heapSize(e){let t=rp(e);return this._editStackElementsMap.has(t)?this._editStackElementsMap.get(t).heapSize():0}split(){return this._editStackElementsArr}toString(){let e=[];for(let t of this._editStackElementsArr)e.push(`${qb(t.resource)}: ${t}`);return`{${e.join(", ")}}`}};zL=class n{constructor(e,t){this._model=e,this._undoRedoService=t}pushStackElement(){let e=this._undoRedoService.getLastElement(this._model.uri);Ul(e)&&e.close()}popStackElement(){let e=this._undoRedoService.getLastElement(this._model.uri);Ul(e)&&e.open()}clear(){this._undoRedoService.removeElements(this._model.uri)}_getOrCreateEditStackElement(e,t){let i=this._undoRedoService.getLastElement(this._model.uri);if(Ul(i)&&i.canAppend(this._model))return i;let o=new WL(p("edit","Typing"),"undoredo.textBufferEdit",this._model,e);return this._undoRedoService.pushElement(o,t),o}pushEOL(e){let t=this._getOrCreateEditStackElement(null,void 0);this._model.setEOL(e),t.append(this._model,[],LR(this._model),this._model.getAlternativeVersionId(),null)}pushEditOperation(e,t,i,o){let s=this._getOrCreateEditStackElement(e,o),r=this._model.applyEdits(t,!0),a=n._computeCursorState(i,r),l=r.map((c,d)=>({index:d,textChange:c.textChange}));return l.sort((c,d)=>c.textChange.oldPosition===d.textChange.oldPosition?c.index-d.index:c.textChange.oldPosition-d.textChange.oldPosition),s.append(this._model,l.map(c=>c.textChange),LR(this._model),this._model.getAlternativeVersionId(),a),a}static _computeCursorState(e,t){try{return e?e(t):null}catch(i){return ut(i),null}}}});function oZ(n,e,t,i,o){o.spacesDiff=0,o.looksLikeAlignment=!1;let s;for(s=0;s0&&a>0||l>0&&c>0)return;let d=Math.abs(a-c),h=Math.abs(r-l);if(d===0){o.spacesDiff=h,h>0&&0<=l-1&&l-10?o++:x>1&&s++,oZ(r,a,C,y,h),h.looksLikeAlignment&&!(t&&e===h.spacesDiff)))continue;let T=h.spacesDiff;T<=c&&d[T]++,r=C,a=y}let u=t;o!==s&&(u=o{let C=d[m];C>g&&(g=C,f=m)}),f===4&&d[4]>0&&d[2]>0&&d[2]>=d[4]/2&&(f=2)}return{insertSpaces:u,tabSize:f}}var DR,ez=J(()=>{"use strict";_();v();b();DR=class{constructor(){this.spacesDiff=0,this.looksLikeAlignment=!1}}});function os(n){return(n.metadata&1)>>>0}function ei(n,e){n.metadata=n.metadata&254|e<<0}function Yn(n){return(n.metadata&2)>>>1===1}function Xt(n,e){n.metadata=n.metadata&253|(e?1:0)<<1}function az(n){return(n.metadata&4)>>>2===1}function tz(n,e){n.metadata=n.metadata&251|(e?1:0)<<2}function lz(n){return(n.metadata&64)>>>6===1}function iz(n,e){n.metadata=n.metadata&191|(e?1:0)<<6}function sZ(n){return(n.metadata&24)>>>3}function nz(n,e){n.metadata=n.metadata&231|e<<3}function rZ(n){return(n.metadata&32)>>>5===1}function oz(n,e){n.metadata=n.metadata&223|(e?1:0)<<5}function aZ(n){let e=n.root,t=0;for(;e!==lt;){if(e.left!==lt&&!Yn(e.left)){e=e.left;continue}if(e.right!==lt&&!Yn(e.right)){t+=e.delta,e=e.right;continue}e.start=t+e.start,e.end=t+e.end,e.delta=0,jc(e),Xt(e,!0),Xt(e.left,!1),Xt(e.right,!1),e===e.parent.right&&(t-=e.parent.delta),e=e.parent}Xt(n.root,!1)}function ap(n,e,t,i){return nt||i===1?!1:i===2?!0:e}function lZ(n,e,t,i,o){let s=sZ(n),r=s===0||s===2,a=s===1||s===2,l=t-e,c=i,d=Math.min(l,c),h=n.start,u=!1,f=n.end,g=!1;e<=h&&f<=t&&rZ(n)&&(n.start=e,u=!0,n.end=e,g=!0);{let C=o?1:l>0?2:0;!u&&ap(h,r,e,C)&&(u=!0),!g&&ap(f,a,e,C)&&(g=!0)}if(d>0&&!o){let C=l>c?2:0;!u&&ap(h,r,e+d,C)&&(u=!0),!g&&ap(f,a,e+d,C)&&(g=!0)}{let C=o?1:0;!u&&ap(h,r,t,C)&&(n.start=e+c,u=!0),!g&&ap(f,a,t,C)&&(n.end=e+c,g=!0)}let m=c-l;u||(n.start=Math.max(0,h+m)),g||(n.end=Math.max(0,f+m)),n.start>n.end&&(n.end=n.start)}function cZ(n,e,t){let i=n.root,o=0,s=0,r=0,a=0,l=[],c=0;for(;i!==lt;){if(Yn(i)){Xt(i.left,!1),Xt(i.right,!1),i===i.parent.right&&(o-=i.parent.delta),i=i.parent;continue}if(!Yn(i.left)){if(s=o+i.maxEnd,st){Xt(i,!0);continue}if(a=o+i.end,a>=e&&(i.setCachedOffsets(r,a,0),l[c++]=i),Xt(i,!0),i.right!==lt&&!Yn(i.right)){o+=i.delta,i=i.right;continue}}return Xt(n.root,!1),l}function dZ(n,e,t,i){let o=n.root,s=0,r=0,a=0,l=i-(t-e);for(;o!==lt;){if(Yn(o)){Xt(o.left,!1),Xt(o.right,!1),o===o.parent.right&&(s-=o.parent.delta),jc(o),o=o.parent;continue}if(!Yn(o.left)){if(r=s+o.maxEnd,rt){o.start+=l,o.end+=l,o.delta+=l,(o.delta<-1073741824||o.delta>1073741824)&&(n.requestNormalizeDelta=!0),Xt(o,!0);continue}if(Xt(o,!0),o.right!==lt&&!Yn(o.right)){s+=o.delta,o=o.right;continue}}Xt(n.root,!1)}function hZ(n,e){let t=n.root,i=[],o=0;for(;t!==lt;){if(Yn(t)){Xt(t.left,!1),Xt(t.right,!1),t=t.parent;continue}if(t.left!==lt&&!Yn(t.left)){t=t.left;continue}if(t.ownerId===e&&(i[o++]=t),Xt(t,!0),t.right!==lt&&!Yn(t.right)){t=t.right;continue}}return Xt(n.root,!1),i}function uZ(n){let e=n.root,t=[],i=0;for(;e!==lt;){if(Yn(e)){Xt(e.left,!1),Xt(e.right,!1),e=e.parent;continue}if(e.left!==lt&&!Yn(e.left)){e=e.left;continue}if(e.right!==lt&&!Yn(e.right)){e=e.right;continue}t[i++]=e,Xt(e,!0)}return Xt(n.root,!1),t}function fZ(n,e,t,i,o){let s=n.root,r=0,a=0,l=0,c=[],d=0;for(;s!==lt;){if(Yn(s)){Xt(s.left,!1),Xt(s.right,!1),s===s.parent.right&&(r-=s.parent.delta),s=s.parent;continue}if(s.left!==lt&&!Yn(s.left)){s=s.left;continue}a=r+s.start,l=r+s.end,s.setCachedOffsets(a,l,i);let h=!0;if(e&&s.ownerId&&s.ownerId!==e&&(h=!1),t&&az(s)&&(h=!1),o&&!lz(s)&&(h=!1),h&&(c[d++]=s),Xt(s,!0),s.right!==lt&&!Yn(s.right)){r+=s.delta,s=s.right;continue}}return Xt(n.root,!1),c}function gZ(n,e,t,i,o,s,r){let a=n.root,l=0,c=0,d=0,h=0,u=[],f=0;for(;a!==lt;){if(Yn(a)){Xt(a.left,!1),Xt(a.right,!1),a===a.parent.right&&(l-=a.parent.delta),a=a.parent;continue}if(!Yn(a.left)){if(c=l+a.maxEnd,ct){Xt(a,!0);continue}if(h=l+a.end,h>=e){a.setCachedOffsets(d,h,s);let g=!0;i&&a.ownerId&&a.ownerId!==i&&(g=!1),o&&az(a)&&(g=!1),r&&!lz(a)&&(g=!1),g&&(u[f++]=a)}if(Xt(a,!0),a.right!==lt&&!Yn(a.right)){l+=a.delta,a=a.right;continue}}return Xt(n.root,!1),u}function sz(n,e){if(n.root===lt)return e.parent=lt,e.left=lt,e.right=lt,ei(e,0),n.root=e,n.root;mZ(n,e),Sh(e.parent);let t=e;for(;t!==n.root&&os(t.parent)===1;)if(t.parent===t.parent.parent.left){let i=t.parent.parent.right;os(i)===1?(ei(t.parent,0),ei(i,0),ei(t.parent.parent,1),t=t.parent.parent):(t===t.parent.right&&(t=t.parent,jb(n,t)),ei(t.parent,0),ei(t.parent.parent,1),Gb(n,t.parent.parent))}else{let i=t.parent.parent.left;os(i)===1?(ei(t.parent,0),ei(i,0),ei(t.parent.parent,1),t=t.parent.parent):(t===t.parent.left&&(t=t.parent,Gb(n,t)),ei(t.parent,0),ei(t.parent.parent,1),jb(n,t.parent.parent))}return ei(n.root,0),e}function mZ(n,e){let t=0,i=n.root,o=e.start,s=e.end;for(;;)if(_Z(o,s,i.start+t,i.end+t)<0)if(i.left===lt){e.start-=t,e.end-=t,e.maxEnd-=t,i.left=e;break}else i=i.left;else if(i.right===lt){e.start-=t+i.delta,e.end-=t+i.delta,e.maxEnd-=t+i.delta,i.right=e;break}else t+=i.delta,i=i.right;e.parent=i,e.left=lt,e.right=lt,ei(e,1)}function rz(n,e){let t,i;if(e.left===lt?(t=e.right,i=e,t.delta+=e.delta,(t.delta<-1073741824||t.delta>1073741824)&&(n.requestNormalizeDelta=!0),t.start+=e.delta,t.end+=e.delta):e.right===lt?(t=e.left,i=e):(i=pZ(e.right),t=i.right,t.start+=i.delta,t.end+=i.delta,t.delta+=i.delta,(t.delta<-1073741824||t.delta>1073741824)&&(n.requestNormalizeDelta=!0),i.start+=e.delta,i.end+=e.delta,i.delta=e.delta,(i.delta<-1073741824||i.delta>1073741824)&&(n.requestNormalizeDelta=!0)),i===n.root){n.root=t,ei(t,0),e.detach(),IR(),jc(t),n.root.parent=lt;return}let o=os(i)===1;if(i===i.parent.left?i.parent.left=t:i.parent.right=t,i===e?t.parent=i.parent:(i.parent===e?t.parent=i:t.parent=i.parent,i.left=e.left,i.right=e.right,i.parent=e.parent,ei(i,os(e)),e===n.root?n.root=i:e===e.parent.left?e.parent.left=i:e.parent.right=i,i.left!==lt&&(i.left.parent=i),i.right!==lt&&(i.right.parent=i)),e.detach(),o){Sh(t.parent),i!==e&&(Sh(i),Sh(i.parent)),IR();return}Sh(t),Sh(t.parent),i!==e&&(Sh(i),Sh(i.parent));let s;for(;t!==n.root&&os(t)===0;)t===t.parent.left?(s=t.parent.right,os(s)===1&&(ei(s,0),ei(t.parent,1),jb(n,t.parent),s=t.parent.right),os(s.left)===0&&os(s.right)===0?(ei(s,1),t=t.parent):(os(s.right)===0&&(ei(s.left,0),ei(s,1),Gb(n,s),s=t.parent.right),ei(s,os(t.parent)),ei(t.parent,0),ei(s.right,0),jb(n,t.parent),t=n.root)):(s=t.parent.left,os(s)===1&&(ei(s,0),ei(t.parent,1),Gb(n,t.parent),s=t.parent.left),os(s.left)===0&&os(s.right)===0?(ei(s,1),t=t.parent):(os(s.left)===0&&(ei(s.right,0),ei(s,1),jb(n,s),s=t.parent.left),ei(s,os(t.parent)),ei(t.parent,0),ei(s.left,0),Gb(n,t.parent),t=n.root));ei(t,0),IR()}function pZ(n){for(;n.left!==lt;)n=n.left;return n}function IR(){lt.parent=lt,lt.delta=0,lt.start=0,lt.end=0}function jb(n,e){let t=e.right;t.delta+=e.delta,(t.delta<-1073741824||t.delta>1073741824)&&(n.requestNormalizeDelta=!0),t.start+=e.delta,t.end+=e.delta,e.right=t.left,t.left!==lt&&(t.left.parent=e),t.parent=e.parent,e.parent===lt?n.root=t:e===e.parent.left?e.parent.left=t:e.parent.right=t,t.left=e,e.parent=t,jc(e),jc(t)}function Gb(n,e){let t=e.left;e.delta-=t.delta,(e.delta<-1073741824||e.delta>1073741824)&&(n.requestNormalizeDelta=!0),e.start-=t.delta,e.end-=t.delta,e.left=t.right,t.right!==lt&&(t.right.parent=e),t.parent=e.parent,e.parent===lt?n.root=t:e===e.parent.right?e.parent.right=t:e.parent.left=t,t.right=e,e.parent=t,jc(e),jc(t)}function cz(n){let e=n.end;if(n.left!==lt){let t=n.left.maxEnd;t>e&&(e=t)}if(n.right!==lt){let t=n.right.maxEnd+n.delta;t>e&&(e=t)}return e}function jc(n){n.maxEnd=cz(n)}function Sh(n){for(;n!==lt;){let e=cz(n);if(n.maxEnd===e)return;n.maxEnd=e,n=n.parent}}function _Z(n,e,t,i){return n===t?e-i:n-t}var Zb,lt,lp,dz=J(()=>{"use strict";_();v();b();Zb=class{constructor(e,t,i){this.metadata=0,this.parent=this,this.left=this,this.right=this,ei(this,1),this.start=t,this.end=i,this.delta=0,this.maxEnd=i,this.id=e,this.ownerId=0,this.options=null,tz(this,!1),iz(this,!1),nz(this,1),oz(this,!1),this.cachedVersionId=0,this.cachedAbsoluteStart=t,this.cachedAbsoluteEnd=i,this.range=null,Xt(this,!1)}reset(e,t,i,o){this.start=t,this.end=i,this.maxEnd=i,this.cachedVersionId=e,this.cachedAbsoluteStart=t,this.cachedAbsoluteEnd=i,this.range=o}setOptions(e){this.options=e;let t=this.options.className;tz(this,t==="squiggly-error"||t==="squiggly-warning"||t==="squiggly-info"),iz(this,this.options.glyphMarginClassName!==null),nz(this,this.options.stickiness),oz(this,this.options.collapseOnReplaceEdit)}setCachedOffsets(e,t,i){this.cachedVersionId!==i&&(this.range=null),this.cachedVersionId=i,this.cachedAbsoluteStart=e,this.cachedAbsoluteEnd=t}detach(){this.parent=null,this.left=null,this.right=null}},lt=new Zb(null,0,0);lt.parent=lt;lt.left=lt;lt.right=lt;ei(lt,0);lp=class{constructor(){this.root=lt,this.requestNormalizeDelta=!1}intervalSearch(e,t,i,o,s,r){return this.root===lt?[]:gZ(this,e,t,i,o,s,r)}search(e,t,i,o){return this.root===lt?[]:fZ(this,e,t,i,o)}collectNodesFromOwner(e){return hZ(this,e)}collectNodesPostOrder(){return uZ(this)}insert(e){sz(this,e),this._normalizeDeltaIfNecessary()}delete(e){rz(this,e),this._normalizeDeltaIfNecessary()}resolveNode(e,t){let i=e,o=0;for(;e!==this.root;)e===e.parent.right&&(o+=e.parent.delta),e=e.parent;let s=i.start+o,r=i.end+o;i.setCachedOffsets(s,r,t)}acceptReplace(e,t,i,o){let s=cZ(this,e,e+t);for(let r=0,a=s.length;r{"use strict";_();v();b();cp=class{constructor(e,t){this.piece=e,this.color=t,this.size_left=0,this.lf_left=0,this.parent=this,this.left=this,this.right=this}next(){if(this.right!==je)return VL(this.right);let e=this;for(;e.parent!==je&&e.parent.left!==e;)e=e.parent;return e.parent===je?je:e.parent}prev(){if(this.left!==je)return NR(this.left);let e=this;for(;e.parent!==je&&e.parent.right!==e;)e=e.parent;return e.parent===je?je:e.parent}detach(){this.parent=null,this.left=null,this.right=null}},je=new cp(null,0);je.parent=je;je.left=je;je.right=je;je.color=0});function uz(n){let e;return n[n.length-1]<65536?e=new Uint16Array(n.length):e=new Uint32Array(n.length),e.set(n,0),e}function $l(n,e=!0){let t=[0],i=1;for(let o=0,s=n.length;o126)&&(r=!1)}let a=new PR(uz(n),i,o,s,r);return n.length=0,a}var Gc,PR,Uo,ql,OR,FR,HL,BR=J(()=>{"use strict";_();v();b();ft();Ke();hr();hz();eS();Gc=65535;PR=class{constructor(e,t,i,o,s){this.lineStarts=e,this.cr=t,this.lf=i,this.crlf=o,this.isBasicASCII=s}};Uo=class{constructor(e,t,i,o,s){this.bufferIndex=e,this.start=t,this.end=i,this.lineFeedCnt=o,this.length=s}},ql=class{constructor(e,t){this.buffer=e,this.lineStarts=t}},OR=class{constructor(e,t){this._pieces=[],this._tree=e,this._BOM=t,this._index=0,e.root!==je&&e.iterate(e.root,i=>(i!==je&&this._pieces.push(i.piece),!0))}read(){return this._pieces.length===0?this._index===0?(this._index++,this._BOM):null:this._index>this._pieces.length-1?null:this._index===0?this._BOM+this._tree.getPieceContent(this._pieces[this._index++]):this._tree.getPieceContent(this._pieces[this._index++])}},FR=class{constructor(e){this._limit=e,this._cache=[]}get(e){for(let t=this._cache.length-1;t>=0;t--){let i=this._cache[t];if(i.nodeStartOffset<=e&&i.nodeStartOffset+i.node.piece.length>=e)return i}return null}get2(e){for(let t=this._cache.length-1;t>=0;t--){let i=this._cache[t];if(i.nodeStartLineNumber&&i.nodeStartLineNumber=e)return i}return null}set(e){this._cache.length>=this._limit&&this._cache.shift(),this._cache.push(e)}validate(e){let t=!1,i=this._cache;for(let o=0;o=e){i[o]=null,t=!0;continue}}if(t){let o=[];for(let s of i)s!==null&&o.push(s);this._cache=o}}},HL=class{constructor(e,t,i){this.create(e,t,i)}create(e,t,i){this._buffers=[new ql("",[0])],this._lastChangeBufferPos={line:0,column:0},this.root=je,this._lineCnt=1,this._length=0,this._EOL=t,this._EOLLength=t.length,this._EOLNormalized=i;let o=null;for(let s=0,r=e.length;s0){e[s].lineStarts||(e[s].lineStarts=$l(e[s].buffer));let a=new Uo(s+1,{line:0,column:0},{line:e[s].lineStarts.length-1,column:e[s].buffer.length-e[s].lineStarts[e[s].lineStarts.length-1]},e[s].lineStarts.length-1,e[s].buffer.length);this._buffers.push(e[s]),o=this.rbInsertRight(o,a)}this._searchCache=new FR(1),this._lastVisitedLine={lineNumber:0,value:""},this.computeBufferMetadata()}normalizeEOL(e){let t=Gc,i=t-Math.floor(t/3),o=i*2,s="",r=0,a=[];if(this.iterate(this.root,l=>{let c=this.getNodeContent(l),d=c.length;if(r<=i||r+d0){let l=s.replace(/\r\n|\r|\n/g,e);a.push(new ql(l,$l(l)))}this.create(a,e,!0)}getEOL(){return this._EOL}setEOL(e){this._EOL=e,this._EOLLength=this._EOL.length,this.normalizeEOL(e)}createSnapshot(e){return new OR(this,e)}getOffsetAt(e,t){let i=0,o=this.root;for(;o!==je;)if(o.left!==je&&o.lf_left+1>=e)o=o.left;else if(o.lf_left+o.piece.lineFeedCnt+1>=e){i+=o.size_left;let s=this.getAccumulatedValue(o,e-o.lf_left-2);return i+=s+t-1}else e-=o.lf_left+o.piece.lineFeedCnt,i+=o.size_left+o.piece.length,o=o.right;return i}getPositionAt(e){e=Math.floor(e),e=Math.max(0,e);let t=this.root,i=0,o=e;for(;t!==je;)if(t.size_left!==0&&t.size_left>=e)t=t.left;else if(t.size_left+t.piece.length>=e){let s=this.getIndexOf(t,e-t.size_left);if(i+=t.lf_left+s.index,s.index===0){let r=this.getOffsetAt(i+1,1),a=o-r;return new U(i+1,a+1)}return new U(i+1,s.remainder+1)}else if(e-=t.size_left+t.piece.length,i+=t.lf_left+t.piece.lineFeedCnt,t.right===je){let s=this.getOffsetAt(i+1,1),r=o-e-s;return new U(i+1,r+1)}else t=t.right;return new U(1,1)}getValueInRange(e,t){if(e.startLineNumber===e.endLineNumber&&e.startColumn===e.endColumn)return"";let i=this.nodeAt2(e.startLineNumber,e.startColumn),o=this.nodeAt2(e.endLineNumber,e.endColumn),s=this.getValueInRange2(i,o);return t?t!==this._EOL||!this._EOLNormalized?s.replace(/\r\n|\r|\n/g,t):t===this.getEOL()&&this._EOLNormalized?s:s.replace(/\r\n|\r|\n/g,t):s}getValueInRange2(e,t){if(e.node===t.node){let a=e.node,l=this._buffers[a.piece.bufferIndex].buffer,c=this.offsetInBuffer(a.piece.bufferIndex,a.piece.start);return l.substring(c+e.remainder,c+t.remainder)}let i=e.node,o=this._buffers[i.piece.bufferIndex].buffer,s=this.offsetInBuffer(i.piece.bufferIndex,i.piece.start),r=o.substring(s+e.remainder,s+i.piece.length);for(i=i.next();i!==je;){let a=this._buffers[i.piece.bufferIndex].buffer,l=this.offsetInBuffer(i.piece.bufferIndex,i.piece.start);if(i===t.node){r+=a.substring(l,l+t.remainder);break}else r+=a.substr(l,i.piece.length);i=i.next()}return r}getLinesContent(){let e=[],t=0,i="",o=!1;return this.iterate(this.root,s=>{if(s===je)return!0;let r=s.piece,a=r.length;if(a===0)return!0;let l=this._buffers[r.bufferIndex].buffer,c=this._buffers[r.bufferIndex].lineStarts,d=r.start.line,h=r.end.line,u=c[d]+r.start.column;if(o&&(l.charCodeAt(u)===10&&(u++,a--),e[t++]=i,i="",o=!1,a===0))return!0;if(d===h)return!this._EOLNormalized&&l.charCodeAt(u+a-1)===13?(o=!0,i+=l.substr(u,a-1)):i+=l.substr(u,a),!0;i+=this._EOLNormalized?l.substring(u,Math.max(u,c[d+1]-this._EOLLength)):l.substring(u,c[d+1]).replace(/(\r\n|\r|\n)$/,""),e[t++]=i;for(let f=d+1;fx+g,t.reset(0)):(w=u.buffer,y=x=>x,t.reset(g));do if(C=t.next(w),C){if(y(C.index)>=m)return d;this.positionInBuffer(e,y(C.index)-f,S);let x=this.getLineFeedCnt(e.piece.bufferIndex,s,S),k=S.line===s.line?S.column-s.column+o:S.column+1,T=k+C[0].length;if(h[d++]=Yd(new P(i+x,k,i+x,T),C,l),y(C.index)+C[0].length>=m||d>=c)return d}while(C);return d}findMatchesLineByLine(e,t,i,o){let s=[],r=0,a=new kl(t.wordSeparators,t.regex),l=this.nodeAt2(e.startLineNumber,e.startColumn);if(l===null)return[];let c=this.nodeAt2(e.endLineNumber,e.endColumn);if(c===null)return[];let d=this.positionInBuffer(l.node,l.remainder),h=this.positionInBuffer(c.node,c.remainder);if(l.node===c.node)return this.findMatchesInNode(l.node,a,e.startLineNumber,e.startColumn,d,h,t,i,o,r,s),s;let u=e.startLineNumber,f=l.node;for(;f!==c.node;){let m=this.getLineFeedCnt(f.piece.bufferIndex,d,f.piece.end);if(m>=1){let S=this._buffers[f.piece.bufferIndex].lineStarts,w=this.offsetInBuffer(f.piece.bufferIndex,f.piece.start),y=S[d.line+m],x=u===e.startLineNumber?e.startColumn:1;if(r=this.findMatchesInNode(f,a,u,x,d,this.positionInBuffer(f,y-w),t,i,o,r,s),r>=o)return s;u+=m}let C=u===e.startLineNumber?e.startColumn-1:0;if(u===e.endLineNumber){let S=this.getLineContent(u).substring(C,e.endColumn-1);return r=this._findMatchesInLine(t,a,S,e.endLineNumber,C,r,s,i,o),s}if(r=this._findMatchesInLine(t,a,this.getLineContent(u).substr(C),u,C,r,s,i,o),r>=o)return s;u++,l=this.nodeAt2(u,1),f=l.node,d=this.positionInBuffer(l.node,l.remainder)}if(u===e.endLineNumber){let m=u===e.startLineNumber?e.startColumn-1:0,C=this.getLineContent(u).substring(m,e.endColumn-1);return r=this._findMatchesInLine(t,a,C,e.endLineNumber,m,r,s,i,o),s}let g=u===e.startLineNumber?e.startColumn:1;return r=this.findMatchesInNode(c.node,a,u,g,d,h,t,i,o,r,s),s}_findMatchesInLine(e,t,i,o,s,r,a,l,c){let d=e.wordSeparators;if(!l&&e.simpleSearch){let u=e.simpleSearch,f=u.length,g=i.length,m=-f;for(;(m=i.indexOf(u,m+f))!==-1;)if((!d||Jy(d,i,g,m,f))&&(a[r++]=new Ll(new P(o,m+1+s,o,m+1+f+s),null),r>=c))return r;return r}let h;t.reset(0);do if(h=t.next(i),h&&(a[r++]=Yd(new P(o,h.index+1+s,o,h.index+1+h[0].length+s),h,l),r>=c))return r;while(h);return r}insert(e,t,i=!1){if(this._EOLNormalized=this._EOLNormalized&&i,this._lastVisitedLine.lineNumber=0,this._lastVisitedLine.value="",this.root!==je){let{node:o,remainder:s,nodeStartOffset:r}=this.nodeAt(e),a=o.piece,l=a.bufferIndex,c=this.positionInBuffer(o,s);if(o.piece.bufferIndex===0&&a.end.line===this._lastChangeBufferPos.line&&a.end.column===this._lastChangeBufferPos.column&&r+a.length===e&&t.lengthe){let d=[],h=new Uo(a.bufferIndex,c,a.end,this.getLineFeedCnt(a.bufferIndex,c,a.end),this.offsetInBuffer(l,a.end)-this.offsetInBuffer(l,c));if(this.shouldCheckCRLF()&&this.endWithCR(t)&&this.nodeCharCodeAt(o,s)===10){let m={line:h.start.line+1,column:0};h=new Uo(h.bufferIndex,m,h.end,this.getLineFeedCnt(h.bufferIndex,m,h.end),h.length-1),t+=` +`}if(this.shouldCheckCRLF()&&this.startWithLF(t))if(this.nodeCharCodeAt(o,s-1)===13){let m=this.positionInBuffer(o,s-1);this.deleteNodeTail(o,m),t="\r"+t,o.piece.length===0&&d.push(o)}else this.deleteNodeTail(o,c);else this.deleteNodeTail(o,c);let u=this.createNewPieces(t);h.length>0&&this.rbInsertRight(o,h);let f=o;for(let g=0;g=0;r--)s=this.rbInsertLeft(s,o[r]);this.validateCRLFWithPrevNode(s),this.deleteNodes(i)}insertContentToNodeRight(e,t){this.adjustCarriageReturnFromNext(e,t)&&(e+=` +`);let i=this.createNewPieces(e),o=this.rbInsertRight(t,i[0]),s=o;for(let r=1;r=u)c=h+1;else break;return i?(i.line=h,i.column=l-f,null):{line:h,column:l-f}}getLineFeedCnt(e,t,i){if(i.column===0)return i.line-t.line;let o=this._buffers[e].lineStarts;if(i.line===o.length-1)return i.line-t.line;let s=o[i.line+1],r=o[i.line]+i.column;if(s>r+1)return i.line-t.line;let a=r-1;return this._buffers[e].buffer.charCodeAt(a)===13?i.line-t.line+1:i.line-t.line}offsetInBuffer(e,t){return this._buffers[e].lineStarts[t.line]+t.column}deleteNodes(e){for(let t=0;tGc){let d=[];for(;e.length>Gc;){let u=e.charCodeAt(Gc-1),f;u===13||u>=55296&&u<=56319?(f=e.substring(0,Gc-1),e=e.substring(Gc-1)):(f=e.substring(0,Gc),e=e.substring(Gc));let g=$l(f);d.push(new Uo(this._buffers.length,{line:0,column:0},{line:g.length-1,column:f.length-g[g.length-1]},g.length-1,f.length)),this._buffers.push(new ql(f,g))}let h=$l(e);return d.push(new Uo(this._buffers.length,{line:0,column:0},{line:h.length-1,column:e.length-h[h.length-1]},h.length-1,e.length)),this._buffers.push(new ql(e,h)),d}let t=this._buffers[0].buffer.length,i=$l(e,!1),o=this._lastChangeBufferPos;if(this._buffers[0].lineStarts[this._buffers[0].lineStarts.length-1]===t&&t!==0&&this.startWithLF(e)&&this.endWithCR(this._buffers[0].buffer)){this._lastChangeBufferPos={line:this._lastChangeBufferPos.line,column:this._lastChangeBufferPos.column+1},o=this._lastChangeBufferPos;for(let d=0;d=e-1)i=i.left;else if(i.lf_left+i.piece.lineFeedCnt>e-1){let l=this.getAccumulatedValue(i,e-i.lf_left-2),c=this.getAccumulatedValue(i,e-i.lf_left-1),d=this._buffers[i.piece.bufferIndex].buffer,h=this.offsetInBuffer(i.piece.bufferIndex,i.piece.start);return r+=i.size_left,this._searchCache.set({node:i,nodeStartOffset:r,nodeStartLineNumber:a-(e-1-i.lf_left)}),d.substring(h+l,h+c-t)}else if(i.lf_left+i.piece.lineFeedCnt===e-1){let l=this.getAccumulatedValue(i,e-i.lf_left-2),c=this._buffers[i.piece.bufferIndex].buffer,d=this.offsetInBuffer(i.piece.bufferIndex,i.piece.start);o=c.substring(d+l,d+i.piece.length);break}else e-=i.lf_left+i.piece.lineFeedCnt,r+=i.size_left+i.piece.length,i=i.right}for(i=i.next();i!==je;){let r=this._buffers[i.piece.bufferIndex].buffer;if(i.piece.lineFeedCnt>0){let a=this.getAccumulatedValue(i,0),l=this.offsetInBuffer(i.piece.bufferIndex,i.piece.start);return o+=r.substring(l,l+a-t),o}else{let a=this.offsetInBuffer(i.piece.bufferIndex,i.piece.start);o+=r.substr(a,i.piece.length)}i=i.next()}return o}computeBufferMetadata(){let e=this.root,t=1,i=0;for(;e!==je;)t+=e.lf_left+e.piece.lineFeedCnt,i+=e.size_left+e.piece.length,e=e.right;this._lineCnt=t,this._length=i,this._searchCache.validate(this._length)}getIndexOf(e,t){let i=e.piece,o=this.positionInBuffer(e,t),s=o.line-i.start.line;if(this.offsetInBuffer(i.bufferIndex,i.end)-this.offsetInBuffer(i.bufferIndex,i.start)===t){let r=this.getLineFeedCnt(e.piece.bufferIndex,i.start,o);if(r!==s)return{index:r,remainder:0}}return{index:s,remainder:o.column}}getAccumulatedValue(e,t){if(t<0)return 0;let i=e.piece,o=this._buffers[i.bufferIndex].lineStarts,s=i.start.line+t+1;return s>i.end.line?o[i.end.line]+i.end.column-o[i.start.line]-i.start.column:o[s]-o[i.start.line]-i.start.column}deleteNodeTail(e,t){let i=e.piece,o=i.lineFeedCnt,s=this.offsetInBuffer(i.bufferIndex,i.end),r=t,a=this.offsetInBuffer(i.bufferIndex,r),l=this.getLineFeedCnt(i.bufferIndex,i.start,r),c=l-o,d=a-s,h=i.length+d;e.piece=new Uo(i.bufferIndex,i.start,r,l,h),Kl(this,e,d,c)}deleteNodeHead(e,t){let i=e.piece,o=i.lineFeedCnt,s=this.offsetInBuffer(i.bufferIndex,i.start),r=t,a=this.getLineFeedCnt(i.bufferIndex,r,i.end),l=this.offsetInBuffer(i.bufferIndex,r),c=a-o,d=s-l,h=i.length+d;e.piece=new Uo(i.bufferIndex,r,i.end,a,h),Kl(this,e,d,c)}shrinkNode(e,t,i){let o=e.piece,s=o.start,r=o.end,a=o.length,l=o.lineFeedCnt,c=t,d=this.getLineFeedCnt(o.bufferIndex,o.start,c),h=this.offsetInBuffer(o.bufferIndex,t)-this.offsetInBuffer(o.bufferIndex,s);e.piece=new Uo(o.bufferIndex,o.start,c,d,h),Kl(this,e,h-a,d-l);let u=new Uo(o.bufferIndex,i,r,this.getLineFeedCnt(o.bufferIndex,i,r),this.offsetInBuffer(o.bufferIndex,r)-this.offsetInBuffer(o.bufferIndex,i)),f=this.rbInsertRight(e,u);this.validateCRLFWithPrevNode(f)}appendToNode(e,t){this.adjustCarriageReturnFromNext(t,e)&&(t+=` +`);let i=this.shouldCheckCRLF()&&this.startWithLF(t)&&this.endWithCR(e),o=this._buffers[0].buffer.length;this._buffers[0].buffer+=t;let s=$l(t,!1);for(let f=0;fe)t=t.left;else if(t.size_left+t.piece.length>=e){o+=t.size_left;let s={node:t,remainder:e-t.size_left,nodeStartOffset:o};return this._searchCache.set(s),s}else e-=t.size_left+t.piece.length,o+=t.size_left+t.piece.length,t=t.right;return null}nodeAt2(e,t){let i=this.root,o=0;for(;i!==je;)if(i.left!==je&&i.lf_left>=e-1)i=i.left;else if(i.lf_left+i.piece.lineFeedCnt>e-1){let s=this.getAccumulatedValue(i,e-i.lf_left-2),r=this.getAccumulatedValue(i,e-i.lf_left-1);return o+=i.size_left,{node:i,remainder:Math.min(s+t-1,r),nodeStartOffset:o}}else if(i.lf_left+i.piece.lineFeedCnt===e-1){let s=this.getAccumulatedValue(i,e-i.lf_left-2);if(s+t-1<=i.piece.length)return{node:i,remainder:s+t-1,nodeStartOffset:o};t-=i.piece.length-s;break}else e-=i.lf_left+i.piece.lineFeedCnt,o+=i.size_left+i.piece.length,i=i.right;for(i=i.next();i!==je;){if(i.piece.lineFeedCnt>0){let s=this.getAccumulatedValue(i,0),r=this.offsetOfNode(i);return{node:i,remainder:Math.min(t-1,s),nodeStartOffset:r}}else if(i.piece.length>=t-1){let s=this.offsetOfNode(i);return{node:i,remainder:t-1,nodeStartOffset:s}}else t-=i.piece.length;i=i.next()}return null}nodeCharCodeAt(e,t){if(e.piece.lineFeedCnt<1)return-1;let i=this._buffers[e.piece.bufferIndex],o=this.offsetInBuffer(e.piece.bufferIndex,e.piece.start)+t;return i.buffer.charCodeAt(o)}offsetOfNode(e){if(!e)return 0;let t=e.size_left;for(;e!==this.root;)e.parent.right===e&&(t+=e.parent.size_left+e.parent.piece.length),e=e.parent;return t}shouldCheckCRLF(){return!(this._EOLNormalized&&this._EOL===` +`)}startWithLF(e){if(typeof e=="string")return e.charCodeAt(0)===10;if(e===je||e.piece.lineFeedCnt===0)return!1;let t=e.piece,i=this._buffers[t.bufferIndex].lineStarts,o=t.start.line,s=i[o]+t.start.column;return o===i.length-1||i[o+1]>s+1?!1:this._buffers[t.bufferIndex].buffer.charCodeAt(s)===10}endWithCR(e){return typeof e=="string"?e.charCodeAt(e.length-1)===13:e===je||e.piece.lineFeedCnt===0?!1:this.nodeCharCodeAt(e,e.piece.length-1)===13}validateCRLFWithPrevNode(e){if(this.shouldCheckCRLF()&&this.startWithLF(e)){let t=e.prev();this.endWithCR(t)&&this.fixCRLF(t,e)}}validateCRLFWithNextNode(e){if(this.shouldCheckCRLF()&&this.endWithCR(e)){let t=e.next();this.startWithLF(t)&&this.fixCRLF(e,t)}}fixCRLF(e,t){let i=[],o=this._buffers[e.piece.bufferIndex].lineStarts,s;e.piece.end.column===0?s={line:e.piece.end.line-1,column:o[e.piece.end.line]-o[e.piece.end.line-1]-1}:s={line:e.piece.end.line,column:e.piece.end.column-1};let r=e.piece.length-1,a=e.piece.lineFeedCnt-1;e.piece=new Uo(e.piece.bufferIndex,e.piece.start,s,a,r),Kl(this,e,-1,-1),e.piece.length===0&&i.push(e);let l={line:t.piece.start.line+1,column:0},c=t.piece.length-1,d=this.getLineFeedCnt(t.piece.bufferIndex,l,t.piece.end);t.piece=new Uo(t.piece.bufferIndex,l,t.piece.end,d,c),Kl(this,t,-1,-1),t.piece.length===0&&i.push(t);let h=this.createNewPieces(`\r +`);this.rbInsertRight(e,h[0]);for(let u=0;u{"use strict";_();v();b();ye();ot();Ke();hr();BR();tp();vR();le();dp=class n extends H{constructor(e,t,i,o,s,r,a){super(),this._onDidChangeContent=this._register(new B),this._BOM=t,this._mightContainNonBasicASCII=!r,this._mightContainRTL=o,this._mightContainUnusualLineTerminators=s,this._pieceTree=new HL(e,i,a)}mightContainRTL(){return this._mightContainRTL}mightContainUnusualLineTerminators(){return this._mightContainUnusualLineTerminators}resetMightContainUnusualLineTerminators(){this._mightContainUnusualLineTerminators=!1}mightContainNonBasicASCII(){return this._mightContainNonBasicASCII}getBOM(){return this._BOM}getEOL(){return this._pieceTree.getEOL()}createSnapshot(e){return this._pieceTree.createSnapshot(e?this._BOM:"")}getOffsetAt(e,t){return this._pieceTree.getOffsetAt(e,t)}getPositionAt(e){return this._pieceTree.getPositionAt(e)}getRangeAt(e,t){let i=e+t,o=this.getPositionAt(e),s=this.getPositionAt(i);return new P(o.lineNumber,o.column,s.lineNumber,s.column)}getValueInRange(e,t=0){if(e.isEmpty())return"";let i=this._getEndOfLine(t);return this._pieceTree.getValueInRange(e,i)}getValueLengthInRange(e,t=0){if(e.isEmpty())return 0;if(e.startLineNumber===e.endLineNumber)return e.endColumn-e.startColumn;let i=this.getOffsetAt(e.startLineNumber,e.startColumn),o=this.getOffsetAt(e.endLineNumber,e.endColumn),s=0,r=this._getEndOfLine(t),a=this.getEOL();if(r.length!==a.length){let l=r.length-a.length,c=e.endLineNumber-e.startLineNumber;s=l*c}return o-i+s}getCharacterCountInRange(e,t=0){if(this._mightContainNonBasicASCII){let i=0,o=e.startLineNumber,s=e.endLineNumber;for(let r=o;r<=s;r++){let a=this.getLineContent(r),l=r===o?e.startColumn-1:0,c=r===s?e.endColumn-1:a.length;for(let d=l;dC.sortIndex-S.sortIndex)}this._mightContainRTL=o,this._mightContainUnusualLineTerminators=s,this._mightContainNonBasicASCII=r;let f=this._doApplyEdits(l),g=null;if(t&&h.length>0){h.sort((m,C)=>C.lineNumber-m.lineNumber),g=[];for(let m=0,C=h.length;m0&&h[m-1].lineNumber===S)continue;let w=h[m].oldContent,y=this.getLineContent(S);y.length===0||y===w||Ri(y)!==-1||g.push(S)}}return this._onDidChangeContent.fire(),new Xy(u,f,g)}_reduceOperations(e){return e.length<1e3?e:[this._toSingleEditOperation(e)]}_toSingleEditOperation(e){let t=!1,i=e[0].range,o=e[e.length-1].range,s=new P(i.startLineNumber,i.startColumn,o.endLineNumber,o.endColumn),r=i.startLineNumber,a=i.startColumn,l=[];for(let f=0,g=e.length;f0&&l.push(m.text),r=C.endLineNumber,a=C.endColumn}let c=l.join(""),[d,h,u]=na(c);return{sortIndex:0,identifier:e[0].identifier,range:s,rangeOffset:this.getOffsetAt(s.startLineNumber,s.startColumn),rangeLength:this.getValueLengthInRange(s,0),text:c,eolCount:d,firstLineLength:h,lastLineLength:u,forceMoveMarkers:t,isAutoWhitespaceEdit:!1}}_doApplyEdits(e){e.sort(n._sortOpsDescending);let t=[];for(let i=0;i0){let u=l.eolCount+1;u===1?h=new P(c,d,c,d+l.firstLineLength):h=new P(c,d,c+u-1,l.lastLineLength+1)}else h=new P(c,d,c,d);i=h.endLineNumber,o=h.endColumn,t.push(h),s=l}return t}static _sortOpsAscending(e,t){let i=P.compareRangesUsingEnds(e.range,t.range);return i===0?e.sortIndex-t.sortIndex:i}static _sortOpsDescending(e,t){let i=P.compareRangesUsingEnds(e.range,t.range);return i===0?t.sortIndex-e.sortIndex:-i}}});var zR,ev,gz=J(()=>{"use strict";_();v();b();ot();BR();WR();zR=class{constructor(e,t,i,o,s,r,a,l,c){this._chunks=e,this._bom=t,this._cr=i,this._lf=o,this._crlf=s,this._containsRTL=r,this._containsUnusualLineTerminators=a,this._isBasicASCII=l,this._normalizeEOL=c}_getEOL(e){let t=this._cr+this._lf+this._crlf,i=this._cr+this._crlf;return t===0?e===1?` +`:`\r +`:i>t/2?`\r +`:` +`}create(e){let t=this._getEOL(e),i=this._chunks;if(this._normalizeEOL&&(t===`\r +`&&(this._cr>0||this._lf>0)||t===` +`&&(this._cr>0||this._crlf>0)))for(let s=0,r=i.length;s=55296&&t<=56319?(this._acceptChunk1(e.substr(0,e.length-1),!1),this._hasPreviousChar=!0,this._previousChar=t):(this._acceptChunk1(e,!1),this._hasPreviousChar=!1,this._previousChar=t)}_acceptChunk1(e,t){!t&&e.length===0||(this._hasPreviousChar?this._acceptChunk2(String.fromCharCode(this._previousChar)+e):this._acceptChunk2(e))}_acceptChunk2(e){let t=fz(this._tmpLineStarts,e);this.chunks.push(new ql(e,t.lineStarts)),this.cr+=t.cr,this.lf+=t.lf,this.crlf+=t.crlf,t.isBasicASCII||(this.isBasicASCII=!1,this.containsRTL||(this.containsRTL=Lc(e)),this.containsUnusualLineTerminators||(this.containsUnusualLineTerminators=vw(e)))}finish(e=!0){return this._finish(),new zR(this.chunks,this.BOM,this.cr,this.lf,this.crlf,this.containsRTL,this.containsUnusualLineTerminators,this.isBasicASCII,e)}_finish(){if(this.chunks.length===0&&this._acceptChunk1("",!0),this._hasPreviousChar){this._hasPreviousChar=!1;let e=this.chunks[this.chunks.length-1];e.buffer+=String.fromCharCode(this._previousChar);let t=$l(e.buffer);e.lineStarts=t,this._previousChar===13&&this.cr++}}}});function bZ(n,e){let t=[];for(let i=0;i{"use strict";_();v();b();wt();UL=class{constructor(e){this._default=e,this._store=[]}get(e){return e=this._store.length;)this._store[this._store.length]=this._default;this._store[e]=t}replace(e,t,i){if(e>=this._store.length)return;if(t===0){this.insert(e,i);return}else if(i===0){this.delete(e,t);return}let o=this._store.slice(0,e),s=this._store.slice(e+t),r=bZ(i,this._default);this._store=o.concat(r,s)}delete(e,t){t===0||e>=this._store.length||this._store.splice(e,t)}insert(e,t){if(t===0||e>=this._store.length)return;let i=[];for(let o=0;o{"use strict";_();v();b();KL=class{get startLineNumber(){return this._startLineNumber}get endLineNumber(){return this._startLineNumber+this._tokens.length-1}constructor(e,t){this._startLineNumber=e,this._tokens=t}getLineTokens(e){return this._tokens[e-this._startLineNumber]}appendLineTokens(e){this._tokens.push(e)}}});var vf,VR=J(()=>{"use strict";_();v();b();pz();vf=class{constructor(){this._tokens=[]}add(e,t){if(this._tokens.length>0){let i=this._tokens[this._tokens.length-1];if(i.endLineNumber+1===e){i.appendLineTokens(t);return}}this._tokens.push(new KL(e,[t]))}finalize(){return this._tokens}}});function tv(n,e,t,i,o,s){let r=null;if(t)try{r=t.tokenizeEncoded(i,o,s.clone())}catch(a){ut(a)}return r||(r=hm(n.encodeLanguageId(e),s)),Hi.convertToEndOffset(r.tokens,i.length),r}var HR,$L,hp,UR,KR,qL,_z=J(()=>{"use strict";_();v();b();Gt();xt();Lt();vg();tp();Bo();es();Y0();mz();VR();Pc();HR=class{constructor(e,t){this.tokenizationSupport=t,this.initialState=this.tokenizationSupport.getInitialState(),this.store=new hp(e)}getStartState(e){return this.store.getStartState(e,this.initialState)}getFirstInvalidLine(){return this.store.getFirstInvalidLine(this.initialState)}},$L=class extends HR{constructor(e,t,i,o){super(e,t),this._textModel=i,this._languageIdCodec=o}updateTokensUntilLine(e,t){let i=this._textModel.getLanguageId();for(;;){let o=this.getFirstInvalidLine();if(!o||o.lineNumber>t)break;let s=this._textModel.getLineContent(o.lineNumber),r=tv(this._languageIdCodec,i,this.tokenizationSupport,s,!0,o.startState);e.add(o.lineNumber,r.tokens),this.store.setEndState(o.lineNumber,r.endState)}}getTokenTypeIfInsertingCharacter(e,t){let i=this.getStartState(e.lineNumber);if(!i)return 0;let o=this._textModel.getLanguageId(),s=this._textModel.getLineContent(e.lineNumber),r=s.substring(0,e.column-1)+t+s.substring(e.column-1),a=tv(this._languageIdCodec,o,this.tokenizationSupport,r,!0,i),l=new Hi(a.tokens,r,this._languageIdCodec);if(l.getCount()===0)return 0;let c=l.findTokenIndexAtOffset(e.column-1);return l.getStandardTokenType(c)}tokenizeLineWithEdit(e,t,i){let o=e.lineNumber,s=e.column,r=this.getStartState(o);if(!r)return null;let a=this._textModel.getLineContent(o),l=a.substring(0,s-1)+i+a.substring(s-1+t),c=this._textModel.getLanguageIdAtPosition(o,0),d=tv(this._languageIdCodec,c,this.tokenizationSupport,l,!0,r);return new Hi(d.tokens,l,this._languageIdCodec)}hasAccurateTokensForLine(e){let t=this.store.getFirstInvalidEndStateLineNumberOrMax();return e1&&a>=1;a--){let l=this._textModel.getLineFirstNonWhitespaceColumn(a);if(l!==0&&l0&&i>0&&(i--,t--),this._lineEndStates.replace(e.startLineNumber,i,t)}},KR=class{constructor(){this._ranges=[]}get min(){return this._ranges.length===0?null:this._ranges[0].start}delete(e){let t=this._ranges.findIndex(i=>i.contains(e));if(t!==-1){let i=this._ranges[t];i.start===e?i.endExclusive===e+1?this._ranges.splice(t,1):this._ranges[t]=new ze(e+1,i.endExclusive):i.endExclusive===e+1?this._ranges[t]=new ze(i.start,e):this._ranges.splice(t,1,new ze(i.start,e),new ze(e+1,i.endExclusive))}}addRange(e){ze.addRange(e,this._ranges)}addRangeAndResize(e,t){let i=0;for(;!(i>=this._ranges.length||e.start<=this._ranges[i].endExclusive);)i++;let o=i;for(;!(o>=this._ranges.length||e.endExclusivee.toString()).join(" + ")}};qL=class{constructor(e,t){this._tokenizerWithStateStore=e,this._backgroundTokenStore=t,this._isDisposed=!1,this._isScheduled=!1}dispose(){this._isDisposed=!0}handleChanges(){this._beginBackgroundTokenization()}_beginBackgroundTokenization(){this._isScheduled||!this._tokenizerWithStateStore._textModel.isAttachedToEditor()||!this._hasLinesToTokenize()||(this._isScheduled=!0,OT(e=>{this._isScheduled=!1,this._backgroundTokenizeWithDeadline(e)}))}_backgroundTokenizeWithDeadline(e){let t=Date.now()+e.timeRemaining(),i=()=>{this._isDisposed||!this._tokenizerWithStateStore._textModel.isAttachedToEditor()||!this._hasLinesToTokenize()||(this._backgroundTokenizeForAtLeast1ms(),Date.now()1||this._tokenizeOneInvalidLine(t)>=e)break;while(this._hasLinesToTokenize());this._backgroundTokenStore.setTokens(t.finalize()),this.checkFinished()}_hasLinesToTokenize(){return this._tokenizerWithStateStore?!this._tokenizerWithStateStore.store.allStatesValid():!1}_tokenizeOneInvalidLine(e){var t;let i=(t=this._tokenizerWithStateStore)===null||t===void 0?void 0:t.getFirstInvalidLine();return i?(this._tokenizerWithStateStore.updateTokensUntilLine(e,i.lineNumber),i.lineNumber):this._tokenizerWithStateStore._textModel.getLineCount()+1}checkFinished(){this._isDisposed||this._tokenizerWithStateStore.store.allStatesValid()&&this._backgroundTokenStore.backgroundTokenizationFinished()}requestTokens(e,t){this._tokenizerWithStateStore.store.invalidateEndStateRange(new Ne(e,t))}}});function Gl(n){return n instanceof Uint32Array?n:new Uint32Array(n)}var jl,Zl,bz=J(()=>{"use strict";_();v();b();Pc();jl=new Uint32Array(0).buffer,Zl=class n{static deleteBeginning(e,t){return e===null||e===jl?e:n.delete(e,0,t)}static deleteEnding(e,t){if(e===null||e===jl)return e;let i=Gl(e),o=i[i.length-2];return n.delete(e,t,o)}static delete(e,t,i){if(e===null||e===jl||t===i)return e;let o=Gl(e),s=o.length>>>1;if(t===0&&o[o.length-2]===i)return jl;let r=Hi.findIndexInTokensArray(o,t),a=r>0?o[r-1<<1]:0,l=o[r<<1];if(id&&(o[c++]=g,o[c++]=o[(f<<1)+1],d=g)}if(c===o.length)return e;let u=new Uint32Array(c);return u.set(o.subarray(0,c),0),u.buffer}static append(e,t){if(t===jl)return e;if(e===jl)return t;if(e===null)return e;if(t===null)return null;let i=Gl(e),o=Gl(t),s=o.length>>>1,r=new Uint32Array(i.length+o.length);r.set(i,0);let a=i.length,l=i[i.length-2];for(let c=0;c>>1,r=Hi.findIndexInTokensArray(o,t);r>0&&o[r-1<<1]===t&&r--;for(let a=r;a>>0}var iv,Cz=J(()=>{"use strict";_();v();b();wt();ft();bz();Pc();um();iv=class n{constructor(e){this._lineTokens=[],this._len=0,this._languageIdCodec=e}flush(){this._lineTokens=[],this._len=0}get hasTokens(){return this._lineTokens.length>0}getTokens(e,t,i){let o=null;if(t1&&(s=mn.getLanguageId(o[1])!==e),!s)return jl}if(!o||o.length===0){let s=new Uint32Array(2);return s[0]=t,s[1]=vz(e),s.buffer}return o[o.length-2]=t,o.byteOffset===0&&o.byteLength===o.buffer.byteLength?o.buffer:o}_ensureLine(e){for(;e>=this._len;)this._lineTokens[this._len]=null,this._len++}_deleteLines(e,t){t!==0&&(e+t>this._len&&(t=this._len-e),this._lineTokens.splice(e,t),this._len-=t)}_insertLines(e,t){if(t===0)return;let i=[];for(let o=0;o=this._len)return;if(e.startLineNumber===e.endLineNumber){if(e.startColumn===e.endColumn)return;this._lineTokens[t]=Zl.delete(this._lineTokens[t],e.startColumn-1,e.endColumn-1);return}this._lineTokens[t]=Zl.deleteEnding(this._lineTokens[t],e.startColumn-1);let i=e.endLineNumber-1,o=null;i=this._len)){if(t===0){this._lineTokens[o]=Zl.insert(this._lineTokens[o],e.column-1,i);return}this._lineTokens[o]=Zl.deleteEnding(this._lineTokens[o],e.column-1),this._lineTokens[o]=Zl.insert(this._lineTokens[o],e.column-1,i),this._insertLines(e.lineNumber,t)}}setMultilineTokens(e,t){if(e.length===0)return{changes:[]};let i=[];for(let o=0,s=e.length;o{"use strict";_();v();b();wt();Pc();jL=class n{constructor(e){this._pieces=[],this._isComplete=!1,this._languageIdCodec=e}flush(){this._pieces=[],this._isComplete=!1}isEmpty(){return this._pieces.length===0}set(e,t){this._pieces=e||[],this._isComplete=t}setPartial(e,t){let i=e;if(t.length>0){let s=t[0].getRange(),r=t[t.length-1].getRange();if(!s||!r)return e;i=e.plusRange(s).plusRange(r)}let o=null;for(let s=0,r=this._pieces.length;si.endLineNumber){o=o||{index:s};break}if(a.removeTokens(i),a.isEmpty()){this._pieces.splice(s,1),s--,r--;continue}if(a.endLineNumberi.endLineNumber){o=o||{index:s};continue}let[l,c]=a.split(i);if(l.isEmpty()){o=o||{index:s};continue}c.isEmpty()||(this._pieces.splice(s,1,l,c),s++,r++,o=o||{index:s})}return o=o||{index:this._pieces.length},t.length>0&&(this._pieces=fd(this._pieces,o.index,t)),i}isComplete(){return this._isComplete}addSparseTokens(e,t){if(t.getLineContent().length===0)return t;let i=this._pieces;if(i.length===0)return t;let o=n._findFirstPieceWithLine(i,e),s=i[o].getLineTokens(e);if(!s)return t;let r=t.getCount(),a=s.getCount(),l=0,c=[],d=0,h=0,u=(f,g)=>{f!==h&&(h=f,c[d++]=f,c[d++]=g)};for(let f=0;f>>0,w=~S>>>0;for(;lt)o=s-1;else{for(;s>i&&e[s-1].startLineNumber<=t&&t<=e[s-1].endLineNumber;)s--;return s}}return i}acceptEdit(e,t,i,o,s){for(let r of this._pieces)r.acceptEdit(e,t,i,o,s)}}});var GL,$R,qR,yz=J(()=>{"use strict";_();v();b();wt();Gt();xt();ye();le();tp();Bo();ft();ug();Yo();FM();_z();VR();Cz();wz();GL=class n extends Gm{constructor(e,t,i,o,s,r){super(),this._languageService=e,this._languageConfigurationService=t,this._textModel=i,this._bracketPairsTextModelPart=o,this._languageId=s,this._attachedViews=r,this._semanticTokens=new jL(this._languageService.languageIdCodec),this._onDidChangeLanguage=this._register(new B),this.onDidChangeLanguage=this._onDidChangeLanguage.event,this._onDidChangeLanguageConfiguration=this._register(new B),this.onDidChangeLanguageConfiguration=this._onDidChangeLanguageConfiguration.event,this._onDidChangeTokens=this._register(new B),this.onDidChangeTokens=this._onDidChangeTokens.event,this.grammarTokens=this._register(new $R(this._languageService.languageIdCodec,this._textModel,()=>this._languageId,this._attachedViews)),this._register(this._languageConfigurationService.onDidChange(a=>{a.affects(this._languageId)&&this._onDidChangeLanguageConfiguration.fire({})})),this._register(this.grammarTokens.onDidChangeTokens(a=>{this._emitModelTokensChangedEvent(a)})),this._register(this.grammarTokens.onDidChangeBackgroundTokenizationState(a=>{this._bracketPairsTextModelPart.handleDidChangeBackgroundTokenizationState()}))}handleDidChangeContent(e){if(e.isFlush)this._semanticTokens.flush();else if(!e.isEolChange)for(let t of e.changes){let[i,o,s]=na(t.text);this._semanticTokens.acceptEdit(t.range,i,o,s,t.text.length>0?t.text.charCodeAt(0):0)}this.grammarTokens.handleDidChangeContent(e)}handleDidChangeAttached(){this.grammarTokens.handleDidChangeAttached()}getLineTokens(e){this.validateLineNumber(e);let t=this.grammarTokens.getLineTokens(e);return this._semanticTokens.addSparseTokens(e,t)}_emitModelTokensChangedEvent(e){this._textModel._isDisposing()||(this._bracketPairsTextModelPart.handleDidChangeTokens(e),this._onDidChangeTokens.fire(e))}validateLineNumber(e){if(e<1||e>this._textModel.getLineCount())throw new St("Illegal value for lineNumber")}get hasTokens(){return this.grammarTokens.hasTokens}resetTokenization(){this.grammarTokens.resetTokenization()}get backgroundTokenizationState(){return this.grammarTokens.backgroundTokenizationState}forceTokenization(e){this.validateLineNumber(e),this.grammarTokens.forceTokenization(e)}hasAccurateTokensForLine(e){return this.validateLineNumber(e),this.grammarTokens.hasAccurateTokensForLine(e)}isCheapToTokenize(e){return this.validateLineNumber(e),this.grammarTokens.isCheapToTokenize(e)}tokenizeIfCheap(e){this.validateLineNumber(e),this.grammarTokens.tokenizeIfCheap(e)}getTokenTypeIfInsertingCharacter(e,t,i){return this.grammarTokens.getTokenTypeIfInsertingCharacter(e,t,i)}tokenizeLineWithEdit(e,t,i){return this.grammarTokens.tokenizeLineWithEdit(e,t,i)}setSemanticTokens(e,t){this._semanticTokens.set(e,t),this._emitModelTokensChangedEvent({semanticTokensApplied:e!==null,ranges:[{fromLineNumber:1,toLineNumber:this._textModel.getLineCount()}]})}hasCompleteSemanticTokens(){return this._semanticTokens.isComplete()}hasSomeSemanticTokens(){return!this._semanticTokens.isEmpty()}setPartialSemanticTokens(e,t){if(this.hasCompleteSemanticTokens())return;let i=this._textModel.validateRange(this._semanticTokens.setPartial(e,t));this._emitModelTokensChangedEvent({semanticTokensApplied:!0,ranges:[{fromLineNumber:i.startLineNumber,toLineNumber:i.endLineNumber}]})}getWordAtPosition(e){this.assertNotDisposed();let t=this._textModel.validatePosition(e),i=this._textModel.getLineContent(t.lineNumber),o=this.getLineTokens(t.lineNumber),s=o.findTokenIndexAtOffset(t.column-1),[r,a]=n._findLanguageBoundaries(o,s),l=pd(t.column,this.getLanguageConfiguration(o.getLanguageId(s)).getWordDefinition(),i.substring(r,a),r);if(l&&l.startColumn<=e.column&&e.column<=l.endColumn)return l;if(s>0&&r===t.column-1){let[c,d]=n._findLanguageBoundaries(o,s-1),h=pd(t.column,this.getLanguageConfiguration(o.getLanguageId(s-1)).getWordDefinition(),i.substring(c,d),c);if(h&&h.startColumn<=e.column&&e.column<=h.endColumn)return h}return null}getLanguageConfiguration(e){return this._languageConfigurationService.getLanguageConfiguration(e)}static _findLanguageBoundaries(e,t){let i=e.getLanguageId(t),o=0;for(let r=t;r>=0&&e.getLanguageId(r)===i;r--)o=e.getStartOffset(r);let s=e.getLineContent().length;for(let r=t,a=e.getCount();r{let r=this.getLanguageId();s.changedLanguages.indexOf(r)!==-1&&this.resetTokenization()})),this.resetTokenization(),this._register(o.onDidChangeVisibleRanges(({view:s,state:r})=>{if(r){let a=this._attachedViewStates.get(s);a||(a=new qR(()=>this.refreshRanges(a.lineRanges)),this._attachedViewStates.set(s,a)),a.handleStateChange(r)}else this._attachedViewStates.deleteAndDispose(s)}))}resetTokenization(e=!0){var t;this._tokens.flush(),(t=this._debugBackgroundTokens)===null||t===void 0||t.flush(),this._debugBackgroundStates&&(this._debugBackgroundStates=new hp(this._textModel.getLineCount())),e&&this._onDidChangeTokens.fire({semanticTokensApplied:!1,ranges:[{fromLineNumber:1,toLineNumber:this._textModel.getLineCount()}]});let i=()=>{if(this._textModel.isTooLargeForTokenization())return[null,null];let r=Bt.get(this.getLanguageId());if(!r)return[null,null];let a;try{a=r.getInitialState()}catch(l){return ut(l),[null,null]}return[r,a]},[o,s]=i();if(o&&s?this._tokenizer=new $L(this._textModel.getLineCount(),o,this._textModel,this._languageIdCodec):this._tokenizer=null,this._backgroundTokenizer.clear(),this._defaultBackgroundTokenizer=null,this._tokenizer){let r={setTokens:a=>{this.setTokens(a)},backgroundTokenizationFinished:()=>{if(this._backgroundTokenizationState===2)return;let a=2;this._backgroundTokenizationState=a,this._onDidChangeBackgroundTokenizationState.fire()},setEndState:(a,l)=>{var c;if(!this._tokenizer)return;let d=this._tokenizer.store.getFirstInvalidEndStateLineNumber();d!==null&&a>=d&&((c=this._tokenizer)===null||c===void 0||c.store.setEndState(a,l))}};o&&o.createBackgroundTokenizer&&!o.backgroundTokenizerShouldOnlyVerifyTokens&&(this._backgroundTokenizer.value=o.createBackgroundTokenizer(this._textModel,r)),!this._backgroundTokenizer.value&&!this._textModel.isTooLargeForTokenization()&&(this._backgroundTokenizer.value=this._defaultBackgroundTokenizer=new qL(this._tokenizer,r),this._defaultBackgroundTokenizer.handleChanges()),o?.backgroundTokenizerShouldOnlyVerifyTokens&&o.createBackgroundTokenizer?(this._debugBackgroundTokens=new iv(this._languageIdCodec),this._debugBackgroundStates=new hp(this._textModel.getLineCount()),this._debugBackgroundTokenizer.clear(),this._debugBackgroundTokenizer.value=o.createBackgroundTokenizer(this._textModel,{setTokens:a=>{var l;(l=this._debugBackgroundTokens)===null||l===void 0||l.setMultilineTokens(a,this._textModel)},backgroundTokenizationFinished(){},setEndState:(a,l)=>{var c;(c=this._debugBackgroundStates)===null||c===void 0||c.setEndState(a,l)}})):(this._debugBackgroundTokens=void 0,this._debugBackgroundStates=void 0,this._debugBackgroundTokenizer.value=void 0)}this.refreshAllVisibleLineTokens()}handleDidChangeAttached(){var e;(e=this._defaultBackgroundTokenizer)===null||e===void 0||e.handleChanges()}handleDidChangeContent(e){var t,i,o;if(e.isFlush)this.resetTokenization(!1);else if(!e.isEolChange){for(let s of e.changes){let[r,a]=na(s.text);this._tokens.acceptEdit(s.range,r,a),(t=this._debugBackgroundTokens)===null||t===void 0||t.acceptEdit(s.range,r,a)}(i=this._debugBackgroundStates)===null||i===void 0||i.acceptChanges(e.changes),this._tokenizer&&this._tokenizer.store.acceptChanges(e.changes),(o=this._defaultBackgroundTokenizer)===null||o===void 0||o.handleChanges()}}setTokens(e){let{changes:t}=this._tokens.setMultilineTokens(e,this._textModel);return t.length>0&&this._onDidChangeTokens.fire({semanticTokensApplied:!1,ranges:t}),{changes:t}}refreshAllVisibleLineTokens(){let e=Ne.joinMany([...this._attachedViewStates].map(([t,i])=>i.lineRanges));this.refreshRanges(e)}refreshRanges(e){for(let t of e)this.refreshRange(t.startLineNumber,t.endLineNumberExclusive-1)}refreshRange(e,t){var i,o;if(!this._tokenizer)return;e=Math.max(1,Math.min(this._textModel.getLineCount(),e)),t=Math.min(this._textModel.getLineCount(),t);let s=new vf,{heuristicTokens:r}=this._tokenizer.tokenizeHeuristically(s,e,t),a=this.setTokens(s.finalize());if(r)for(let l of a.changes)(i=this._backgroundTokenizer.value)===null||i===void 0||i.requestTokens(l.fromLineNumber,l.toLineNumber+1);(o=this._defaultBackgroundTokenizer)===null||o===void 0||o.checkFinished()}forceTokenization(e){var t,i;let o=new vf;(t=this._tokenizer)===null||t===void 0||t.updateTokensUntilLine(o,e),this.setTokens(o.finalize()),(i=this._defaultBackgroundTokenizer)===null||i===void 0||i.checkFinished()}hasAccurateTokensForLine(e){return this._tokenizer?this._tokenizer.hasAccurateTokensForLine(e):!0}isCheapToTokenize(e){return this._tokenizer?this._tokenizer.isCheapToTokenize(e):!0}tokenizeIfCheap(e){this.isCheapToTokenize(e)&&this.forceTokenization(e)}getLineTokens(e){var t;let i=this._textModel.getLineContent(e),o=this._tokens.getTokens(this._textModel.getLanguageId(),e-1,i);if(this._debugBackgroundTokens&&this._debugBackgroundStates&&this._tokenizer&&this._debugBackgroundStates.getFirstInvalidEndStateLineNumberOrMax()>e&&this._tokenizer.store.getFirstInvalidEndStateLineNumberOrMax()>e){let s=this._debugBackgroundTokens.getTokens(this._textModel.getLanguageId(),e-1,i);!o.equals(s)&&(!((t=this._debugBackgroundTokenizer.value)===null||t===void 0)&&t.reportMismatchingTokens)&&this._debugBackgroundTokenizer.value.reportMismatchingTokens(e)}return o}getTokenTypeIfInsertingCharacter(e,t,i){if(!this._tokenizer)return 0;let o=this._textModel.validatePosition(new U(e,t));return this.forceTokenization(o.lineNumber),this._tokenizer.getTokenTypeIfInsertingCharacter(o,i)}tokenizeLineWithEdit(e,t,i){if(!this._tokenizer)return null;let o=this._textModel.validatePosition(e);return this.forceTokenization(o.lineNumber),this._tokenizer.tokenizeLineWithEdit(o,t,i)}get hasTokens(){return this._tokens.hasTokens}},qR=class extends H{get lineRanges(){return this._lineRanges}constructor(e){super(),this._refreshTokens=e,this.runner=this._register(new di(()=>this.update(),50)),this._computedLineRanges=[],this._lineRanges=[]}update(){Ht(this._computedLineRanges,this._lineRanges,(e,t)=>e.equals(t))||(this._computedLineRanges=this._lineRanges,this._refreshTokens())}handleStateChange(e){this._lineRanges=e.visibleLineRanges,e.stabilized?(this.runner.cancel(),this.update()):this.runner.schedule()}}});var up,nv,Cf,Ya,ZL=J(()=>{"use strict";_();v();b();qe();up=De("undoRedoService"),nv=class{constructor(e,t){this.resource=e,this.elements=t}},Cf=class n{constructor(){this.id=n._ID++,this.order=1}nextOrder(){return this.id===0?0:this.order++}};Cf._ID=0;Cf.None=new Cf;Ya=class n{constructor(){this.id=n._ID++,this.order=1}nextOrder(){return this.id===0?0:this.order++}};Ya._ID=0;Ya.None=new Ya});function CZ(n){let e=new ev;return e.acceptChunk(n),e.finish()}function wZ(n){let e=new ev,t;for(;typeof(t=n.read())=="string";)e.acceptChunk(t);return e.finish()}function Sz(n,e){let t;return typeof n=="string"?t=CZ(n):K3(n)?t=wZ(n):t=n,t.create(e)}function xZ(n){let e=0;for(let t of n)if(t===" "||t===" ")e++;else break;return e}function GR(n){return!!(n.options.overviewRuler&&n.options.overviewRuler.color)}function LZ(n){return!!n.after||!!n.before}function XL(n){return!!n.options.after||!!n.options.before}function Yl(n){return n.replace(/[^a-z0-9\-_]/gi," ")}function Lz(n){return n instanceof qi?n:qi.createDynamic(n)}var vZ,jR,wf,YL,yZ,SZ,ZR,ov,Zc,QL,JL,YR,XR,QR,ek,qi,xz,JR,e4,t4,i4,sv=J(()=>{"use strict";_();v();b();wt();gn();xt();ye();le();ot();sn();tp();xM();Bo();ft();Ke();Kn();I_();Hr();lr();hr();KW();$W();kR();BM();ez();dz();WR();gz();eS();yz();bh();ZL();vZ=function(n,e,t,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},jR=function(n,e){return function(t,i){e(t,i,n)}};YL=0,yZ=999,SZ=1e4,ZR=class{constructor(e){this._source=e,this._eos=!1}read(){if(this._eos)return null;let e=[],t=0,i=0;do{let o=this._source.read();if(o===null)return this._eos=!0,t===0?null:e.join("");if(o.length>0&&(e[t++]=o,i+=o.length),i>=64*1024)return e.join("")}while(!0)}},ov=()=>{throw new Error("Invalid change accessor")},Zc=wf=class extends H{static resolveOptions(e,t){if(t.detectIndentation){let i=ER(e,t.tabSize,t.insertSpaces);return new Zd({tabSize:i.tabSize,indentSize:"tabSize",insertSpaces:i.insertSpaces,trimAutoWhitespace:t.trimAutoWhitespace,defaultEOL:t.defaultEOL,bracketPairColorizationOptions:t.bracketPairColorizationOptions})}return new Zd(t)}get onDidChangeLanguage(){return this._tokenizationTextModelPart.onDidChangeLanguage}get onDidChangeLanguageConfiguration(){return this._tokenizationTextModelPart.onDidChangeLanguageConfiguration}get onDidChangeTokens(){return this._tokenizationTextModelPart.onDidChangeTokens}onDidChangeContent(e){return this._eventEmitter.slowEvent(t=>e(t.contentChangedEvent))}onDidChangeContentOrInjectedText(e){return _o(this._eventEmitter.fastEvent(t=>e(t)),this._onDidChangeInjectedText.event(t=>e(t)))}_isDisposing(){return this.__isDisposing}get tokenization(){return this._tokenizationTextModelPart}get bracketPairs(){return this._bracketPairs}get guides(){return this._guidesTextModelPart}constructor(e,t,i,o=null,s,r,a){super(),this._undoRedoService=s,this._languageService=r,this._languageConfigurationService=a,this._onWillDispose=this._register(new B),this.onWillDispose=this._onWillDispose.event,this._onDidChangeDecorations=this._register(new JR(f=>this.handleBeforeFireDecorationsChangedEvent(f))),this.onDidChangeDecorations=this._onDidChangeDecorations.event,this._onDidChangeOptions=this._register(new B),this.onDidChangeOptions=this._onDidChangeOptions.event,this._onDidChangeAttached=this._register(new B),this.onDidChangeAttached=this._onDidChangeAttached.event,this._onDidChangeInjectedText=this._register(new B),this._eventEmitter=this._register(new e4),this._languageSelectionListener=this._register(new no),this._deltaDecorationCallCnt=0,this._attachedViews=new t4,YL++,this.id="$model"+YL,this.isForSimpleWidget=i.isForSimpleWidget,typeof o>"u"||o===null?this._associatedResource=Oe.parse("inmemory://model/"+YL):this._associatedResource=o,this._attachedEditorCount=0;let{textBuffer:l,disposable:c}=Sz(e,i.defaultEOL);this._buffer=l,this._bufferDisposable=c,this._options=wf.resolveOptions(this._buffer,i);let d=typeof t=="string"?t:t.languageId;typeof t!="string"&&(this._languageSelectionListener.value=t.onDidChange(()=>this._setLanguage(t.languageId))),this._bracketPairs=this._register(new PL(this,this._languageConfigurationService)),this._guidesTextModelPart=this._register(new $x(this,this._languageConfigurationService)),this._decorationProvider=this._register(new OL(this)),this._tokenizationTextModelPart=new GL(this._languageService,this._languageConfigurationService,this,this._bracketPairs,d,this._attachedViews);let h=this._buffer.getLineCount(),u=this._buffer.getValueLengthInRange(new P(1,1,h,this._buffer.getLineLength(h)+1),0);i.largeFileOptimizations?(this._isTooLargeForTokenization=u>wf.LARGE_FILE_SIZE_THRESHOLD||h>wf.LARGE_FILE_LINE_COUNT_THRESHOLD,this._isTooLargeForHeapOperation=u>wf.LARGE_FILE_HEAP_OPERATION_THRESHOLD):(this._isTooLargeForTokenization=!1,this._isTooLargeForHeapOperation=!1),this._isTooLargeForSyncing=u>wf._MODEL_SYNC_LIMIT,this._versionId=1,this._alternativeVersionId=1,this._initialUndoRedoSnapshot=null,this._isDisposed=!1,this.__isDisposing=!1,this._instanceId=Cw(YL),this._lastDecorationId=0,this._decorations=Object.create(null),this._decorationsTree=new QL,this._commandManager=new zL(this,this._undoRedoService),this._isUndoing=!1,this._isRedoing=!1,this._trimAutoWhitespaceLines=null,this._register(this._decorationProvider.onDidChange(()=>{this._onDidChangeDecorations.beginDeferredEmit(),this._onDidChangeDecorations.fire(),this._onDidChangeDecorations.endDeferredEmit()})),this._languageService.requestRichLanguageFeatures(d)}dispose(){this.__isDisposing=!0,this._onWillDispose.fire(),this._tokenizationTextModelPart.dispose(),this._isDisposed=!0,super.dispose(),this._bufferDisposable.dispose(),this.__isDisposing=!1;let e=new dp([],"",` +`,!1,!1,!0,!0);e.dispose(),this._buffer=e,this._bufferDisposable=H.None}_assertNotDisposed(){if(this._isDisposed)throw new Error("Model is disposed!")}_emitContentChangedEvent(e,t){this.__isDisposing||(this._tokenizationTextModelPart.handleDidChangeContent(t),this._bracketPairs.handleDidChangeContent(t),this._eventEmitter.fire(new _h(e,t)))}setValue(e){if(this._assertNotDisposed(),e==null)throw Sd();let{textBuffer:t,disposable:i}=Sz(e,this._options.defaultEOL);this._setValueFromTextBuffer(t,i)}_createContentChanged2(e,t,i,o,s,r,a,l){return{changes:[{range:e,rangeOffset:t,rangeLength:i,text:o}],eol:this._buffer.getEOL(),isEolChange:l,versionId:this.getVersionId(),isUndoing:s,isRedoing:r,isFlush:a}}_setValueFromTextBuffer(e,t){this._assertNotDisposed();let i=this.getFullModelRange(),o=this.getValueLengthInRange(i),s=this.getLineCount(),r=this.getLineMaxColumn(s);this._buffer=e,this._bufferDisposable.dispose(),this._bufferDisposable=t,this._increaseVersionId(),this._decorations=Object.create(null),this._decorationsTree=new QL,this._commandManager.clear(),this._trimAutoWhitespaceLines=null,this._emitContentChangedEvent(new pf([new _L],this._versionId,!1,!1),this._createContentChanged2(new P(1,1,s,r),0,o,this.getValue(),!1,!1,!0,!1))}setEOL(e){this._assertNotDisposed();let t=e===1?`\r +`:` +`;if(this._buffer.getEOL()===t)return;let i=this.getFullModelRange(),o=this.getValueLengthInRange(i),s=this.getLineCount(),r=this.getLineMaxColumn(s);this._onBeforeEOLChange(),this._buffer.setEOL(t),this._increaseVersionId(),this._onAfterEOLChange(),this._emitContentChangedEvent(new pf([new CL],this._versionId,!1,!1),this._createContentChanged2(new P(1,1,s,r),0,o,this.getValue(),!1,!1,!1,!0))}_onBeforeEOLChange(){this._decorationsTree.ensureAllNodesHaveRanges(this)}_onAfterEOLChange(){let e=this.getVersionId(),t=this._decorationsTree.collectNodesPostOrder();for(let i=0,o=t.length;i0}getAttachedEditorCount(){return this._attachedEditorCount}isTooLargeForSyncing(){return this._isTooLargeForSyncing}isTooLargeForTokenization(){return this._isTooLargeForTokenization}isTooLargeForHeapOperation(){return this._isTooLargeForHeapOperation}isDisposed(){return this._isDisposed}isDominatedByLongLines(){if(this._assertNotDisposed(),this.isTooLargeForTokenization())return!1;let e=0,t=0,i=this._buffer.getLineCount();for(let o=1;o<=i;o++){let s=this._buffer.getLineLength(o);s>=SZ?t+=s:e+=s}return t>e}get uri(){return this._associatedResource}getOptions(){return this._assertNotDisposed(),this._options}getFormattingOptions(){return{tabSize:this._options.indentSize,insertSpaces:this._options.insertSpaces}}updateOptions(e){this._assertNotDisposed();let t=typeof e.tabSize<"u"?e.tabSize:this._options.tabSize,i=typeof e.indentSize<"u"?e.indentSize:this._options.originalIndentSize,o=typeof e.insertSpaces<"u"?e.insertSpaces:this._options.insertSpaces,s=typeof e.trimAutoWhitespace<"u"?e.trimAutoWhitespace:this._options.trimAutoWhitespace,r=typeof e.bracketColorizationOptions<"u"?e.bracketColorizationOptions:this._options.bracketPairColorizationOptions,a=new Zd({tabSize:t,indentSize:i,insertSpaces:o,defaultEOL:this._options.defaultEOL,trimAutoWhitespace:s,bracketPairColorizationOptions:r});if(this._options.equals(a))return;let l=this._options.createChangeEvent(a);this._options=a,this._bracketPairs.handleDidChangeOptions(l),this._decorationProvider.handleDidChangeOptions(l),this._onDidChangeOptions.fire(l)}detectIndentation(e,t){this._assertNotDisposed();let i=ER(this._buffer,t,e);this.updateOptions({insertSpaces:i.insertSpaces,tabSize:i.tabSize,indentSize:i.tabSize})}normalizeIndentation(e){return this._assertNotDisposed(),yx(e,this._options.indentSize,this._options.insertSpaces)}getVersionId(){return this._assertNotDisposed(),this._versionId}mightContainRTL(){return this._buffer.mightContainRTL()}mightContainUnusualLineTerminators(){return this._buffer.mightContainUnusualLineTerminators()}removeUnusualLineTerminators(e=null){let t=this.findMatches(IT.source,!1,!0,!1,null,!1,1073741824);this._buffer.resetMightContainUnusualLineTerminators(),this.pushEditOperations(e,t.map(i=>({range:i.range,text:null})),()=>null)}mightContainNonBasicASCII(){return this._buffer.mightContainNonBasicASCII()}getAlternativeVersionId(){return this._assertNotDisposed(),this._alternativeVersionId}getInitialUndoRedoSnapshot(){return this._assertNotDisposed(),this._initialUndoRedoSnapshot}getOffsetAt(e){this._assertNotDisposed();let t=this._validatePosition(e.lineNumber,e.column,0);return this._buffer.getOffsetAt(t.lineNumber,t.column)}getPositionAt(e){this._assertNotDisposed();let t=Math.min(this._buffer.getLength(),Math.max(0,e));return this._buffer.getPositionAt(t)}_increaseVersionId(){this._versionId=this._versionId+1,this._alternativeVersionId=this._versionId}_overwriteVersionId(e){this._versionId=e}_overwriteAlternativeVersionId(e){this._alternativeVersionId=e}_overwriteInitialUndoRedoSnapshot(e){this._initialUndoRedoSnapshot=e}getValue(e,t=!1){if(this._assertNotDisposed(),this.isTooLargeForHeapOperation())throw new St("Operation would exceed heap memory limits");let i=this.getFullModelRange(),o=this.getValueInRange(i,e);return t?this._buffer.getBOM()+o:o}createSnapshot(e=!1){return new ZR(this._buffer.createSnapshot(e))}getValueLength(e,t=!1){this._assertNotDisposed();let i=this.getFullModelRange(),o=this.getValueLengthInRange(i,e);return t?this._buffer.getBOM().length+o:o}getValueInRange(e,t=0){return this._assertNotDisposed(),this._buffer.getValueInRange(this.validateRange(e),t)}getValueLengthInRange(e,t=0){return this._assertNotDisposed(),this._buffer.getValueLengthInRange(this.validateRange(e),t)}getCharacterCountInRange(e,t=0){return this._assertNotDisposed(),this._buffer.getCharacterCountInRange(this.validateRange(e),t)}getLineCount(){return this._assertNotDisposed(),this._buffer.getLineCount()}getLineContent(e){if(this._assertNotDisposed(),e<1||e>this.getLineCount())throw new St("Illegal value for lineNumber");return this._buffer.getLineContent(e)}getLineLength(e){if(this._assertNotDisposed(),e<1||e>this.getLineCount())throw new St("Illegal value for lineNumber");return this._buffer.getLineLength(e)}getLinesContent(){if(this._assertNotDisposed(),this.isTooLargeForHeapOperation())throw new St("Operation would exceed heap memory limits");return this._buffer.getLinesContent()}getEOL(){return this._assertNotDisposed(),this._buffer.getEOL()}getEndOfLineSequence(){return this._assertNotDisposed(),this._buffer.getEOL()===` +`?0:1}getLineMinColumn(e){return this._assertNotDisposed(),1}getLineMaxColumn(e){if(this._assertNotDisposed(),e<1||e>this.getLineCount())throw new St("Illegal value for lineNumber");return this._buffer.getLineLength(e)+1}getLineFirstNonWhitespaceColumn(e){if(this._assertNotDisposed(),e<1||e>this.getLineCount())throw new St("Illegal value for lineNumber");return this._buffer.getLineFirstNonWhitespaceColumn(e)}getLineLastNonWhitespaceColumn(e){if(this._assertNotDisposed(),e<1||e>this.getLineCount())throw new St("Illegal value for lineNumber");return this._buffer.getLineLastNonWhitespaceColumn(e)}_validateRangeRelaxedNoAllocations(e){let t=this._buffer.getLineCount(),i=e.startLineNumber,o=e.startColumn,s=Math.floor(typeof i=="number"&&!isNaN(i)?i:1),r=Math.floor(typeof o=="number"&&!isNaN(o)?o:1);if(s<1)s=1,r=1;else if(s>t)s=t,r=this.getLineMaxColumn(s);else if(r<=1)r=1;else{let h=this.getLineMaxColumn(s);r>=h&&(r=h)}let a=e.endLineNumber,l=e.endColumn,c=Math.floor(typeof a=="number"&&!isNaN(a)?a:1),d=Math.floor(typeof l=="number"&&!isNaN(l)?l:1);if(c<1)c=1,d=1;else if(c>t)c=t,d=this.getLineMaxColumn(c);else if(d<=1)d=1;else{let h=this.getLineMaxColumn(c);d>=h&&(d=h)}return i===s&&o===r&&a===c&&l===d&&e instanceof P&&!(e instanceof nt)?e:new P(s,r,c,d)}_isValidPosition(e,t,i){if(typeof e!="number"||typeof t!="number"||isNaN(e)||isNaN(t)||e<1||t<1||(e|0)!==e||(t|0)!==t)return!1;let o=this._buffer.getLineCount();if(e>o)return!1;if(t===1)return!0;let s=this.getLineMaxColumn(e);if(t>s)return!1;if(i===1){let r=this._buffer.getLineCharCode(e,t-2);if(pi(r))return!1}return!0}_validatePosition(e,t,i){let o=Math.floor(typeof e=="number"&&!isNaN(e)?e:1),s=Math.floor(typeof t=="number"&&!isNaN(t)?t:1),r=this._buffer.getLineCount();if(o<1)return new U(1,1);if(o>r)return new U(r,this.getLineMaxColumn(r));if(s<=1)return new U(o,1);let a=this.getLineMaxColumn(o);if(s>=a)return new U(o,a);if(i===1){let l=this._buffer.getLineCharCode(o,s-2);if(pi(l))return new U(o,s-1)}return new U(o,s)}validatePosition(e){return this._assertNotDisposed(),e instanceof U&&this._isValidPosition(e.lineNumber,e.column,1)?e:this._validatePosition(e.lineNumber,e.column,1)}_isValidRange(e,t){let i=e.startLineNumber,o=e.startColumn,s=e.endLineNumber,r=e.endColumn;if(!this._isValidPosition(i,o,0)||!this._isValidPosition(s,r,0))return!1;if(t===1){let a=o>1?this._buffer.getLineCharCode(i,o-2):0,l=r>1&&r<=this._buffer.getLineLength(s)?this._buffer.getLineCharCode(s,r-2):0,c=pi(a),d=pi(l);return!c&&!d}return!0}validateRange(e){if(this._assertNotDisposed(),e instanceof P&&!(e instanceof nt)&&this._isValidRange(e,1))return e;let i=this._validatePosition(e.startLineNumber,e.startColumn,0),o=this._validatePosition(e.endLineNumber,e.endColumn,0),s=i.lineNumber,r=i.column,a=o.lineNumber,l=o.column;{let c=r>1?this._buffer.getLineCharCode(s,r-2):0,d=l>1&&l<=this._buffer.getLineLength(a)?this._buffer.getLineCharCode(a,l-2):0,h=pi(c),u=pi(d);return!h&&!u?new P(s,r,a,l):s===a&&r===l?new P(s,r-1,a,l-1):h&&u?new P(s,r-1,a,l+1):h?new P(s,r-1,a,l):new P(s,r,a,l+1)}return new P(s,r,a,l)}modifyPosition(e,t){this._assertNotDisposed();let i=this.getOffsetAt(e)+t;return this.getPositionAt(Math.min(this._buffer.getLength(),Math.max(0,i)))}getFullModelRange(){this._assertNotDisposed();let e=this.getLineCount();return new P(1,1,e,this.getLineMaxColumn(e))}findMatchesLineByLine(e,t,i,o){return this._buffer.findMatchesLineByLine(e,t,i,o)}findMatches(e,t,i,o,s,r,a=yZ){this._assertNotDisposed();let l=null;t!==null&&(Array.isArray(t)||(t=[t]),t.every(h=>P.isIRange(h))&&(l=t.map(h=>this.validateRange(h)))),l===null&&(l=[this.getFullModelRange()]),l=l.sort((h,u)=>h.startLineNumber-u.startLineNumber||h.startColumn-u.startColumn);let c=[];c.push(l.reduce((h,u)=>P.areIntersecting(h,u)?h.plusRange(u):(c.push(h),u)));let d;if(!i&&e.indexOf(` +`)<0){let u=new Ac(e,i,o,s).parseSearchRequest();if(!u)return[];d=f=>this.findMatchesLineByLine(f,u,r,a)}else d=h=>Au.findMatches(this,new Ac(e,i,o,s),h,r,a);return c.map(d).reduce((h,u)=>h.concat(u),[])}findNextMatch(e,t,i,o,s,r){this._assertNotDisposed();let a=this.validatePosition(t);if(!i&&e.indexOf(` +`)<0){let c=new Ac(e,i,o,s).parseSearchRequest();if(!c)return null;let d=this.getLineCount(),h=new P(a.lineNumber,a.column,d,this.getLineMaxColumn(d)),u=this.findMatchesLineByLine(h,c,r,1);return Au.findNextMatch(this,new Ac(e,i,o,s),a,r),u.length>0||(h=new P(1,1,a.lineNumber,this.getLineMaxColumn(a.lineNumber)),u=this.findMatchesLineByLine(h,c,r,1),u.length>0)?u[0]:null}return Au.findNextMatch(this,new Ac(e,i,o,s),a,r)}findPreviousMatch(e,t,i,o,s,r){this._assertNotDisposed();let a=this.validatePosition(t);return Au.findPreviousMatch(this,new Ac(e,i,o,s),a,r)}pushStackElement(){this._commandManager.pushStackElement()}popStackElement(){this._commandManager.popStackElement()}pushEOL(e){if((this.getEOL()===` +`?0:1)!==e)try{this._onDidChangeDecorations.beginDeferredEmit(),this._eventEmitter.beginDeferredEmit(),this._initialUndoRedoSnapshot===null&&(this._initialUndoRedoSnapshot=this._undoRedoService.createSnapshot(this.uri)),this._commandManager.pushEOL(e)}finally{this._eventEmitter.endDeferredEmit(),this._onDidChangeDecorations.endDeferredEmit()}}_validateEditOperation(e){return e instanceof tm?e:new tm(e.identifier||null,this.validateRange(e.range),e.text,e.forceMoveMarkers||!1,e.isAutoWhitespaceEdit||!1,e._isTracked||!1)}_validateEditOperations(e){let t=[];for(let i=0,o=e.length;i({range:this.validateRange(a.range),text:a.text})),r=!0;if(e)for(let a=0,l=e.length;ac.endLineNumber,m=c.startLineNumber>f.endLineNumber;if(!g&&!m){d=!0;break}}if(!d){r=!1;break}}if(r)for(let a=0,l=this._trimAutoWhitespaceLines.length;ag.endLineNumber)&&!(c===g.startLineNumber&&g.startColumn===d&&g.isEmpty()&&m&&m.length>0&&m.charAt(0)===` +`)&&!(c===g.startLineNumber&&g.startColumn===1&&g.isEmpty()&&m&&m.length>0&&m.charAt(m.length-1)===` +`)){h=!1;break}}if(h){let u=new P(c,1,c,d);t.push(new tm(null,u,null,!1,!1,!1))}}this._trimAutoWhitespaceLines=null}return this._initialUndoRedoSnapshot===null&&(this._initialUndoRedoSnapshot=this._undoRedoService.createSnapshot(this.uri)),this._commandManager.pushEditOperation(e,t,i,o)}_applyUndo(e,t,i,o){let s=e.map(r=>{let a=this.getPositionAt(r.newPosition),l=this.getPositionAt(r.newEnd);return{range:new P(a.lineNumber,a.column,l.lineNumber,l.column),text:r.oldText}});this._applyUndoRedoEdits(s,t,!0,!1,i,o)}_applyRedo(e,t,i,o){let s=e.map(r=>{let a=this.getPositionAt(r.oldPosition),l=this.getPositionAt(r.oldEnd);return{range:new P(a.lineNumber,a.column,l.lineNumber,l.column),text:r.newText}});this._applyUndoRedoEdits(s,t,!1,!0,i,o)}_applyUndoRedoEdits(e,t,i,o,s,r){try{this._onDidChangeDecorations.beginDeferredEmit(),this._eventEmitter.beginDeferredEmit(),this._isUndoing=i,this._isRedoing=o,this.applyEdits(e,!1),this.setEOL(t),this._overwriteAlternativeVersionId(s)}finally{this._isUndoing=!1,this._isRedoing=!1,this._eventEmitter.endDeferredEmit(r),this._onDidChangeDecorations.endDeferredEmit()}}applyEdits(e,t=!1){try{this._onDidChangeDecorations.beginDeferredEmit(),this._eventEmitter.beginDeferredEmit();let i=this._validateEditOperations(e);return this._doApplyEdits(i,t)}finally{this._eventEmitter.endDeferredEmit(),this._onDidChangeDecorations.endDeferredEmit()}}_doApplyEdits(e,t){let i=this._buffer.getLineCount(),o=this._buffer.applyEdits(e,this._options.trimAutoWhitespace,t),s=this._buffer.getLineCount(),r=o.changes;if(this._trimAutoWhitespaceLines=o.trimAutoWhitespaceLineNumbers,r.length!==0){for(let c=0,d=r.length;c=0;W--){let j=f+W,G=y+W;M.takeFromEndWhile(z=>z.lineNumber>G);let V=M.takeFromEndWhile(z=>z.lineNumber===G);a.push(new Ab(j,this.getLineContent(G),V))}if(SCe.lineNumberCe.lineNumber===ce)}a.push(new vL(j+1,f+C,te,z))}l+=w}this._emitContentChangedEvent(new pf(a,this.getVersionId(),this._isUndoing,this._isRedoing),{changes:r,eol:this._buffer.getEOL(),isEolChange:!1,versionId:this.getVersionId(),isUndoing:this._isUndoing,isRedoing:this._isRedoing,isFlush:!1})}return o.reverseEdits===null?void 0:o.reverseEdits}undo(){return this._undoRedoService.undo(this.uri)}canUndo(){return this._undoRedoService.canUndo(this.uri)}redo(){return this._undoRedoService.redo(this.uri)}canRedo(){return this._undoRedoService.canRedo(this.uri)}handleBeforeFireDecorationsChangedEvent(e){if(e===null||e.size===0)return;let i=Array.from(e).map(o=>new Ab(o,this.getLineContent(o),this._getInjectedTextInLine(o)));this._onDidChangeInjectedText.fire(new Jm(i))}changeDecorations(e,t=0){this._assertNotDisposed();try{return this._onDidChangeDecorations.beginDeferredEmit(),this._changeDecorations(t,e)}finally{this._onDidChangeDecorations.endDeferredEmit()}}_changeDecorations(e,t){let i={addDecoration:(s,r)=>this._deltaDecorationsImpl(e,[],[{range:s,options:r}])[0],changeDecoration:(s,r)=>{this._changeDecorationImpl(s,r)},changeDecorationOptions:(s,r)=>{this._changeDecorationOptionsImpl(s,Lz(r))},removeDecoration:s=>{this._deltaDecorationsImpl(e,[s],[])},deltaDecorations:(s,r)=>s.length===0&&r.length===0?[]:this._deltaDecorationsImpl(e,s,r)},o=null;try{o=t(i)}catch(s){ut(s)}return i.addDecoration=ov,i.changeDecoration=ov,i.changeDecorationOptions=ov,i.removeDecoration=ov,i.deltaDecorations=ov,o}deltaDecorations(e,t,i=0){if(this._assertNotDisposed(),e||(e=[]),e.length===0&&t.length===0)return[];try{return this._deltaDecorationCallCnt++,this._deltaDecorationCallCnt>1&&(console.warn("Invoking deltaDecorations recursively could lead to leaking decorations."),ut(new Error("Invoking deltaDecorations recursively could lead to leaking decorations."))),this._onDidChangeDecorations.beginDeferredEmit(),this._deltaDecorationsImpl(i,e,t)}finally{this._onDidChangeDecorations.endDeferredEmit(),this._deltaDecorationCallCnt--}}_getTrackedRange(e){return this.getDecorationRange(e)}_setTrackedRange(e,t,i){let o=e?this._decorations[e]:null;if(!o)return t?this._deltaDecorationsImpl(0,[],[{range:t,options:xz[i]}],!0)[0]:null;if(!t)return this._decorationsTree.delete(o),delete this._decorations[o.id],null;let s=this._validateRangeRelaxedNoAllocations(t),r=this._buffer.getOffsetAt(s.startLineNumber,s.startColumn),a=this._buffer.getOffsetAt(s.endLineNumber,s.endColumn);return this._decorationsTree.delete(o),o.reset(this.getVersionId(),r,a,s),o.setOptions(xz[i]),this._decorationsTree.insert(o),o.id}removeAllDecorationsWithOwnerId(e){if(this._isDisposed)return;let t=this._decorationsTree.collectNodesFromOwner(e);for(let i=0,o=t.length;ithis.getLineCount()?[]:this.getLinesDecorations(e,e,t,i)}getLinesDecorations(e,t,i=0,o=!1,s=!1){let r=this.getLineCount(),a=Math.min(r,Math.max(1,e)),l=Math.min(r,Math.max(1,t)),c=this.getLineMaxColumn(l),d=new P(a,1,l,c),h=this._getDecorationsInRange(d,i,o,s);return L_(h,this._decorationProvider.getDecorationsInRange(d,i,o)),h}getDecorationsInRange(e,t=0,i=!1,o=!1,s=!1){let r=this.validateRange(e),a=this._getDecorationsInRange(r,t,i,s);return L_(a,this._decorationProvider.getDecorationsInRange(r,t,i,o)),a}getOverviewRulerDecorations(e=0,t=!1){return this._decorationsTree.getAll(this,e,t,!0,!1)}getInjectedTextDecorations(e=0){return this._decorationsTree.getAllInjectedText(this,e)}_getInjectedTextInLine(e){let t=this._buffer.getOffsetAt(e,1),i=t+this._buffer.getLineLength(e),o=this._decorationsTree.getInjectedTextInInterval(this,t,i,0);return Ls.fromDecorations(o).filter(s=>s.lineNumber===e)}getAllDecorations(e=0,t=!1){let i=this._decorationsTree.getAll(this,e,t,!1,!1);return i=i.concat(this._decorationProvider.getAllDecorations(e,t)),i}getAllMarginDecorations(e=0){return this._decorationsTree.getAll(this,e,!1,!1,!0)}_getDecorationsInRange(e,t,i,o){let s=this._buffer.getOffsetAt(e.startLineNumber,e.startColumn),r=this._buffer.getOffsetAt(e.endLineNumber,e.endColumn);return this._decorationsTree.getAllInInterval(this,s,r,t,i,o)}getRangeAt(e,t){return this._buffer.getRangeAt(e,t-e)}_changeDecorationImpl(e,t){let i=this._decorations[e];if(!i)return;if(i.options.after){let a=this.getDecorationRange(e);this._onDidChangeDecorations.recordLineAffectedByInjectedText(a.endLineNumber)}if(i.options.before){let a=this.getDecorationRange(e);this._onDidChangeDecorations.recordLineAffectedByInjectedText(a.startLineNumber)}let o=this._validateRangeRelaxedNoAllocations(t),s=this._buffer.getOffsetAt(o.startLineNumber,o.startColumn),r=this._buffer.getOffsetAt(o.endLineNumber,o.endColumn);this._decorationsTree.delete(i),i.reset(this.getVersionId(),s,r,o),this._decorationsTree.insert(i),this._onDidChangeDecorations.checkAffectedAndFire(i.options),i.options.after&&this._onDidChangeDecorations.recordLineAffectedByInjectedText(o.endLineNumber),i.options.before&&this._onDidChangeDecorations.recordLineAffectedByInjectedText(o.startLineNumber)}_changeDecorationOptionsImpl(e,t){let i=this._decorations[e];if(!i)return;let o=!!(i.options.overviewRuler&&i.options.overviewRuler.color),s=!!(t.overviewRuler&&t.overviewRuler.color);if(this._onDidChangeDecorations.checkAffectedAndFire(i.options),this._onDidChangeDecorations.checkAffectedAndFire(t),i.options.after||t.after){let l=this._decorationsTree.getNodeRange(this,i);this._onDidChangeDecorations.recordLineAffectedByInjectedText(l.endLineNumber)}if(i.options.before||t.before){let l=this._decorationsTree.getNodeRange(this,i);this._onDidChangeDecorations.recordLineAffectedByInjectedText(l.startLineNumber)}let r=o!==s,a=LZ(t)!==XL(i);r||a?(this._decorationsTree.delete(i),i.setOptions(t),this._decorationsTree.insert(i)):i.setOptions(t)}_deltaDecorationsImpl(e,t,i,o=!1){let s=this.getVersionId(),r=t.length,a=0,l=i.length,c=0;this._onDidChangeDecorations.beginDeferredEmit();try{let d=new Array(l);for(;athis._setLanguage(e.languageId,t)),this._setLanguage(e.languageId,t))}_setLanguage(e,t){this.tokenization.setLanguageId(e,t),this._languageService.requestRichLanguageFeatures(e)}getLanguageIdAtPosition(e,t){return this.tokenization.getLanguageIdAtPosition(e,t)}getWordAtPosition(e){return this._tokenizationTextModelPart.getWordAtPosition(e)}getWordUntilPosition(e){return this._tokenizationTextModelPart.getWordUntilPosition(e)}normalizePosition(e,t){return e}getLineIndentColumn(e){return xZ(this.getLineContent(e))+1}};Zc._MODEL_SYNC_LIMIT=50*1024*1024;Zc.LARGE_FILE_SIZE_THRESHOLD=20*1024*1024;Zc.LARGE_FILE_LINE_COUNT_THRESHOLD=300*1e3;Zc.LARGE_FILE_HEAP_OPERATION_THRESHOLD=256*1024*1024;Zc.DEFAULT_CREATION_OPTIONS={isForSimpleWidget:!1,tabSize:nn.tabSize,indentSize:nn.indentSize,insertSpaces:nn.insertSpaces,detectIndentation:!1,defaultEOL:1,trimAutoWhitespace:nn.trimAutoWhitespace,largeFileOptimizations:nn.largeFileOptimizations,bracketPairColorizationOptions:nn.bracketPairColorizationOptions};Zc=wf=vZ([jR(4,up),jR(5,ii),jR(6,yo)],Zc);QL=class{constructor(){this._decorationsTree0=new lp,this._decorationsTree1=new lp,this._injectedTextDecorationsTree=new lp}ensureAllNodesHaveRanges(e){this.getAll(e,0,!1,!1,!1)}_ensureNodesHaveRanges(e,t){for(let i of t)i.range===null&&(i.range=e.getRangeAt(i.cachedAbsoluteStart,i.cachedAbsoluteEnd));return t}getAllInInterval(e,t,i,o,s,r){let a=e.getVersionId(),l=this._intervalSearch(t,i,o,s,a,r);return this._ensureNodesHaveRanges(e,l)}_intervalSearch(e,t,i,o,s,r){let a=this._decorationsTree0.intervalSearch(e,t,i,o,s,r),l=this._decorationsTree1.intervalSearch(e,t,i,o,s,r),c=this._injectedTextDecorationsTree.intervalSearch(e,t,i,o,s,r);return a.concat(l).concat(c)}getInjectedTextInInterval(e,t,i,o){let s=e.getVersionId(),r=this._injectedTextDecorationsTree.intervalSearch(t,i,o,!1,s,!1);return this._ensureNodesHaveRanges(e,r).filter(a=>a.options.showIfCollapsed||!a.range.isEmpty())}getAllInjectedText(e,t){let i=e.getVersionId(),o=this._injectedTextDecorationsTree.search(t,!1,i,!1);return this._ensureNodesHaveRanges(e,o).filter(s=>s.options.showIfCollapsed||!s.range.isEmpty())}getAll(e,t,i,o,s){let r=e.getVersionId(),a=this._search(t,i,o,r,s);return this._ensureNodesHaveRanges(e,a)}_search(e,t,i,o,s){if(i)return this._decorationsTree1.search(e,t,o,s);{let r=this._decorationsTree0.search(e,t,o,s),a=this._decorationsTree1.search(e,t,o,s),l=this._injectedTextDecorationsTree.search(e,t,o,s);return r.concat(a).concat(l)}}collectNodesFromOwner(e){let t=this._decorationsTree0.collectNodesFromOwner(e),i=this._decorationsTree1.collectNodesFromOwner(e),o=this._injectedTextDecorationsTree.collectNodesFromOwner(e);return t.concat(i).concat(o)}collectNodesPostOrder(){let e=this._decorationsTree0.collectNodesPostOrder(),t=this._decorationsTree1.collectNodesPostOrder(),i=this._injectedTextDecorationsTree.collectNodesPostOrder();return e.concat(t).concat(i)}insert(e){XL(e)?this._injectedTextDecorationsTree.insert(e):GR(e)?this._decorationsTree1.insert(e):this._decorationsTree0.insert(e)}delete(e){XL(e)?this._injectedTextDecorationsTree.delete(e):GR(e)?this._decorationsTree1.delete(e):this._decorationsTree0.delete(e)}getNodeRange(e,t){let i=e.getVersionId();return t.cachedVersionId!==i&&this._resolveNode(t,i),t.range===null&&(t.range=e.getRangeAt(t.cachedAbsoluteStart,t.cachedAbsoluteEnd)),t.range}_resolveNode(e,t){XL(e)?this._injectedTextDecorationsTree.resolveNode(e,t):GR(e)?this._decorationsTree1.resolveNode(e,t):this._decorationsTree0.resolveNode(e,t)}acceptReplace(e,t,i,o){this._decorationsTree0.acceptReplace(e,t,i,o),this._decorationsTree1.acceptReplace(e,t,i,o),this._injectedTextDecorationsTree.acceptReplace(e,t,i,o)}};JL=class{constructor(e){this.color=e.color||"",this.darkColor=e.darkColor||""}},YR=class extends JL{constructor(e){super(e),this._resolvedColor=null,this.position=typeof e.position=="number"?e.position:em.Center}getColor(e){return this._resolvedColor||(e.type!=="light"&&this.darkColor?this._resolvedColor=this._resolveColor(this.darkColor,e):this._resolvedColor=this._resolveColor(this.color,e)),this._resolvedColor}invalidateCachedColor(){this._resolvedColor=null}_resolveColor(e,t){if(typeof e=="string")return e;let i=e?t.getColor(e.id):null;return i?i.toString():""}},XR=class{constructor(e){var t;this.position=(t=e?.position)!==null&&t!==void 0?t:dr.Center,this.persistLane=e?.persistLane}},QR=class extends JL{constructor(e){var t,i;super(e),this.position=e.position,this.sectionHeaderStyle=(t=e.sectionHeaderStyle)!==null&&t!==void 0?t:null,this.sectionHeaderText=(i=e.sectionHeaderText)!==null&&i!==void 0?i:null}getColor(e){return this._resolvedColor||(e.type!=="light"&&this.darkColor?this._resolvedColor=this._resolveColor(this.darkColor,e):this._resolvedColor=this._resolveColor(this.color,e)),this._resolvedColor}invalidateCachedColor(){this._resolvedColor=void 0}_resolveColor(e,t){return typeof e=="string"?Z.fromHex(e):t.getColor(e.id)}},ek=class n{static from(e){return e instanceof n?e:new n(e)}constructor(e){this.content=e.content||"",this.inlineClassName=e.inlineClassName||null,this.inlineClassNameAffectsLetterSpacing=e.inlineClassNameAffectsLetterSpacing||!1,this.attachedData=e.attachedData||null,this.cursorStops=e.cursorStops||null}},qi=class n{static register(e){return new n(e)}static createDynamic(e){return new n(e)}constructor(e){var t,i,o,s,r,a;this.description=e.description,this.blockClassName=e.blockClassName?Yl(e.blockClassName):null,this.blockDoesNotCollapse=(t=e.blockDoesNotCollapse)!==null&&t!==void 0?t:null,this.blockIsAfterEnd=(i=e.blockIsAfterEnd)!==null&&i!==void 0?i:null,this.blockPadding=(o=e.blockPadding)!==null&&o!==void 0?o:null,this.stickiness=e.stickiness||0,this.zIndex=e.zIndex||0,this.className=e.className?Yl(e.className):null,this.shouldFillLineOnLineBreak=(s=e.shouldFillLineOnLineBreak)!==null&&s!==void 0?s:null,this.hoverMessage=e.hoverMessage||null,this.glyphMarginHoverMessage=e.glyphMarginHoverMessage||null,this.lineNumberHoverMessage=e.lineNumberHoverMessage||null,this.isWholeLine=e.isWholeLine||!1,this.showIfCollapsed=e.showIfCollapsed||!1,this.collapseOnReplaceEdit=e.collapseOnReplaceEdit||!1,this.overviewRuler=e.overviewRuler?new YR(e.overviewRuler):null,this.minimap=e.minimap?new QR(e.minimap):null,this.glyphMargin=e.glyphMarginClassName?new XR(e.glyphMargin):null,this.glyphMarginClassName=e.glyphMarginClassName?Yl(e.glyphMarginClassName):null,this.linesDecorationsClassName=e.linesDecorationsClassName?Yl(e.linesDecorationsClassName):null,this.lineNumberClassName=e.lineNumberClassName?Yl(e.lineNumberClassName):null,this.linesDecorationsTooltip=e.linesDecorationsTooltip?a7(e.linesDecorationsTooltip):null,this.firstLineDecorationClassName=e.firstLineDecorationClassName?Yl(e.firstLineDecorationClassName):null,this.marginClassName=e.marginClassName?Yl(e.marginClassName):null,this.inlineClassName=e.inlineClassName?Yl(e.inlineClassName):null,this.inlineClassNameAffectsLetterSpacing=e.inlineClassNameAffectsLetterSpacing||!1,this.beforeContentClassName=e.beforeContentClassName?Yl(e.beforeContentClassName):null,this.afterContentClassName=e.afterContentClassName?Yl(e.afterContentClassName):null,this.after=e.after?ek.from(e.after):null,this.before=e.before?ek.from(e.before):null,this.hideInCommentTokens=(r=e.hideInCommentTokens)!==null&&r!==void 0?r:!1,this.hideInStringTokens=(a=e.hideInStringTokens)!==null&&a!==void 0?a:!1}};qi.EMPTY=qi.register({description:"empty"});xz=[qi.register({description:"tracked-range-always-grows-when-typing-at-edges",stickiness:0}),qi.register({description:"tracked-range-never-grows-when-typing-at-edges",stickiness:1}),qi.register({description:"tracked-range-grows-only-when-typing-before",stickiness:2}),qi.register({description:"tracked-range-grows-only-when-typing-after",stickiness:3})];JR=class extends H{constructor(e){super(),this.handleBeforeFire=e,this._actual=this._register(new B),this.event=this._actual.event,this._affectedInjectedTextLines=null,this._deferredCnt=0,this._shouldFireDeferred=!1,this._affectsMinimap=!1,this._affectsOverviewRuler=!1,this._affectsGlyphMargin=!1,this._affectsLineNumber=!1}beginDeferredEmit(){this._deferredCnt++}endDeferredEmit(){var e;this._deferredCnt--,this._deferredCnt===0&&(this._shouldFireDeferred&&this.doFire(),(e=this._affectedInjectedTextLines)===null||e===void 0||e.clear(),this._affectedInjectedTextLines=null)}recordLineAffectedByInjectedText(e){this._affectedInjectedTextLines||(this._affectedInjectedTextLines=new Set),this._affectedInjectedTextLines.add(e)}checkAffectedAndFire(e){var t,i;this._affectsMinimap||(this._affectsMinimap=!!(!((t=e.minimap)===null||t===void 0)&&t.position)),this._affectsOverviewRuler||(this._affectsOverviewRuler=!!(!((i=e.overviewRuler)===null||i===void 0)&&i.color)),this._affectsGlyphMargin||(this._affectsGlyphMargin=!!e.glyphMarginClassName),this._affectsLineNumber||(this._affectsLineNumber=!!e.lineNumberClassName),this.tryFire()}fire(){this._affectsMinimap=!0,this._affectsOverviewRuler=!0,this._affectsGlyphMargin=!0,this.tryFire()}tryFire(){this._deferredCnt===0?this.doFire():this._shouldFireDeferred=!0}doFire(){this.handleBeforeFire(this._affectedInjectedTextLines);let e={affectsMinimap:this._affectsMinimap,affectsOverviewRuler:this._affectsOverviewRuler,affectsGlyphMargin:this._affectsGlyphMargin,affectsLineNumber:this._affectsLineNumber};this._shouldFireDeferred=!1,this._affectsMinimap=!1,this._affectsOverviewRuler=!1,this._affectsGlyphMargin=!1,this._actual.fire(e)}},e4=class extends H{constructor(){super(),this._fastEmitter=this._register(new B),this.fastEvent=this._fastEmitter.event,this._slowEmitter=this._register(new B),this.slowEvent=this._slowEmitter.event,this._deferredCnt=0,this._deferredEvent=null}beginDeferredEmit(){this._deferredCnt++}endDeferredEmit(e=null){if(this._deferredCnt--,this._deferredCnt===0&&this._deferredEvent!==null){this._deferredEvent.rawContentChangedEvent.resultingSelection=e;let t=this._deferredEvent;this._deferredEvent=null,this._fastEmitter.fire(t),this._slowEmitter.fire(t)}}fire(e){if(this._deferredCnt>0){this._deferredEvent?this._deferredEvent=this._deferredEvent.merge(e):this._deferredEvent=e;return}this._fastEmitter.fire(e),this._slowEmitter.fire(e)}},t4=class{constructor(){this._onDidChangeVisibleRanges=new B,this.onDidChangeVisibleRanges=this._onDidChangeVisibleRanges.event,this._views=new Set}attachView(){let e=new i4(t=>{this._onDidChangeVisibleRanges.fire({view:e,state:t})});return this._views.add(e),e}detachView(e){this._views.delete(e),this._onDidChangeVisibleRanges.fire({view:e,state:void 0})}},i4=class{constructor(e){this.handleStateChange=e}setVisibleLines(e,t){let i=e.map(o=>new Ne(o.startLineNumber,o.endLineNumber+1));this.handleStateChange({visibleLineRanges:i,stabilized:t})}}});function Bn(n,e,t){return Math.min(Math.max(n,e),t)}var pv,Zk,Cp=J(()=>{"use strict";_();v();b();pv=class{constructor(){this._n=1,this._val=0}update(e){return this._val=this._val+(e-this._val)/this._n,this._n+=1,this._val}get value(){return this._val}},Zk=class{constructor(e){this._n=0,this._val=0,this._values=[],this._index=0,this._sum=0,this._values=new Array(e),this._values.fill(0,0,e)}update(e){let t=this._values[this._index];return this._values[this._index]=e,this._index=(this._index+1)%this._values.length,this._sum-=t,this._sum+=e,this._n{"use strict";_();v();b();qe();Yk=De("environmentService")});var jZ,Uz,GZ,Xk,T4,N4,A4,Kz=J(()=>{"use strict";_();v();b();Bg();cr();Cp();I4();Ur();qe();Aa();er();jZ=function(n,e,t,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},Uz=function(n,e){return function(t,i){e(t,i,n)}},GZ=De("ILanguageFeatureDebounceService");(function(n){let e=new WeakMap,t=0;function i(o){let s=e.get(o);return s===void 0&&(s=++t,e.set(o,s)),s}n.of=i})(Xk||(Xk={}));T4=class{constructor(e){this._default=e}get(e){return this._default}update(e,t){return this._default}default(){return this._default}},N4=class{constructor(e,t,i,o,s,r){this._logService=e,this._name=t,this._registry=i,this._default=o,this._min=s,this._max=r,this._cache=new Kr(50,.7)}_key(e){return e.id+this._registry.all(e).reduce((t,i)=>u0(Xk.of(i),t),0)}get(e){let t=this._key(e),i=this._cache.get(t);return i?Bn(i.value,this._min,this._max):this.default()}update(e,t){let i=this._key(e),o=this._cache.get(i);o||(o=new Zk(6),this._cache.set(i,o));let s=Bn(o.update(t),this._min,this._max);return c0(e.uri,"output")||this._logService.trace(`[DEBOUNCE: ${this._name}] for ${e.uri.toString()} is ${s}ms`),s}_overall(){let e=new pv;for(let[,t]of this._cache)e.update(t.value);return e.value}default(){let e=this._overall()|0||this._default;return Bn(e,this._min,this._max)}},A4=class{constructor(e,t){this._logService=e,this._data=new Map,this._isDev=t.isExtensionDevelopment||!t.isBuilt}for(e,t,i){var o,s,r;let a=(o=i?.min)!==null&&o!==void 0?o:50,l=(s=i?.max)!==null&&s!==void 0?s:a**2,c=(r=i?.key)!==null&&r!==void 0?r:void 0,d=`${Xk.of(e)},${a}${c?","+c:""}`,h=this._data.get(d);return h||(this._isDev?(this._logService.debug(`[DEBOUNCE: ${t}] is disabled in developed mode`),h=new T4(a*1.5)):h=new N4(this._logService,t,e,this._overallAverage()|0||a*1.5,a,l),this._data.set(d,h)),h}_overallAverage(){let e=new pv;for(let t of this._data.values())e.update(t.default());return e.value}};A4=jZ([Uz(0,En),Uz(1,Yk)],A4);_t(GZ,A4,1)});function ra(n){let e=new Array,t,i=0,o=0;for(;(t=gY.exec(n))!==null;){o=t.index||0,i{"use strict";_();v();b();ke();Ln();gY=new RegExp(`(\\\\)?\\$\\((${Xe.iconNameExpression}(?:${Xe.iconModifierExpression})?)\\)`,"g")});function cV(n){let e=mY(n);if(e&&e.length>0)return new Uint32Array(e)}function mY(n){if(Ks=0,ec(n,j4,4352),Ks>0||(ec(n,G4,4449),Ks>0)||(ec(n,Z4,4520),Ks>0)||(ec(n,If,12593),Ks))return kh.subarray(0,Ks);if(n>=44032&&n<=55203){let e=n-44032,t=e%588,i=Math.floor(e/588),o=Math.floor(t/28),s=t%28-1;if(i=0&&(s0)return kh.subarray(0,Ks)}}function ec(n,e,t){n>=t&&n>8&&(kh[Ks++]=n>>8&255),n>>16&&(kh[Ks++]=n>>16&255))}var Ks,kh,j4,G4,Z4,If,dV=J(()=>{"use strict";_();v();b();Ks=0,kh=new Uint32Array(10);j4=new Uint8Array([114,82,115,101,69,102,97,113,81,116,84,100,119,87,99,122,120,118,103]),G4=new Uint16Array([107,111,105,79,106,112,117,80,104,27496,28520,27752,121,110,27246,28782,27758,98,109,27757,108]),Z4=new Uint16Array([114,82,29810,115,30579,26483,101,102,29286,24934,29030,29798,30822,30310,26470,97,113,29809,116,84,100,119,99,122,120,118,103]),If=new Uint16Array([114,82,29810,115,30579,26483,101,69,102,29286,24934,29030,29798,30822,30310,26470,97,113,81,29809,116,84,100,119,87,99,122,120,118,103,107,111,105,79,106,112,117,80,104,27496,28520,27752,121,110,27246,28782,27758,98,109,27757,108])});function mV(...n){return function(e,t){for(let i=0,o=n.length;i0?[{start:0,end:e.length}]:[]:null}function _Y(n,e){let t=e.toLowerCase().indexOf(n.toLowerCase());return t===-1?null:[{start:t,end:t+n.length}]}function bY(n,e){return Q4(n.toLowerCase(),e.toLowerCase(),0,0)}function Q4(n,e,t,i){if(t===n.length)return[];if(i===e.length)return null;if(n[t]===e[i]){let o=null;return(o=Q4(n,e,t+1,i+1))?o5({start:i,end:i+1},o):null}return Q4(n,e,t,i+1)}function i5(n){return 97<=n&&n<=122}function gD(n){return 65<=n&&n<=90}function n5(n){return 48<=n&&n<=57}function _V(n){return n===32||n===9||n===10||n===13}function uD(n){return _V(n)||bV.has(n)}function hV(n,e){return n===e||uD(n)&&uD(e)}function uV(n){if(Y4.has(n))return Y4.get(n);let e,t=cV(n);return t&&(e=t),Y4.set(n,e),e}function vV(n){return i5(n)||gD(n)||n5(n)}function o5(n,e){return e.length===0?e=[n]:n.end===e[0].start?e[0].start=n.start:e.unshift(n),e}function CV(n,e){for(let t=e;t0&&!vV(n.charCodeAt(t-1)))return t}return n.length}function J4(n,e,t,i){if(t===n.length)return[];if(i===e.length)return null;if(n[t]!==e[i].toLowerCase())return null;{let o=null,s=i+1;for(o=J4(n,e,t+1,i+1);!o&&(s=CV(e,s)).6}function wY(n){let{upperPercent:e,lowerPercent:t,alphaPercent:i,numericPercent:o}=n;return t>.2&&e<.8&&i>.6&&o<.2}function yY(n){let e=0,t=0,i=0,o=0;for(let s=0;s60&&(e=e.substring(0,60));let t=vY(e);if(!wY(t)){if(!CY(t))return null;e=e.toLowerCase()}let i=null,o=0;for(n=n.toLowerCase();o0&&uD(n.charCodeAt(t-1)))return t;return n.length}function s5(n,e,t=!1){if(typeof n!="string"||typeof e!="string")return null;let i=fV.get(n);i||(i=new RegExp(l7(n),"i"),fV.set(n,i));let o=i.exec(e);return o?[{start:o.index,end:o.index+o[0].length}]:t?xY(n,e):SY(n,e)}function SV(n,e){let t=yp(n,n.toLowerCase(),0,e,e.toLowerCase(),0,{firstMatchCanBeWeak:!0,boostFullMatch:!0});return t?LY(t):null}function EHe(n,e,t,i,o,s){let r=Math.min(13,n.length);for(;t"u")return[];let e=[],t=n[1];for(let i=n.length-1;i>1;i--){let o=n[i]+t,s=e[e.length-1];s&&s.end===o?s.end=o+1:e.push({start:o,end:o+1})}return e}function r5(){let n=[],e=[];for(let t=0;t<=Eh;t++)e[t]=0;for(let t=0;t<=Eh;t++)n.push(e.slice(0));return n}function xV(n){let e=[];for(let t=0;t<=n;t++)e[t]=0;return e}function X4(n,e,t,i,o){function s(a,l,c=" "){for(;a.lengths(a,3)).join("|")} +`;for(let a=0;a<=t;a++)a===0?r+=" |":r+=`${e[a-1]}|`,r+=n[a].slice(0,o+1).map(l=>s(l.toString(),3)).join("|")+` +`;return r}function DY(n,e,t,i){n=n.substr(e),t=t.substr(i),console.log(X4(Dh,n,n.length,t,t.length)),console.log(X4(bv,n,n.length,t,t.length)),console.log(X4(tc,n,n.length,t,t.length))}function dD(n,e){if(e<0||e>=n.length)return!1;let t=n.codePointAt(e);switch(t){case 95:case 45:case 46:case 32:case 47:case 92:case 39:case 34:case 58:case 36:case 60:case 62:case 40:case 41:case 91:case 93:case 123:case 125:return!0;case void 0:return!1;default:return!!J_(t)}}function gV(n,e){if(e<0||e>=n.length)return!1;switch(n.charCodeAt(e)){case 32:case 9:return!0;default:return!1}}function hD(n,e,t){return e[n]!==t[n]}function EY(n,e,t,i,o,s,r=!1){for(;eEh?Eh:n.length,l=i.length>Eh?Eh:i.length;if(t>=a||s>=l||a-t>l-s||!EY(e,t,a,o,s,l,!0))return;IY(a,l,t,s,e,o);let c=1,d=1,h=t,u=s,f=[!1];for(c=1,h=t;hw,W=M?Dh[c][d-1]+(tc[c][d-1]>0?-5:0):0,j=u>w+1&&tc[c][d-1]>0,G=j?Dh[c][d-2]+(tc[c][d-2]>0?-5:0):0;if(j&&(!M||G>=W)&&(!T||G>=N))Dh[c][d]=G,bv[c][d]=3,tc[c][d]=0;else if(M&&(!T||W>=N))Dh[c][d]=W,bv[c][d]=2,tc[c][d]=0;else if(T)Dh[c][d]=N,bv[c][d]=1,tc[c][d]=tc[c-1][d-1]+1;else throw new Error("not possible")}}if(kY&&DY(n,t,i,s),!f[0]&&!r.firstMatchCanBeWeak)return;c--,d--;let g=[Dh[c][d],s],m=0,C=0;for(;c>=1;){let w=d;do{let y=bv[c][w];if(y===3)w=w-2;else if(y===2)w=w-1;else break}while(w>=1);m>1&&e[t+c-1]===o[s+d-1]&&!hD(w+s-1,i,o)&&m+1>tc[c][w]&&(w=d),w===d?m++:m=1,C||(C=w),c--,d=w-1,g.push(d)}l===a&&r.boostFullMatch&&(g[0]+=2);let S=C-a;return g[0]-=S,g}function IY(n,e,t,i,o,s){let r=n-1,a=e-1;for(;r>=t&&a>=i;)o[r]===s[a]&&(t5[r]=a,r--),a--}function TY(n,e,t,i,o,s,r,a,l,c,d){if(e[t]!==s[r])return Number.MIN_SAFE_INTEGER;let h=1,u=!1;return r===t-i?h=n[t]===o[r]?7:5:hD(r,o,s)&&(r===0||!hD(r-1,o,s))?(h=n[t]===o[r]?7:5,u=!0):dD(s,r)&&(r===0||!dD(s,r-1))?h=5:(dD(s,r-1)||gV(s,r-1))&&(h=5,u=!0),h>1&&t===i&&(d[0]=!0),u||(u=hD(r,o,s)||dD(s,r-1)||gV(s,r-1)),t===i?r>l&&(h-=u?3:5):c?h+=u?2:0:h+=u?0:1,r+1===a&&(h-=u?3:5),h}function IHe(n,e,t,i,o,s,r){return NY(n,e,t,i,o,s,!0,r)}function NY(n,e,t,i,o,s,r,a){let l=yp(n,e,t,i,o,s,a);if(l&&!r)return l;if(n.length>=3){let c=Math.min(7,n.length-1);for(let d=t+1;dl[0])&&(l=u))}}}return l}function AY(n,e){if(e+1>=n.length)return;let t=n[e],i=n[e+1];if(t!==i)return n.slice(0,e)+i+t+n.slice(e+2)}var kHe,vv,bV,Y4,SY,xY,fV,Eh,LV,t5,tc,Dh,bv,kY,Tf,fD,mD=J(()=>{"use strict";_();v();b();cr();dV();ot();kHe=pV.bind(void 0,!1),vv=pV.bind(void 0,!0);bV=new Set;"()[]{}<>`'\"-/;:,.?!".split("").forEach(n=>bV.add(n.charCodeAt(0)));Y4=new Map;SY=mV(vv,wV,_Y),xY=mV(vv,wV,bY),fV=new Kr(1e4);Eh=128;LV=xV(2*Eh),t5=xV(2*Eh),tc=r5(),Dh=r5(),bv=r5(),kY=!1;(function(n){n.Default=[-100,0];function e(t){return!t||t.length===2&&t[0]===-100&&t[1]===0}n.isDefault=e})(Tf||(Tf={}));fD=class{constructor(e,t){this.firstMatchCanBeWeak=e,this.boostFullMatch=t}};fD.default={boostFullMatch:!0,firstMatchCanBeWeak:!1}});function kV(n){return n.replace(RY,(e,t)=>t?e:`\\${e}`)}function DV(n){return n.replace(PY,e=>`\\${e}`)}function pD(n){return n.indexOf(MY)===-1?n:n.replace(OY,(e,t,i,o)=>i?e:t||o||"")}function EV(n){return n?n.replace(/\$\((.*?)\)/g,(e,t)=>` ${t} `).trim():""}function Sp(n){a5.lastIndex=0;let e="",t=[],i=0;for(;;){let o=a5.lastIndex,s=a5.exec(n),r=n.substring(o,s?.index);if(r.length>0){e+=r;for(let a=0;a{"use strict";_();v();b();mD();ot();Ln();MY="$(",l5=new RegExp(`\\$\\(${Xe.iconNameExpression}(?:${Xe.iconModifierExpression})?\\)`,"g"),RY=new RegExp(`(\\\\)?${l5.source}`,"g");PY=new RegExp(`\\\\${l5.source}`,"g");OY=new RegExp(`(\\s)?(\\\\)?${l5.source}(\\s)?`,"g");a5=new RegExp(`\\$\\(${Xe.iconNameCharacter}+\\)`,"g")});function FY(n){return ic(n)?!n.value:Array.isArray(n)?n.every(FY):!0}function ic(n){return n instanceof Cv?!0:n&&typeof n=="object"?typeof n.value=="string"&&(typeof n.isTrusted=="boolean"||typeof n.isTrusted=="object"||n.isTrusted===void 0)&&(typeof n.supportThemeIcons=="boolean"||n.supportThemeIcons===void 0):!1}function IV(n,e){return n===e?!0:!n||!e?!1:n.value===e.value&&n.isTrusted===e.isTrusted&&n.supportThemeIcons===e.supportThemeIcons&&n.supportHtml===e.supportHtml&&(n.baseUri===e.baseUri||!!n.baseUri&&!!e.baseUri&&XW(Oe.from(n.baseUri),Oe.from(e.baseUri)))}function BY(n){return n.replace(/[\\`*_{}[\]()#+\-!~]/g,"\\$&")}function WY(n,e){var t,i;let o=(i=(t=n.match(/^`+/gm))===null||t===void 0?void 0:t.reduce((r,a)=>r.length>a.length?r:a).length)!==null&&i!==void 0?i:0,s=o>=3?o+1:3;return[`${"`".repeat(s)}${e}`,n,`${"`".repeat(s)}`].join(` +`)}function wv(n){return n.replace(/"/g,""")}function bD(n){return n&&n.replace(/\\([\\`*_{}[\]()#+\-.!~])/g,"$1")}function TV(n){let e=[],t=n.split("|").map(o=>o.trim());n=t[0];let i=t[1];if(i){let o=/height=(\d+)/.exec(i),s=/width=(\d+)/.exec(i),r=o?o[1]:"",a=s?s[1]:"",l=isFinite(parseInt(a)),c=isFinite(parseInt(r));l&&e.push(`width="${a}"`),c&&e.push(`height="${r}"`)}return{href:n,dimensions:e}}var Cv,Lp=J(()=>{"use strict";_();v();b();xt();xp();bf();ot();sn();Cv=class{constructor(e="",t=!1){var i,o,s;if(this.value=e,typeof this.value!="string")throw Sd("value");typeof t=="boolean"?(this.isTrusted=t,this.supportThemeIcons=!1,this.supportHtml=!1):(this.isTrusted=(i=t.isTrusted)!==null&&i!==void 0?i:void 0,this.supportThemeIcons=(o=t.supportThemeIcons)!==null&&o!==void 0?o:!1,this.supportHtml=(s=t.supportHtml)!==null&&s!==void 0?s:!1)}appendText(e,t=0){return this.value+=BY(this.supportThemeIcons?kV(e):e).replace(/([ \t]+)/g,(i,o)=>" ".repeat(o.length)).replace(/\>/gm,"\\>").replace(/\n/g,t===1?`\\ +`:` + +`),this}appendMarkdown(e){return this.value+=e,this}appendCodeblock(e,t){return this.value+=` +${WY(t,e)} +`,this}appendLink(e,t,i){return this.value+="[",this.value+=this._escape(t,"]"),this.value+="](",this.value+=this._escape(String(e),")"),i&&(this.value+=` "${this._escape(this._escape(i,'"'),")")}"`),this.value+=")",this}_escape(e,t){let i=new RegExp(gs(t),"g");return e.replace(i,(o,s)=>e.charAt(s-1)!=="\\"?`\\${o}`:o)}}});var XV,QV,JV,eH,tH,Mv,iH,MD,E5=J(()=>{"use strict";_();v();b();Ge();(function(n){n.inspectTokensAction=p("inspectTokens","Developer: Inspect Tokens")})(XV||(XV={}));(function(n){n.gotoLineActionLabel=p("gotoLineActionLabel","Go to Line/Column...")})(QV||(QV={}));(function(n){n.helpQuickAccessActionLabel=p("helpQuickAccess","Show all Quick Access Providers")})(JV||(JV={}));(function(n){n.quickCommandActionLabel=p("quickCommandActionLabel","Command Palette"),n.quickCommandHelp=p("quickCommandActionHelp","Show And Run Commands")})(eH||(eH={}));(function(n){n.quickOutlineActionLabel=p("quickOutlineActionLabel","Go to Symbol..."),n.quickOutlineByCategoryActionLabel=p("quickOutlineByCategoryActionLabel","Go to Symbol by Category...")})(tH||(tH={}));(function(n){n.editorViewAccessibleLabel=p("editorViewAccessibleLabel","Editor content"),n.accessibilityHelpMessage=p("accessibilityHelpMessage","Press Alt+F1 for Accessibility Options.")})(Mv||(Mv={}));(function(n){n.toggleHighContrast=p("toggleHighContrast","Toggle High Contrast Theme")})(iH||(iH={}));(function(n){n.bulkEditServiceSummary=p("bulkEditServiceSummary","Made {0} edits in {1} files")})(MD||(MD={}))});function uZe(n=aa){return(e,t)=>Ht(e,t,n)}function fZe(){return(n,e)=>n.equals(e)}function gZe(n,e,t){return!n||!e?n===e:t(n,e)}var aa,R5=J(()=>{"use strict";_();v();b();wt();aa=(n,e)=>n===e});function RX(n,e){var t;let i=P5.get(n);if(i)return i;let o=PX(n,e);if(o){let s=(t=fH.get(o))!==null&&t!==void 0?t:0;s++,fH.set(o,s);let r=s===1?o:`${o}#${s}`;return P5.set(n,r),r}}function PX(n,e){let t=P5.get(n);if(t)return t;let i=e.owner?FX(e.owner)+".":"",o,s=e.debugNameSource;if(s!==void 0)if(typeof s=="function"){if(o=s(),o!==void 0)return i+o}else return i+s;let r=e.referenceFn;if(r!==void 0&&(o=Pp(r),o!==void 0))return i+o;if(e.owner!==void 0){let a=OX(e.owner,n);if(a!==void 0)return i+a}}function OX(n,e){for(let t in n)if(n[t]===e)return t}function FX(n){var e;let t=mH.get(n);if(t)return t;let i=BX(n),o=(e=gH.get(i))!==null&&e!==void 0?e:0;o++,gH.set(i,o);let s=o===1?i:`${i}#${o}`;return mH.set(n,s),s}function BX(n){let e=n.constructor;return e?e.name:"Object"}function Pp(n){let e=n.toString(),i=/\/\*\*\s*@description\s*([^*]*)\*\//.exec(e),o=i?i[1]:void 0;return o?.trim()}var zn,fH,P5,gH,mH,Fv=J(()=>{"use strict";_();v();b();zn=class{constructor(e,t,i){this.owner=e,this.debugNameSource=t,this.referenceFn=i}getDebugName(e){return RX(e,this)}},fH=new Map,P5=new WeakMap;gH=new Map,mH=new WeakMap});function _H(n){pH=n}function qs(){return pH}function WX(n){let e=new Array,t=[],i="";function o(r){if("length"in r)for(let a of r)a&&o(a);else"text"in r?(i+=`%c${r.text}`,e.push(r.style),r.data&&t.push(...r.data)):"data"in r&&t.push(...r.data)}o(n);let s=[i,...e];return s.push(...t),s}function Op(n){return Qa(n,{color:"black"})}function Bv(n){return Qa(UX(`${n}: `,10),{color:"black",bold:!0})}function Qa(n,e={color:"black"}){function t(o){return Object.entries(o).reduce((s,[r,a])=>`${s}${r}:${a};`,"")}let i={color:e.color};return e.strikeThrough&&(i["text-decoration"]="line-through"),e.bold&&(i["font-weight"]="bold"),{text:n,style:t(i)}}function Wv(n,e){switch(typeof n){case"number":return""+n;case"string":return n.length+2<=e?`"${n}"`:`"${n.substr(0,e-7)}"+...`;case"boolean":return n?"true":"false";case"undefined":return"undefined";case"object":return n===null?"null":Array.isArray(n)?zX(n,e):VX(n,e);case"symbol":return n.toString();case"function":return`[[Function${n.name?" "+n.name:""}]]`;default:return""+n}}function zX(n,e){let t="[ ",i=!0;for(let o of n){if(i||(t+=", "),t.length-5>e){t+="...";break}i=!1,t+=`${Wv(o,e-t.length)}`}return t+=" ]",t}function VX(n,e){let t="{ ",i=!0;for(let[o,s]of Object.entries(n)){if(i||(t+=", "),t.length-5>e){t+="...";break}i=!1,t+=`${o}: ${Wv(s,e-t.length)}`}return t+=" }",t}function HX(n,e){let t="";for(let i=1;i<=e;i++)t+=n;return t}function UX(n,e){for(;n.length{"use strict";_();v();b();HD=class{constructor(){this.indentation=0,this.changedObservablesSets=new WeakMap}textToConsoleArgs(e){return WX([Op(HX("| ",this.indentation)),e])}formatInfo(e){return e.hadValue?e.didChange?[Op(" "),Qa(Wv(e.oldValue,70),{color:"red",strikeThrough:!0}),Op(" "),Qa(Wv(e.newValue,60),{color:"green"})]:[Op(" (unchanged)")]:[Op(" "),Qa(Wv(e.newValue,60),{color:"green"}),Op(" (initial)")]}handleObservableChanged(e,t){console.log(...this.textToConsoleArgs([Bv("observable value changed"),Qa(e.debugName,{color:"BlueViolet"}),...this.formatInfo(t)]))}formatChanges(e){if(e.size!==0)return Qa(" (changed deps: "+[...e].map(t=>t.debugName).join(", ")+")",{color:"gray"})}handleDerivedCreated(e){let t=e.handleChange;this.changedObservablesSets.set(e,new Set),e.handleChange=(i,o)=>(this.changedObservablesSets.get(e).add(i),t.apply(e,[i,o]))}handleDerivedRecomputed(e,t){let i=this.changedObservablesSets.get(e);console.log(...this.textToConsoleArgs([Bv("derived recomputed"),Qa(e.debugName,{color:"BlueViolet"}),...this.formatInfo(t),this.formatChanges(i),{data:[{fn:e._computeFn}]}])),i.clear()}handleFromEventObservableTriggered(e,t){console.log(...this.textToConsoleArgs([Bv("observable from event triggered"),Qa(e.debugName,{color:"BlueViolet"}),...this.formatInfo(t),{data:[{fn:e._getValue}]}]))}handleAutorunCreated(e){let t=e.handleChange;this.changedObservablesSets.set(e,new Set),e.handleChange=(i,o)=>(this.changedObservablesSets.get(e).add(i),t.apply(e,[i,o]))}handleAutorunTriggered(e){let t=this.changedObservablesSets.get(e);console.log(...this.textToConsoleArgs([Bv("autorun"),Qa(e.debugName,{color:"BlueViolet"}),this.formatChanges(t),{data:[{fn:e._runFn}]}])),t.clear(),this.indentation++}handleAutorunFinished(e){this.indentation--}handleBeginTransaction(e){let t=e.getDebugName();t===void 0&&(t=""),console.log(...this.textToConsoleArgs([Bv("transaction"),Qa(t,{color:"BlueViolet"}),{data:[{fn:e._fn}]}])),this.indentation++}handleEndTransaction(){this.indentation--}}});function vH(n){bH=n}function CH(n){KX=n}function yH(n){wH=n}function ri(n,e){let t=new Bp(n,e);try{n(t)}finally{t.finish()}}function Wp(n){if(UD)n(UD);else{let e=new Bp(n,void 0);UD=e;try{n(e)}finally{e.finish(),UD=void 0}}}async function TZe(n,e){let t=new Bp(n,e);try{await n(t)}finally{t.finish()}}function Pf(n,e,t){n?e(n):ri(e,t)}function ct(n,e){let t;return typeof n=="string"?t=new zn(void 0,n,void 0):t=new zn(n,void 0,void 0),new Vv(t,e,aa)}function NZe(n,e){var t;return new Vv(new zn(n.owner,n.debugName,void 0),e,(t=n.equalsFn)!==null&&t!==void 0?t:aa)}function F5(n,e){let t;return typeof n=="string"?t=new zn(void 0,n,void 0):t=new zn(n,void 0,void 0),new O5(t,e,aa)}var bH,KX,wH,zv,td,UD,Bp,Vv,O5,zp=J(()=>{"use strict";_();v();b();R5();Fv();Fp();zv=class{get TChange(){return null}reportChanges(){this.get()}read(e){return e?e.readObservable(this):this.get()}map(e,t){let i=t===void 0?void 0:e,o=t===void 0?e:t;return wH({owner:i,debugName:()=>{let s=Pp(o);if(s!==void 0)return s;let a=/^\s*\(?\s*([a-zA-Z_$][a-zA-Z_$0-9]*)\s*\)?\s*=>\s*\1(?:\??)\.([a-zA-Z_$][a-zA-Z_$0-9]*)\s*$/.exec(o.toString());if(a)return`${this.debugName}.${a[2]}`;if(!i)return`${this.debugName} (mapped)`},debugReferenceFn:o},s=>o(this.read(s),s))}recomputeInitiallyAndOnChange(e,t){return e.add(bH(this,t)),this}},td=class extends zv{constructor(){super(...arguments),this.observers=new Set}addObserver(e){let t=this.observers.size;this.observers.add(e),t===0&&this.onFirstObserverAdded()}removeObserver(e){this.observers.delete(e)&&this.observers.size===0&&this.onLastObserverRemoved()}onFirstObserverAdded(){}onLastObserverRemoved(){}};Bp=class{constructor(e,t){var i;this._fn=e,this._getDebugName=t,this.updatingObservers=[],(i=qs())===null||i===void 0||i.handleBeginTransaction(this)}getDebugName(){return this._getDebugName?this._getDebugName():Pp(this._fn)}updateObserver(e,t){this.updatingObservers.push({observer:e,observable:t}),e.beginUpdate(t)}finish(){var e;let t=this.updatingObservers;for(let i=0;i{},()=>`Setting ${this.debugName}`));try{let r=this._value;this._setValue(e),(o=qs())===null||o===void 0||o.handleObservableChanged(this,{oldValue:r,newValue:e,change:i,didChange:!0,hadValue:!0});for(let a of this.observers)t.updateObserver(a,this),a.handleChange(this,i)}finally{s&&s.finish()}}toString(){return`${this.debugName}: ${this._value}`}_setValue(e){this._value=e}};O5=class extends Vv{_setValue(e){this._value!==e&&(this._value&&this._value.dispose(),this._value=e)}dispose(){var e;(e=this._value)===null||e===void 0||e.dispose()}}});function We(n,e){return e!==void 0?new Ah(new zn(n,void 0,e),e,void 0,void 0,void 0,aa):new Ah(new zn(void 0,void 0,n),n,void 0,void 0,void 0,aa)}function Vp(n,e){var t;return new Ah(new zn(n.owner,n.debugName,n.debugReferenceFn),e,void 0,void 0,n.onLastObserverRemoved,(t=n.equalsFn)!==null&&t!==void 0?t:aa)}function $X(n,e){var t;return new Ah(new zn(n.owner,n.debugName,void 0),e,n.createEmptyChangeSummary,n.handleChange,void 0,(t=n.equalityComparer)!==null&&t!==void 0?t:aa)}function pr(n,e){let t,i;e===void 0?(t=n,i=void 0):(i=n,t=e);let o=new ae;return new Ah(new zn(i,void 0,t),s=>(o.clear(),t(s,o)),void 0,void 0,()=>o.dispose(),aa)}function Ja(n,e){let t,i;e===void 0?(t=n,i=void 0):(i=n,t=e);let o=new ae;return new Ah(new zn(i,void 0,t),s=>{o.clear();let r=t(s);return r&&o.add(r),r},void 0,void 0,()=>o.dispose(),aa)}var Ah,Hv=J(()=>{"use strict";_();v();b();Na();R5();le();zp();Fv();Fp();yH(Vp);Ah=class extends td{get debugName(){var e;return(e=this._debugNameData.getDebugName(this))!==null&&e!==void 0?e:"(anonymous)"}constructor(e,t,i,o,s=void 0,r){var a,l;super(),this._debugNameData=e,this._computeFn=t,this.createChangeSummary=i,this._handleChange=o,this._handleLastObserverRemoved=s,this._equalityComparator=r,this.state=0,this.value=void 0,this.updateCount=0,this.dependencies=new Set,this.dependenciesToBeRemoved=new Set,this.changeSummary=void 0,this.changeSummary=(a=this.createChangeSummary)===null||a===void 0?void 0:a.call(this),(l=qs())===null||l===void 0||l.handleDerivedCreated(this)}onLastObserverRemoved(){var e;this.state=0,this.value=void 0;for(let t of this.dependencies)t.removeObserver(this);this.dependencies.clear(),(e=this._handleLastObserverRemoved)===null||e===void 0||e.call(this)}get(){var e;if(this.observers.size===0){let t=this._computeFn(this,(e=this.createChangeSummary)===null||e===void 0?void 0:e.call(this));return this.onLastObserverRemoved(),t}else{do{if(this.state===1){for(let t of this.dependencies)if(t.reportChanges(),this.state===2)break}this.state===1&&(this.state=3),this._recomputeIfNeeded()}while(this.state!==3);return this.value}}_recomputeIfNeeded(){var e,t;if(this.state===3)return;let i=this.dependenciesToBeRemoved;this.dependenciesToBeRemoved=this.dependencies,this.dependencies=i;let o=this.state!==0,s=this.value;this.state=3;let r=this.changeSummary;this.changeSummary=(e=this.createChangeSummary)===null||e===void 0?void 0:e.call(this);try{this.value=this._computeFn(this,r)}finally{for(let l of this.dependenciesToBeRemoved)l.removeObserver(this);this.dependenciesToBeRemoved.clear()}let a=o&&!this._equalityComparator(s,this.value);if((t=qs())===null||t===void 0||t.handleDerivedRecomputed(this,{oldValue:s,newValue:this.value,change:void 0,didChange:a,hadValue:o}),a)for(let l of this.observers)l.handleChange(this,void 0)}toString(){return`LazyDerived<${this.debugName}>`}beginUpdate(e){this.updateCount++;let t=this.updateCount===1;if(this.state===3&&(this.state=1,!t))for(let i of this.observers)i.handlePossibleChange(this);if(t)for(let i of this.observers)i.beginUpdate(this)}endUpdate(e){if(this.updateCount--,this.updateCount===0){let t=[...this.observers];for(let i of t)i.endUpdate(this)}Fr(()=>this.updateCount>=0)}handlePossibleChange(e){if(this.state===3&&this.dependencies.has(e)&&!this.dependenciesToBeRemoved.has(e)){this.state=1;for(let t of this.observers)t.handlePossibleChange(this)}}handleChange(e,t){if(this.dependencies.has(e)&&!this.dependenciesToBeRemoved.has(e)){let i=this._handleChange?this._handleChange({changedObservable:e,change:t,didChange:s=>s===e},this.changeSummary):!0,o=this.state===3;if(i&&(this.state===1||o)&&(this.state=2,o))for(let s of this.observers)s.handlePossibleChange(this)}}readObservable(e){e.addObserver(this);let t=e.get();return this.dependencies.add(e),this.dependenciesToBeRemoved.delete(e),t}addObserver(e){let t=!this.observers.has(e)&&this.updateCount>0;super.addObserver(e),t&&e.beginUpdate(this)}removeObserver(e){let t=this.observers.has(e)&&this.updateCount>0;super.removeObserver(e),t&&e.endUpdate(this)}}});function pt(n){return new Hp(new zn(void 0,void 0,n),n,void 0,void 0)}function Uv(n,e){var t;return new Hp(new zn(n.owner,n.debugName,(t=n.debugReferenceFn)!==null&&t!==void 0?t:e),e,void 0,void 0)}function Mh(n,e){var t;return new Hp(new zn(n.owner,n.debugName,(t=n.debugReferenceFn)!==null&&t!==void 0?t:e),e,n.createEmptyChangeSummary,n.handleChange)}function Jn(n){let e=new ae,t=Uv({owner:void 0,debugName:void 0,debugReferenceFn:n},i=>{e.clear(),n(i,e)});return be(()=>{t.dispose(),e.dispose()})}var Hp,B5=J(()=>{"use strict";_();v();b();Na();le();Fv();Fp();Hp=class{get debugName(){var e;return(e=this._debugNameData.getDebugName(this))!==null&&e!==void 0?e:"(anonymous)"}constructor(e,t,i,o){var s,r;this._debugNameData=e,this._runFn=t,this.createChangeSummary=i,this._handleChange=o,this.state=2,this.updateCount=0,this.disposed=!1,this.dependencies=new Set,this.dependenciesToBeRemoved=new Set,this.changeSummary=(s=this.createChangeSummary)===null||s===void 0?void 0:s.call(this),(r=qs())===null||r===void 0||r.handleAutorunCreated(this),this._runIfNeeded(),ou(this)}dispose(){this.disposed=!0;for(let e of this.dependencies)e.removeObserver(this);this.dependencies.clear(),su(this)}_runIfNeeded(){var e,t,i;if(this.state===3)return;let o=this.dependenciesToBeRemoved;this.dependenciesToBeRemoved=this.dependencies,this.dependencies=o,this.state=3;let s=this.disposed;try{if(!s){(e=qs())===null||e===void 0||e.handleAutorunTriggered(this);let r=this.changeSummary;this.changeSummary=(t=this.createChangeSummary)===null||t===void 0?void 0:t.call(this),this._runFn(this,r)}}finally{s||(i=qs())===null||i===void 0||i.handleAutorunFinished(this);for(let r of this.dependenciesToBeRemoved)r.removeObserver(this);this.dependenciesToBeRemoved.clear()}}toString(){return`Autorun<${this.debugName}>`}beginUpdate(){this.state===3&&(this.state=1),this.updateCount++}endUpdate(){if(this.updateCount===1)do{if(this.state===1){this.state=3;for(let e of this.dependencies)if(e.reportChanges(),this.state===2)break}this._runIfNeeded()}while(this.state!==3);this.updateCount--,Fr(()=>this.updateCount>=0)}handlePossibleChange(e){this.state===3&&this.dependencies.has(e)&&!this.dependenciesToBeRemoved.has(e)&&(this.state=1)}handleChange(e,t){this.dependencies.has(e)&&!this.dependenciesToBeRemoved.has(e)&&(!this._handleChange||this._handleChange({changedObservable:e,change:t,didChange:o=>o===e},this.changeSummary))&&(this.state=2)}readObservable(e){if(this.disposed)return e.get();e.addObserver(this);let t=e.get();return this.dependencies.add(e),this.dependenciesToBeRemoved.delete(e),t}};(function(n){n.Observer=Hp})(pt||(pt={}))});function Rh(n){return new W5(n)}function $t(n,e){return new Of(n,e)}function fo(n,e){return new z5(n,e)}function Kv(n){return typeof n=="string"?new KD(n):new KD(void 0,n)}function SH(n){let e=new $D(!1,void 0);return n.addObserver(e),be(()=>{n.removeObserver(e)})}function Ph(n,e){let t=new $D(!0,e);return n.addObserver(t),e?e(n.get()):n.reportChanges(),be(()=>{n.removeObserver(t)})}function rYe(n,e,t,i){let o=new qD(t,i);return Vp({debugReferenceFn:t,owner:n,onLastObserverRemoved:()=>{o.dispose(),o=new qD(t)}},r=>(o.setItems(e.read(r)),o.getItems()))}var W5,Of,z5,KD,$D,qD,xH=J(()=>{"use strict";_();v();b();ye();le();zp();Fv();Hv();Fp();W5=class extends zv{constructor(e){super(),this.value=e}get debugName(){return this.toString()}get(){return this.value}addObserver(e){}removeObserver(e){}toString(){return`Const: ${this.value}`}};Of=class n extends td{constructor(e,t){super(),this.event=e,this._getValue=t,this.hasValue=!1,this.handleEvent=i=>{var o;let s=this._getValue(i),r=this.value,a=!this.hasValue||r!==s,l=!1;a&&(this.value=s,this.hasValue&&(l=!0,Pf(n.globalTransaction,c=>{var d;(d=qs())===null||d===void 0||d.handleFromEventObservableTriggered(this,{oldValue:r,newValue:s,change:void 0,didChange:a,hadValue:this.hasValue});for(let h of this.observers)c.updateObserver(h,this),h.handleChange(this,void 0)},()=>{let c=this.getDebugName();return"Event fired"+(c?`: ${c}`:"")})),this.hasValue=!0),l||(o=qs())===null||o===void 0||o.handleFromEventObservableTriggered(this,{oldValue:r,newValue:s,change:void 0,didChange:a,hadValue:this.hasValue})}}getDebugName(){return Pp(this._getValue)}get debugName(){let e=this.getDebugName();return"From Event"+(e?`: ${e}`:"")}onFirstObserverAdded(){this.subscription=this.event(this.handleEvent)}onLastObserverRemoved(){this.subscription.dispose(),this.subscription=void 0,this.hasValue=!1,this.value=void 0}get(){return this.subscription?(this.hasValue||this.handleEvent(void 0),this.value):this._getValue(void 0)}};(function(n){n.Observer=Of;function e(t,i){let o=!1;Of.globalTransaction===void 0&&(Of.globalTransaction=t,o=!0);try{i()}finally{o&&(Of.globalTransaction=void 0)}}n.batchEventsGlobally=e})($t||($t={}));z5=class extends td{constructor(e,t){super(),this.debugName=e,this.event=t,this.handleEvent=()=>{ri(i=>{for(let o of this.observers)i.updateObserver(o,this),o.handleChange(this,void 0)},()=>this.debugName)}}onFirstObserverAdded(){this.subscription=this.event(this.handleEvent)}onLastObserverRemoved(){this.subscription.dispose(),this.subscription=void 0}get(){}};KD=class extends td{get debugName(){var e;return(e=new zn(this._owner,this._debugName,void 0).getDebugName(this))!==null&&e!==void 0?e:"Observable Signal"}constructor(e,t){super(),this._debugName=e,this._owner=t}trigger(e,t){if(!e){ri(i=>{this.trigger(i,t)},()=>`Trigger signal ${this.debugName}`);return}for(let i of this.observers)e.updateObserver(i,this),i.handleChange(this,t)}get(){}};CH(SH);vH(Ph);$D=class{constructor(e,t){this._forceRecompute=e,this._handleValue=t,this._counter=0}beginUpdate(e){this._counter++}endUpdate(e){this._counter--,this._counter===0&&this._forceRecompute&&(this._handleValue?this._handleValue(e.get()):e.reportChanges())}handlePossibleChange(e){}handleChange(e,t){}};qD=class{constructor(e,t){this._map=e,this._keySelector=t,this._cache=new Map,this._items=[]}dispose(){this._cache.forEach(e=>e.store.dispose()),this._cache.clear()}setItems(e){let t=[],i=new Set(this._cache.keys());for(let o of e){let s=this._keySelector?this._keySelector(o):o,r=this._cache.get(s);if(r)i.delete(s);else{let a=new ae;r={out:this._map(o,a),store:a},this._cache.set(s,r)}t.push(r.out)}for(let o of i)this._cache.get(o).store.dispose(),this._cache.delete(o);this._items=t}getItems(){return this._items}}});function V5(n,e,t,i){return e||(e=o=>o!=null),new Promise((o,s)=>{let r=!0,a=!1,l=n.map(d=>({isFinished:e(d),error:t?t(d):!1,state:d})),c=pt(d=>{let{isFinished:h,error:u,state:f}=l.read(d);(h||u)&&(r?a=!0:c.dispose(),u?s(u===!0?f:u):o(f))});if(i){let d=i.onCancellationRequested(()=>{c.dispose(),d.dispose(),s(new Dr)});if(i.isCancellationRequested){c.dispose(),d.dispose(),s(new Dr);return}}r=!1,a&&c.dispose()})}var LH=J(()=>{"use strict";_();v();b();B5();xt()});var qX,bn=J(()=>{"use strict";_();v();b();zp();Hv();B5();xH();LH();Fp();qX=!1;qX&&_H(new HD)});var rc,dE=J(()=>{"use strict";_();v();b();qe();rc=De("editorWorkerService")});var ls,x1=J(()=>{"use strict";_();v();b();qe();ls=De("themeService")});function A2(){return H_&&!!H_.VSCODE_DEV}function tF(n){if(A2()){let e=bJ();return e.add(n),{dispose(){e.delete(n)}}}else return{dispose(){}}}function bJ(){N2||(N2=new Set);let n=globalThis;return n.$hotReload_applyNewExports||(n.$hotReload_applyNewExports=e=>{let t={config:{mode:void 0},...e};for(let i of N2){let o=i(t);if(o)return o}}),N2}var N2,GU=J(()=>{"use strict";_();v();b();pT();A2()&&tF(({oldExports:n,newSrc:e,config:t})=>{if(t.mode==="patch-prototype")return i=>{var o,s;for(let r in i){let a=i[r];if(console.log(`[hot-reload] Patching prototype methods of '${r}'`,{exportedItem:a}),typeof a=="function"&&a.prototype){let l=n[r];if(l){for(let c of Object.getOwnPropertyNames(a.prototype)){let d=Object.getOwnPropertyDescriptor(a.prototype,c),h=Object.getOwnPropertyDescriptor(l.prototype,c);((o=d?.value)===null||o===void 0?void 0:o.toString())!==((s=h?.value)===null||s===void 0?void 0:s.toString())&&console.log(`[hot-reload] Patching prototype method '${r}.${c}'`),Object.defineProperty(l.prototype,c,d)}i[r]=l}}}return!0}})});function YU(n,e,t,i){if(n.length===0)return e;if(e.length===0)return n;let o=[],s=0,r=0;for(;sd?(o.push(l),r++):(o.push(i(a,l)),s++,r++)}for(;s`Apply decorations from ${e.debugName}`},o=>{let s=e.read(o);i.set(s)})),t.add({dispose:()=>{i.clear()}}),t}function ig(n,e){return n.appendChild(e),be(()=>{n.removeChild(e)})}function XU(n,e){return n.prepend(e),be(()=>{n.removeChild(e)})}function iF(n,e,t){let i=e.get(),o=i,s=i,r=ct("animatedValue",i),a=-1,l=300,c;t.add(Mh({createEmptyChangeSummary:()=>({animate:!1}),handleChange:(h,u)=>(h.didChange(e)&&(u.animate=u.animate||h.change),!0)},(h,u)=>{c!==void 0&&(n.cancelAnimationFrame(c),c=void 0),o=s,i=e.read(h),a=Date.now()-(u.animate?0:l),d()}));function d(){let h=Date.now()-a;s=Math.floor(vJ(h,o,i-o,l)),h{for(let[i,o]of Object.entries(e))o&&typeof o=="object"&&"read"in o&&(o=o.read(t)),typeof o=="number"&&(o=`${o}px`),i=i.replace(/[A-Z]/g,s=>"-"+s.toLowerCase()),n.style[i]=o})}function Ts(n,e){return CJ([n],e),n}function CJ(n,e){A2()&&fo("reload",i=>tF(({oldExports:o})=>{if([...Object.values(o)].some(s=>n.includes(s)))return s=>(i(void 0),!0)})).read(e)}function m_(n,e,t,i){let o=new ae,s=[];return o.add(Jn((r,a)=>{let l=e.read(r),c=new Map,d=new Map;t&&t(!0),n.changeViewZones(h=>{for(let u of s)h.removeZone(u),i?.delete(u);s.length=0;for(let u of l){let f=h.addZone(u);u.setZoneId&&u.setZoneId(f),s.push(f),i?.add(f),c.set(u,f)}}),t&&t(!1),a.add(Mh({createEmptyChangeSummary(){return{zoneIds:[]}},handleChange(h,u){let f=d.get(h.changedObservable);return f!==void 0&&u.zoneIds.push(f),!0}},(h,u)=>{for(let f of l)f.onChange&&(d.set(f.onChange,c.get(f)),f.onChange.read(h));t&&t(!0),n.changeViewZones(f=>{for(let g of u.zoneIds)f.layoutZone(g)}),t&&t(!1)}))})),o.add({dispose(){t&&t(!0),n.changeViewZones(r=>{for(let a of s)r.removeZone(a)}),i?.clear(),t&&t(!1)}}),o}function nF(n,e){let t=Mu(e,o=>o.original.startLineNumber<=n.lineNumber);if(!t)return P.fromPositions(n);if(t.original.endLineNumberExclusive<=n.lineNumber){let o=n.lineNumber-t.original.endLineNumberExclusive+t.modified.endLineNumberExclusive;return P.fromPositions(new U(o,n.column))}if(!t.innerChanges)return P.fromPositions(new U(t.modified.startLineNumber,1));let i=Mu(t.innerChanges,o=>o.originalRange.getStartPosition().isBeforeOrEqual(n));if(!i){let o=n.lineNumber-t.original.startLineNumber+t.modified.startLineNumber;return P.fromPositions(new U(o,n.column))}if(i.originalRange.containsPosition(n))return i.modifiedRange;{let o=wJ(i.originalRange.getEndPosition(),n);return P.fromPositions(o.addToPosition(i.modifiedRange.getEndPosition()))}}function wJ(n,e){return n.lineNumber===e.lineNumber?new ws(0,e.column-n.column):new ws(e.lineNumber-n.lineNumber,e.column-1)}function mc(n,e,t){let i=n.bindTo(e);return Uv({debugName:()=>`Set Context Key "${n.key}"`},o=>{i.set(t(o))})}function QU(n,e){let t;return n.filter(i=>{let o=e(i,t);return t=i,o})}var u_,f_,Gh,M2,ZU,ca=J(()=>{"use strict";_();v();b();Dl();fs();GU();le();bn();OA();ft();Ke();om();u_=class extends H{get width(){return this._width}get height(){return this._height}constructor(e,t){super(),this.elementSizeObserver=this._register(new vm(e,t)),this._width=ct(this,this.elementSizeObserver.getWidth()),this._height=ct(this,this.elementSizeObserver.getHeight()),this._register(this.elementSizeObserver.onDidChange(i=>ri(o=>{this._width.set(this.elementSizeObserver.getWidth(),o),this._height.set(this.elementSizeObserver.getHeight(),o)})))}observe(e){this.elementSizeObserver.observe(e)}setAutomaticLayout(e){e?this.elementSizeObserver.startObserving():this.elementSizeObserver.stopObserving()}};f_=class extends H{constructor(e,t,i){super(),this._register(new M2(e,i)),this._register(br(i,{height:t.actualHeight,top:t.actualTop}))}},Gh=class{get afterLineNumber(){return this._afterLineNumber.get()}constructor(e,t){this._afterLineNumber=e,this.heightInPx=t,this.domNode=document.createElement("div"),this._actualTop=ct(this,void 0),this._actualHeight=ct(this,void 0),this.actualTop=this._actualTop,this.actualHeight=this._actualHeight,this.showInHiddenAreas=!0,this.onChange=this._afterLineNumber,this.onDomNodeTop=i=>{this._actualTop.set(i,void 0)},this.onComputedHeight=i=>{this._actualHeight.set(i,void 0)}}},M2=class n{constructor(e,t){this._editor=e,this._domElement=t,this._overlayWidgetId=`managedOverlayWidget-${n._counter++}`,this._overlayWidget={getId:()=>this._overlayWidgetId,getDomNode:()=>this._domElement,getPosition:()=>null},this._editor.addOverlayWidget(this._overlayWidget)}dispose(){this._editor.removeOverlayWidget(this._overlayWidget)}};M2._counter=0;ZU=class extends un{dispose(){super.dispose(!0)}}});var AJ,MJ,DF,P1,Z2,fK=J(()=>{"use strict";_();v();b();ke();Ef();$n();Lp();le();bn();Hv();Ln();xi();ca();Bo();ft();Ke();Yo();Ge();qe();AJ=function(n,e,t,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},MJ=function(n,e){return function(t,i){e(t,i,n)}},P1=DF=class extends H{static setBreadcrumbsSourceFactory(e){this._breadcrumbsSourceFactory.set(e,void 0)}get isUpdatingHiddenAreas(){return this._isUpdatingHiddenAreas}constructor(e,t,i,o){super(),this._editors=e,this._diffModel=t,this._options=i,this._instantiationService=o,this._modifiedOutlineSource=Ja(this,l=>{let c=this._editors.modifiedModel.read(l),d=DF._breadcrumbsSourceFactory.read(l);return!c||!d?void 0:d(c,this._instantiationService)}),this._isUpdatingHiddenAreas=!1,this._register(this._editors.original.onDidChangeCursorPosition(l=>{if(l.reason===1)return;let c=this._diffModel.get();ri(d=>{for(let h of this._editors.original.getSelections()||[])c?.ensureOriginalLineIsVisible(h.getStartPosition().lineNumber,0,d),c?.ensureOriginalLineIsVisible(h.getEndPosition().lineNumber,0,d)})})),this._register(this._editors.modified.onDidChangeCursorPosition(l=>{if(l.reason===1)return;let c=this._diffModel.get();ri(d=>{for(let h of this._editors.modified.getSelections()||[])c?.ensureModifiedLineIsVisible(h.getStartPosition().lineNumber,0,d),c?.ensureModifiedLineIsVisible(h.getEndPosition().lineNumber,0,d)})}));let s=this._diffModel.map((l,c)=>{var d,h;let u=(d=l?.unchangedRegions.read(c))!==null&&d!==void 0?d:[];return u.length===1&&u[0].modifiedLineNumber===1&&u[0].lineCount===((h=this._editors.modifiedModel.read(c))===null||h===void 0?void 0:h.getLineCount())?[]:u});this.viewZones=pr(this,(l,c)=>{let d=this._modifiedOutlineSource.read(l);if(!d)return{origViewZones:[],modViewZones:[]};let h=[],u=[],f=this._options.renderSideBySide.read(l),g=s.read(l);for(let m of g)if(!m.shouldHideControls(l)){{let C=We(this,w=>m.getHiddenOriginalRange(w).startLineNumber-1),S=new Gh(C,24);h.push(S),c.add(new Z2(this._editors.original,S,m,m.originalUnchangedRange,!f,d,w=>this._diffModel.get().ensureModifiedLineIsVisible(w,2,void 0),this._options))}{let C=We(this,w=>m.getHiddenModifiedRange(w).startLineNumber-1),S=new Gh(C,24);u.push(S),c.add(new Z2(this._editors.modified,S,m,m.modifiedUnchangedRange,!1,d,w=>this._diffModel.get().ensureModifiedLineIsVisible(w,2,void 0),this._options))}}return{origViewZones:h,modViewZones:u}});let r={description:"unchanged lines",className:"diff-unchanged-lines",isWholeLine:!0},a={description:"Fold Unchanged",glyphMarginHoverMessage:new Cv(void 0,{isTrusted:!0,supportThemeIcons:!0}).appendMarkdown(p("foldUnchanged","Fold Unchanged Region")),glyphMarginClassName:"fold-unchanged "+Xe.asClassName(ue.fold),zIndex:10001};this._register(g_(this._editors.original,We(this,l=>{let c=s.read(l),d=c.map(h=>({range:h.originalUnchangedRange.toInclusiveRange(),options:r}));for(let h of c)h.shouldHideControls(l)&&d.push({range:P.fromPositions(new U(h.originalLineNumber,1)),options:a});return d}))),this._register(g_(this._editors.modified,We(this,l=>{let c=s.read(l),d=c.map(h=>({range:h.modifiedUnchangedRange.toInclusiveRange(),options:r}));for(let h of c)h.shouldHideControls(l)&&d.push({range:Ne.ofLength(h.modifiedLineNumber,1).toInclusiveRange(),options:a});return d}))),this._register(pt(l=>{let c=s.read(l);this._isUpdatingHiddenAreas=!0;try{this._editors.original.setHiddenAreas(c.map(d=>d.getHiddenOriginalRange(l).toInclusiveRange()).filter(bc)),this._editors.modified.setHiddenAreas(c.map(d=>d.getHiddenModifiedRange(l).toInclusiveRange()).filter(bc))}finally{this._isUpdatingHiddenAreas=!1}})),this._register(this._editors.modified.onMouseUp(l=>{var c;if(!l.event.rightButton&&l.target.position&&(!((c=l.target.element)===null||c===void 0)&&c.className.includes("fold-unchanged"))){let d=l.target.position.lineNumber,h=this._diffModel.get();if(!h)return;let u=h.unchangedRegions.get().find(f=>f.modifiedUnchangedRange.includes(d));if(!u)return;u.collapseAll(void 0),l.event.stopPropagation(),l.event.preventDefault()}})),this._register(this._editors.original.onMouseUp(l=>{var c;if(!l.event.rightButton&&l.target.position&&(!((c=l.target.element)===null||c===void 0)&&c.className.includes("fold-unchanged"))){let d=l.target.position.lineNumber,h=this._diffModel.get();if(!h)return;let u=h.unchangedRegions.get().find(f=>f.originalUnchangedRange.includes(d));if(!u)return;u.collapseAll(void 0),l.event.stopPropagation(),l.event.preventDefault()}}))}};P1._breadcrumbsSourceFactory=ct("breadcrumbsSourceFactory",void 0);P1=DF=AJ([MJ(3,Ye)],P1);Z2=class extends f_{constructor(e,t,i,o,s,r,a,l){let c=kt("div.diff-hidden-lines-widget");super(e,t,c.root),this._editor=e,this._unchangedRegion=i,this._unchangedRegionRange=o,this._hide=s,this._modifiedOutlineSource=r,this._revealModifiedHiddenLine=a,this._options=l,this._nodes=kt("div.diff-hidden-lines",[kt("div.top@top",{title:p("diff.hiddenLines.top","Click or drag to show more above")}),kt("div.center@content",{style:{display:"flex"}},[kt("div@first",{style:{display:"flex",justifyContent:"center",alignItems:"center",flexShrink:"0"}},[ve("a",{title:p("showUnchangedRegion","Show Unchanged Region"),role:"button",onclick:()=>{this._unchangedRegion.showAll(void 0)}},...ra("$(unfold)"))]),kt("div@others",{style:{display:"flex",justifyContent:"center",alignItems:"center"}})]),kt("div.bottom@bottom",{title:p("diff.bottom","Click or drag to show more below"),role:"button"})]),c.root.appendChild(this._nodes.root);let d=$t(this._editor.onDidLayoutChange,()=>this._editor.getLayoutInfo());this._hide?Wi(this._nodes.first):this._register(br(this._nodes.first,{width:d.map(u=>u.contentLeft)})),this._register(pt(u=>{let f=this._unchangedRegion.visibleLineCountTop.read(u)+this._unchangedRegion.visibleLineCountBottom.read(u)===this._unchangedRegion.lineCount;this._nodes.bottom.classList.toggle("canMoveTop",!f),this._nodes.bottom.classList.toggle("canMoveBottom",this._unchangedRegion.visibleLineCountBottom.read(u)>0),this._nodes.top.classList.toggle("canMoveTop",this._unchangedRegion.visibleLineCountTop.read(u)>0),this._nodes.top.classList.toggle("canMoveBottom",!f);let g=this._unchangedRegion.isDragged.read(u),m=this._editor.getDomNode();m&&(m.classList.toggle("draggingUnchangedRegion",!!g),g==="top"?(m.classList.toggle("canMoveTop",this._unchangedRegion.visibleLineCountTop.read(u)>0),m.classList.toggle("canMoveBottom",!f)):g==="bottom"?(m.classList.toggle("canMoveTop",!f),m.classList.toggle("canMoveBottom",this._unchangedRegion.visibleLineCountBottom.read(u)>0)):(m.classList.toggle("canMoveTop",!1),m.classList.toggle("canMoveBottom",!1)))}));let h=this._editor;this._register($(this._nodes.top,"mousedown",u=>{if(u.button!==0)return;this._nodes.top.classList.toggle("dragging",!0),this._nodes.root.classList.toggle("dragging",!0),u.preventDefault();let f=u.clientY,g=!1,m=this._unchangedRegion.visibleLineCountTop.get();this._unchangedRegion.isDragged.set("top",void 0);let C=ge(this._nodes.top),S=$(C,"mousemove",y=>{let k=y.clientY-f;g=g||Math.abs(k)>2;let T=Math.round(k/h.getOption(67)),N=Math.max(0,Math.min(m+T,this._unchangedRegion.getMaxVisibleLineCountTop()));this._unchangedRegion.visibleLineCountTop.set(N,void 0)}),w=$(C,"mouseup",y=>{g||this._unchangedRegion.showMoreAbove(this._options.hideUnchangedRegionsRevealLineCount.get(),void 0),this._nodes.top.classList.toggle("dragging",!1),this._nodes.root.classList.toggle("dragging",!1),this._unchangedRegion.isDragged.set(void 0,void 0),S.dispose(),w.dispose()})})),this._register($(this._nodes.bottom,"mousedown",u=>{if(u.button!==0)return;this._nodes.bottom.classList.toggle("dragging",!0),this._nodes.root.classList.toggle("dragging",!0),u.preventDefault();let f=u.clientY,g=!1,m=this._unchangedRegion.visibleLineCountBottom.get();this._unchangedRegion.isDragged.set("bottom",void 0);let C=ge(this._nodes.bottom),S=$(C,"mousemove",y=>{let k=y.clientY-f;g=g||Math.abs(k)>2;let T=Math.round(k/h.getOption(67)),N=Math.max(0,Math.min(m-T,this._unchangedRegion.getMaxVisibleLineCountBottom())),M=this._unchangedRegionRange.endLineNumberExclusive>h.getModel().getLineCount()?h.getContentHeight():h.getTopForLineNumber(this._unchangedRegionRange.endLineNumberExclusive);this._unchangedRegion.visibleLineCountBottom.set(N,void 0);let W=this._unchangedRegionRange.endLineNumberExclusive>h.getModel().getLineCount()?h.getContentHeight():h.getTopForLineNumber(this._unchangedRegionRange.endLineNumberExclusive);h.setScrollTop(h.getScrollTop()+(W-M))}),w=$(C,"mouseup",y=>{if(this._unchangedRegion.isDragged.set(void 0,void 0),!g){let x=h.getTopForLineNumber(this._unchangedRegionRange.endLineNumberExclusive);this._unchangedRegion.showMoreBelow(this._options.hideUnchangedRegionsRevealLineCount.get(),void 0);let k=h.getTopForLineNumber(this._unchangedRegionRange.endLineNumberExclusive);h.setScrollTop(h.getScrollTop()+(k-x))}this._nodes.bottom.classList.toggle("dragging",!1),this._nodes.root.classList.toggle("dragging",!1),S.dispose(),w.dispose()})})),this._register(pt(u=>{let f=[];if(!this._hide){let g=i.getHiddenModifiedRange(u).length,m=p("hiddenLines","{0} hidden lines",g),C=ve("span",{title:p("diff.hiddenLines.expandAll","Double click to unfold")},m);C.addEventListener("dblclick",y=>{y.button===0&&(y.preventDefault(),this._unchangedRegion.showAll(void 0))}),f.push(C);let S=this._unchangedRegion.getHiddenModifiedRange(u),w=this._modifiedOutlineSource.getBreadcrumbItems(S,u);if(w.length>0){f.push(ve("span",void 0,"\xA0\xA0|\xA0\xA0"));for(let y=0;y{this._revealModifiedHiddenLine(x.startLineNumber)}}}}Wi(this._nodes.others,...f)}))}}});var BF,EK,cI,IK=J(()=>{"use strict";_();v();b();Ud();Oi();fs();kr();qe();Ur();Ge();BF=De("IEditorCancelService"),EK=new xe("cancellableOperation",!1,p("cancellableOperation","Whether the editor runs a cancellable operation, e.g. like 'Peek References'"));_t(BF,class{constructor(){this._tokens=new WeakMap}add(n,e){let t=this._tokens.get(n);t||(t=n.invokeWithinContext(o=>{let s=EK.bindTo(o.get(rt)),r=new Ii;return{key:s,tokens:r}}),this._tokens.set(n,t));let i;return t.key.set(!0),i=t.tokens.push(e),()=>{i&&(i(),t.key.set(!t.tokens.isEmpty()),i=void 0)}}cancel(n){let e=this._tokens.get(n);if(!e)return;let t=e.tokens.pop();t&&(t.cancel(),e.key.set(!e.tokens.isEmpty()))}},1);cI=class extends un{constructor(e,t){super(t),this.editor=e,this._unregister=e.invokeWithinContext(i=>i.get(BF).add(e,this))}dispose(){this._unregister(),super.dispose()}};Je(new class extends yl{constructor(){super({id:"editor.cancelOperation",kbOpts:{weight:100,primary:9},precondition:EK})}runEditorCommand(n,e){n.get(BF).cancel(e)}})});var TK,W1,z1,NK=J(()=>{"use strict";_();v();b();ot();Ke();fs();le();IK();TK=class n{constructor(e,t){if(this.flags=t,this.flags&1){let i=e.getModel();this.modelVersionId=i?du("{0}#{1}",i.uri.toString(),i.getVersionId()):null}else this.modelVersionId=null;this.flags&4?this.position=e.getPosition():this.position=null,this.flags&2?this.selection=e.getSelection():this.selection=null,this.flags&8?(this.scrollLeft=e.getScrollLeft(),this.scrollTop=e.getScrollTop()):(this.scrollLeft=-1,this.scrollTop=-1)}_equals(e){if(!(e instanceof n))return!1;let t=e;return!(this.modelVersionId!==t.modelVersionId||this.scrollLeft!==t.scrollLeft||this.scrollTop!==t.scrollTop||!this.position&&t.position||this.position&&!t.position||this.position&&t.position&&!this.position.equals(t.position)||!this.selection&&t.selection||this.selection&&!t.selection||this.selection&&t.selection&&!this.selection.equalsRange(t.selection))}validate(e){return this._equals(new n(e,this.flags))}},W1=class extends cI{constructor(e,t,i,o){super(e,o),this._listener=new ae,t&4&&this._listener.add(e.onDidChangeCursorPosition(s=>{(!i||!P.containsPosition(i,s.position))&&this.cancel()})),t&2&&this._listener.add(e.onDidChangeCursorSelection(s=>{(!i||!P.containsRange(i,s.selection))&&this.cancel()})),t&8&&this._listener.add(e.onDidScrollChange(s=>this.cancel())),t&1&&(this._listener.add(e.onDidChangeModel(s=>this.cancel())),this._listener.add(e.onDidChangeModelContent(s=>this.cancel())))}dispose(){this._listener.dispose(),super.dispose()}},z1=class extends un{constructor(e,t){super(t),this._listener=e.onDidChangeContent(()=>this.cancel())}dispose(){this._listener.dispose(),super.dispose()}}});var Ote={};PK(Ote,{CancellationTokenSource:()=>yte,Emitter:()=>Ste,KeyCode:()=>xte,KeyMod:()=>Lte,MarkerSeverity:()=>Tte,MarkerTag:()=>Nte,Position:()=>kte,Range:()=>Dte,Selection:()=>Ete,SelectionDirection:()=>Ite,Token:()=>Mte,Uri:()=>Ate,editor:()=>Rte,languages:()=>Pte});_();v();b();_();v();b();wt();hs();Lt();I_();ug();Ge();var va=8,mg=class{constructor(e){this._values=e}hasChanged(e){return this._values[e]}},A_=class{constructor(){this.stableMinimapLayoutInput=null,this.stableFitMaxMinimapScale=0,this.stableFitRemainingWidth=0}},jt=class{constructor(e,t,i,o){this.id=e,this.name=t,this.defaultValue=i,this.schema=o}applyUpdate(e,t){return tC(e,t)}compute(e,t,i){return i}},_d=class{constructor(e,t){this.newValue=e,this.didChange=t}};function tC(n,e){if(typeof n!="object"||typeof e!="object"||!n||!e)return new _d(e,n!==e);if(Array.isArray(n)||Array.isArray(e)){let i=Array.isArray(n)&&Array.isArray(e)&&Ht(n,e);return new _d(e,!i)}let t=!1;for(let i in e)if(e.hasOwnProperty(i)){let o=tC(n[i],e[i]);o.didChange&&(n[i]=o.newValue,t=!0)}return new _d(n,t)}var iu=class{constructor(e){this.schema=void 0,this.id=e,this.name="_never_",this.defaultValue=void 0}applyUpdate(e,t){return tC(e,t)}validate(e){return this.defaultValue}},bd=class{constructor(e,t,i,o){this.id=e,this.name=t,this.defaultValue=i,this.schema=o}applyUpdate(e,t){return tC(e,t)}validate(e){return typeof e>"u"?this.defaultValue:e}compute(e,t,i){return i}};function we(n,e){return typeof n>"u"?e:n==="false"?!1:!!n}var yt=class extends bd{constructor(e,t,i,o=void 0){typeof o<"u"&&(o.type="boolean",o.default=i),super(e,t,i,o)}validate(e){return we(e,this.defaultValue)}};function Cd(n,e,t,i){if(typeof n>"u")return e;let o=parseInt(n,10);return isNaN(o)?e:(o=Math.max(t,o),o=Math.min(i,o),o|0)}var zt=class n extends bd{static clampedInt(e,t,i,o){return Cd(e,t,i,o)}constructor(e,t,i,o,s,r=void 0){typeof r<"u"&&(r.type="integer",r.default=i,r.minimum=o,r.maximum=s),super(e,t,i,r),this.minimum=o,this.maximum=s}validate(e){return n.clampedInt(e,this.defaultValue,this.minimum,this.maximum)}};function S9(n,e,t,i){if(typeof n>"u")return e;let o=Gs.float(n,e);return Gs.clamp(o,t,i)}var Gs=class n extends bd{static clamp(e,t,i){return ei?i:e}static float(e,t){if(typeof e=="number")return e;if(typeof e>"u")return t;let i=parseFloat(e);return isNaN(i)?t:i}constructor(e,t,i,o,s){typeof s<"u"&&(s.type="number",s.default=i),super(e,t,i,s),this.validationFn=o}validate(e){return this.validationFn(n.float(e,this.defaultValue))}},No=class n extends bd{static string(e,t){return typeof e!="string"?t:e}constructor(e,t,i,o=void 0){typeof o<"u"&&(o.type="string",o.default=i),super(e,t,i,o)}validate(e){return n.string(e,this.defaultValue)}};function wi(n,e,t,i){return typeof n!="string"?e:i&&n in i?i[n]:t.indexOf(n)===-1?e:n}var ai=class extends bd{constructor(e,t,i,o,s=void 0){typeof s<"u"&&(s.type="string",s.enum=o,s.default=i),super(e,t,i,s),this._allowedValues=o}validate(e){return wi(e,this.defaultValue,this._allowedValues)}},fg=class extends jt{constructor(e,t,i,o,s,r,a=void 0){typeof a<"u"&&(a.type="string",a.enum=s,a.default=o),super(e,t,i,a),this._allowedValues=s,this._convert=r}validate(e){return typeof e!="string"?this.defaultValue:this._allowedValues.indexOf(e)===-1?this.defaultValue:this._convert(e)}};function XK(n){switch(n){case"none":return 0;case"keep":return 1;case"brackets":return 2;case"advanced":return 3;case"full":return 4}}var kI=class extends jt{constructor(){super(2,"accessibilitySupport",0,{type:"string",enum:["auto","on","off"],enumDescriptions:[p("accessibilitySupport.auto","Use platform APIs to detect when a Screen Reader is attached."),p("accessibilitySupport.on","Optimize for usage with a Screen Reader."),p("accessibilitySupport.off","Assume a screen reader is not attached.")],default:"auto",tags:["accessibility"],description:p("accessibilitySupport","Controls if the UI should run in a mode where it is optimized for screen readers.")})}validate(e){switch(e){case"auto":return 0;case"off":return 1;case"on":return 2}return this.defaultValue}compute(e,t,i){return i===0?e.accessibilitySupport:i}},DI=class extends jt{constructor(){let e={insertSpace:!0,ignoreEmptyLines:!0};super(23,"comments",e,{"editor.comments.insertSpace":{type:"boolean",default:e.insertSpace,description:p("comments.insertSpace","Controls whether a space character is inserted when commenting.")},"editor.comments.ignoreEmptyLines":{type:"boolean",default:e.ignoreEmptyLines,description:p("comments.ignoreEmptyLines","Controls if empty lines should be ignored with toggle, add or remove actions for line comments.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;let t=e;return{insertSpace:we(t.insertSpace,this.defaultValue.insertSpace),ignoreEmptyLines:we(t.ignoreEmptyLines,this.defaultValue.ignoreEmptyLines)}}};function QK(n){switch(n){case"blink":return 1;case"smooth":return 2;case"phase":return 3;case"expand":return 4;case"solid":return 5}}var on;(function(n){n[n.Line=1]="Line",n[n.Block=2]="Block",n[n.Underline=3]="Underline",n[n.LineThin=4]="LineThin",n[n.BlockOutline=5]="BlockOutline",n[n.UnderlineThin=6]="UnderlineThin"})(on||(on={}));function JK(n){switch(n){case"line":return on.Line;case"block":return on.Block;case"underline":return on.Underline;case"line-thin":return on.LineThin;case"block-outline":return on.BlockOutline;case"underline-thin":return on.UnderlineThin}}var EI=class extends iu{constructor(){super(142)}compute(e,t,i){let o=["monaco-editor"];return t.get(39)&&o.push(t.get(39)),e.extraEditorClassName&&o.push(e.extraEditorClassName),t.get(74)==="default"?o.push("mouse-default"):t.get(74)==="copy"&&o.push("mouse-copy"),t.get(111)&&o.push("showUnused"),t.get(140)&&o.push("showDeprecated"),o.join(" ")}},II=class extends yt{constructor(){super(37,"emptySelectionClipboard",!0,{description:p("emptySelectionClipboard","Controls whether copying without a selection copies the current line.")})}compute(e,t,i){return i&&e.emptySelectionClipboard}},TI=class extends jt{constructor(){let e={cursorMoveOnType:!0,seedSearchStringFromSelection:"always",autoFindInSelection:"never",globalFindClipboard:!1,addExtraSpaceOnTop:!0,loop:!0};super(41,"find",e,{"editor.find.cursorMoveOnType":{type:"boolean",default:e.cursorMoveOnType,description:p("find.cursorMoveOnType","Controls whether the cursor should jump to find matches while typing.")},"editor.find.seedSearchStringFromSelection":{type:"string",enum:["never","always","selection"],default:e.seedSearchStringFromSelection,enumDescriptions:[p("editor.find.seedSearchStringFromSelection.never","Never seed search string from the editor selection."),p("editor.find.seedSearchStringFromSelection.always","Always seed search string from the editor selection, including word at cursor position."),p("editor.find.seedSearchStringFromSelection.selection","Only seed search string from the editor selection.")],description:p("find.seedSearchStringFromSelection","Controls whether the search string in the Find Widget is seeded from the editor selection.")},"editor.find.autoFindInSelection":{type:"string",enum:["never","always","multiline"],default:e.autoFindInSelection,enumDescriptions:[p("editor.find.autoFindInSelection.never","Never turn on Find in Selection automatically (default)."),p("editor.find.autoFindInSelection.always","Always turn on Find in Selection automatically."),p("editor.find.autoFindInSelection.multiline","Turn on Find in Selection automatically when multiple lines of content are selected.")],description:p("find.autoFindInSelection","Controls the condition for turning on Find in Selection automatically.")},"editor.find.globalFindClipboard":{type:"boolean",default:e.globalFindClipboard,description:p("find.globalFindClipboard","Controls whether the Find Widget should read or modify the shared find clipboard on macOS."),included:Be},"editor.find.addExtraSpaceOnTop":{type:"boolean",default:e.addExtraSpaceOnTop,description:p("find.addExtraSpaceOnTop","Controls whether the Find Widget should add extra lines on top of the editor. When true, you can scroll beyond the first line when the Find Widget is visible.")},"editor.find.loop":{type:"boolean",default:e.loop,description:p("find.loop","Controls whether the search automatically restarts from the beginning (or the end) when no further matches can be found.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;let t=e;return{cursorMoveOnType:we(t.cursorMoveOnType,this.defaultValue.cursorMoveOnType),seedSearchStringFromSelection:typeof e.seedSearchStringFromSelection=="boolean"?e.seedSearchStringFromSelection?"always":"never":wi(t.seedSearchStringFromSelection,this.defaultValue.seedSearchStringFromSelection,["never","always","selection"]),autoFindInSelection:typeof e.autoFindInSelection=="boolean"?e.autoFindInSelection?"always":"never":wi(t.autoFindInSelection,this.defaultValue.autoFindInSelection,["never","always","multiline"]),globalFindClipboard:we(t.globalFindClipboard,this.defaultValue.globalFindClipboard),addExtraSpaceOnTop:we(t.addExtraSpaceOnTop,this.defaultValue.addExtraSpaceOnTop),loop:we(t.loop,this.defaultValue.loop)}}},Zs=class n extends jt{constructor(){super(51,"fontLigatures",n.OFF,{anyOf:[{type:"boolean",description:p("fontLigatures","Enables/Disables font ligatures ('calt' and 'liga' font features). Change this to a string for fine-grained control of the 'font-feature-settings' CSS property.")},{type:"string",description:p("fontFeatureSettings","Explicit 'font-feature-settings' CSS property. A boolean can be passed instead if one only needs to turn on/off ligatures.")}],description:p("fontLigaturesGeneral","Configures font ligatures or font features. Can be either a boolean to enable/disable ligatures or a string for the value of the CSS 'font-feature-settings' property."),default:!1})}validate(e){return typeof e>"u"?this.defaultValue:typeof e=="string"?e==="false"||e.length===0?n.OFF:e==="true"?n.ON:e:e?n.ON:n.OFF}};Zs.OFF='"liga" off, "calt" off';Zs.ON='"liga" on, "calt" on';var vd=class n extends jt{constructor(){super(54,"fontVariations",n.OFF,{anyOf:[{type:"boolean",description:p("fontVariations","Enables/Disables the translation from font-weight to font-variation-settings. Change this to a string for fine-grained control of the 'font-variation-settings' CSS property.")},{type:"string",description:p("fontVariationSettings","Explicit 'font-variation-settings' CSS property. A boolean can be passed instead if one only needs to translate font-weight to font-variation-settings.")}],description:p("fontVariationsGeneral","Configures font variations. Can be either a boolean to enable/disable the translation from font-weight to font-variation-settings or a string for the value of the CSS 'font-variation-settings' property."),default:!1})}validate(e){return typeof e>"u"?this.defaultValue:typeof e=="string"?e==="false"?n.OFF:e==="true"?n.TRANSLATE:e:e?n.TRANSLATE:n.OFF}compute(e,t,i){return e.fontInfo.fontVariationSettings}};vd.OFF="normal";vd.TRANSLATE="translate";var NI=class extends iu{constructor(){super(50)}compute(e,t,i){return e.fontInfo}},AI=class extends bd{constructor(){super(52,"fontSize",Ao.fontSize,{type:"number",minimum:6,maximum:100,default:Ao.fontSize,description:p("fontSize","Controls the font size in pixels.")})}validate(e){let t=Gs.float(e,this.defaultValue);return t===0?Ao.fontSize:Gs.clamp(t,6,100)}compute(e,t,i){return e.fontInfo.fontSize}},pg=class n extends jt{constructor(){super(53,"fontWeight",Ao.fontWeight,{anyOf:[{type:"number",minimum:n.MINIMUM_VALUE,maximum:n.MAXIMUM_VALUE,errorMessage:p("fontWeightErrorMessage",'Only "normal" and "bold" keywords or numbers between 1 and 1000 are allowed.')},{type:"string",pattern:"^(normal|bold|1000|[1-9][0-9]{0,2})$"},{enum:n.SUGGESTION_VALUES}],default:Ao.fontWeight,description:p("fontWeight",'Controls the font weight. Accepts "normal" and "bold" keywords or numbers between 1 and 1000.')})}validate(e){return e==="normal"||e==="bold"?e:String(zt.clampedInt(e,Ao.fontWeight,n.MINIMUM_VALUE,n.MAXIMUM_VALUE))}};pg.SUGGESTION_VALUES=["normal","bold","100","200","300","400","500","600","700","800","900"];pg.MINIMUM_VALUE=1;pg.MAXIMUM_VALUE=1e3;var MI=class extends jt{constructor(){let e={multiple:"peek",multipleDefinitions:"peek",multipleTypeDefinitions:"peek",multipleDeclarations:"peek",multipleImplementations:"peek",multipleReferences:"peek",alternativeDefinitionCommand:"editor.action.goToReferences",alternativeTypeDefinitionCommand:"editor.action.goToReferences",alternativeDeclarationCommand:"editor.action.goToReferences",alternativeImplementationCommand:"",alternativeReferenceCommand:""},t={type:"string",enum:["peek","gotoAndPeek","goto"],default:e.multiple,enumDescriptions:[p("editor.gotoLocation.multiple.peek","Show Peek view of the results (default)"),p("editor.gotoLocation.multiple.gotoAndPeek","Go to the primary result and show a Peek view"),p("editor.gotoLocation.multiple.goto","Go to the primary result and enable Peek-less navigation to others")]},i=["","editor.action.referenceSearch.trigger","editor.action.goToReferences","editor.action.peekImplementation","editor.action.goToImplementation","editor.action.peekTypeDefinition","editor.action.goToTypeDefinition","editor.action.peekDeclaration","editor.action.revealDeclaration","editor.action.peekDefinition","editor.action.revealDefinitionAside","editor.action.revealDefinition"];super(58,"gotoLocation",e,{"editor.gotoLocation.multiple":{deprecationMessage:p("editor.gotoLocation.multiple.deprecated","This setting is deprecated, please use separate settings like 'editor.editor.gotoLocation.multipleDefinitions' or 'editor.editor.gotoLocation.multipleImplementations' instead.")},"editor.gotoLocation.multipleDefinitions":{description:p("editor.editor.gotoLocation.multipleDefinitions","Controls the behavior the 'Go to Definition'-command when multiple target locations exist."),...t},"editor.gotoLocation.multipleTypeDefinitions":{description:p("editor.editor.gotoLocation.multipleTypeDefinitions","Controls the behavior the 'Go to Type Definition'-command when multiple target locations exist."),...t},"editor.gotoLocation.multipleDeclarations":{description:p("editor.editor.gotoLocation.multipleDeclarations","Controls the behavior the 'Go to Declaration'-command when multiple target locations exist."),...t},"editor.gotoLocation.multipleImplementations":{description:p("editor.editor.gotoLocation.multipleImplemenattions","Controls the behavior the 'Go to Implementations'-command when multiple target locations exist."),...t},"editor.gotoLocation.multipleReferences":{description:p("editor.editor.gotoLocation.multipleReferences","Controls the behavior the 'Go to References'-command when multiple target locations exist."),...t},"editor.gotoLocation.alternativeDefinitionCommand":{type:"string",default:e.alternativeDefinitionCommand,enum:i,description:p("alternativeDefinitionCommand","Alternative command id that is being executed when the result of 'Go to Definition' is the current location.")},"editor.gotoLocation.alternativeTypeDefinitionCommand":{type:"string",default:e.alternativeTypeDefinitionCommand,enum:i,description:p("alternativeTypeDefinitionCommand","Alternative command id that is being executed when the result of 'Go to Type Definition' is the current location.")},"editor.gotoLocation.alternativeDeclarationCommand":{type:"string",default:e.alternativeDeclarationCommand,enum:i,description:p("alternativeDeclarationCommand","Alternative command id that is being executed when the result of 'Go to Declaration' is the current location.")},"editor.gotoLocation.alternativeImplementationCommand":{type:"string",default:e.alternativeImplementationCommand,enum:i,description:p("alternativeImplementationCommand","Alternative command id that is being executed when the result of 'Go to Implementation' is the current location.")},"editor.gotoLocation.alternativeReferenceCommand":{type:"string",default:e.alternativeReferenceCommand,enum:i,description:p("alternativeReferenceCommand","Alternative command id that is being executed when the result of 'Go to Reference' is the current location.")}})}validate(e){var t,i,o,s,r;if(!e||typeof e!="object")return this.defaultValue;let a=e;return{multiple:wi(a.multiple,this.defaultValue.multiple,["peek","gotoAndPeek","goto"]),multipleDefinitions:(t=a.multipleDefinitions)!==null&&t!==void 0?t:wi(a.multipleDefinitions,"peek",["peek","gotoAndPeek","goto"]),multipleTypeDefinitions:(i=a.multipleTypeDefinitions)!==null&&i!==void 0?i:wi(a.multipleTypeDefinitions,"peek",["peek","gotoAndPeek","goto"]),multipleDeclarations:(o=a.multipleDeclarations)!==null&&o!==void 0?o:wi(a.multipleDeclarations,"peek",["peek","gotoAndPeek","goto"]),multipleImplementations:(s=a.multipleImplementations)!==null&&s!==void 0?s:wi(a.multipleImplementations,"peek",["peek","gotoAndPeek","goto"]),multipleReferences:(r=a.multipleReferences)!==null&&r!==void 0?r:wi(a.multipleReferences,"peek",["peek","gotoAndPeek","goto"]),alternativeDefinitionCommand:No.string(a.alternativeDefinitionCommand,this.defaultValue.alternativeDefinitionCommand),alternativeTypeDefinitionCommand:No.string(a.alternativeTypeDefinitionCommand,this.defaultValue.alternativeTypeDefinitionCommand),alternativeDeclarationCommand:No.string(a.alternativeDeclarationCommand,this.defaultValue.alternativeDeclarationCommand),alternativeImplementationCommand:No.string(a.alternativeImplementationCommand,this.defaultValue.alternativeImplementationCommand),alternativeReferenceCommand:No.string(a.alternativeReferenceCommand,this.defaultValue.alternativeReferenceCommand)}}},RI=class extends jt{constructor(){let e={enabled:!0,delay:300,hidingDelay:300,sticky:!0,above:!0};super(60,"hover",e,{"editor.hover.enabled":{type:"boolean",default:e.enabled,description:p("hover.enabled","Controls whether the hover is shown.")},"editor.hover.delay":{type:"number",default:e.delay,minimum:0,maximum:1e4,description:p("hover.delay","Controls the delay in milliseconds after which the hover is shown.")},"editor.hover.sticky":{type:"boolean",default:e.sticky,description:p("hover.sticky","Controls whether the hover should remain visible when mouse is moved over it.")},"editor.hover.hidingDelay":{type:"integer",minimum:0,default:e.hidingDelay,description:p("hover.hidingDelay","Controls the delay in milliseconds after which the hover is hidden. Requires `editor.hover.sticky` to be enabled.")},"editor.hover.above":{type:"boolean",default:e.above,description:p("hover.above","Prefer showing hovers above the line, if there's space.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;let t=e;return{enabled:we(t.enabled,this.defaultValue.enabled),delay:zt.clampedInt(t.delay,this.defaultValue.delay,0,1e4),sticky:we(t.sticky,this.defaultValue.sticky),hidingDelay:zt.clampedInt(t.hidingDelay,this.defaultValue.hidingDelay,0,6e5),above:we(t.above,this.defaultValue.above)}}},M_=class n extends iu{constructor(){super(145)}compute(e,t,i){return n.computeLayout(t,{memory:e.memory,outerWidth:e.outerWidth,outerHeight:e.outerHeight,isDominatedByLongLines:e.isDominatedByLongLines,lineHeight:e.fontInfo.lineHeight,viewLineCount:e.viewLineCount,lineNumbersDigitCount:e.lineNumbersDigitCount,typicalHalfwidthCharacterWidth:e.fontInfo.typicalHalfwidthCharacterWidth,maxDigitWidth:e.fontInfo.maxDigitWidth,pixelRatio:e.pixelRatio,glyphMarginDecorationLaneCount:e.glyphMarginDecorationLaneCount})}static computeContainedMinimapLineCount(e){let t=e.height/e.lineHeight,i=Math.floor(e.paddingTop/e.lineHeight),o=Math.floor(e.paddingBottom/e.lineHeight);e.scrollBeyondLastLine&&(o=Math.max(o,t-1));let s=(i+e.viewLineCount+o)/(e.pixelRatio*e.height),r=Math.floor(e.viewLineCount/s);return{typicalViewportLineCount:t,extraLinesBeforeFirstLine:i,extraLinesBeyondLastLine:o,desiredRatio:s,minimapLineCount:r}}static _computeMinimapLayout(e,t){let i=e.outerWidth,o=e.outerHeight,s=e.pixelRatio;if(!e.minimap.enabled)return{renderMinimap:0,minimapLeft:0,minimapWidth:0,minimapHeightIsEditorHeight:!1,minimapIsSampling:!1,minimapScale:1,minimapLineHeight:1,minimapCanvasInnerWidth:0,minimapCanvasInnerHeight:Math.floor(s*o),minimapCanvasOuterWidth:0,minimapCanvasOuterHeight:o};let r=t.stableMinimapLayoutInput,a=r&&e.outerHeight===r.outerHeight&&e.lineHeight===r.lineHeight&&e.typicalHalfwidthCharacterWidth===r.typicalHalfwidthCharacterWidth&&e.pixelRatio===r.pixelRatio&&e.scrollBeyondLastLine===r.scrollBeyondLastLine&&e.paddingTop===r.paddingTop&&e.paddingBottom===r.paddingBottom&&e.minimap.enabled===r.minimap.enabled&&e.minimap.side===r.minimap.side&&e.minimap.size===r.minimap.size&&e.minimap.showSlider===r.minimap.showSlider&&e.minimap.renderCharacters===r.minimap.renderCharacters&&e.minimap.maxColumn===r.minimap.maxColumn&&e.minimap.scale===r.minimap.scale&&e.verticalScrollbarWidth===r.verticalScrollbarWidth&&e.isViewportWrapping===r.isViewportWrapping,l=e.lineHeight,c=e.typicalHalfwidthCharacterWidth,d=e.scrollBeyondLastLine,h=e.minimap.renderCharacters,u=s>=2?Math.round(e.minimap.scale*2):e.minimap.scale,f=e.minimap.maxColumn,g=e.minimap.size,m=e.minimap.side,C=e.verticalScrollbarWidth,S=e.viewLineCount,w=e.remainingWidth,y=e.isViewportWrapping,x=h?2:3,k=Math.floor(s*o),T=k/s,N=!1,M=!1,W=x*u,j=u/s,G=1;if(g==="fill"||g==="fit"){let{typicalViewportLineCount:Se,extraLinesBeforeFirstLine:pe,extraLinesBeyondLastLine:Pe,desiredRatio:Qe,minimapLineCount:Te}=n.computeContainedMinimapLineCount({viewLineCount:S,scrollBeyondLastLine:d,paddingTop:e.paddingTop,paddingBottom:e.paddingBottom,height:o,lineHeight:l,pixelRatio:s});if(S/Te>1)N=!0,M=!0,u=1,W=1,j=u/s;else{let Ki=!1,Vn=u+1;if(g==="fit"){let Gi=Math.ceil((pe+S+Pe)*W);y&&a&&w<=t.stableFitRemainingWidth?(Ki=!0,Vn=t.stableFitMaxMinimapScale):Ki=Gi>k}if(g==="fill"||Ki){N=!0;let Gi=u;W=Math.min(l*s,Math.max(1,Math.floor(1/Qe))),y&&a&&w<=t.stableFitRemainingWidth&&(Vn=t.stableFitMaxMinimapScale),u=Math.min(Vn,Math.max(1,Math.floor(W/x))),u>Gi&&(G=Math.min(2,u/Gi)),j=u/s/G,k=Math.ceil(Math.max(Se,pe+S+Pe)*W),y?(t.stableMinimapLayoutInput=e,t.stableFitRemainingWidth=w,t.stableFitMaxMinimapScale=u):(t.stableMinimapLayoutInput=null,t.stableFitRemainingWidth=0)}}}let V=Math.floor(f*j),z=Math.min(V,Math.max(0,Math.floor((w-C-2)*j/(c+j)))+va),te=Math.floor(s*z),ee=te/s;te=Math.floor(te*G);let ce=h?1:2,Ce=m==="left"?0:i-z-C;return{renderMinimap:ce,minimapLeft:Ce,minimapWidth:z,minimapHeightIsEditorHeight:N,minimapIsSampling:M,minimapScale:u,minimapLineHeight:W,minimapCanvasInnerWidth:te,minimapCanvasInnerHeight:k,minimapCanvasOuterWidth:ee,minimapCanvasOuterHeight:T}}static computeLayout(e,t){let i=t.outerWidth|0,o=t.outerHeight|0,s=t.lineHeight|0,r=t.lineNumbersDigitCount|0,a=t.typicalHalfwidthCharacterWidth,l=t.maxDigitWidth,c=t.pixelRatio,d=t.viewLineCount,h=e.get(137),u=h==="inherit"?e.get(136):h,f=u==="inherit"?e.get(132):u,g=e.get(135),m=t.isDominatedByLongLines,C=e.get(57),S=e.get(68).renderType!==0,w=e.get(69),y=e.get(105),x=e.get(84),k=e.get(73),T=e.get(103),N=T.verticalScrollbarSize,M=T.verticalHasArrows,W=T.arrowSize,j=T.horizontalScrollbarSize,G=e.get(43),V=e.get(110)!=="never",z=e.get(66);G&&V&&(z+=16);let te=0;if(S){let Ot=Math.max(r,w);te=Math.round(Ot*l)}let ee=0;C&&(ee=s*t.glyphMarginDecorationLaneCount);let ce=0,Ce=ce+ee,Se=Ce+te,pe=Se+z,Pe=i-ee-te-z,Qe=!1,Te=!1,de=-1;u==="inherit"&&m?(Qe=!0,Te=!0):f==="on"||f==="bounded"?Te=!0:f==="wordWrapColumn"&&(de=g);let Ki=n._computeMinimapLayout({outerWidth:i,outerHeight:o,lineHeight:s,typicalHalfwidthCharacterWidth:a,pixelRatio:c,scrollBeyondLastLine:y,paddingTop:x.top,paddingBottom:x.bottom,minimap:k,verticalScrollbarWidth:N,viewLineCount:d,remainingWidth:Pe,isViewportWrapping:Te},t.memory||new A_);Ki.renderMinimap!==0&&Ki.minimapLeft===0&&(ce+=Ki.minimapWidth,Ce+=Ki.minimapWidth,Se+=Ki.minimapWidth,pe+=Ki.minimapWidth);let Vn=Pe-Ki.minimapWidth,Gi=Math.max(1,Math.floor((Vn-N-2)/a)),Ns=M?W:0;return Te&&(de=Math.max(1,Gi),f==="bounded"&&(de=Math.min(de,g))),{width:i,height:o,glyphMarginLeft:ce,glyphMarginWidth:ee,glyphMarginDecorationLaneCount:t.glyphMarginDecorationLaneCount,lineNumbersLeft:Ce,lineNumbersWidth:te,decorationsLeft:Se,decorationsWidth:z,contentLeft:pe,contentWidth:Vn,minimap:Ki,viewportColumn:Gi,isWordWrapMinified:Qe,isViewportWrapping:Te,wrappingColumn:de,verticalScrollbarWidth:N,horizontalScrollbarHeight:j,overviewRuler:{top:Ns,width:N,height:o-2*Ns,right:0}}}},PI=class extends jt{constructor(){super(139,"wrappingStrategy","simple",{"editor.wrappingStrategy":{enumDescriptions:[p("wrappingStrategy.simple","Assumes that all characters are of the same width. This is a fast algorithm that works correctly for monospace fonts and certain scripts (like Latin characters) where glyphs are of equal width."),p("wrappingStrategy.advanced","Delegates wrapping points computation to the browser. This is a slow algorithm, that might cause freezes for large files, but it works correctly in all cases.")],type:"string",enum:["simple","advanced"],default:"simple",description:p("wrappingStrategy","Controls the algorithm that computes wrapping points. Note that when in accessibility mode, advanced will be used for the best experience.")}})}validate(e){return wi(e,"simple",["simple","advanced"])}compute(e,t,i){return t.get(2)===2?"advanced":i}},Cc;(function(n){n.Off="off",n.OnCode="onCode",n.On="on"})(Cc||(Cc={}));var OI=class extends jt{constructor(){let e={enabled:Cc.On};super(65,"lightbulb",e,{"editor.lightbulb.enabled":{type:"string",tags:["experimental"],enum:[Cc.Off,Cc.OnCode,Cc.On],default:e.enabled,enumDescriptions:[p("editor.lightbulb.enabled.off","Disable the code action menu."),p("editor.lightbulb.enabled.onCode","Show the code action menu when the cursor is on lines with code."),p("editor.lightbulb.enabled.on","Show the code action menu when the cursor is on lines with code or on empty lines.")],description:p("enabled","Enables the Code Action lightbulb in the editor.")}})}validate(e){return!e||typeof e!="object"?this.defaultValue:{enabled:wi(e.enabled,this.defaultValue.enabled,[Cc.Off,Cc.OnCode,Cc.On])}}},FI=class extends jt{constructor(){let e={enabled:!0,maxLineCount:5,defaultModel:"outlineModel",scrollWithEditor:!0};super(115,"stickyScroll",e,{"editor.stickyScroll.enabled":{type:"boolean",default:e.enabled,description:p("editor.stickyScroll.enabled","Shows the nested current scopes during the scroll at the top of the editor."),tags:["experimental"]},"editor.stickyScroll.maxLineCount":{type:"number",default:e.maxLineCount,minimum:1,maximum:20,description:p("editor.stickyScroll.maxLineCount","Defines the maximum number of sticky lines to show.")},"editor.stickyScroll.defaultModel":{type:"string",enum:["outlineModel","foldingProviderModel","indentationModel"],default:e.defaultModel,description:p("editor.stickyScroll.defaultModel","Defines the model to use for determining which lines to stick. If the outline model does not exist, it will fall back on the folding provider model which falls back on the indentation model. This order is respected in all three cases.")},"editor.stickyScroll.scrollWithEditor":{type:"boolean",default:e.scrollWithEditor,description:p("editor.stickyScroll.scrollWithEditor","Enable scrolling of Sticky Scroll with the editor's horizontal scrollbar.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;let t=e;return{enabled:we(t.enabled,this.defaultValue.enabled),maxLineCount:zt.clampedInt(t.maxLineCount,this.defaultValue.maxLineCount,1,20),defaultModel:wi(t.defaultModel,this.defaultValue.defaultModel,["outlineModel","foldingProviderModel","indentationModel"]),scrollWithEditor:we(t.scrollWithEditor,this.defaultValue.scrollWithEditor)}}},BI=class extends jt{constructor(){let e={enabled:"on",fontSize:0,fontFamily:"",padding:!1};super(141,"inlayHints",e,{"editor.inlayHints.enabled":{type:"string",default:e.enabled,description:p("inlayHints.enable","Enables the inlay hints in the editor."),enum:["on","onUnlessPressed","offUnlessPressed","off"],markdownEnumDescriptions:[p("editor.inlayHints.on","Inlay hints are enabled"),p("editor.inlayHints.onUnlessPressed","Inlay hints are showing by default and hide when holding {0}",Be?"Ctrl+Option":"Ctrl+Alt"),p("editor.inlayHints.offUnlessPressed","Inlay hints are hidden by default and show when holding {0}",Be?"Ctrl+Option":"Ctrl+Alt"),p("editor.inlayHints.off","Inlay hints are disabled")]},"editor.inlayHints.fontSize":{type:"number",default:e.fontSize,markdownDescription:p("inlayHints.fontSize","Controls font size of inlay hints in the editor. As default the {0} is used when the configured value is less than {1} or greater than the editor font size.","`#editor.fontSize#`","`5`")},"editor.inlayHints.fontFamily":{type:"string",default:e.fontFamily,markdownDescription:p("inlayHints.fontFamily","Controls font family of inlay hints in the editor. When set to empty, the {0} is used.","`#editor.fontFamily#`")},"editor.inlayHints.padding":{type:"boolean",default:e.padding,description:p("inlayHints.padding","Enables the padding around the inlay hints in the editor.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;let t=e;return typeof t.enabled=="boolean"&&(t.enabled=t.enabled?"on":"off"),{enabled:wi(t.enabled,this.defaultValue.enabled,["on","off","offUnlessPressed","onUnlessPressed"]),fontSize:zt.clampedInt(t.fontSize,this.defaultValue.fontSize,0,100),fontFamily:No.string(t.fontFamily,this.defaultValue.fontFamily),padding:we(t.padding,this.defaultValue.padding)}}},WI=class extends jt{constructor(){super(66,"lineDecorationsWidth",10)}validate(e){return typeof e=="string"&&/^\d+(\.\d+)?ch$/.test(e)?-parseFloat(e.substring(0,e.length-2)):zt.clampedInt(e,this.defaultValue,0,1e3)}compute(e,t,i){return i<0?zt.clampedInt(-i*e.fontInfo.typicalHalfwidthCharacterWidth,this.defaultValue,0,1e3):i}},zI=class extends Gs{constructor(){super(67,"lineHeight",Ao.lineHeight,e=>Gs.clamp(e,0,150),{markdownDescription:p("lineHeight",`Controls the line height. + - Use 0 to automatically compute the line height from the font size. + - Values between 0 and 8 will be used as a multiplier with the font size. + - Values greater than or equal to 8 will be used as effective values.`)})}compute(e,t,i){return e.fontInfo.lineHeight}},VI=class extends jt{constructor(){let e={enabled:!0,size:"proportional",side:"right",showSlider:"mouseover",autohide:!1,renderCharacters:!0,maxColumn:120,scale:1,showRegionSectionHeaders:!0,showMarkSectionHeaders:!0,sectionHeaderFontSize:9};super(73,"minimap",e,{"editor.minimap.enabled":{type:"boolean",default:e.enabled,description:p("minimap.enabled","Controls whether the minimap is shown.")},"editor.minimap.autohide":{type:"boolean",default:e.autohide,description:p("minimap.autohide","Controls whether the minimap is hidden automatically.")},"editor.minimap.size":{type:"string",enum:["proportional","fill","fit"],enumDescriptions:[p("minimap.size.proportional","The minimap has the same size as the editor contents (and might scroll)."),p("minimap.size.fill","The minimap will stretch or shrink as necessary to fill the height of the editor (no scrolling)."),p("minimap.size.fit","The minimap will shrink as necessary to never be larger than the editor (no scrolling).")],default:e.size,description:p("minimap.size","Controls the size of the minimap.")},"editor.minimap.side":{type:"string",enum:["left","right"],default:e.side,description:p("minimap.side","Controls the side where to render the minimap.")},"editor.minimap.showSlider":{type:"string",enum:["always","mouseover"],default:e.showSlider,description:p("minimap.showSlider","Controls when the minimap slider is shown.")},"editor.minimap.scale":{type:"number",default:e.scale,minimum:1,maximum:3,enum:[1,2,3],description:p("minimap.scale","Scale of content drawn in the minimap: 1, 2 or 3.")},"editor.minimap.renderCharacters":{type:"boolean",default:e.renderCharacters,description:p("minimap.renderCharacters","Render the actual characters on a line as opposed to color blocks.")},"editor.minimap.maxColumn":{type:"number",default:e.maxColumn,description:p("minimap.maxColumn","Limit the width of the minimap to render at most a certain number of columns.")},"editor.minimap.showRegionSectionHeaders":{type:"boolean",default:e.showRegionSectionHeaders,description:p("minimap.showRegionSectionHeaders","Controls whether named regions are shown as section headers in the minimap.")},"editor.minimap.showMarkSectionHeaders":{type:"boolean",default:e.showMarkSectionHeaders,description:p("minimap.showMarkSectionHeaders","Controls whether MARK: comments are shown as section headers in the minimap.")},"editor.minimap.sectionHeaderFontSize":{type:"number",default:e.sectionHeaderFontSize,description:p("minimap.sectionHeaderFontSize","Controls the font size of section headers in the minimap.")}})}validate(e){var t;if(!e||typeof e!="object")return this.defaultValue;let i=e;return{enabled:we(i.enabled,this.defaultValue.enabled),autohide:we(i.autohide,this.defaultValue.autohide),size:wi(i.size,this.defaultValue.size,["proportional","fill","fit"]),side:wi(i.side,this.defaultValue.side,["right","left"]),showSlider:wi(i.showSlider,this.defaultValue.showSlider,["always","mouseover"]),renderCharacters:we(i.renderCharacters,this.defaultValue.renderCharacters),scale:zt.clampedInt(i.scale,1,1,3),maxColumn:zt.clampedInt(i.maxColumn,this.defaultValue.maxColumn,1,1e4),showRegionSectionHeaders:we(i.showRegionSectionHeaders,this.defaultValue.showRegionSectionHeaders),showMarkSectionHeaders:we(i.showMarkSectionHeaders,this.defaultValue.showMarkSectionHeaders),sectionHeaderFontSize:Gs.clamp((t=i.sectionHeaderFontSize)!==null&&t!==void 0?t:this.defaultValue.sectionHeaderFontSize,4,32)}}};function e$(n){return n==="ctrlCmd"?Be?"metaKey":"ctrlKey":"altKey"}var HI=class extends jt{constructor(){super(84,"padding",{top:0,bottom:0},{"editor.padding.top":{type:"number",default:0,minimum:0,maximum:1e3,description:p("padding.top","Controls the amount of space between the top edge of the editor and the first line.")},"editor.padding.bottom":{type:"number",default:0,minimum:0,maximum:1e3,description:p("padding.bottom","Controls the amount of space between the bottom edge of the editor and the last line.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;let t=e;return{top:zt.clampedInt(t.top,0,0,1e3),bottom:zt.clampedInt(t.bottom,0,0,1e3)}}},UI=class extends jt{constructor(){let e={enabled:!0,cycle:!0};super(86,"parameterHints",e,{"editor.parameterHints.enabled":{type:"boolean",default:e.enabled,description:p("parameterHints.enabled","Enables a pop-up that shows parameter documentation and type information as you type.")},"editor.parameterHints.cycle":{type:"boolean",default:e.cycle,description:p("parameterHints.cycle","Controls whether the parameter hints menu cycles or closes when reaching the end of the list.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;let t=e;return{enabled:we(t.enabled,this.defaultValue.enabled),cycle:we(t.cycle,this.defaultValue.cycle)}}},KI=class extends iu{constructor(){super(143)}compute(e,t,i){return e.pixelRatio}},$I=class extends jt{constructor(){let e={other:"on",comments:"off",strings:"off"},t=[{type:"boolean"},{type:"string",enum:["on","inline","off"],enumDescriptions:[p("on","Quick suggestions show inside the suggest widget"),p("inline","Quick suggestions show as ghost text"),p("off","Quick suggestions are disabled")]}];super(89,"quickSuggestions",e,{type:"object",additionalProperties:!1,properties:{strings:{anyOf:t,default:e.strings,description:p("quickSuggestions.strings","Enable quick suggestions inside strings.")},comments:{anyOf:t,default:e.comments,description:p("quickSuggestions.comments","Enable quick suggestions inside comments.")},other:{anyOf:t,default:e.other,description:p("quickSuggestions.other","Enable quick suggestions outside of strings and comments.")}},default:e,markdownDescription:p("quickSuggestions","Controls whether suggestions should automatically show up while typing. This can be controlled for typing in comments, strings, and other code. Quick suggestion can be configured to show as ghost text or with the suggest widget. Also be aware of the '{0}'-setting which controls if suggestions are triggered by special characters.","#editor.suggestOnTriggerCharacters#")}),this.defaultValue=e}validate(e){if(typeof e=="boolean"){let c=e?"on":"off";return{comments:c,strings:c,other:c}}if(!e||typeof e!="object")return this.defaultValue;let{other:t,comments:i,strings:o}=e,s=["on","inline","off"],r,a,l;return typeof t=="boolean"?r=t?"on":"off":r=wi(t,this.defaultValue.other,s),typeof i=="boolean"?a=i?"on":"off":a=wi(i,this.defaultValue.comments,s),typeof o=="boolean"?l=o?"on":"off":l=wi(o,this.defaultValue.strings,s),{other:r,comments:a,strings:l}}},qI=class extends jt{constructor(){super(68,"lineNumbers",{renderType:1,renderFn:null},{type:"string",enum:["off","on","relative","interval"],enumDescriptions:[p("lineNumbers.off","Line numbers are not rendered."),p("lineNumbers.on","Line numbers are rendered as absolute number."),p("lineNumbers.relative","Line numbers are rendered as distance in lines to cursor position."),p("lineNumbers.interval","Line numbers are rendered every 10 lines.")],default:"on",description:p("lineNumbers","Controls the display of line numbers.")})}validate(e){let t=this.defaultValue.renderType,i=this.defaultValue.renderFn;return typeof e<"u"&&(typeof e=="function"?(t=4,i=e):e==="interval"?t=3:e==="relative"?t=2:e==="on"?t=1:t=0),{renderType:t,renderFn:i}}};function nu(n){let e=n.get(98);return e==="editable"?n.get(91):e!=="on"}var jI=class extends jt{constructor(){let e=[],t={type:"number",description:p("rulers.size","Number of monospace characters at which this editor ruler will render.")};super(102,"rulers",e,{type:"array",items:{anyOf:[t,{type:["object"],properties:{column:t,color:{type:"string",description:p("rulers.color","Color of this editor ruler."),format:"color-hex"}}}]},default:e,description:p("rulers","Render vertical rulers after a certain number of monospace characters. Use multiple values for multiple rulers. No rulers are drawn if array is empty.")})}validate(e){if(Array.isArray(e)){let t=[];for(let i of e)if(typeof i=="number")t.push({column:zt.clampedInt(i,0,0,1e4),color:null});else if(i&&typeof i=="object"){let o=i;t.push({column:zt.clampedInt(o.column,0,0,1e4),color:o.color})}return t.sort((i,o)=>i.column-o.column),t}return this.defaultValue}},GI=class extends jt{constructor(){super(92,"readOnlyMessage",void 0)}validate(e){return!e||typeof e!="object"?this.defaultValue:e}};function y9(n,e){if(typeof n!="string")return e;switch(n){case"hidden":return 2;case"visible":return 3;default:return 1}}var ZI=class extends jt{constructor(){let e={vertical:1,horizontal:1,arrowSize:11,useShadows:!0,verticalHasArrows:!1,horizontalHasArrows:!1,horizontalScrollbarSize:12,horizontalSliderSize:12,verticalScrollbarSize:14,verticalSliderSize:14,handleMouseWheel:!0,alwaysConsumeMouseWheel:!0,scrollByPage:!1,ignoreHorizontalScrollbarInContentHeight:!1};super(103,"scrollbar",e,{"editor.scrollbar.vertical":{type:"string",enum:["auto","visible","hidden"],enumDescriptions:[p("scrollbar.vertical.auto","The vertical scrollbar will be visible only when necessary."),p("scrollbar.vertical.visible","The vertical scrollbar will always be visible."),p("scrollbar.vertical.fit","The vertical scrollbar will always be hidden.")],default:"auto",description:p("scrollbar.vertical","Controls the visibility of the vertical scrollbar.")},"editor.scrollbar.horizontal":{type:"string",enum:["auto","visible","hidden"],enumDescriptions:[p("scrollbar.horizontal.auto","The horizontal scrollbar will be visible only when necessary."),p("scrollbar.horizontal.visible","The horizontal scrollbar will always be visible."),p("scrollbar.horizontal.fit","The horizontal scrollbar will always be hidden.")],default:"auto",description:p("scrollbar.horizontal","Controls the visibility of the horizontal scrollbar.")},"editor.scrollbar.verticalScrollbarSize":{type:"number",default:e.verticalScrollbarSize,description:p("scrollbar.verticalScrollbarSize","The width of the vertical scrollbar.")},"editor.scrollbar.horizontalScrollbarSize":{type:"number",default:e.horizontalScrollbarSize,description:p("scrollbar.horizontalScrollbarSize","The height of the horizontal scrollbar.")},"editor.scrollbar.scrollByPage":{type:"boolean",default:e.scrollByPage,description:p("scrollbar.scrollByPage","Controls whether clicks scroll by page or jump to click position.")},"editor.scrollbar.ignoreHorizontalScrollbarInContentHeight":{type:"boolean",default:e.ignoreHorizontalScrollbarInContentHeight,description:p("scrollbar.ignoreHorizontalScrollbarInContentHeight","When set, the horizontal scrollbar will not increase the size of the editor's content.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;let t=e,i=zt.clampedInt(t.horizontalScrollbarSize,this.defaultValue.horizontalScrollbarSize,0,1e3),o=zt.clampedInt(t.verticalScrollbarSize,this.defaultValue.verticalScrollbarSize,0,1e3);return{arrowSize:zt.clampedInt(t.arrowSize,this.defaultValue.arrowSize,0,1e3),vertical:y9(t.vertical,this.defaultValue.vertical),horizontal:y9(t.horizontal,this.defaultValue.horizontal),useShadows:we(t.useShadows,this.defaultValue.useShadows),verticalHasArrows:we(t.verticalHasArrows,this.defaultValue.verticalHasArrows),horizontalHasArrows:we(t.horizontalHasArrows,this.defaultValue.horizontalHasArrows),handleMouseWheel:we(t.handleMouseWheel,this.defaultValue.handleMouseWheel),alwaysConsumeMouseWheel:we(t.alwaysConsumeMouseWheel,this.defaultValue.alwaysConsumeMouseWheel),horizontalScrollbarSize:i,horizontalSliderSize:zt.clampedInt(t.horizontalSliderSize,i,0,1e3),verticalScrollbarSize:o,verticalSliderSize:zt.clampedInt(t.verticalSliderSize,o,0,1e3),scrollByPage:we(t.scrollByPage,this.defaultValue.scrollByPage),ignoreHorizontalScrollbarInContentHeight:we(t.ignoreHorizontalScrollbarInContentHeight,this.defaultValue.ignoreHorizontalScrollbarInContentHeight)}}},ba="inUntrustedWorkspace",tu={allowedCharacters:"editor.unicodeHighlight.allowedCharacters",invisibleCharacters:"editor.unicodeHighlight.invisibleCharacters",nonBasicASCII:"editor.unicodeHighlight.nonBasicASCII",ambiguousCharacters:"editor.unicodeHighlight.ambiguousCharacters",includeComments:"editor.unicodeHighlight.includeComments",includeStrings:"editor.unicodeHighlight.includeStrings",allowedLocales:"editor.unicodeHighlight.allowedLocales"},YI=class extends jt{constructor(){let e={nonBasicASCII:ba,invisibleCharacters:!0,ambiguousCharacters:!0,includeComments:ba,includeStrings:!0,allowedCharacters:{},allowedLocales:{_os:!0,_vscode:!0}};super(125,"unicodeHighlight",e,{[tu.nonBasicASCII]:{restricted:!0,type:["boolean","string"],enum:[!0,!1,ba],default:e.nonBasicASCII,description:p("unicodeHighlight.nonBasicASCII","Controls whether all non-basic ASCII characters are highlighted. Only characters between U+0020 and U+007E, tab, line-feed and carriage-return are considered basic ASCII.")},[tu.invisibleCharacters]:{restricted:!0,type:"boolean",default:e.invisibleCharacters,description:p("unicodeHighlight.invisibleCharacters","Controls whether characters that just reserve space or have no width at all are highlighted.")},[tu.ambiguousCharacters]:{restricted:!0,type:"boolean",default:e.ambiguousCharacters,description:p("unicodeHighlight.ambiguousCharacters","Controls whether characters are highlighted that can be confused with basic ASCII characters, except those that are common in the current user locale.")},[tu.includeComments]:{restricted:!0,type:["boolean","string"],enum:[!0,!1,ba],default:e.includeComments,description:p("unicodeHighlight.includeComments","Controls whether characters in comments should also be subject to Unicode highlighting.")},[tu.includeStrings]:{restricted:!0,type:["boolean","string"],enum:[!0,!1,ba],default:e.includeStrings,description:p("unicodeHighlight.includeStrings","Controls whether characters in strings should also be subject to Unicode highlighting.")},[tu.allowedCharacters]:{restricted:!0,type:"object",default:e.allowedCharacters,description:p("unicodeHighlight.allowedCharacters","Defines allowed characters that are not being highlighted."),additionalProperties:{type:"boolean"}},[tu.allowedLocales]:{restricted:!0,type:"object",additionalProperties:{type:"boolean"},default:e.allowedLocales,description:p("unicodeHighlight.allowedLocales","Unicode characters that are common in allowed locales are not being highlighted.")}})}applyUpdate(e,t){let i=!1;t.allowedCharacters&&e&&(hn(e.allowedCharacters,t.allowedCharacters)||(e={...e,allowedCharacters:t.allowedCharacters},i=!0)),t.allowedLocales&&e&&(hn(e.allowedLocales,t.allowedLocales)||(e={...e,allowedLocales:t.allowedLocales},i=!0));let o=super.applyUpdate(e,t);return i?new _d(o.newValue,!0):o}validate(e){if(!e||typeof e!="object")return this.defaultValue;let t=e;return{nonBasicASCII:gg(t.nonBasicASCII,ba,[!0,!1,ba]),invisibleCharacters:we(t.invisibleCharacters,this.defaultValue.invisibleCharacters),ambiguousCharacters:we(t.ambiguousCharacters,this.defaultValue.ambiguousCharacters),includeComments:gg(t.includeComments,ba,[!0,!1,ba]),includeStrings:gg(t.includeStrings,ba,[!0,!1,ba]),allowedCharacters:this.validateBooleanMap(e.allowedCharacters,this.defaultValue.allowedCharacters),allowedLocales:this.validateBooleanMap(e.allowedLocales,this.defaultValue.allowedLocales)}}validateBooleanMap(e,t){if(typeof e!="object"||!e)return t;let i={};for(let[o,s]of Object.entries(e))s===!0&&(i[o]=!0);return i}},XI=class extends jt{constructor(){let e={enabled:!0,mode:"subwordSmart",showToolbar:"onHover",suppressSuggestions:!1,keepOnBlur:!1,fontFamily:"default"};super(62,"inlineSuggest",e,{"editor.inlineSuggest.enabled":{type:"boolean",default:e.enabled,description:p("inlineSuggest.enabled","Controls whether to automatically show inline suggestions in the editor.")},"editor.inlineSuggest.showToolbar":{type:"string",default:e.showToolbar,enum:["always","onHover","never"],enumDescriptions:[p("inlineSuggest.showToolbar.always","Show the inline suggestion toolbar whenever an inline suggestion is shown."),p("inlineSuggest.showToolbar.onHover","Show the inline suggestion toolbar when hovering over an inline suggestion."),p("inlineSuggest.showToolbar.never","Never show the inline suggestion toolbar.")],description:p("inlineSuggest.showToolbar","Controls when to show the inline suggestion toolbar.")},"editor.inlineSuggest.suppressSuggestions":{type:"boolean",default:e.suppressSuggestions,description:p("inlineSuggest.suppressSuggestions","Controls how inline suggestions interact with the suggest widget. If enabled, the suggest widget is not shown automatically when inline suggestions are available.")},"editor.inlineSuggest.fontFamily":{type:"string",default:e.fontFamily,description:p("inlineSuggest.fontFamily","Controls the font family of the inline suggestions.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;let t=e;return{enabled:we(t.enabled,this.defaultValue.enabled),mode:wi(t.mode,this.defaultValue.mode,["prefix","subword","subwordSmart"]),showToolbar:wi(t.showToolbar,this.defaultValue.showToolbar,["always","onHover","never"]),suppressSuggestions:we(t.suppressSuggestions,this.defaultValue.suppressSuggestions),keepOnBlur:we(t.keepOnBlur,this.defaultValue.keepOnBlur),fontFamily:No.string(t.fontFamily,this.defaultValue.fontFamily)}}},QI=class extends jt{constructor(){let e={enabled:!1,showToolbar:"onHover",fontFamily:"default",keepOnBlur:!1,backgroundColoring:!1};super(63,"experimentalInlineEdit",e,{"editor.experimentalInlineEdit.enabled":{type:"boolean",default:e.enabled,description:p("inlineEdit.enabled","Controls whether to show inline edits in the editor.")},"editor.experimentalInlineEdit.showToolbar":{type:"string",default:e.showToolbar,enum:["always","onHover","never"],enumDescriptions:[p("inlineEdit.showToolbar.always","Show the inline edit toolbar whenever an inline suggestion is shown."),p("inlineEdit.showToolbar.onHover","Show the inline edit toolbar when hovering over an inline suggestion."),p("inlineEdit.showToolbar.never","Never show the inline edit toolbar.")],description:p("inlineEdit.showToolbar","Controls when to show the inline edit toolbar.")},"editor.experimentalInlineEdit.fontFamily":{type:"string",default:e.fontFamily,description:p("inlineEdit.fontFamily","Controls the font family of the inline edit.")},"editor.experimentalInlineEdit.backgroundColoring":{type:"boolean",default:e.backgroundColoring,description:p("inlineEdit.backgroundColoring","Controls whether to color the background of inline edits.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;let t=e;return{enabled:we(t.enabled,this.defaultValue.enabled),showToolbar:wi(t.showToolbar,this.defaultValue.showToolbar,["always","onHover","never"]),fontFamily:No.string(t.fontFamily,this.defaultValue.fontFamily),keepOnBlur:we(t.keepOnBlur,this.defaultValue.keepOnBlur),backgroundColoring:we(t.backgroundColoring,this.defaultValue.backgroundColoring)}}},JI=class extends jt{constructor(){let e={enabled:nn.bracketPairColorizationOptions.enabled,independentColorPoolPerBracketType:nn.bracketPairColorizationOptions.independentColorPoolPerBracketType};super(15,"bracketPairColorization",e,{"editor.bracketPairColorization.enabled":{type:"boolean",default:e.enabled,markdownDescription:p("bracketPairColorization.enabled","Controls whether bracket pair colorization is enabled or not. Use {0} to override the bracket highlight colors.","`#workbench.colorCustomizations#`")},"editor.bracketPairColorization.independentColorPoolPerBracketType":{type:"boolean",default:e.independentColorPoolPerBracketType,description:p("bracketPairColorization.independentColorPoolPerBracketType","Controls whether each bracket type has its own independent color pool.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;let t=e;return{enabled:we(t.enabled,this.defaultValue.enabled),independentColorPoolPerBracketType:we(t.independentColorPoolPerBracketType,this.defaultValue.independentColorPoolPerBracketType)}}},eT=class extends jt{constructor(){let e={bracketPairs:!1,bracketPairsHorizontal:"active",highlightActiveBracketPair:!0,indentation:!0,highlightActiveIndentation:!0};super(16,"guides",e,{"editor.guides.bracketPairs":{type:["boolean","string"],enum:[!0,"active",!1],enumDescriptions:[p("editor.guides.bracketPairs.true","Enables bracket pair guides."),p("editor.guides.bracketPairs.active","Enables bracket pair guides only for the active bracket pair."),p("editor.guides.bracketPairs.false","Disables bracket pair guides.")],default:e.bracketPairs,description:p("editor.guides.bracketPairs","Controls whether bracket pair guides are enabled or not.")},"editor.guides.bracketPairsHorizontal":{type:["boolean","string"],enum:[!0,"active",!1],enumDescriptions:[p("editor.guides.bracketPairsHorizontal.true","Enables horizontal guides as addition to vertical bracket pair guides."),p("editor.guides.bracketPairsHorizontal.active","Enables horizontal guides only for the active bracket pair."),p("editor.guides.bracketPairsHorizontal.false","Disables horizontal bracket pair guides.")],default:e.bracketPairsHorizontal,description:p("editor.guides.bracketPairsHorizontal","Controls whether horizontal bracket pair guides are enabled or not.")},"editor.guides.highlightActiveBracketPair":{type:"boolean",default:e.highlightActiveBracketPair,description:p("editor.guides.highlightActiveBracketPair","Controls whether the editor should highlight the active bracket pair.")},"editor.guides.indentation":{type:"boolean",default:e.indentation,description:p("editor.guides.indentation","Controls whether the editor should render indent guides.")},"editor.guides.highlightActiveIndentation":{type:["boolean","string"],enum:[!0,"always",!1],enumDescriptions:[p("editor.guides.highlightActiveIndentation.true","Highlights the active indent guide."),p("editor.guides.highlightActiveIndentation.always","Highlights the active indent guide even if bracket guides are highlighted."),p("editor.guides.highlightActiveIndentation.false","Do not highlight the active indent guide.")],default:e.highlightActiveIndentation,description:p("editor.guides.highlightActiveIndentation","Controls whether the editor should highlight the active indent guide.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;let t=e;return{bracketPairs:gg(t.bracketPairs,this.defaultValue.bracketPairs,[!0,!1,"active"]),bracketPairsHorizontal:gg(t.bracketPairsHorizontal,this.defaultValue.bracketPairsHorizontal,[!0,!1,"active"]),highlightActiveBracketPair:we(t.highlightActiveBracketPair,this.defaultValue.highlightActiveBracketPair),indentation:we(t.indentation,this.defaultValue.indentation),highlightActiveIndentation:gg(t.highlightActiveIndentation,this.defaultValue.highlightActiveIndentation,[!0,!1,"always"])}}};function gg(n,e,t){let i=t.indexOf(n);return i===-1?e:t[i]}var tT=class extends jt{constructor(){let e={insertMode:"insert",filterGraceful:!0,snippetsPreventQuickSuggestions:!1,localityBonus:!1,shareSuggestSelections:!1,selectionMode:"always",showIcons:!0,showStatusBar:!1,preview:!1,previewMode:"subwordSmart",showInlineDetails:!0,showMethods:!0,showFunctions:!0,showConstructors:!0,showDeprecated:!0,matchOnWordStartOnly:!0,showFields:!0,showVariables:!0,showClasses:!0,showStructs:!0,showInterfaces:!0,showModules:!0,showProperties:!0,showEvents:!0,showOperators:!0,showUnits:!0,showValues:!0,showConstants:!0,showEnums:!0,showEnumMembers:!0,showKeywords:!0,showWords:!0,showColors:!0,showFiles:!0,showReferences:!0,showFolders:!0,showTypeParameters:!0,showSnippets:!0,showUsers:!0,showIssues:!0};super(118,"suggest",e,{"editor.suggest.insertMode":{type:"string",enum:["insert","replace"],enumDescriptions:[p("suggest.insertMode.insert","Insert suggestion without overwriting text right of the cursor."),p("suggest.insertMode.replace","Insert suggestion and overwrite text right of the cursor.")],default:e.insertMode,description:p("suggest.insertMode","Controls whether words are overwritten when accepting completions. Note that this depends on extensions opting into this feature.")},"editor.suggest.filterGraceful":{type:"boolean",default:e.filterGraceful,description:p("suggest.filterGraceful","Controls whether filtering and sorting suggestions accounts for small typos.")},"editor.suggest.localityBonus":{type:"boolean",default:e.localityBonus,description:p("suggest.localityBonus","Controls whether sorting favors words that appear close to the cursor.")},"editor.suggest.shareSuggestSelections":{type:"boolean",default:e.shareSuggestSelections,markdownDescription:p("suggest.shareSuggestSelections","Controls whether remembered suggestion selections are shared between multiple workspaces and windows (needs `#editor.suggestSelection#`).")},"editor.suggest.selectionMode":{type:"string",enum:["always","never","whenTriggerCharacter","whenQuickSuggestion"],enumDescriptions:[p("suggest.insertMode.always","Always select a suggestion when automatically triggering IntelliSense."),p("suggest.insertMode.never","Never select a suggestion when automatically triggering IntelliSense."),p("suggest.insertMode.whenTriggerCharacter","Select a suggestion only when triggering IntelliSense from a trigger character."),p("suggest.insertMode.whenQuickSuggestion","Select a suggestion only when triggering IntelliSense as you type.")],default:e.selectionMode,markdownDescription:p("suggest.selectionMode","Controls whether a suggestion is selected when the widget shows. Note that this only applies to automatically triggered suggestions (`#editor.quickSuggestions#` and `#editor.suggestOnTriggerCharacters#`) and that a suggestion is always selected when explicitly invoked, e.g via `Ctrl+Space`.")},"editor.suggest.snippetsPreventQuickSuggestions":{type:"boolean",default:e.snippetsPreventQuickSuggestions,description:p("suggest.snippetsPreventQuickSuggestions","Controls whether an active snippet prevents quick suggestions.")},"editor.suggest.showIcons":{type:"boolean",default:e.showIcons,description:p("suggest.showIcons","Controls whether to show or hide icons in suggestions.")},"editor.suggest.showStatusBar":{type:"boolean",default:e.showStatusBar,description:p("suggest.showStatusBar","Controls the visibility of the status bar at the bottom of the suggest widget.")},"editor.suggest.preview":{type:"boolean",default:e.preview,description:p("suggest.preview","Controls whether to preview the suggestion outcome in the editor.")},"editor.suggest.showInlineDetails":{type:"boolean",default:e.showInlineDetails,description:p("suggest.showInlineDetails","Controls whether suggest details show inline with the label or only in the details widget.")},"editor.suggest.maxVisibleSuggestions":{type:"number",deprecationMessage:p("suggest.maxVisibleSuggestions.dep","This setting is deprecated. The suggest widget can now be resized.")},"editor.suggest.filteredTypes":{type:"object",deprecationMessage:p("deprecated","This setting is deprecated, please use separate settings like 'editor.suggest.showKeywords' or 'editor.suggest.showSnippets' instead.")},"editor.suggest.showMethods":{type:"boolean",default:!0,markdownDescription:p("editor.suggest.showMethods","When enabled IntelliSense shows `method`-suggestions.")},"editor.suggest.showFunctions":{type:"boolean",default:!0,markdownDescription:p("editor.suggest.showFunctions","When enabled IntelliSense shows `function`-suggestions.")},"editor.suggest.showConstructors":{type:"boolean",default:!0,markdownDescription:p("editor.suggest.showConstructors","When enabled IntelliSense shows `constructor`-suggestions.")},"editor.suggest.showDeprecated":{type:"boolean",default:!0,markdownDescription:p("editor.suggest.showDeprecated","When enabled IntelliSense shows `deprecated`-suggestions.")},"editor.suggest.matchOnWordStartOnly":{type:"boolean",default:!0,markdownDescription:p("editor.suggest.matchOnWordStartOnly","When enabled IntelliSense filtering requires that the first character matches on a word start. For example, `c` on `Console` or `WebContext` but _not_ on `description`. When disabled IntelliSense will show more results but still sorts them by match quality.")},"editor.suggest.showFields":{type:"boolean",default:!0,markdownDescription:p("editor.suggest.showFields","When enabled IntelliSense shows `field`-suggestions.")},"editor.suggest.showVariables":{type:"boolean",default:!0,markdownDescription:p("editor.suggest.showVariables","When enabled IntelliSense shows `variable`-suggestions.")},"editor.suggest.showClasses":{type:"boolean",default:!0,markdownDescription:p("editor.suggest.showClasss","When enabled IntelliSense shows `class`-suggestions.")},"editor.suggest.showStructs":{type:"boolean",default:!0,markdownDescription:p("editor.suggest.showStructs","When enabled IntelliSense shows `struct`-suggestions.")},"editor.suggest.showInterfaces":{type:"boolean",default:!0,markdownDescription:p("editor.suggest.showInterfaces","When enabled IntelliSense shows `interface`-suggestions.")},"editor.suggest.showModules":{type:"boolean",default:!0,markdownDescription:p("editor.suggest.showModules","When enabled IntelliSense shows `module`-suggestions.")},"editor.suggest.showProperties":{type:"boolean",default:!0,markdownDescription:p("editor.suggest.showPropertys","When enabled IntelliSense shows `property`-suggestions.")},"editor.suggest.showEvents":{type:"boolean",default:!0,markdownDescription:p("editor.suggest.showEvents","When enabled IntelliSense shows `event`-suggestions.")},"editor.suggest.showOperators":{type:"boolean",default:!0,markdownDescription:p("editor.suggest.showOperators","When enabled IntelliSense shows `operator`-suggestions.")},"editor.suggest.showUnits":{type:"boolean",default:!0,markdownDescription:p("editor.suggest.showUnits","When enabled IntelliSense shows `unit`-suggestions.")},"editor.suggest.showValues":{type:"boolean",default:!0,markdownDescription:p("editor.suggest.showValues","When enabled IntelliSense shows `value`-suggestions.")},"editor.suggest.showConstants":{type:"boolean",default:!0,markdownDescription:p("editor.suggest.showConstants","When enabled IntelliSense shows `constant`-suggestions.")},"editor.suggest.showEnums":{type:"boolean",default:!0,markdownDescription:p("editor.suggest.showEnums","When enabled IntelliSense shows `enum`-suggestions.")},"editor.suggest.showEnumMembers":{type:"boolean",default:!0,markdownDescription:p("editor.suggest.showEnumMembers","When enabled IntelliSense shows `enumMember`-suggestions.")},"editor.suggest.showKeywords":{type:"boolean",default:!0,markdownDescription:p("editor.suggest.showKeywords","When enabled IntelliSense shows `keyword`-suggestions.")},"editor.suggest.showWords":{type:"boolean",default:!0,markdownDescription:p("editor.suggest.showTexts","When enabled IntelliSense shows `text`-suggestions.")},"editor.suggest.showColors":{type:"boolean",default:!0,markdownDescription:p("editor.suggest.showColors","When enabled IntelliSense shows `color`-suggestions.")},"editor.suggest.showFiles":{type:"boolean",default:!0,markdownDescription:p("editor.suggest.showFiles","When enabled IntelliSense shows `file`-suggestions.")},"editor.suggest.showReferences":{type:"boolean",default:!0,markdownDescription:p("editor.suggest.showReferences","When enabled IntelliSense shows `reference`-suggestions.")},"editor.suggest.showCustomcolors":{type:"boolean",default:!0,markdownDescription:p("editor.suggest.showCustomcolors","When enabled IntelliSense shows `customcolor`-suggestions.")},"editor.suggest.showFolders":{type:"boolean",default:!0,markdownDescription:p("editor.suggest.showFolders","When enabled IntelliSense shows `folder`-suggestions.")},"editor.suggest.showTypeParameters":{type:"boolean",default:!0,markdownDescription:p("editor.suggest.showTypeParameters","When enabled IntelliSense shows `typeParameter`-suggestions.")},"editor.suggest.showSnippets":{type:"boolean",default:!0,markdownDescription:p("editor.suggest.showSnippets","When enabled IntelliSense shows `snippet`-suggestions.")},"editor.suggest.showUsers":{type:"boolean",default:!0,markdownDescription:p("editor.suggest.showUsers","When enabled IntelliSense shows `user`-suggestions.")},"editor.suggest.showIssues":{type:"boolean",default:!0,markdownDescription:p("editor.suggest.showIssues","When enabled IntelliSense shows `issues`-suggestions.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;let t=e;return{insertMode:wi(t.insertMode,this.defaultValue.insertMode,["insert","replace"]),filterGraceful:we(t.filterGraceful,this.defaultValue.filterGraceful),snippetsPreventQuickSuggestions:we(t.snippetsPreventQuickSuggestions,this.defaultValue.filterGraceful),localityBonus:we(t.localityBonus,this.defaultValue.localityBonus),shareSuggestSelections:we(t.shareSuggestSelections,this.defaultValue.shareSuggestSelections),selectionMode:wi(t.selectionMode,this.defaultValue.selectionMode,["always","never","whenQuickSuggestion","whenTriggerCharacter"]),showIcons:we(t.showIcons,this.defaultValue.showIcons),showStatusBar:we(t.showStatusBar,this.defaultValue.showStatusBar),preview:we(t.preview,this.defaultValue.preview),previewMode:wi(t.previewMode,this.defaultValue.previewMode,["prefix","subword","subwordSmart"]),showInlineDetails:we(t.showInlineDetails,this.defaultValue.showInlineDetails),showMethods:we(t.showMethods,this.defaultValue.showMethods),showFunctions:we(t.showFunctions,this.defaultValue.showFunctions),showConstructors:we(t.showConstructors,this.defaultValue.showConstructors),showDeprecated:we(t.showDeprecated,this.defaultValue.showDeprecated),matchOnWordStartOnly:we(t.matchOnWordStartOnly,this.defaultValue.matchOnWordStartOnly),showFields:we(t.showFields,this.defaultValue.showFields),showVariables:we(t.showVariables,this.defaultValue.showVariables),showClasses:we(t.showClasses,this.defaultValue.showClasses),showStructs:we(t.showStructs,this.defaultValue.showStructs),showInterfaces:we(t.showInterfaces,this.defaultValue.showInterfaces),showModules:we(t.showModules,this.defaultValue.showModules),showProperties:we(t.showProperties,this.defaultValue.showProperties),showEvents:we(t.showEvents,this.defaultValue.showEvents),showOperators:we(t.showOperators,this.defaultValue.showOperators),showUnits:we(t.showUnits,this.defaultValue.showUnits),showValues:we(t.showValues,this.defaultValue.showValues),showConstants:we(t.showConstants,this.defaultValue.showConstants),showEnums:we(t.showEnums,this.defaultValue.showEnums),showEnumMembers:we(t.showEnumMembers,this.defaultValue.showEnumMembers),showKeywords:we(t.showKeywords,this.defaultValue.showKeywords),showWords:we(t.showWords,this.defaultValue.showWords),showColors:we(t.showColors,this.defaultValue.showColors),showFiles:we(t.showFiles,this.defaultValue.showFiles),showReferences:we(t.showReferences,this.defaultValue.showReferences),showFolders:we(t.showFolders,this.defaultValue.showFolders),showTypeParameters:we(t.showTypeParameters,this.defaultValue.showTypeParameters),showSnippets:we(t.showSnippets,this.defaultValue.showSnippets),showUsers:we(t.showUsers,this.defaultValue.showUsers),showIssues:we(t.showIssues,this.defaultValue.showIssues)}}},iT=class extends jt{constructor(){super(113,"smartSelect",{selectLeadingAndTrailingWhitespace:!0,selectSubwords:!0},{"editor.smartSelect.selectLeadingAndTrailingWhitespace":{description:p("selectLeadingAndTrailingWhitespace","Whether leading and trailing whitespace should always be selected."),default:!0,type:"boolean"},"editor.smartSelect.selectSubwords":{description:p("selectSubwords","Whether subwords (like 'foo' in 'fooBar' or 'foo_bar') should be selected."),default:!0,type:"boolean"}})}validate(e){return!e||typeof e!="object"?this.defaultValue:{selectLeadingAndTrailingWhitespace:we(e.selectLeadingAndTrailingWhitespace,this.defaultValue.selectLeadingAndTrailingWhitespace),selectSubwords:we(e.selectSubwords,this.defaultValue.selectSubwords)}}},nT=class extends jt{constructor(){let e=[];super(130,"wordSegmenterLocales",e,{anyOf:[{description:p("wordSegmenterLocales","Locales to be used for word segmentation when doing word related navigations or operations. Specify the BCP 47 language tag of the word you wish to recognize (e.g., ja, zh-CN, zh-Hant-TW, etc.)."),type:"string"},{description:p("wordSegmenterLocales","Locales to be used for word segmentation when doing word related navigations or operations. Specify the BCP 47 language tag of the word you wish to recognize (e.g., ja, zh-CN, zh-Hant-TW, etc.)."),type:"array",items:{type:"string"}}]})}validate(e){if(typeof e=="string"&&(e=[e]),Array.isArray(e)){let t=[];for(let i of e)if(typeof i=="string")try{Intl.Segmenter.supportedLocalesOf(i).length>0&&t.push(i)}catch{}return t}return this.defaultValue}},oT=class extends jt{constructor(){super(138,"wrappingIndent",1,{"editor.wrappingIndent":{type:"string",enum:["none","same","indent","deepIndent"],enumDescriptions:[p("wrappingIndent.none","No indentation. Wrapped lines begin at column 1."),p("wrappingIndent.same","Wrapped lines get the same indentation as the parent."),p("wrappingIndent.indent","Wrapped lines get +1 indentation toward the parent."),p("wrappingIndent.deepIndent","Wrapped lines get +2 indentation toward the parent.")],description:p("wrappingIndent","Controls the indentation of wrapped lines."),default:"same"}})}validate(e){switch(e){case"none":return 0;case"same":return 1;case"indent":return 2;case"deepIndent":return 3}return 1}compute(e,t,i){return t.get(2)===2?0:i}},sT=class extends iu{constructor(){super(146)}compute(e,t,i){let o=t.get(145);return{isDominatedByLongLines:e.isDominatedByLongLines,isWordWrapMinified:o.isWordWrapMinified,isViewportWrapping:o.isViewportWrapping,wrappingColumn:o.wrappingColumn}}},rT=class extends jt{constructor(){let e={enabled:!0,showDropSelector:"afterDrop"};super(36,"dropIntoEditor",e,{"editor.dropIntoEditor.enabled":{type:"boolean",default:e.enabled,markdownDescription:p("dropIntoEditor.enabled","Controls whether you can drag and drop a file into a text editor by holding down the `Shift` key (instead of opening the file in an editor).")},"editor.dropIntoEditor.showDropSelector":{type:"string",markdownDescription:p("dropIntoEditor.showDropSelector","Controls if a widget is shown when dropping files into the editor. This widget lets you control how the file is dropped."),enum:["afterDrop","never"],enumDescriptions:[p("dropIntoEditor.showDropSelector.afterDrop","Show the drop selector widget after a file is dropped into the editor."),p("dropIntoEditor.showDropSelector.never","Never show the drop selector widget. Instead the default drop provider is always used.")],default:"afterDrop"}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;let t=e;return{enabled:we(t.enabled,this.defaultValue.enabled),showDropSelector:wi(t.showDropSelector,this.defaultValue.showDropSelector,["afterDrop","never"])}}},aT=class extends jt{constructor(){let e={enabled:!0,showPasteSelector:"afterPaste"};super(85,"pasteAs",e,{"editor.pasteAs.enabled":{type:"boolean",default:e.enabled,markdownDescription:p("pasteAs.enabled","Controls whether you can paste content in different ways.")},"editor.pasteAs.showPasteSelector":{type:"string",markdownDescription:p("pasteAs.showPasteSelector","Controls if a widget is shown when pasting content in to the editor. This widget lets you control how the file is pasted."),enum:["afterPaste","never"],enumDescriptions:[p("pasteAs.showPasteSelector.afterPaste","Show the paste selector widget after content is pasted into the editor."),p("pasteAs.showPasteSelector.never","Never show the paste selector widget. Instead the default pasting behavior is always used.")],default:"afterPaste"}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;let t=e;return{enabled:we(t.enabled,this.defaultValue.enabled),showPasteSelector:wi(t.showPasteSelector,this.defaultValue.showPasteSelector,["afterPaste","never"])}}},t$="Consolas, 'Courier New', monospace",i$="Menlo, Monaco, 'Courier New', monospace",n$="'Droid Sans Mono', 'monospace', monospace",Ao={fontFamily:Be?i$:mi?n$:t$,fontWeight:"normal",fontSize:Be?12:14,lineHeight:0,letterSpacing:0},wd=[];function oe(n){return wd[n.id]=n,n}var Ca={acceptSuggestionOnCommitCharacter:oe(new yt(0,"acceptSuggestionOnCommitCharacter",!0,{markdownDescription:p("acceptSuggestionOnCommitCharacter","Controls whether suggestions should be accepted on commit characters. For example, in JavaScript, the semi-colon (`;`) can be a commit character that accepts a suggestion and types that character.")})),acceptSuggestionOnEnter:oe(new ai(1,"acceptSuggestionOnEnter","on",["on","smart","off"],{markdownEnumDescriptions:["",p("acceptSuggestionOnEnterSmart","Only accept a suggestion with `Enter` when it makes a textual change."),""],markdownDescription:p("acceptSuggestionOnEnter","Controls whether suggestions should be accepted on `Enter`, in addition to `Tab`. Helps to avoid ambiguity between inserting new lines or accepting suggestions.")})),accessibilitySupport:oe(new kI),accessibilityPageSize:oe(new zt(3,"accessibilityPageSize",10,1,1073741824,{description:p("accessibilityPageSize","Controls the number of lines in the editor that can be read out by a screen reader at once. When we detect a screen reader we automatically set the default to be 500. Warning: this has a performance implication for numbers larger than the default."),tags:["accessibility"]})),ariaLabel:oe(new No(4,"ariaLabel",p("editorViewAccessibleLabel","Editor content"))),ariaRequired:oe(new yt(5,"ariaRequired",!1,void 0)),screenReaderAnnounceInlineSuggestion:oe(new yt(8,"screenReaderAnnounceInlineSuggestion",!0,{description:p("screenReaderAnnounceInlineSuggestion","Control whether inline suggestions are announced by a screen reader."),tags:["accessibility"]})),autoClosingBrackets:oe(new ai(6,"autoClosingBrackets","languageDefined",["always","languageDefined","beforeWhitespace","never"],{enumDescriptions:["",p("editor.autoClosingBrackets.languageDefined","Use language configurations to determine when to autoclose brackets."),p("editor.autoClosingBrackets.beforeWhitespace","Autoclose brackets only when the cursor is to the left of whitespace."),""],description:p("autoClosingBrackets","Controls whether the editor should automatically close brackets after the user adds an opening bracket.")})),autoClosingComments:oe(new ai(7,"autoClosingComments","languageDefined",["always","languageDefined","beforeWhitespace","never"],{enumDescriptions:["",p("editor.autoClosingComments.languageDefined","Use language configurations to determine when to autoclose comments."),p("editor.autoClosingComments.beforeWhitespace","Autoclose comments only when the cursor is to the left of whitespace."),""],description:p("autoClosingComments","Controls whether the editor should automatically close comments after the user adds an opening comment.")})),autoClosingDelete:oe(new ai(9,"autoClosingDelete","auto",["always","auto","never"],{enumDescriptions:["",p("editor.autoClosingDelete.auto","Remove adjacent closing quotes or brackets only if they were automatically inserted."),""],description:p("autoClosingDelete","Controls whether the editor should remove adjacent closing quotes or brackets when deleting.")})),autoClosingOvertype:oe(new ai(10,"autoClosingOvertype","auto",["always","auto","never"],{enumDescriptions:["",p("editor.autoClosingOvertype.auto","Type over closing quotes or brackets only if they were automatically inserted."),""],description:p("autoClosingOvertype","Controls whether the editor should type over closing quotes or brackets.")})),autoClosingQuotes:oe(new ai(11,"autoClosingQuotes","languageDefined",["always","languageDefined","beforeWhitespace","never"],{enumDescriptions:["",p("editor.autoClosingQuotes.languageDefined","Use language configurations to determine when to autoclose quotes."),p("editor.autoClosingQuotes.beforeWhitespace","Autoclose quotes only when the cursor is to the left of whitespace."),""],description:p("autoClosingQuotes","Controls whether the editor should automatically close quotes after the user adds an opening quote.")})),autoIndent:oe(new fg(12,"autoIndent",4,"full",["none","keep","brackets","advanced","full"],XK,{enumDescriptions:[p("editor.autoIndent.none","The editor will not insert indentation automatically."),p("editor.autoIndent.keep","The editor will keep the current line's indentation."),p("editor.autoIndent.brackets","The editor will keep the current line's indentation and honor language defined brackets."),p("editor.autoIndent.advanced","The editor will keep the current line's indentation, honor language defined brackets and invoke special onEnterRules defined by languages."),p("editor.autoIndent.full","The editor will keep the current line's indentation, honor language defined brackets, invoke special onEnterRules defined by languages, and honor indentationRules defined by languages.")],description:p("autoIndent","Controls whether the editor should automatically adjust the indentation when users type, paste, move or indent lines.")})),automaticLayout:oe(new yt(13,"automaticLayout",!1)),autoSurround:oe(new ai(14,"autoSurround","languageDefined",["languageDefined","quotes","brackets","never"],{enumDescriptions:[p("editor.autoSurround.languageDefined","Use language configurations to determine when to automatically surround selections."),p("editor.autoSurround.quotes","Surround with quotes but not brackets."),p("editor.autoSurround.brackets","Surround with brackets but not quotes."),""],description:p("autoSurround","Controls whether the editor should automatically surround selections when typing quotes or brackets.")})),bracketPairColorization:oe(new JI),bracketPairGuides:oe(new eT),stickyTabStops:oe(new yt(116,"stickyTabStops",!1,{description:p("stickyTabStops","Emulate selection behavior of tab characters when using spaces for indentation. Selection will stick to tab stops.")})),codeLens:oe(new yt(17,"codeLens",!0,{description:p("codeLens","Controls whether the editor shows CodeLens.")})),codeLensFontFamily:oe(new No(18,"codeLensFontFamily","",{description:p("codeLensFontFamily","Controls the font family for CodeLens.")})),codeLensFontSize:oe(new zt(19,"codeLensFontSize",0,0,100,{type:"number",default:0,minimum:0,maximum:100,markdownDescription:p("codeLensFontSize","Controls the font size in pixels for CodeLens. When set to 0, 90% of `#editor.fontSize#` is used.")})),colorDecorators:oe(new yt(20,"colorDecorators",!0,{description:p("colorDecorators","Controls whether the editor should render the inline color decorators and color picker.")})),colorDecoratorActivatedOn:oe(new ai(148,"colorDecoratorsActivatedOn","clickAndHover",["clickAndHover","hover","click"],{enumDescriptions:[p("editor.colorDecoratorActivatedOn.clickAndHover","Make the color picker appear both on click and hover of the color decorator"),p("editor.colorDecoratorActivatedOn.hover","Make the color picker appear on hover of the color decorator"),p("editor.colorDecoratorActivatedOn.click","Make the color picker appear on click of the color decorator")],description:p("colorDecoratorActivatedOn","Controls the condition to make a color picker appear from a color decorator")})),colorDecoratorsLimit:oe(new zt(21,"colorDecoratorsLimit",500,1,1e6,{markdownDescription:p("colorDecoratorsLimit","Controls the max number of color decorators that can be rendered in an editor at once.")})),columnSelection:oe(new yt(22,"columnSelection",!1,{description:p("columnSelection","Enable that the selection with the mouse and keys is doing column selection.")})),comments:oe(new DI),contextmenu:oe(new yt(24,"contextmenu",!0)),copyWithSyntaxHighlighting:oe(new yt(25,"copyWithSyntaxHighlighting",!0,{description:p("copyWithSyntaxHighlighting","Controls whether syntax highlighting should be copied into the clipboard.")})),cursorBlinking:oe(new fg(26,"cursorBlinking",1,"blink",["blink","smooth","phase","expand","solid"],QK,{description:p("cursorBlinking","Control the cursor animation style.")})),cursorSmoothCaretAnimation:oe(new ai(27,"cursorSmoothCaretAnimation","off",["off","explicit","on"],{enumDescriptions:[p("cursorSmoothCaretAnimation.off","Smooth caret animation is disabled."),p("cursorSmoothCaretAnimation.explicit","Smooth caret animation is enabled only when the user moves the cursor with an explicit gesture."),p("cursorSmoothCaretAnimation.on","Smooth caret animation is always enabled.")],description:p("cursorSmoothCaretAnimation","Controls whether the smooth caret animation should be enabled.")})),cursorStyle:oe(new fg(28,"cursorStyle",on.Line,"line",["line","block","underline","line-thin","block-outline","underline-thin"],JK,{description:p("cursorStyle","Controls the cursor style.")})),cursorSurroundingLines:oe(new zt(29,"cursorSurroundingLines",0,0,1073741824,{description:p("cursorSurroundingLines","Controls the minimal number of visible leading lines (minimum 0) and trailing lines (minimum 1) surrounding the cursor. Known as 'scrollOff' or 'scrollOffset' in some other editors.")})),cursorSurroundingLinesStyle:oe(new ai(30,"cursorSurroundingLinesStyle","default",["default","all"],{enumDescriptions:[p("cursorSurroundingLinesStyle.default","`cursorSurroundingLines` is enforced only when triggered via the keyboard or API."),p("cursorSurroundingLinesStyle.all","`cursorSurroundingLines` is enforced always.")],markdownDescription:p("cursorSurroundingLinesStyle","Controls when `#editor.cursorSurroundingLines#` should be enforced.")})),cursorWidth:oe(new zt(31,"cursorWidth",0,0,1073741824,{markdownDescription:p("cursorWidth","Controls the width of the cursor when `#editor.cursorStyle#` is set to `line`.")})),disableLayerHinting:oe(new yt(32,"disableLayerHinting",!1)),disableMonospaceOptimizations:oe(new yt(33,"disableMonospaceOptimizations",!1)),domReadOnly:oe(new yt(34,"domReadOnly",!1)),dragAndDrop:oe(new yt(35,"dragAndDrop",!0,{description:p("dragAndDrop","Controls whether the editor should allow moving selections via drag and drop.")})),emptySelectionClipboard:oe(new II),dropIntoEditor:oe(new rT),stickyScroll:oe(new FI),experimentalWhitespaceRendering:oe(new ai(38,"experimentalWhitespaceRendering","svg",["svg","font","off"],{enumDescriptions:[p("experimentalWhitespaceRendering.svg","Use a new rendering method with svgs."),p("experimentalWhitespaceRendering.font","Use a new rendering method with font characters."),p("experimentalWhitespaceRendering.off","Use the stable rendering method.")],description:p("experimentalWhitespaceRendering","Controls whether whitespace is rendered with a new, experimental method.")})),extraEditorClassName:oe(new No(39,"extraEditorClassName","")),fastScrollSensitivity:oe(new Gs(40,"fastScrollSensitivity",5,n=>n<=0?5:n,{markdownDescription:p("fastScrollSensitivity","Scrolling speed multiplier when pressing `Alt`.")})),find:oe(new TI),fixedOverflowWidgets:oe(new yt(42,"fixedOverflowWidgets",!1)),folding:oe(new yt(43,"folding",!0,{description:p("folding","Controls whether the editor has code folding enabled.")})),foldingStrategy:oe(new ai(44,"foldingStrategy","auto",["auto","indentation"],{enumDescriptions:[p("foldingStrategy.auto","Use a language-specific folding strategy if available, else the indentation-based one."),p("foldingStrategy.indentation","Use the indentation-based folding strategy.")],description:p("foldingStrategy","Controls the strategy for computing folding ranges.")})),foldingHighlight:oe(new yt(45,"foldingHighlight",!0,{description:p("foldingHighlight","Controls whether the editor should highlight folded ranges.")})),foldingImportsByDefault:oe(new yt(46,"foldingImportsByDefault",!1,{description:p("foldingImportsByDefault","Controls whether the editor automatically collapses import ranges.")})),foldingMaximumRegions:oe(new zt(47,"foldingMaximumRegions",5e3,10,65e3,{description:p("foldingMaximumRegions","The maximum number of foldable regions. Increasing this value may result in the editor becoming less responsive when the current source has a large number of foldable regions.")})),unfoldOnClickAfterEndOfLine:oe(new yt(48,"unfoldOnClickAfterEndOfLine",!1,{description:p("unfoldOnClickAfterEndOfLine","Controls whether clicking on the empty content after a folded line will unfold the line.")})),fontFamily:oe(new No(49,"fontFamily",Ao.fontFamily,{description:p("fontFamily","Controls the font family.")})),fontInfo:oe(new NI),fontLigatures2:oe(new Zs),fontSize:oe(new AI),fontWeight:oe(new pg),fontVariations:oe(new vd),formatOnPaste:oe(new yt(55,"formatOnPaste",!1,{description:p("formatOnPaste","Controls whether the editor should automatically format the pasted content. A formatter must be available and the formatter should be able to format a range in a document.")})),formatOnType:oe(new yt(56,"formatOnType",!1,{description:p("formatOnType","Controls whether the editor should automatically format the line after typing.")})),glyphMargin:oe(new yt(57,"glyphMargin",!0,{description:p("glyphMargin","Controls whether the editor should render the vertical glyph margin. Glyph margin is mostly used for debugging.")})),gotoLocation:oe(new MI),hideCursorInOverviewRuler:oe(new yt(59,"hideCursorInOverviewRuler",!1,{description:p("hideCursorInOverviewRuler","Controls whether the cursor should be hidden in the overview ruler.")})),hover:oe(new RI),inDiffEditor:oe(new yt(61,"inDiffEditor",!1)),letterSpacing:oe(new Gs(64,"letterSpacing",Ao.letterSpacing,n=>Gs.clamp(n,-5,20),{description:p("letterSpacing","Controls the letter spacing in pixels.")})),lightbulb:oe(new OI),lineDecorationsWidth:oe(new WI),lineHeight:oe(new zI),lineNumbers:oe(new qI),lineNumbersMinChars:oe(new zt(69,"lineNumbersMinChars",5,1,300)),linkedEditing:oe(new yt(70,"linkedEditing",!1,{description:p("linkedEditing","Controls whether the editor has linked editing enabled. Depending on the language, related symbols such as HTML tags, are updated while editing.")})),links:oe(new yt(71,"links",!0,{description:p("links","Controls whether the editor should detect links and make them clickable.")})),matchBrackets:oe(new ai(72,"matchBrackets","always",["always","near","never"],{description:p("matchBrackets","Highlight matching brackets.")})),minimap:oe(new VI),mouseStyle:oe(new ai(74,"mouseStyle","text",["text","default","copy"])),mouseWheelScrollSensitivity:oe(new Gs(75,"mouseWheelScrollSensitivity",1,n=>n===0?1:n,{markdownDescription:p("mouseWheelScrollSensitivity","A multiplier to be used on the `deltaX` and `deltaY` of mouse wheel scroll events.")})),mouseWheelZoom:oe(new yt(76,"mouseWheelZoom",!1,{markdownDescription:Be?p("mouseWheelZoom.mac","Zoom the font of the editor when using mouse wheel and holding `Cmd`."):p("mouseWheelZoom","Zoom the font of the editor when using mouse wheel and holding `Ctrl`.")})),multiCursorMergeOverlapping:oe(new yt(77,"multiCursorMergeOverlapping",!0,{description:p("multiCursorMergeOverlapping","Merge multiple cursors when they are overlapping.")})),multiCursorModifier:oe(new fg(78,"multiCursorModifier","altKey","alt",["ctrlCmd","alt"],e$,{markdownEnumDescriptions:[p("multiCursorModifier.ctrlCmd","Maps to `Control` on Windows and Linux and to `Command` on macOS."),p("multiCursorModifier.alt","Maps to `Alt` on Windows and Linux and to `Option` on macOS.")],markdownDescription:p({key:"multiCursorModifier",comment:["- `ctrlCmd` refers to a value the setting can take and should not be localized.","- `Control` and `Command` refer to the modifier keys Ctrl or Cmd on the keyboard and can be localized."]},"The modifier to be used to add multiple cursors with the mouse. The Go to Definition and Open Link mouse gestures will adapt such that they do not conflict with the [multicursor modifier](https://code.visualstudio.com/docs/editor/codebasics#_multicursor-modifier).")})),multiCursorPaste:oe(new ai(79,"multiCursorPaste","spread",["spread","full"],{markdownEnumDescriptions:[p("multiCursorPaste.spread","Each cursor pastes a single line of the text."),p("multiCursorPaste.full","Each cursor pastes the full text.")],markdownDescription:p("multiCursorPaste","Controls pasting when the line count of the pasted text matches the cursor count.")})),multiCursorLimit:oe(new zt(80,"multiCursorLimit",1e4,1,1e5,{markdownDescription:p("multiCursorLimit","Controls the max number of cursors that can be in an active editor at once.")})),occurrencesHighlight:oe(new ai(81,"occurrencesHighlight","singleFile",["off","singleFile","multiFile"],{markdownEnumDescriptions:[p("occurrencesHighlight.off","Does not highlight occurrences."),p("occurrencesHighlight.singleFile","Highlights occurrences only in the current file."),p("occurrencesHighlight.multiFile","Experimental: Highlights occurrences across all valid open files.")],markdownDescription:p("occurrencesHighlight","Controls whether occurrences should be highlighted across open files.")})),overviewRulerBorder:oe(new yt(82,"overviewRulerBorder",!0,{description:p("overviewRulerBorder","Controls whether a border should be drawn around the overview ruler.")})),overviewRulerLanes:oe(new zt(83,"overviewRulerLanes",3,0,3)),padding:oe(new HI),pasteAs:oe(new aT),parameterHints:oe(new UI),peekWidgetDefaultFocus:oe(new ai(87,"peekWidgetDefaultFocus","tree",["tree","editor"],{enumDescriptions:[p("peekWidgetDefaultFocus.tree","Focus the tree when opening peek"),p("peekWidgetDefaultFocus.editor","Focus the editor when opening peek")],description:p("peekWidgetDefaultFocus","Controls whether to focus the inline editor or the tree in the peek widget.")})),definitionLinkOpensInPeek:oe(new yt(88,"definitionLinkOpensInPeek",!1,{description:p("definitionLinkOpensInPeek","Controls whether the Go to Definition mouse gesture always opens the peek widget.")})),quickSuggestions:oe(new $I),quickSuggestionsDelay:oe(new zt(90,"quickSuggestionsDelay",10,0,1073741824,{description:p("quickSuggestionsDelay","Controls the delay in milliseconds after which quick suggestions will show up.")})),readOnly:oe(new yt(91,"readOnly",!1)),readOnlyMessage:oe(new GI),renameOnType:oe(new yt(93,"renameOnType",!1,{description:p("renameOnType","Controls whether the editor auto renames on type."),markdownDeprecationMessage:p("renameOnTypeDeprecate","Deprecated, use `editor.linkedEditing` instead.")})),renderControlCharacters:oe(new yt(94,"renderControlCharacters",!0,{description:p("renderControlCharacters","Controls whether the editor should render control characters."),restricted:!0})),renderFinalNewline:oe(new ai(95,"renderFinalNewline",mi?"dimmed":"on",["off","on","dimmed"],{description:p("renderFinalNewline","Render last line number when the file ends with a newline.")})),renderLineHighlight:oe(new ai(96,"renderLineHighlight","line",["none","gutter","line","all"],{enumDescriptions:["","","",p("renderLineHighlight.all","Highlights both the gutter and the current line.")],description:p("renderLineHighlight","Controls how the editor should render the current line highlight.")})),renderLineHighlightOnlyWhenFocus:oe(new yt(97,"renderLineHighlightOnlyWhenFocus",!1,{description:p("renderLineHighlightOnlyWhenFocus","Controls if the editor should render the current line highlight only when the editor is focused.")})),renderValidationDecorations:oe(new ai(98,"renderValidationDecorations","editable",["editable","on","off"])),renderWhitespace:oe(new ai(99,"renderWhitespace","selection",["none","boundary","selection","trailing","all"],{enumDescriptions:["",p("renderWhitespace.boundary","Render whitespace characters except for single spaces between words."),p("renderWhitespace.selection","Render whitespace characters only on selected text."),p("renderWhitespace.trailing","Render only trailing whitespace characters."),""],description:p("renderWhitespace","Controls how the editor should render whitespace characters.")})),revealHorizontalRightPadding:oe(new zt(100,"revealHorizontalRightPadding",15,0,1e3)),roundedSelection:oe(new yt(101,"roundedSelection",!0,{description:p("roundedSelection","Controls whether selections should have rounded corners.")})),rulers:oe(new jI),scrollbar:oe(new ZI),scrollBeyondLastColumn:oe(new zt(104,"scrollBeyondLastColumn",4,0,1073741824,{description:p("scrollBeyondLastColumn","Controls the number of extra characters beyond which the editor will scroll horizontally.")})),scrollBeyondLastLine:oe(new yt(105,"scrollBeyondLastLine",!0,{description:p("scrollBeyondLastLine","Controls whether the editor will scroll beyond the last line.")})),scrollPredominantAxis:oe(new yt(106,"scrollPredominantAxis",!0,{description:p("scrollPredominantAxis","Scroll only along the predominant axis when scrolling both vertically and horizontally at the same time. Prevents horizontal drift when scrolling vertically on a trackpad.")})),selectionClipboard:oe(new yt(107,"selectionClipboard",!0,{description:p("selectionClipboard","Controls whether the Linux primary clipboard should be supported."),included:mi})),selectionHighlight:oe(new yt(108,"selectionHighlight",!0,{description:p("selectionHighlight","Controls whether the editor should highlight matches similar to the selection.")})),selectOnLineNumbers:oe(new yt(109,"selectOnLineNumbers",!0)),showFoldingControls:oe(new ai(110,"showFoldingControls","mouseover",["always","never","mouseover"],{enumDescriptions:[p("showFoldingControls.always","Always show the folding controls."),p("showFoldingControls.never","Never show the folding controls and reduce the gutter size."),p("showFoldingControls.mouseover","Only show the folding controls when the mouse is over the gutter.")],description:p("showFoldingControls","Controls when the folding controls on the gutter are shown.")})),showUnused:oe(new yt(111,"showUnused",!0,{description:p("showUnused","Controls fading out of unused code.")})),showDeprecated:oe(new yt(140,"showDeprecated",!0,{description:p("showDeprecated","Controls strikethrough deprecated variables.")})),inlayHints:oe(new BI),snippetSuggestions:oe(new ai(112,"snippetSuggestions","inline",["top","bottom","inline","none"],{enumDescriptions:[p("snippetSuggestions.top","Show snippet suggestions on top of other suggestions."),p("snippetSuggestions.bottom","Show snippet suggestions below other suggestions."),p("snippetSuggestions.inline","Show snippets suggestions with other suggestions."),p("snippetSuggestions.none","Do not show snippet suggestions.")],description:p("snippetSuggestions","Controls whether snippets are shown with other suggestions and how they are sorted.")})),smartSelect:oe(new iT),smoothScrolling:oe(new yt(114,"smoothScrolling",!1,{description:p("smoothScrolling","Controls whether the editor will scroll using an animation.")})),stopRenderingLineAfter:oe(new zt(117,"stopRenderingLineAfter",1e4,-1,1073741824)),suggest:oe(new tT),inlineSuggest:oe(new XI),inlineEdit:oe(new QI),inlineCompletionsAccessibilityVerbose:oe(new yt(149,"inlineCompletionsAccessibilityVerbose",!1,{description:p("inlineCompletionsAccessibilityVerbose","Controls whether the accessibility hint should be provided to screen reader users when an inline completion is shown.")})),suggestFontSize:oe(new zt(119,"suggestFontSize",0,0,1e3,{markdownDescription:p("suggestFontSize","Font size for the suggest widget. When set to {0}, the value of {1} is used.","`0`","`#editor.fontSize#`")})),suggestLineHeight:oe(new zt(120,"suggestLineHeight",0,0,1e3,{markdownDescription:p("suggestLineHeight","Line height for the suggest widget. When set to {0}, the value of {1} is used. The minimum value is 8.","`0`","`#editor.lineHeight#`")})),suggestOnTriggerCharacters:oe(new yt(121,"suggestOnTriggerCharacters",!0,{description:p("suggestOnTriggerCharacters","Controls whether suggestions should automatically show up when typing trigger characters.")})),suggestSelection:oe(new ai(122,"suggestSelection","first",["first","recentlyUsed","recentlyUsedByPrefix"],{markdownEnumDescriptions:[p("suggestSelection.first","Always select the first suggestion."),p("suggestSelection.recentlyUsed","Select recent suggestions unless further typing selects one, e.g. `console.| -> console.log` because `log` has been completed recently."),p("suggestSelection.recentlyUsedByPrefix","Select suggestions based on previous prefixes that have completed those suggestions, e.g. `co -> console` and `con -> const`.")],description:p("suggestSelection","Controls how suggestions are pre-selected when showing the suggest list.")})),tabCompletion:oe(new ai(123,"tabCompletion","off",["on","off","onlySnippets"],{enumDescriptions:[p("tabCompletion.on","Tab complete will insert the best matching suggestion when pressing tab."),p("tabCompletion.off","Disable tab completions."),p("tabCompletion.onlySnippets","Tab complete snippets when their prefix match. Works best when 'quickSuggestions' aren't enabled.")],description:p("tabCompletion","Enables tab completions.")})),tabIndex:oe(new zt(124,"tabIndex",0,-1,1073741824)),unicodeHighlight:oe(new YI),unusualLineTerminators:oe(new ai(126,"unusualLineTerminators","prompt",["auto","off","prompt"],{enumDescriptions:[p("unusualLineTerminators.auto","Unusual line terminators are automatically removed."),p("unusualLineTerminators.off","Unusual line terminators are ignored."),p("unusualLineTerminators.prompt","Unusual line terminators prompt to be removed.")],description:p("unusualLineTerminators","Remove unusual line terminators that might cause problems.")})),useShadowDOM:oe(new yt(127,"useShadowDOM",!0)),useTabStops:oe(new yt(128,"useTabStops",!0,{description:p("useTabStops","Spaces and tabs are inserted and deleted in alignment with tab stops.")})),wordBreak:oe(new ai(129,"wordBreak","normal",["normal","keepAll"],{markdownEnumDescriptions:[p("wordBreak.normal","Use the default line break rule."),p("wordBreak.keepAll","Word breaks should not be used for Chinese/Japanese/Korean (CJK) text. Non-CJK text behavior is the same as for normal.")],description:p("wordBreak","Controls the word break rules used for Chinese/Japanese/Korean (CJK) text.")})),wordSegmenterLocales:oe(new nT),wordSeparators:oe(new No(131,"wordSeparators",LI,{description:p("wordSeparators","Characters that will be used as word separators when doing word related navigations or operations.")})),wordWrap:oe(new ai(132,"wordWrap","off",["off","on","wordWrapColumn","bounded"],{markdownEnumDescriptions:[p("wordWrap.off","Lines will never wrap."),p("wordWrap.on","Lines will wrap at the viewport width."),p({key:"wordWrap.wordWrapColumn",comment:["- `editor.wordWrapColumn` refers to a different setting and should not be localized."]},"Lines will wrap at `#editor.wordWrapColumn#`."),p({key:"wordWrap.bounded",comment:["- viewport means the edge of the visible window size.","- `editor.wordWrapColumn` refers to a different setting and should not be localized."]},"Lines will wrap at the minimum of viewport and `#editor.wordWrapColumn#`.")],description:p({key:"wordWrap",comment:["- 'off', 'on', 'wordWrapColumn' and 'bounded' refer to values the setting can take and should not be localized.","- `editor.wordWrapColumn` refers to a different setting and should not be localized."]},"Controls how lines should wrap.")})),wordWrapBreakAfterCharacters:oe(new No(133,"wordWrapBreakAfterCharacters"," })]?|/&.,;\xA2\xB0\u2032\u2033\u2030\u2103\u3001\u3002\uFF61\uFF64\uFFE0\uFF0C\uFF0E\uFF1A\uFF1B\uFF1F\uFF01\uFF05\u30FB\uFF65\u309D\u309E\u30FD\u30FE\u30FC\u30A1\u30A3\u30A5\u30A7\u30A9\u30C3\u30E3\u30E5\u30E7\u30EE\u30F5\u30F6\u3041\u3043\u3045\u3047\u3049\u3063\u3083\u3085\u3087\u308E\u3095\u3096\u31F0\u31F1\u31F2\u31F3\u31F4\u31F5\u31F6\u31F7\u31F8\u31F9\u31FA\u31FB\u31FC\u31FD\u31FE\u31FF\u3005\u303B\uFF67\uFF68\uFF69\uFF6A\uFF6B\uFF6C\uFF6D\uFF6E\uFF6F\uFF70\u201D\u3009\u300B\u300D\u300F\u3011\u3015\uFF09\uFF3D\uFF5D\uFF63")),wordWrapBreakBeforeCharacters:oe(new No(134,"wordWrapBreakBeforeCharacters","([{\u2018\u201C\u3008\u300A\u300C\u300E\u3010\u3014\uFF08\uFF3B\uFF5B\uFF62\xA3\xA5\uFF04\uFFE1\uFFE5+\uFF0B")),wordWrapColumn:oe(new zt(135,"wordWrapColumn",80,1,1073741824,{markdownDescription:p({key:"wordWrapColumn",comment:["- `editor.wordWrap` refers to a different setting and should not be localized.","- 'wordWrapColumn' and 'bounded' refer to values the different setting can take and should not be localized."]},"Controls the wrapping column of the editor when `#editor.wordWrap#` is `wordWrapColumn` or `bounded`.")})),wordWrapOverride1:oe(new ai(136,"wordWrapOverride1","inherit",["off","on","inherit"])),wordWrapOverride2:oe(new ai(137,"wordWrapOverride2","inherit",["off","on","inherit"])),editorClassName:oe(new EI),defaultColorDecorators:oe(new yt(147,"defaultColorDecorators",!1,{markdownDescription:p("defaultColorDecorators","Controls whether inline color decorations should be shown using the default document color provider")})),pixelRatio:oe(new KI),tabFocusMode:oe(new yt(144,"tabFocusMode",!1,{markdownDescription:p("tabFocusMode","Controls whether the editor receives tabs or defers them to the workbench for navigation.")})),layoutInfo:oe(new M_),wrappingInfo:oe(new sT),wrappingIndent:oe(new oT),wrappingStrategy:oe(new PI)};_();v();b();fs();ye();z_();sn();ft();Ke();Kn();Yo();_();v();b();var yC;(function(n){n[n.Unknown=0]="Unknown",n[n.Disabled=1]="Disabled",n[n.Enabled=2]="Enabled"})(yC||(yC={}));var SC;(function(n){n[n.Invoke=1]="Invoke",n[n.Auto=2]="Auto"})(SC||(SC={}));var xC;(function(n){n[n.None=0]="None",n[n.KeepWhitespace=1]="KeepWhitespace",n[n.InsertAsSnippet=4]="InsertAsSnippet"})(xC||(xC={}));var LC;(function(n){n[n.Method=0]="Method",n[n.Function=1]="Function",n[n.Constructor=2]="Constructor",n[n.Field=3]="Field",n[n.Variable=4]="Variable",n[n.Class=5]="Class",n[n.Struct=6]="Struct",n[n.Interface=7]="Interface",n[n.Module=8]="Module",n[n.Property=9]="Property",n[n.Event=10]="Event",n[n.Operator=11]="Operator",n[n.Unit=12]="Unit",n[n.Value=13]="Value",n[n.Constant=14]="Constant",n[n.Enum=15]="Enum",n[n.EnumMember=16]="EnumMember",n[n.Keyword=17]="Keyword",n[n.Text=18]="Text",n[n.Color=19]="Color",n[n.File=20]="File",n[n.Reference=21]="Reference",n[n.Customcolor=22]="Customcolor",n[n.Folder=23]="Folder",n[n.TypeParameter=24]="TypeParameter",n[n.User=25]="User",n[n.Issue=26]="Issue",n[n.Snippet=27]="Snippet"})(LC||(LC={}));var kC;(function(n){n[n.Deprecated=1]="Deprecated"})(kC||(kC={}));var DC;(function(n){n[n.Invoke=0]="Invoke",n[n.TriggerCharacter=1]="TriggerCharacter",n[n.TriggerForIncompleteCompletions=2]="TriggerForIncompleteCompletions"})(DC||(DC={}));var EC;(function(n){n[n.EXACT=0]="EXACT",n[n.ABOVE=1]="ABOVE",n[n.BELOW=2]="BELOW"})(EC||(EC={}));var IC;(function(n){n[n.NotSet=0]="NotSet",n[n.ContentFlush=1]="ContentFlush",n[n.RecoverFromMarkers=2]="RecoverFromMarkers",n[n.Explicit=3]="Explicit",n[n.Paste=4]="Paste",n[n.Undo=5]="Undo",n[n.Redo=6]="Redo"})(IC||(IC={}));var TC;(function(n){n[n.LF=1]="LF",n[n.CRLF=2]="CRLF"})(TC||(TC={}));var NC;(function(n){n[n.Text=0]="Text",n[n.Read=1]="Read",n[n.Write=2]="Write"})(NC||(NC={}));var AC;(function(n){n[n.None=0]="None",n[n.Keep=1]="Keep",n[n.Brackets=2]="Brackets",n[n.Advanced=3]="Advanced",n[n.Full=4]="Full"})(AC||(AC={}));var MC;(function(n){n[n.acceptSuggestionOnCommitCharacter=0]="acceptSuggestionOnCommitCharacter",n[n.acceptSuggestionOnEnter=1]="acceptSuggestionOnEnter",n[n.accessibilitySupport=2]="accessibilitySupport",n[n.accessibilityPageSize=3]="accessibilityPageSize",n[n.ariaLabel=4]="ariaLabel",n[n.ariaRequired=5]="ariaRequired",n[n.autoClosingBrackets=6]="autoClosingBrackets",n[n.autoClosingComments=7]="autoClosingComments",n[n.screenReaderAnnounceInlineSuggestion=8]="screenReaderAnnounceInlineSuggestion",n[n.autoClosingDelete=9]="autoClosingDelete",n[n.autoClosingOvertype=10]="autoClosingOvertype",n[n.autoClosingQuotes=11]="autoClosingQuotes",n[n.autoIndent=12]="autoIndent",n[n.automaticLayout=13]="automaticLayout",n[n.autoSurround=14]="autoSurround",n[n.bracketPairColorization=15]="bracketPairColorization",n[n.guides=16]="guides",n[n.codeLens=17]="codeLens",n[n.codeLensFontFamily=18]="codeLensFontFamily",n[n.codeLensFontSize=19]="codeLensFontSize",n[n.colorDecorators=20]="colorDecorators",n[n.colorDecoratorsLimit=21]="colorDecoratorsLimit",n[n.columnSelection=22]="columnSelection",n[n.comments=23]="comments",n[n.contextmenu=24]="contextmenu",n[n.copyWithSyntaxHighlighting=25]="copyWithSyntaxHighlighting",n[n.cursorBlinking=26]="cursorBlinking",n[n.cursorSmoothCaretAnimation=27]="cursorSmoothCaretAnimation",n[n.cursorStyle=28]="cursorStyle",n[n.cursorSurroundingLines=29]="cursorSurroundingLines",n[n.cursorSurroundingLinesStyle=30]="cursorSurroundingLinesStyle",n[n.cursorWidth=31]="cursorWidth",n[n.disableLayerHinting=32]="disableLayerHinting",n[n.disableMonospaceOptimizations=33]="disableMonospaceOptimizations",n[n.domReadOnly=34]="domReadOnly",n[n.dragAndDrop=35]="dragAndDrop",n[n.dropIntoEditor=36]="dropIntoEditor",n[n.emptySelectionClipboard=37]="emptySelectionClipboard",n[n.experimentalWhitespaceRendering=38]="experimentalWhitespaceRendering",n[n.extraEditorClassName=39]="extraEditorClassName",n[n.fastScrollSensitivity=40]="fastScrollSensitivity",n[n.find=41]="find",n[n.fixedOverflowWidgets=42]="fixedOverflowWidgets",n[n.folding=43]="folding",n[n.foldingStrategy=44]="foldingStrategy",n[n.foldingHighlight=45]="foldingHighlight",n[n.foldingImportsByDefault=46]="foldingImportsByDefault",n[n.foldingMaximumRegions=47]="foldingMaximumRegions",n[n.unfoldOnClickAfterEndOfLine=48]="unfoldOnClickAfterEndOfLine",n[n.fontFamily=49]="fontFamily",n[n.fontInfo=50]="fontInfo",n[n.fontLigatures=51]="fontLigatures",n[n.fontSize=52]="fontSize",n[n.fontWeight=53]="fontWeight",n[n.fontVariations=54]="fontVariations",n[n.formatOnPaste=55]="formatOnPaste",n[n.formatOnType=56]="formatOnType",n[n.glyphMargin=57]="glyphMargin",n[n.gotoLocation=58]="gotoLocation",n[n.hideCursorInOverviewRuler=59]="hideCursorInOverviewRuler",n[n.hover=60]="hover",n[n.inDiffEditor=61]="inDiffEditor",n[n.inlineSuggest=62]="inlineSuggest",n[n.inlineEdit=63]="inlineEdit",n[n.letterSpacing=64]="letterSpacing",n[n.lightbulb=65]="lightbulb",n[n.lineDecorationsWidth=66]="lineDecorationsWidth",n[n.lineHeight=67]="lineHeight",n[n.lineNumbers=68]="lineNumbers",n[n.lineNumbersMinChars=69]="lineNumbersMinChars",n[n.linkedEditing=70]="linkedEditing",n[n.links=71]="links",n[n.matchBrackets=72]="matchBrackets",n[n.minimap=73]="minimap",n[n.mouseStyle=74]="mouseStyle",n[n.mouseWheelScrollSensitivity=75]="mouseWheelScrollSensitivity",n[n.mouseWheelZoom=76]="mouseWheelZoom",n[n.multiCursorMergeOverlapping=77]="multiCursorMergeOverlapping",n[n.multiCursorModifier=78]="multiCursorModifier",n[n.multiCursorPaste=79]="multiCursorPaste",n[n.multiCursorLimit=80]="multiCursorLimit",n[n.occurrencesHighlight=81]="occurrencesHighlight",n[n.overviewRulerBorder=82]="overviewRulerBorder",n[n.overviewRulerLanes=83]="overviewRulerLanes",n[n.padding=84]="padding",n[n.pasteAs=85]="pasteAs",n[n.parameterHints=86]="parameterHints",n[n.peekWidgetDefaultFocus=87]="peekWidgetDefaultFocus",n[n.definitionLinkOpensInPeek=88]="definitionLinkOpensInPeek",n[n.quickSuggestions=89]="quickSuggestions",n[n.quickSuggestionsDelay=90]="quickSuggestionsDelay",n[n.readOnly=91]="readOnly",n[n.readOnlyMessage=92]="readOnlyMessage",n[n.renameOnType=93]="renameOnType",n[n.renderControlCharacters=94]="renderControlCharacters",n[n.renderFinalNewline=95]="renderFinalNewline",n[n.renderLineHighlight=96]="renderLineHighlight",n[n.renderLineHighlightOnlyWhenFocus=97]="renderLineHighlightOnlyWhenFocus",n[n.renderValidationDecorations=98]="renderValidationDecorations",n[n.renderWhitespace=99]="renderWhitespace",n[n.revealHorizontalRightPadding=100]="revealHorizontalRightPadding",n[n.roundedSelection=101]="roundedSelection",n[n.rulers=102]="rulers",n[n.scrollbar=103]="scrollbar",n[n.scrollBeyondLastColumn=104]="scrollBeyondLastColumn",n[n.scrollBeyondLastLine=105]="scrollBeyondLastLine",n[n.scrollPredominantAxis=106]="scrollPredominantAxis",n[n.selectionClipboard=107]="selectionClipboard",n[n.selectionHighlight=108]="selectionHighlight",n[n.selectOnLineNumbers=109]="selectOnLineNumbers",n[n.showFoldingControls=110]="showFoldingControls",n[n.showUnused=111]="showUnused",n[n.snippetSuggestions=112]="snippetSuggestions",n[n.smartSelect=113]="smartSelect",n[n.smoothScrolling=114]="smoothScrolling",n[n.stickyScroll=115]="stickyScroll",n[n.stickyTabStops=116]="stickyTabStops",n[n.stopRenderingLineAfter=117]="stopRenderingLineAfter",n[n.suggest=118]="suggest",n[n.suggestFontSize=119]="suggestFontSize",n[n.suggestLineHeight=120]="suggestLineHeight",n[n.suggestOnTriggerCharacters=121]="suggestOnTriggerCharacters",n[n.suggestSelection=122]="suggestSelection",n[n.tabCompletion=123]="tabCompletion",n[n.tabIndex=124]="tabIndex",n[n.unicodeHighlighting=125]="unicodeHighlighting",n[n.unusualLineTerminators=126]="unusualLineTerminators",n[n.useShadowDOM=127]="useShadowDOM",n[n.useTabStops=128]="useTabStops",n[n.wordBreak=129]="wordBreak",n[n.wordSegmenterLocales=130]="wordSegmenterLocales",n[n.wordSeparators=131]="wordSeparators",n[n.wordWrap=132]="wordWrap",n[n.wordWrapBreakAfterCharacters=133]="wordWrapBreakAfterCharacters",n[n.wordWrapBreakBeforeCharacters=134]="wordWrapBreakBeforeCharacters",n[n.wordWrapColumn=135]="wordWrapColumn",n[n.wordWrapOverride1=136]="wordWrapOverride1",n[n.wordWrapOverride2=137]="wordWrapOverride2",n[n.wrappingIndent=138]="wrappingIndent",n[n.wrappingStrategy=139]="wrappingStrategy",n[n.showDeprecated=140]="showDeprecated",n[n.inlayHints=141]="inlayHints",n[n.editorClassName=142]="editorClassName",n[n.pixelRatio=143]="pixelRatio",n[n.tabFocusMode=144]="tabFocusMode",n[n.layoutInfo=145]="layoutInfo",n[n.wrappingInfo=146]="wrappingInfo",n[n.defaultColorDecorators=147]="defaultColorDecorators",n[n.colorDecoratorsActivatedOn=148]="colorDecoratorsActivatedOn",n[n.inlineCompletionsAccessibilityVerbose=149]="inlineCompletionsAccessibilityVerbose"})(MC||(MC={}));var RC;(function(n){n[n.TextDefined=0]="TextDefined",n[n.LF=1]="LF",n[n.CRLF=2]="CRLF"})(RC||(RC={}));var PC;(function(n){n[n.LF=0]="LF",n[n.CRLF=1]="CRLF"})(PC||(PC={}));var OC;(function(n){n[n.Left=1]="Left",n[n.Center=2]="Center",n[n.Right=3]="Right"})(OC||(OC={}));var FC;(function(n){n[n.Increase=0]="Increase",n[n.Decrease=1]="Decrease"})(FC||(FC={}));var BC;(function(n){n[n.None=0]="None",n[n.Indent=1]="Indent",n[n.IndentOutdent=2]="IndentOutdent",n[n.Outdent=3]="Outdent"})(BC||(BC={}));var WC;(function(n){n[n.Both=0]="Both",n[n.Right=1]="Right",n[n.Left=2]="Left",n[n.None=3]="None"})(WC||(WC={}));var zC;(function(n){n[n.Type=1]="Type",n[n.Parameter=2]="Parameter"})(zC||(zC={}));var VC;(function(n){n[n.Automatic=0]="Automatic",n[n.Explicit=1]="Explicit"})(VC||(VC={}));var HC;(function(n){n[n.Invoke=0]="Invoke",n[n.Automatic=1]="Automatic"})(HC||(HC={}));var UC;(function(n){n[n.DependsOnKbLayout=-1]="DependsOnKbLayout",n[n.Unknown=0]="Unknown",n[n.Backspace=1]="Backspace",n[n.Tab=2]="Tab",n[n.Enter=3]="Enter",n[n.Shift=4]="Shift",n[n.Ctrl=5]="Ctrl",n[n.Alt=6]="Alt",n[n.PauseBreak=7]="PauseBreak",n[n.CapsLock=8]="CapsLock",n[n.Escape=9]="Escape",n[n.Space=10]="Space",n[n.PageUp=11]="PageUp",n[n.PageDown=12]="PageDown",n[n.End=13]="End",n[n.Home=14]="Home",n[n.LeftArrow=15]="LeftArrow",n[n.UpArrow=16]="UpArrow",n[n.RightArrow=17]="RightArrow",n[n.DownArrow=18]="DownArrow",n[n.Insert=19]="Insert",n[n.Delete=20]="Delete",n[n.Digit0=21]="Digit0",n[n.Digit1=22]="Digit1",n[n.Digit2=23]="Digit2",n[n.Digit3=24]="Digit3",n[n.Digit4=25]="Digit4",n[n.Digit5=26]="Digit5",n[n.Digit6=27]="Digit6",n[n.Digit7=28]="Digit7",n[n.Digit8=29]="Digit8",n[n.Digit9=30]="Digit9",n[n.KeyA=31]="KeyA",n[n.KeyB=32]="KeyB",n[n.KeyC=33]="KeyC",n[n.KeyD=34]="KeyD",n[n.KeyE=35]="KeyE",n[n.KeyF=36]="KeyF",n[n.KeyG=37]="KeyG",n[n.KeyH=38]="KeyH",n[n.KeyI=39]="KeyI",n[n.KeyJ=40]="KeyJ",n[n.KeyK=41]="KeyK",n[n.KeyL=42]="KeyL",n[n.KeyM=43]="KeyM",n[n.KeyN=44]="KeyN",n[n.KeyO=45]="KeyO",n[n.KeyP=46]="KeyP",n[n.KeyQ=47]="KeyQ",n[n.KeyR=48]="KeyR",n[n.KeyS=49]="KeyS",n[n.KeyT=50]="KeyT",n[n.KeyU=51]="KeyU",n[n.KeyV=52]="KeyV",n[n.KeyW=53]="KeyW",n[n.KeyX=54]="KeyX",n[n.KeyY=55]="KeyY",n[n.KeyZ=56]="KeyZ",n[n.Meta=57]="Meta",n[n.ContextMenu=58]="ContextMenu",n[n.F1=59]="F1",n[n.F2=60]="F2",n[n.F3=61]="F3",n[n.F4=62]="F4",n[n.F5=63]="F5",n[n.F6=64]="F6",n[n.F7=65]="F7",n[n.F8=66]="F8",n[n.F9=67]="F9",n[n.F10=68]="F10",n[n.F11=69]="F11",n[n.F12=70]="F12",n[n.F13=71]="F13",n[n.F14=72]="F14",n[n.F15=73]="F15",n[n.F16=74]="F16",n[n.F17=75]="F17",n[n.F18=76]="F18",n[n.F19=77]="F19",n[n.F20=78]="F20",n[n.F21=79]="F21",n[n.F22=80]="F22",n[n.F23=81]="F23",n[n.F24=82]="F24",n[n.NumLock=83]="NumLock",n[n.ScrollLock=84]="ScrollLock",n[n.Semicolon=85]="Semicolon",n[n.Equal=86]="Equal",n[n.Comma=87]="Comma",n[n.Minus=88]="Minus",n[n.Period=89]="Period",n[n.Slash=90]="Slash",n[n.Backquote=91]="Backquote",n[n.BracketLeft=92]="BracketLeft",n[n.Backslash=93]="Backslash",n[n.BracketRight=94]="BracketRight",n[n.Quote=95]="Quote",n[n.OEM_8=96]="OEM_8",n[n.IntlBackslash=97]="IntlBackslash",n[n.Numpad0=98]="Numpad0",n[n.Numpad1=99]="Numpad1",n[n.Numpad2=100]="Numpad2",n[n.Numpad3=101]="Numpad3",n[n.Numpad4=102]="Numpad4",n[n.Numpad5=103]="Numpad5",n[n.Numpad6=104]="Numpad6",n[n.Numpad7=105]="Numpad7",n[n.Numpad8=106]="Numpad8",n[n.Numpad9=107]="Numpad9",n[n.NumpadMultiply=108]="NumpadMultiply",n[n.NumpadAdd=109]="NumpadAdd",n[n.NUMPAD_SEPARATOR=110]="NUMPAD_SEPARATOR",n[n.NumpadSubtract=111]="NumpadSubtract",n[n.NumpadDecimal=112]="NumpadDecimal",n[n.NumpadDivide=113]="NumpadDivide",n[n.KEY_IN_COMPOSITION=114]="KEY_IN_COMPOSITION",n[n.ABNT_C1=115]="ABNT_C1",n[n.ABNT_C2=116]="ABNT_C2",n[n.AudioVolumeMute=117]="AudioVolumeMute",n[n.AudioVolumeUp=118]="AudioVolumeUp",n[n.AudioVolumeDown=119]="AudioVolumeDown",n[n.BrowserSearch=120]="BrowserSearch",n[n.BrowserHome=121]="BrowserHome",n[n.BrowserBack=122]="BrowserBack",n[n.BrowserForward=123]="BrowserForward",n[n.MediaTrackNext=124]="MediaTrackNext",n[n.MediaTrackPrevious=125]="MediaTrackPrevious",n[n.MediaStop=126]="MediaStop",n[n.MediaPlayPause=127]="MediaPlayPause",n[n.LaunchMediaPlayer=128]="LaunchMediaPlayer",n[n.LaunchMail=129]="LaunchMail",n[n.LaunchApp2=130]="LaunchApp2",n[n.Clear=131]="Clear",n[n.MAX_VALUE=132]="MAX_VALUE"})(UC||(UC={}));var KC;(function(n){n[n.Hint=1]="Hint",n[n.Info=2]="Info",n[n.Warning=4]="Warning",n[n.Error=8]="Error"})(KC||(KC={}));var $C;(function(n){n[n.Unnecessary=1]="Unnecessary",n[n.Deprecated=2]="Deprecated"})($C||($C={}));var qC;(function(n){n[n.Inline=1]="Inline",n[n.Gutter=2]="Gutter"})(qC||(qC={}));var jC;(function(n){n[n.Normal=1]="Normal",n[n.Underlined=2]="Underlined"})(jC||(jC={}));var GC;(function(n){n[n.UNKNOWN=0]="UNKNOWN",n[n.TEXTAREA=1]="TEXTAREA",n[n.GUTTER_GLYPH_MARGIN=2]="GUTTER_GLYPH_MARGIN",n[n.GUTTER_LINE_NUMBERS=3]="GUTTER_LINE_NUMBERS",n[n.GUTTER_LINE_DECORATIONS=4]="GUTTER_LINE_DECORATIONS",n[n.GUTTER_VIEW_ZONE=5]="GUTTER_VIEW_ZONE",n[n.CONTENT_TEXT=6]="CONTENT_TEXT",n[n.CONTENT_EMPTY=7]="CONTENT_EMPTY",n[n.CONTENT_VIEW_ZONE=8]="CONTENT_VIEW_ZONE",n[n.CONTENT_WIDGET=9]="CONTENT_WIDGET",n[n.OVERVIEW_RULER=10]="OVERVIEW_RULER",n[n.SCROLLBAR=11]="SCROLLBAR",n[n.OVERLAY_WIDGET=12]="OVERLAY_WIDGET",n[n.OUTSIDE_EDITOR=13]="OUTSIDE_EDITOR"})(GC||(GC={}));var ZC;(function(n){n[n.AIGenerated=1]="AIGenerated"})(ZC||(ZC={}));var YC;(function(n){n[n.Invoke=0]="Invoke",n[n.Automatic=1]="Automatic"})(YC||(YC={}));var XC;(function(n){n[n.TOP_RIGHT_CORNER=0]="TOP_RIGHT_CORNER",n[n.BOTTOM_RIGHT_CORNER=1]="BOTTOM_RIGHT_CORNER",n[n.TOP_CENTER=2]="TOP_CENTER"})(XC||(XC={}));var QC;(function(n){n[n.Left=1]="Left",n[n.Center=2]="Center",n[n.Right=4]="Right",n[n.Full=7]="Full"})(QC||(QC={}));var JC;(function(n){n[n.Word=0]="Word",n[n.Line=1]="Line",n[n.Suggest=2]="Suggest"})(JC||(JC={}));var ew;(function(n){n[n.Left=0]="Left",n[n.Right=1]="Right",n[n.None=2]="None",n[n.LeftOfInjectedText=3]="LeftOfInjectedText",n[n.RightOfInjectedText=4]="RightOfInjectedText"})(ew||(ew={}));var tw;(function(n){n[n.Off=0]="Off",n[n.On=1]="On",n[n.Relative=2]="Relative",n[n.Interval=3]="Interval",n[n.Custom=4]="Custom"})(tw||(tw={}));var iw;(function(n){n[n.None=0]="None",n[n.Text=1]="Text",n[n.Blocks=2]="Blocks"})(iw||(iw={}));var nw;(function(n){n[n.Smooth=0]="Smooth",n[n.Immediate=1]="Immediate"})(nw||(nw={}));var ow;(function(n){n[n.Auto=1]="Auto",n[n.Hidden=2]="Hidden",n[n.Visible=3]="Visible"})(ow||(ow={}));var sw;(function(n){n[n.LTR=0]="LTR",n[n.RTL=1]="RTL"})(sw||(sw={}));var rw;(function(n){n.Off="off",n.OnCode="onCode",n.On="on"})(rw||(rw={}));var aw;(function(n){n[n.Invoke=1]="Invoke",n[n.TriggerCharacter=2]="TriggerCharacter",n[n.ContentChange=3]="ContentChange"})(aw||(aw={}));var lw;(function(n){n[n.File=0]="File",n[n.Module=1]="Module",n[n.Namespace=2]="Namespace",n[n.Package=3]="Package",n[n.Class=4]="Class",n[n.Method=5]="Method",n[n.Property=6]="Property",n[n.Field=7]="Field",n[n.Constructor=8]="Constructor",n[n.Enum=9]="Enum",n[n.Interface=10]="Interface",n[n.Function=11]="Function",n[n.Variable=12]="Variable",n[n.Constant=13]="Constant",n[n.String=14]="String",n[n.Number=15]="Number",n[n.Boolean=16]="Boolean",n[n.Array=17]="Array",n[n.Object=18]="Object",n[n.Key=19]="Key",n[n.Null=20]="Null",n[n.EnumMember=21]="EnumMember",n[n.Struct=22]="Struct",n[n.Event=23]="Event",n[n.Operator=24]="Operator",n[n.TypeParameter=25]="TypeParameter"})(lw||(lw={}));var cw;(function(n){n[n.Deprecated=1]="Deprecated"})(cw||(cw={}));var dw;(function(n){n[n.Hidden=0]="Hidden",n[n.Blink=1]="Blink",n[n.Smooth=2]="Smooth",n[n.Phase=3]="Phase",n[n.Expand=4]="Expand",n[n.Solid=5]="Solid"})(dw||(dw={}));var hw;(function(n){n[n.Line=1]="Line",n[n.Block=2]="Block",n[n.Underline=3]="Underline",n[n.LineThin=4]="LineThin",n[n.BlockOutline=5]="BlockOutline",n[n.UnderlineThin=6]="UnderlineThin"})(hw||(hw={}));var uw;(function(n){n[n.AlwaysGrowsWhenTypingAtEdges=0]="AlwaysGrowsWhenTypingAtEdges",n[n.NeverGrowsWhenTypingAtEdges=1]="NeverGrowsWhenTypingAtEdges",n[n.GrowsOnlyWhenTypingBefore=2]="GrowsOnlyWhenTypingBefore",n[n.GrowsOnlyWhenTypingAfter=3]="GrowsOnlyWhenTypingAfter"})(uw||(uw={}));var fw;(function(n){n[n.None=0]="None",n[n.Same=1]="Same",n[n.Indent=2]="Indent",n[n.DeepIndent=3]="DeepIndent"})(fw||(fw={}));var ru=class{static chord(e,t){return N9(e,t)}};ru.CtrlCmd=2048;ru.Shift=1024;ru.Alt=512;ru.WinCtrl=256;function gw(){return{editor:void 0,languages:void 0,CancellationTokenSource:un,Emitter:B,KeyCode:UC,KeyMod:ru,Position:U,Range:P,Selection:nt,SelectionDirection:sw,MarkerSeverity:KC,MarkerTag:$C,Uri:Oe,Token:xa}}_();v();b();vo();le();ot();sn();_();v();b();ke();_();v();b();ke();ye();le();var nN=class extends H{constructor(e){super(),this._onDidChange=this._register(new B),this.onDidChange=this._onDidChange.event,this._listener=()=>this._handleChange(e,!0),this._mediaQueryList=null,this._handleChange(e,!1)}_handleChange(e,t){var i;(i=this._mediaQueryList)===null||i===void 0||i.removeEventListener("change",this._listener),this._mediaQueryList=e.matchMedia(`(resolution: ${e.devicePixelRatio}dppx)`),this._mediaQueryList.addEventListener("change",this._listener),t&&this._onDidChange.fire()}},oN=class extends H{get value(){return this._value}constructor(e){super(),this._onDidChange=this._register(new B),this.onDidChange=this._onDidChange.event,this._value=this._getPixelRatio(e);let t=this._register(new nN(e));this._register(t.onDidChange(()=>{this._value=this._getPixelRatio(e),this._onDidChange.fire(this._value)}))}_getPixelRatio(e){let t=document.createElement("canvas").getContext("2d"),i=e.devicePixelRatio||1,o=t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1;return i/o}},sN=class{constructor(){this.mapWindowIdToPixelRatioMonitor=new Map}_getOrCreatePixelRatioMonitor(e){let t=Wg(e),i=this.mapWindowIdToPixelRatioMonitor.get(t);return i||(i=Ld(new oN(e)),this.mapWindowIdToPixelRatioMonitor.set(t,i),Ld(ie.once(P7)(({vscodeWindowId:o})=>{o===t&&(i?.dispose(),this.mapWindowIdToPixelRatioMonitor.delete(t))}))),i}getInstance(e){return this._getOrCreatePixelRatioMonitor(e)}},Kg=new sN;ye();le();_();v();b();_();v();b();_();v();b();var v0=class{constructor(e){this.domNode=e,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingLeft="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(e){let t=Ta(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=Ta(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=Ta(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=Ta(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=Ta(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=Ta(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=Ta(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingLeft(e){let t=Ta(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=Ta(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=Ta(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=Ta(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function Ta(n){return typeof n=="number"?`${n}px`:n}function $e(n){return new v0(n)}function Si(n,e){n instanceof v0?(n.setFontFamily(e.getMassagedFontFamily()),n.setFontWeight(e.fontWeight),n.setFontSize(e.fontSize),n.setFontFeatureSettings(e.fontFeatureSettings),n.setFontVariationSettings(e.fontVariationSettings),n.setLineHeight(e.lineHeight),n.setLetterSpacing(e.letterSpacing)):(n.style.fontFamily=e.getMassagedFontFamily(),n.style.fontWeight=e.fontWeight,n.style.fontSize=e.fontSize+"px",n.style.fontFeatureSettings=e.fontFeatureSettings,n.style.fontVariationSettings=e.fontVariationSettings,n.style.lineHeight=e.lineHeight+"px",n.style.letterSpacing=e.letterSpacing+"px")}var Qw=class{constructor(e,t){this.chr=e,this.type=t,this.width=0}fulfill(e){this.width=e}},rN=class n{constructor(e,t){this._bareFontInfo=e,this._requests=t,this._container=null,this._testElements=null}read(e){this._createDomElements(),e.document.body.appendChild(this._container),this._readFromDomElements(),e.document.body.removeChild(this._container),this._container=null,this._testElements=null}_createDomElements(){let e=document.createElement("div");e.style.position="absolute",e.style.top="-50000px",e.style.width="50000px";let t=document.createElement("div");Si(t,this._bareFontInfo),e.appendChild(t);let i=document.createElement("div");Si(i,this._bareFontInfo),i.style.fontWeight="bold",e.appendChild(i);let o=document.createElement("div");Si(o,this._bareFontInfo),o.style.fontStyle="italic",e.appendChild(o);let s=[];for(let r of this._requests){let a;r.type===0&&(a=t),r.type===2&&(a=i),r.type===1&&(a=o),a.appendChild(document.createElement("br"));let l=document.createElement("span");n._render(l,r),a.appendChild(l),s.push(l)}this._container=e,this._testElements=s}static _render(e,t){if(t.chr===" "){let i="\xA0";for(let o=0;o<8;o++)i+=i;e.innerText=i}else{let i=t.chr;for(let o=0;o<8;o++)i+=i;e.textContent=i}}_readFromDomElements(){for(let e=0,t=this._requests.length;e{this._evictUntrustedReadingsTimeout=-1,this._evictUntrustedReadings(e)},5e3))}_evictUntrustedReadings(e){let t=this._ensureCache(e),i=t.getValues(),o=!1;for(let s of i)s.isTrusted||(o=!0,t.remove(s));o&&this._onDidChange.fire()}readFontInfo(e,t){let i=this._ensureCache(e);if(!i.has(t)){let o=this._actualReadFontInfo(e,t);(o.typicalHalfwidthCharacterWidth<=2||o.typicalFullwidthCharacterWidth<=2||o.spaceWidth<=2||o.maxDigitWidth<=2)&&(o=new pu({pixelRatio:Kg.getInstance(e).value,fontFamily:o.fontFamily,fontWeight:o.fontWeight,fontSize:o.fontSize,fontFeatureSettings:o.fontFeatureSettings,fontVariationSettings:o.fontVariationSettings,lineHeight:o.lineHeight,letterSpacing:o.letterSpacing,isMonospace:o.isMonospace,typicalHalfwidthCharacterWidth:Math.max(o.typicalHalfwidthCharacterWidth,5),typicalFullwidthCharacterWidth:Math.max(o.typicalFullwidthCharacterWidth,5),canUseHalfwidthRightwardsArrow:o.canUseHalfwidthRightwardsArrow,spaceWidth:Math.max(o.spaceWidth,5),middotWidth:Math.max(o.middotWidth,5),wsmiddotWidth:Math.max(o.wsmiddotWidth,5),maxDigitWidth:Math.max(o.maxDigitWidth,5)},!1)),this._writeToCache(e,t,o)}return i.get(t)}_createRequest(e,t,i,o){let s=new Qw(e,t);return i.push(s),o?.push(s),s}_actualReadFontInfo(e,t){let i=[],o=[],s=this._createRequest("n",0,i,o),r=this._createRequest("\uFF4D",0,i,null),a=this._createRequest(" ",0,i,o),l=this._createRequest("0",0,i,o),c=this._createRequest("1",0,i,o),d=this._createRequest("2",0,i,o),h=this._createRequest("3",0,i,o),u=this._createRequest("4",0,i,o),f=this._createRequest("5",0,i,o),g=this._createRequest("6",0,i,o),m=this._createRequest("7",0,i,o),C=this._createRequest("8",0,i,o),S=this._createRequest("9",0,i,o),w=this._createRequest("\u2192",0,i,o),y=this._createRequest("\uFFEB",0,i,null),x=this._createRequest("\xB7",0,i,o),k=this._createRequest("\u2E31",0,i,null),T="|/-_ilm%";for(let G=0,V=T.length;G.001){M=!1;break}}let j=!0;return M&&y.width!==W&&(j=!1),y.width>w.width&&(j=!1),new pu({pixelRatio:Kg.getInstance(e).value,fontFamily:t.fontFamily,fontWeight:t.fontWeight,fontSize:t.fontSize,fontFeatureSettings:t.fontFeatureSettings,fontVariationSettings:t.fontVariationSettings,lineHeight:t.lineHeight,letterSpacing:t.letterSpacing,isMonospace:M,typicalHalfwidthCharacterWidth:s.width,typicalFullwidthCharacterWidth:r.width,canUseHalfwidthRightwardsArrow:j,spaceWidth:a.width,middotWidth:x.width,wsmiddotWidth:k.width,maxDigitWidth:N},!0)}},cN=class{constructor(){this._keys=Object.create(null),this._values=Object.create(null)}has(e){let t=e.getId();return!!this._values[t]}get(e){let t=e.getId();return this._values[t]}put(e,t){let i=e.getId();this._keys[i]=e,this._values[i]=t}remove(e){let t=e.getId();delete this._keys[t],delete this._values[t]}getValues(){return Object.keys(this._keys).map(e=>this._values[e])}},C0=new lN;Ud();Or();_();v();b();hs();_();v();b();Gt();le();_();v();b();xt();ye();le();hs();Lt();ot();var Jq="$initialize",h3=!1;function I0(n){hl&&(h3||(h3=!0,console.warn("Could not create web worker(s). Falling back to loading web worker code in main thread, which might cause UI freezes. Please see https://github.com/microsoft/monaco-editor#faq")),console.warn(n.message))}var vN=class{constructor(e,t,i,o){this.vsWorker=e,this.req=t,this.method=i,this.args=o,this.type=0}},Cy=class{constructor(e,t,i,o){this.vsWorker=e,this.seq=t,this.res=i,this.err=o,this.type=1}},CN=class{constructor(e,t,i,o){this.vsWorker=e,this.req=t,this.eventName=i,this.arg=o,this.type=2}},wN=class{constructor(e,t,i){this.vsWorker=e,this.req=t,this.event=i,this.type=3}},yN=class{constructor(e,t){this.vsWorker=e,this.req=t,this.type=4}},SN=class{constructor(e){this._workerId=-1,this._handler=e,this._lastSentReq=0,this._pendingReplies=Object.create(null),this._pendingEmitters=new Map,this._pendingEvents=new Map}setWorkerId(e){this._workerId=e}sendMessage(e,t){let i=String(++this._lastSentReq);return new Promise((o,s)=>{this._pendingReplies[i]={resolve:o,reject:s},this._send(new vN(this._workerId,i,e,t))})}listen(e,t){let i=null,o=new B({onWillAddFirstListener:()=>{i=String(++this._lastSentReq),this._pendingEmitters.set(i,o),this._send(new CN(this._workerId,i,e,t))},onDidRemoveLastListener:()=>{this._pendingEmitters.delete(i),this._send(new yN(this._workerId,i)),i=null}});return o.event}handleMessage(e){!e||!e.vsWorker||this._workerId!==-1&&e.vsWorker!==this._workerId||this._handleMessage(e)}_handleMessage(e){switch(e.type){case 1:return this._handleReplyMessage(e);case 0:return this._handleRequestMessage(e);case 2:return this._handleSubscribeEventMessage(e);case 3:return this._handleEventMessage(e);case 4:return this._handleUnsubscribeEventMessage(e)}}_handleReplyMessage(e){if(!this._pendingReplies[e.seq]){console.warn("Got reply to unknown seq");return}let t=this._pendingReplies[e.seq];if(delete this._pendingReplies[e.seq],e.err){let i=e.err;e.err.$isError&&(i=new Error,i.name=e.err.name,i.message=e.err.message,i.stack=e.err.stack),t.reject(i);return}t.resolve(e.res)}_handleRequestMessage(e){let t=e.req;this._handler.handleMessage(e.method,e.args).then(o=>{this._send(new Cy(this._workerId,t,o,void 0))},o=>{o.detail instanceof Error&&(o.detail=cT(o.detail)),this._send(new Cy(this._workerId,t,void 0,cT(o)))})}_handleSubscribeEventMessage(e){let t=e.req,i=this._handler.handleEvent(e.eventName,e.arg)(o=>{this._send(new wN(this._workerId,t,o))});this._pendingEvents.set(t,i)}_handleEventMessage(e){if(!this._pendingEmitters.has(e.req)){console.warn("Got event for unknown req");return}this._pendingEmitters.get(e.req).fire(e.event)}_handleUnsubscribeEventMessage(e){if(!this._pendingEvents.has(e.req)){console.warn("Got unsubscribe for unknown req");return}this._pendingEvents.get(e.req).dispose(),this._pendingEvents.delete(e.req)}_send(e){let t=[];if(e.type===0)for(let i=0;i{this._protocol.handleMessage(d)},d=>{o?.(d)})),this._protocol=new SN({sendMessage:(d,h)=>{this._worker.postMessage(d,h)},handleMessage:(d,h)=>{if(typeof i[d]!="function")return Promise.reject(new Error("Missing method "+d+" on main thread host."));try{return Promise.resolve(i[d].apply(i,h))}catch(u){return Promise.reject(u)}},handleEvent:(d,h)=>{if(f3(d)){let u=i[d].call(i,h);if(typeof u!="function")throw new Error(`Missing dynamic event ${d} on main thread host.`);return u}if(u3(d)){let u=i[d];if(typeof u!="function")throw new Error(`Missing event ${d} on main thread host.`);return u}throw new Error(`Malformed event name ${d}`)}}),this._protocol.setWorkerId(this._worker.getId());let s=null,r=globalThis.require;typeof r<"u"&&typeof r.getConfig=="function"?s=r.getConfig():typeof globalThis.requirejs<"u"&&(s=globalThis.requirejs.s.contexts._.config);let a=dg(i);this._onModuleLoaded=this._protocol.sendMessage(Jq,[this._worker.getId(),JSON.parse(JSON.stringify(s)),t,a]);let l=(d,h)=>this._request(d,h),c=(d,h)=>this._protocol.listen(d,h);this._lazyProxy=new Promise((d,h)=>{o=h,this._onModuleLoaded.then(u=>{d(ej(u,l,c))},u=>{h(u),this._onError("Worker failed to load "+t,u)})})}getProxyObject(){return this._lazyProxy}_request(e,t){return new Promise((i,o)=>{this._onModuleLoaded.then(()=>{this._protocol.sendMessage(e,t).then(i,o)},o)})}_onError(e,t){console.error(e),console.info(t)}};function u3(n){return n[0]==="o"&&n[1]==="n"&&ml(n.charCodeAt(2))}function f3(n){return/^onDynamic/.test(n)&&ml(n.charCodeAt(9))}function ej(n,e,t){let i=r=>function(){let a=Array.prototype.slice.call(arguments,0);return e(r,a)},o=r=>function(a){return t(r,a)},s={};for(let r of n){if(f3(r)){s[r]=o(r);continue}if(u3(r)){s[r]=t(r,void 0);continue}s[r]=i(r)}return s}_();v();b();_();v();b();vo();xt();function Bs(n,e){var t;let i=globalThis.MonacoEnvironment;if(i?.createTrustedTypesPolicy)try{return i.createTrustedTypesPolicy(n,e)}catch(o){ut(o);return}try{return(t=gt.trustedTypes)===null||t===void 0?void 0:t.createPolicy(n,e)}catch(o){ut(o);return}}xt();le();var g3=Bs("defaultWorkerFactory",{createScriptURL:n=>n});function tj(n){let e=globalThis.MonacoEnvironment;if(e){if(typeof e.getWorker=="function")return e.getWorker("workerMain.js",n);if(typeof e.getWorkerUrl=="function"){let t=e.getWorkerUrl("workerMain.js",n);return new Worker(g3?g3.createScriptURL(t):t,{name:n})}}throw new Error("You must define a function MonacoEnvironment.getWorkerUrl or MonacoEnvironment.getWorker")}function ij(n){return typeof n.then=="function"}var xN=class extends H{constructor(e,t,i,o,s){super(),this.id=t,this.label=i;let r=tj(i);ij(r)?this.worker=r:this.worker=Promise.resolve(r),this.postMessage(e,[]),this.worker.then(a=>{a.onmessage=function(l){o(l.data)},a.onmessageerror=s,typeof a.addEventListener=="function"&&a.addEventListener("error",s)}),this._register(be(()=>{var a;(a=this.worker)===null||a===void 0||a.then(l=>{l.onmessage=null,l.onmessageerror=null,l.removeEventListener("error",s),l.terminate()}),this.worker=null}))}getId(){return this.id}postMessage(e,t){var i;(i=this.worker)===null||i===void 0||i.then(o=>{try{o.postMessage(e,t)}catch(s){ut(s),ut(new Error(`FAILED to post message to '${this.label}'-worker`,{cause:s}))}})}},T0=class n{constructor(e){this._label=e,this._webWorkerFailedBeforeError=!1}create(e,t,i){let o=++n.LAST_WORKER_ID;if(this._webWorkerFailedBeforeError)throw this._webWorkerFailedBeforeError;return new xN(e,o,this._label||"anonymous"+o,t,s=>{I0(s),this._webWorkerFailedBeforeError=s,i(s)})}};T0.LAST_WORKER_ID=0;Ke();lr();_();v();b();_();v();b();_();v();b();var Ra=class{constructor(e,t,i,o){this.originalStart=e,this.originalLength=t,this.modifiedStart=i,this.modifiedLength=o}getOriginalEnd(){return this.originalStart+this.originalLength}getModifiedEnd(){return this.modifiedStart+this.modifiedLength}};Bg();var Hy=class{constructor(e){this.source=e}getElements(){let e=this.source,t=new Int32Array(e.length);for(let i=0,o=e.length;i0||this.m_modifiedCount>0)&&this.m_changes.push(new Ra(this.m_originalStart,this.m_originalCount,this.m_modifiedStart,this.m_modifiedCount)),this.m_originalCount=0,this.m_modifiedCount=0,this.m_originalStart=1073741824,this.m_modifiedStart=1073741824}AddOriginalElement(e,t){this.m_originalStart=Math.min(this.m_originalStart,e),this.m_modifiedStart=Math.min(this.m_modifiedStart,t),this.m_originalCount++}AddModifiedElement(e,t){this.m_originalStart=Math.min(this.m_originalStart,e),this.m_modifiedStart=Math.min(this.m_modifiedStart,t),this.m_modifiedCount++}getChanges(){return(this.m_originalCount>0||this.m_modifiedCount>0)&&this.MarkNextChange(),this.m_changes}getReverseChanges(){return(this.m_originalCount>0||this.m_modifiedCount>0)&&this.MarkNextChange(),this.m_changes.reverse(),this.m_changes}},Eu=class n{constructor(e,t,i=null){this.ContinueProcessingPredicate=i,this._originalSequence=e,this._modifiedSequence=t;let[o,s,r]=n._getElements(e),[a,l,c]=n._getElements(t);this._hasStrings=r&&c,this._originalStringElements=o,this._originalElementsOrHash=s,this._modifiedStringElements=a,this._modifiedElementsOrHash=l,this.m_forwardHistory=[],this.m_reverseHistory=[]}static _isStringArray(e){return e.length>0&&typeof e[0]=="string"}static _getElements(e){let t=e.getElements();if(n._isStringArray(t)){let i=new Int32Array(t.length);for(let o=0,s=t.length;o=e&&o>=i&&this.ElementsAreEqual(t,o);)t--,o--;if(e>t||i>o){let h;return i<=o?(jd.Assert(e===t+1,"originalStart should only be one more than originalEnd"),h=[new Ra(e,0,i,o-i+1)]):e<=t?(jd.Assert(i===o+1,"modifiedStart should only be one more than modifiedEnd"),h=[new Ra(e,t-e+1,i,0)]):(jd.Assert(e===t+1,"originalStart should only be one more than originalEnd"),jd.Assert(i===o+1,"modifiedStart should only be one more than modifiedEnd"),h=[]),h}let r=[0],a=[0],l=this.ComputeRecursionPoint(e,t,i,o,r,a,s),c=r[0],d=a[0];if(l!==null)return l;if(!s[0]){let h=this.ComputeDiffRecursive(e,c,i,d,s),u=[];return s[0]?u=[new Ra(c+1,t-(c+1)+1,d+1,o-(d+1)+1)]:u=this.ComputeDiffRecursive(c+1,t,d+1,o,s),this.ConcatenateChanges(h,u)}return[new Ra(e,t-e+1,i,o-i+1)]}WALKTRACE(e,t,i,o,s,r,a,l,c,d,h,u,f,g,m,C,S,w){let y=null,x=null,k=new Uy,T=t,N=i,M=f[0]-C[0]-o,W=-1073741824,j=this.m_forwardHistory.length-1;do{let G=M+e;G===T||G=0&&(c=this.m_forwardHistory[j],e=c[0],T=1,N=c.length-1)}while(--j>=-1);if(y=k.getReverseChanges(),w[0]){let G=f[0]+1,V=C[0]+1;if(y!==null&&y.length>0){let z=y[y.length-1];G=Math.max(G,z.getOriginalEnd()),V=Math.max(V,z.getModifiedEnd())}x=[new Ra(G,u-G+1,V,m-V+1)]}else{k=new Uy,T=r,N=a,M=f[0]-C[0]-l,W=1073741824,j=S?this.m_reverseHistory.length-1:this.m_reverseHistory.length-2;do{let G=M+s;G===T||G=d[G+1]?(h=d[G+1]-1,g=h-M-l,h>W&&k.MarkNextChange(),W=h+1,k.AddOriginalElement(h+1,g+1),M=G+1-s):(h=d[G-1],g=h-M-l,h>W&&k.MarkNextChange(),W=h,k.AddModifiedElement(h+1,g+1),M=G-1-s),j>=0&&(d=this.m_reverseHistory[j],s=d[0],T=1,N=d.length-1)}while(--j>=-1);x=k.getChanges()}return this.ConcatenateChanges(y,x)}ComputeRecursionPoint(e,t,i,o,s,r,a){let l=0,c=0,d=0,h=0,u=0,f=0;e--,i--,s[0]=0,r[0]=0,this.m_forwardHistory=[],this.m_reverseHistory=[];let g=t-e+(o-i),m=g+1,C=new Int32Array(m),S=new Int32Array(m),w=o-i,y=t-e,x=e-i,k=t-o,N=(y-w)%2===0;C[w]=e,S[y]=t,a[0]=!1;for(let M=1;M<=g/2+1;M++){let W=0,j=0;d=this.ClipDiagonalBound(w-M,M,w,m),h=this.ClipDiagonalBound(w+M,M,w,m);for(let V=d;V<=h;V+=2){V===d||VW+j&&(W=l,j=c),!N&&Math.abs(V-y)<=M-1&&l>=S[V])return s[0]=l,r[0]=c,z<=S[V]&&1447>0&&M<=1448?this.WALKTRACE(w,d,h,x,y,u,f,k,C,S,l,t,s,c,o,r,N,a):null}let G=(W-e+(j-i)-M)/2;if(this.ContinueProcessingPredicate!==null&&!this.ContinueProcessingPredicate(W,G))return a[0]=!0,s[0]=W,r[0]=j,G>0&&1447>0&&M<=1448?this.WALKTRACE(w,d,h,x,y,u,f,k,C,S,l,t,s,c,o,r,N,a):(e++,i++,[new Ra(e,t-e+1,i,o-i+1)]);u=this.ClipDiagonalBound(y-M,M,y,m),f=this.ClipDiagonalBound(y+M,M,y,m);for(let V=u;V<=f;V+=2){V===u||V=S[V+1]?l=S[V+1]-1:l=S[V-1],c=l-(V-y)-k;let z=l;for(;l>e&&c>i&&this.ElementsAreEqual(l,c);)l--,c--;if(S[V]=l,N&&Math.abs(V-w)<=M&&l<=C[V])return s[0]=l,r[0]=c,z>=C[V]&&1447>0&&M<=1448?this.WALKTRACE(w,d,h,x,y,u,f,k,C,S,l,t,s,c,o,r,N,a):null}if(M<=1447){let V=new Int32Array(h-d+2);V[0]=w-d+1,Gd.Copy2(C,d,V,1,h-d+1),this.m_forwardHistory.push(V),V=new Int32Array(f-u+2),V[0]=y-u+1,Gd.Copy2(S,u,V,1,f-u+1),this.m_reverseHistory.push(V)}}return this.WALKTRACE(w,d,h,x,y,u,f,k,C,S,l,t,s,c,o,r,N,a)}PrettifyChanges(e){for(let t=0;t0,a=i.modifiedLength>0;for(;i.originalStart+i.originalLength=0;t--){let i=e[t],o=0,s=0;if(t>0){let h=e[t-1];o=h.originalStart+h.originalLength,s=h.modifiedStart+h.modifiedLength}let r=i.originalLength>0,a=i.modifiedLength>0,l=0,c=this._boundaryScore(i.originalStart,i.originalLength,i.modifiedStart,i.modifiedLength);for(let h=1;;h++){let u=i.originalStart-h,f=i.modifiedStart-h;if(uc&&(c=m,l=h)}i.originalStart-=l,i.modifiedStart-=l;let d=[null];if(t>0&&this.ChangesOverlap(e[t-1],e[t],d)){e[t-1]=d[0],e.splice(t,1),t++;continue}}if(this._hasStrings)for(let t=1,i=e.length;t0&&f>l&&(l=f,c=h,d=u)}return l>0?[c,d]:null}_contiguousSequenceScore(e,t,i){let o=0;for(let s=0;s=this._originalElementsOrHash.length-1?!0:this._hasStrings&&/^\s*$/.test(this._originalStringElements[e])}_OriginalRegionIsBoundary(e,t){if(this._OriginalIsBoundary(e)||this._OriginalIsBoundary(e-1))return!0;if(t>0){let i=e+t;if(this._OriginalIsBoundary(i-1)||this._OriginalIsBoundary(i))return!0}return!1}_ModifiedIsBoundary(e){return e<=0||e>=this._modifiedElementsOrHash.length-1?!0:this._hasStrings&&/^\s*$/.test(this._modifiedStringElements[e])}_ModifiedRegionIsBoundary(e,t){if(this._ModifiedIsBoundary(e)||this._ModifiedIsBoundary(e-1))return!0;if(t>0){let i=e+t;if(this._ModifiedIsBoundary(i-1)||this._ModifiedIsBoundary(i))return!0}return!1}_boundaryScore(e,t,i,o){let s=this._OriginalRegionIsBoundary(e,t)?1:0,r=this._ModifiedRegionIsBoundary(i,o)?1:0;return s+r}ConcatenateChanges(e,t){let i=[];if(e.length===0||t.length===0)return t.length>0?t:e;if(this.ChangesOverlap(e[e.length-1],t[0],i)){let o=new Array(e.length+t.length-1);return Gd.Copy(e,0,o,0,e.length-1),o[e.length-1]=i[0],Gd.Copy(t,1,o,e.length,t.length-1),o}else{let o=new Array(e.length+t.length);return Gd.Copy(e,0,o,0,e.length),Gd.Copy(t,0,o,e.length,t.length),o}}ChangesOverlap(e,t,i){if(jd.Assert(e.originalStart<=t.originalStart,"Left change is not less than or equal to right change"),jd.Assert(e.modifiedStart<=t.modifiedStart,"Left change is not less than or equal to right change"),e.originalStart+e.originalLength>=t.originalStart||e.modifiedStart+e.modifiedLength>=t.modifiedStart){let o=e.originalStart,s=e.originalLength,r=e.modifiedStart,a=e.modifiedLength;return e.originalStart+e.originalLength>=t.originalStart&&(s=t.originalStart+t.originalLength-e.originalStart),e.modifiedStart+e.modifiedLength>=t.modifiedStart&&(a=t.modifiedStart+t.modifiedLength-e.modifiedStart),i[0]=new Ra(o,s,r,a),!0}else return i[0]=null,!1}ClipDiagonalBound(e,t,i,o){if(e>=0&&e=0&&this.prefixSum.set(o.subarray(0,this.prefixSumValidIndex[0]+1)),!0)}setValue(e,t){return e=Tu(e),t=Tu(t),this.values[e]===t?!1:(this.values[e]=t,e-1=i.length)return!1;let s=i.length-e;return t>=s&&(t=s),t===0?!1:(this.values=new Uint32Array(i.length-t),this.values.set(i.subarray(0,e),0),this.values.set(i.subarray(e+t),e),this.prefixSum=new Uint32Array(this.values.length),e-1=0&&this.prefixSum.set(o.subarray(0,this.prefixSumValidIndex[0]+1)),!0)}getTotalSum(){return this.values.length===0?0:this._getPrefixSum(this.values.length-1)}getPrefixSum(e){return e<0?0:(e=Tu(e),this._getPrefixSum(e))}_getPrefixSum(e){if(e<=this.prefixSumValidIndex[0])return this.prefixSum[e];let t=this.prefixSumValidIndex[0]+1;t===0&&(this.prefixSum[0]=this.values[0],t++),e>=this.values.length&&(e=this.values.length-1);for(let i=t;i<=e;i++)this.prefixSum[i]=this.prefixSum[i-1]+this.values[i];return this.prefixSumValidIndex[0]=Math.max(this.prefixSumValidIndex[0],e),this.prefixSum[e]}getIndexOf(e){e=Math.floor(e),this.getTotalSum();let t=0,i=this.values.length-1,o=0,s=0,r=0;for(;t<=i;)if(o=t+(i-t)/2|0,s=this.prefixSum[o],r=s-this.values[o],e=s)t=o+1;else break;return new qy(o,e-r)}},$y=class{constructor(e){this._values=e,this._isValid=!1,this._validEndIndex=-1,this._prefixSum=[],this._indexBySum=[]}getTotalSum(){return this._ensureValid(),this._indexBySum.length}getPrefixSum(e){return this._ensureValid(),e===0?0:this._prefixSum[e-1]}getIndexOf(e){this._ensureValid();let t=this._indexBySum[e],i=t>0?this._prefixSum[t-1]:0;return new qy(t,e-i)}removeValues(e,t){this._values.splice(e,t),this._invalidate(e)}insertValues(e,t){this._values=fd(this._values,e,t),this._invalidate(e)}_invalidate(e){this._isValid=!1,this._validEndIndex=Math.min(this._validEndIndex,e-1)}_ensureValid(){if(!this._isValid){for(let e=this._validEndIndex+1,t=this._values.length;e0?this._prefixSum[e-1]:0;this._prefixSum[e]=o+i;for(let s=0;st&&(t=l),a>i&&(i=a),c>i&&(i=c)}t++,i++;let o=new eA(i,t,0);for(let s=0,r=e.length;s=this._maxCharCode?0:this._states.get(e,t)}},JN=null;function wj(){return JN===null&&(JN=new tA([[1,104,2],[1,72,2],[1,102,6],[1,70,6],[2,116,3],[2,84,3],[3,116,4],[3,84,4],[4,112,5],[4,80,5],[5,115,9],[5,83,9],[5,58,10],[6,105,7],[6,73,7],[7,108,8],[7,76,8],[8,101,9],[8,69,9],[9,58,10],[10,47,11],[11,47,12]])),JN}var B0=null;function yj(){if(B0===null){B0=new Nc(0);let n=` <>'"\u3001\u3002\uFF61\uFF64\uFF0C\uFF0E\uFF1A\uFF1B\u2018\u3008\u300C\u300E\u3014\uFF08\uFF3B\uFF5B\uFF62\uFF63\uFF5D\uFF3D\uFF09\u3015\u300F\u300D\u3009\u2019\uFF40\uFF5E\u2026`;for(let t=0;to);if(o>0){let a=t.charCodeAt(o-1),l=t.charCodeAt(r);(a===40&&l===41||a===91&&l===93||a===123&&l===125)&&r--}return{range:{startLineNumber:i,startColumn:o+1,endLineNumber:i,endColumn:r+2},url:t.substring(o,r+1)}}static computeLinks(e,t=wj()){let i=yj(),o=[];for(let s=1,r=e.getLineCount();s<=r;s++){let a=e.getLineContent(s),l=a.length,c=0,d=0,h=0,u=1,f=!1,g=!1,m=!1,C=!1;for(;c=0?(o+=i?1:-1,o<0?o=e.length-1:o%=e.length,e[o]):null}};Qg.INSTANCE=new Qg;vg();_();v();b();Ke();eS();ot();Na();ug();var tS=class{static computeUnicodeHighlights(e,t,i){let o=i?i.startLineNumber:1,s=i?i.endLineNumber:e.getLineCount(),r=new iS(t),a=r.getCandidateCodePoints(),l;a==="allNonBasicAscii"?l=new RegExp("[^\\t\\n\\r\\x20-\\x7E]","g"):l=new RegExp(`${Ij(Array.from(a))}`,"g");let c=new kl(null,l),d=[],h=!1,u,f=0,g=0,m=0;e:for(let C=o,S=s;C<=S;C++){let w=e.getLineContent(C),y=w.length;c.reset(0);do if(u=c.next(w),u){let x=u.index,k=u.index+u[0].length;if(x>0){let W=w.charCodeAt(x-1);pi(W)&&x--}if(k+1=W){h=!0;break e}d.push(new P(C,x+1,C,k+1))}}while(u)}return{ranges:d,hasMore:h,ambiguousCharacterCount:f,invisibleCharacterCount:g,nonBasicAsciiCharacterCount:m}}static computeUnicodeHighlightReason(e,t){let i=new iS(t);switch(i.shouldHighlightNonBasicASCII(e,null)){case 0:return null;case 2:return{kind:1};case 3:{let s=e.codePointAt(0),r=i.ambiguousCharacters.getPrimaryConfusable(s),a=gl.getLocales().filter(l=>!gl.getInstance(new Set([...t.allowedLocales,l])).isAmbiguous(s));return{kind:0,confusableWith:String.fromCodePoint(r),notAmbiguousInLocales:a}}case 1:return{kind:2}}}};function Ij(n,e){return`[${gs(n.map(i=>String.fromCodePoint(i)).join(""))}]`}var iS=class{constructor(e){this.options=e,this.allowedCodePoints=new Set(e.allowedCodePoints),this.ambiguousCharacters=gl.getInstance(new Set(e.allowedLocales))}getCandidateCodePoints(){if(this.options.nonBasicASCII)return"allNonBasicAscii";let e=new Set;if(this.options.invisibleCharacters)for(let t of cu.codePoints)q3(String.fromCodePoint(t))||e.add(t);if(this.options.ambiguousCharacters)for(let t of this.ambiguousCharacters.getConfusableCodePoints())e.add(t);for(let t of this.allowedCodePoints)e.delete(t);return e}shouldHighlightNonBasicASCII(e,t){let i=e.codePointAt(0);if(this.allowedCodePoints.has(i))return 0;if(this.options.nonBasicASCII)return 1;let o=!1,s=!1;if(t)for(let r of t){let a=r.codePointAt(0),l=Ig(r);o=o||l,!l&&!this.ambiguousCharacters.isAmbiguous(a)&&!cu.isInvisibleCharacter(a)&&(s=!0)}return!o&&s?0:this.options.invisibleCharacters&&!q3(e)&&cu.isInvisibleCharacter(i)?2:this.options.ambiguousCharacters&&this.ambiguousCharacters.isAmbiguous(i)?3:0}};function q3(n){return n===" "||n===` +`||n===" "}_();v();b();_();v();b();_();v();b();var Xd=class{constructor(e,t,i){this.changes=e,this.moves=t,this.hitTimeout=i}},im=class{constructor(e,t){this.lineRangeMapping=e,this.changes=t}};_();v();b();xt();Bo();Ke();_();v();b();Na();xt();ft();_();v();b();es();om();var sS=class{constructor(e){this.text=e,this.lineStartOffsetByLineIdx=[],this.lineStartOffsetByLineIdx.push(0);for(let t=0;tqg(e,(t,i)=>t.range.getEndPosition().isBeforeOrEqual(i.range.getStartPosition())))}apply(e){let t="",i=new U(1,1);for(let s of this.edits){let r=s.range,a=r.getStartPosition(),l=r.getEndPosition(),c=X3(i,a);c.isEmpty()||(t+=e.getValueOfRange(c)),t+=s.text,i=l}let o=X3(i,e.endPositionExclusive);return o.isEmpty()||(t+=e.getValueOfRange(o)),t}applyToString(e){let t=new lA(e);return this.apply(t)}getNewRanges(){let e=[],t=0,i=0,o=0;for(let s of this.edits){let r=ws.ofText(s.text),a=U.lift({lineNumber:s.range.startLineNumber+i,column:s.range.startColumn+(s.range.startLineNumber===t?o:0)}),l=r.createRange(a);e.push(l),i=l.endLineNumber-s.range.endLineNumber,o=l.endColumn-s.range.endColumn,t=s.range.endLineNumber}return e}},aS=class{constructor(e,t){this.range=e,this.text=t}};function X3(n,e){if(n.lineNumber===e.lineNumber&&n.column===Number.MAX_SAFE_INTEGER)return P.fromPositions(e,e);if(!n.isBeforeOrEqual(e))throw new St("start must be before end");return new P(n.lineNumber,n.column,e.lineNumber,e.column)}var z0=class{get endPositionExclusive(){return this.length.addToPosition(new U(1,1))}},lA=class extends z0{constructor(e){super(),this.value=e,this._t=new sS(this.value)}getValueOfRange(e){return this._t.getOffsetRange(e).substring(this.value)}get length(){return this._t.textLength}};var So=class n{static inverse(e,t,i){let o=[],s=1,r=1;for(let l of e){let c=new n(new Ne(s,l.original.startLineNumber),new Ne(r,l.modified.startLineNumber));c.modified.isEmpty||o.push(c),s=l.original.endLineNumberExclusive,r=l.modified.endLineNumberExclusive}let a=new n(new Ne(s,t+1),new Ne(r,i+1));return a.modified.isEmpty||o.push(a),o}static clip(e,t,i){let o=[];for(let s of e){let r=s.original.intersect(t),a=s.modified.intersect(i);r&&!r.isEmpty&&a&&!a.isEmpty&&o.push(new n(r,a))}return o}constructor(e,t){this.original=e,this.modified=t}toString(){return`{${this.original.toString()}->${this.modified.toString()}}`}flip(){return new n(this.modified,this.original)}join(e){return new n(this.original.join(e.original),this.modified.join(e.modified))}toRangeMapping(){let e=this.original.toInclusiveRange(),t=this.modified.toInclusiveRange();if(e&&t)return new ts(e,t);if(this.original.startLineNumber===1||this.modified.startLineNumber===1){if(!(this.modified.startLineNumber===1&&this.original.startLineNumber===1))throw new St("not a valid diff");return new ts(new P(this.original.startLineNumber,1,this.original.endLineNumberExclusive,1),new P(this.modified.startLineNumber,1,this.modified.endLineNumberExclusive,1))}else return new ts(new P(this.original.startLineNumber-1,Number.MAX_SAFE_INTEGER,this.original.endLineNumberExclusive-1,Number.MAX_SAFE_INTEGER),new P(this.modified.startLineNumber-1,Number.MAX_SAFE_INTEGER,this.modified.endLineNumberExclusive-1,Number.MAX_SAFE_INTEGER))}},xo=class n extends So{static fromRangeMappings(e){let t=Ne.join(e.map(o=>Ne.fromRangeInclusive(o.originalRange))),i=Ne.join(e.map(o=>Ne.fromRangeInclusive(o.modifiedRange)));return new n(t,i,e)}constructor(e,t,i){super(e,t),this.innerChanges=i}flip(){var e;return new n(this.modified,this.original,(e=this.innerChanges)===null||e===void 0?void 0:e.map(t=>t.flip()))}withInnerChangesFromLineRanges(){return new n(this.original,this.modified,[this.toRangeMapping()])}},ts=class n{constructor(e,t){this.originalRange=e,this.modifiedRange=t}toString(){return`{${this.originalRange.toString()}->${this.modifiedRange.toString()}}`}flip(){return new n(this.modifiedRange,this.originalRange)}toTextEdit(e){let t=e.getValueOfRange(this.modifiedRange);return new aS(this.originalRange,t)}};ot();Ke();Na();Bo();var Nj=3,lS=class{computeDiff(e,t,i){var o;let r=new dA(e,t,{maxComputationTime:i.maxComputationTimeMs,shouldIgnoreTrimWhitespace:i.ignoreTrimWhitespace,shouldComputeCharChanges:!0,shouldMakePrettyDiff:!0,shouldPostProcessCharChanges:!0}).computeDiff(),a=[],l=null;for(let c of r.changes){let d;c.originalEndLineNumber===0?d=new Ne(c.originalStartLineNumber+1,c.originalStartLineNumber+1):d=new Ne(c.originalStartLineNumber,c.originalEndLineNumber+1);let h;c.modifiedEndLineNumber===0?h=new Ne(c.modifiedStartLineNumber+1,c.modifiedStartLineNumber+1):h=new Ne(c.modifiedStartLineNumber,c.modifiedEndLineNumber+1);let u=new xo(d,h,(o=c.charChanges)===null||o===void 0?void 0:o.map(f=>new ts(new P(f.originalStartLineNumber,f.originalStartColumn,f.originalEndLineNumber,f.originalEndColumn),new P(f.modifiedStartLineNumber,f.modifiedStartColumn,f.modifiedEndLineNumber,f.modifiedEndColumn))));l&&(l.modified.endLineNumberExclusive===u.modified.startLineNumber||l.original.endLineNumberExclusive===u.original.startLineNumber)&&(u=new xo(l.original.join(u.original),l.modified.join(u.modified),l.innerChanges&&u.innerChanges?l.innerChanges.concat(u.innerChanges):void 0),a.pop()),a.push(u),l=u}return Fr(()=>qg(a,(c,d)=>d.original.startLineNumber-c.original.endLineNumberExclusive===d.modified.startLineNumber-c.modified.endLineNumberExclusive&&c.original.endLineNumberExclusive(e===10?"\\n":String.fromCharCode(e))+`-(${this._lineNumbers[t]},${this._columns[t]})`).join(", ")+"]"}_assertIndex(e,t){if(e<0||e>=t.length)throw new Error("Illegal index")}getElements(){return this._charCodes}getStartLineNumber(e){return e>0&&e===this._lineNumbers.length?this.getEndLineNumber(e-1):(this._assertIndex(e,this._lineNumbers),this._lineNumbers[e])}getEndLineNumber(e){return e===-1?this.getStartLineNumber(e+1):(this._assertIndex(e,this._lineNumbers),this._charCodes[e]===10?this._lineNumbers[e]+1:this._lineNumbers[e])}getStartColumn(e){return e>0&&e===this._columns.length?this.getEndColumn(e-1):(this._assertIndex(e,this._columns),this._columns[e])}getEndColumn(e){return e===-1?this.getStartColumn(e+1):(this._assertIndex(e,this._columns),this._charCodes[e]===10?1:this._columns[e]+1)}},sm=class n{constructor(e,t,i,o,s,r,a,l){this.originalStartLineNumber=e,this.originalStartColumn=t,this.originalEndLineNumber=i,this.originalEndColumn=o,this.modifiedStartLineNumber=s,this.modifiedStartColumn=r,this.modifiedEndLineNumber=a,this.modifiedEndColumn=l}static createFromDiffChange(e,t,i){let o=t.getStartLineNumber(e.originalStart),s=t.getStartColumn(e.originalStart),r=t.getEndLineNumber(e.originalStart+e.originalLength-1),a=t.getEndColumn(e.originalStart+e.originalLength-1),l=i.getStartLineNumber(e.modifiedStart),c=i.getStartColumn(e.modifiedStart),d=i.getEndLineNumber(e.modifiedStart+e.modifiedLength-1),h=i.getEndColumn(e.modifiedStart+e.modifiedLength-1);return new n(o,s,r,a,l,c,d,h)}};function Aj(n){if(n.length<=1)return n;let e=[n[0]],t=e[0];for(let i=1,o=n.length;i0&&t.originalLength<20&&t.modifiedLength>0&&t.modifiedLength<20&&s()){let f=i.createCharSequence(e,t.originalStart,t.originalStart+t.originalLength-1),g=o.createCharSequence(e,t.modifiedStart,t.modifiedStart+t.modifiedLength-1);if(f.getElements().length>0&&g.getElements().length>0){let m=J3(f,g,s,!0).changes;a&&(m=Aj(m)),u=[];for(let C=0,S=m.length;C1&&m>1;){let C=u.charCodeAt(g-2),S=f.charCodeAt(m-2);if(C!==S)break;g--,m--}(g>1||m>1)&&this._pushTrimWhitespaceCharChange(o,s+1,1,g,r+1,1,m)}{let g=uA(u,1),m=uA(f,1),C=u.length+1,S=f.length+1;for(;g!0;let e=Date.now();return()=>Date.now()-e{i.push(n.fromOffsetPairs(o?o.getEndExclusives():Ws.zero,s?s.getStarts():new Ws(t,(o?o.seq2Range.endExclusive-o.seq1Range.endExclusive:0)+t)))}),i}static fromOffsetPairs(e,t){return new n(new ze(e.offset1,t.offset1),new ze(e.offset2,t.offset2))}constructor(e,t){this.seq1Range=e,this.seq2Range=t}swap(){return new n(this.seq2Range,this.seq1Range)}toString(){return`${this.seq1Range} <-> ${this.seq2Range}`}join(e){return new n(this.seq1Range.join(e.seq1Range),this.seq2Range.join(e.seq2Range))}delta(e){return e===0?this:new n(this.seq1Range.delta(e),this.seq2Range.delta(e))}deltaStart(e){return e===0?this:new n(this.seq1Range.deltaStart(e),this.seq2Range.deltaStart(e))}deltaEnd(e){return e===0?this:new n(this.seq1Range.deltaEnd(e),this.seq2Range.deltaEnd(e))}intersect(e){let t=this.seq1Range.intersect(e.seq1Range),i=this.seq2Range.intersect(e.seq2Range);if(!(!t||!i))return new n(t,i)}getStarts(){return new Ws(this.seq1Range.start,this.seq2Range.start)}getEndExclusives(){return new Ws(this.seq1Range.endExclusive,this.seq2Range.endExclusive)}},Ws=class n{constructor(e,t){this.offset1=e,this.offset2=t}toString(){return`${this.offset1} <-> ${this.offset2}`}delta(e){return e===0?this:new n(this.offset1+e,this.offset2+e)}equals(e){return this.offset1===e.offset1&&this.offset2===e.offset2}};Ws.zero=new Ws(0,0);Ws.max=new Ws(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER);var Il=class{isValid(){return!0}};Il.instance=new Il;var dS=class{constructor(e){if(this.timeout=e,this.startTime=Date.now(),this.valid=!0,e<=0)throw new St("timeout must be positive")}isValid(){if(!(Date.now()-this.startTime0&&m>0&&r.get(g-1,m-1)===3&&(w+=a.get(g-1,m-1)),w+=o?o(g,m):1):w=-1;let y=Math.max(C,S,w);if(y===w){let x=g>0&&m>0?a.get(g-1,m-1):0;a.set(g,m,x+1),r.set(g,m,3)}else y===C?(a.set(g,m,0),r.set(g,m,1)):y===S&&(a.set(g,m,0),r.set(g,m,2));s.set(g,m,y)}let l=[],c=e.length,d=t.length;function h(g,m){(g+1!==c||m+1!==d)&&l.push(new Tn(new ze(g+1,c),new ze(m+1,d))),c=g,d=m}let u=e.length-1,f=t.length-1;for(;u>=0&&f>=0;)r.get(u,f)===3?(h(u,f),u--,f--):r.get(u,f)===1?u--:f--;return h(-1,-1),l.reverse(),new El(l,!1)}};_();v();b();es();var lm=class{compute(e,t,i=Il.instance){if(e.length===0||t.length===0)return El.trivial(e,t);let o=e,s=t;function r(m,C){for(;mo.length||k>s.length)continue;let T=r(x,k);l.set(d,T);let N=x===w?c.get(d+1):c.get(d-1);if(c.set(d,T!==x?new uS(N,x,k,T-x):N),l.get(d)===o.length&&l.get(d)-d===s.length)break e}}let h=c.get(d),u=[],f=o.length,g=s.length;for(;;){let m=h?h.x+h.length:0,C=h?h.y+h.length:0;if((m!==f||C!==g)&&u.push(new Tn(new ze(m,f),new ze(C,g))),!h)break;f=h.x,g=h.y,h=h.prev}return u.reverse(),new El(u,!1)}},uS=class{constructor(e,t,i,o){this.prev=e,this.x=t,this.y=i,this.length=o}},fA=class{constructor(){this.positiveArr=new Int32Array(10),this.negativeArr=new Int32Array(10)}get(e){return e<0?(e=-e-1,this.negativeArr[e]):this.positiveArr[e]}set(e,t){if(e<0){if(e=-e-1,e>=this.negativeArr.length){let i=this.negativeArr;this.negativeArr=new Int32Array(i.length*2),this.negativeArr.set(i)}this.negativeArr[e]=t}else{if(e>=this.positiveArr.length){let i=this.positiveArr;this.positiveArr=new Int32Array(i.length*2),this.positiveArr.set(i)}this.positiveArr[e]=t}}},gA=class{constructor(){this.positiveArr=[],this.negativeArr=[]}get(e){return e<0?(e=-e-1,this.negativeArr[e]):this.positiveArr[e]}set(e,t){e<0?(e=-e-1,this.negativeArr[e]=t):this.positiveArr[e]=t}};_();v();b();wt();Dl();cr();Bo();es();_();v();b();Dl();es();ft();Ke();var Qd=class{constructor(e,t,i){this.lines=e,this.considerWhitespaceChanges=i,this.elements=[],this.firstCharOffsetByLine=[],this.additionalOffsetByLine=[];let o=!1;t.start>0&&t.endExclusive>=e.length&&(t=new ze(t.start-1,t.endExclusive),o=!0),this.lineRange=t,this.firstCharOffsetByLine[0]=0;for(let s=this.lineRange.start;sString.fromCharCode(t)).join("")}getElement(e){return this.elements[e]}get length(){return this.elements.length}getBoundaryScore(e){let t=t8(e>0?this.elements[e-1]:-1),i=t8(ei<=e);return new U(this.lineRange.start+t+1,e-this.firstCharOffsetByLine[t]+this.additionalOffsetByLine[t]+1)}translateRange(e){return P.fromPositions(this.translateOffset(e.start),this.translateOffset(e.endExclusive))}findWordContaining(e){if(e<0||e>=this.elements.length||!mA(this.elements[e]))return;let t=e;for(;t>0&&mA(this.elements[t-1]);)t--;let i=e;for(;ir<=e.start))!==null&&t!==void 0?t:0,s=(i=j3(this.firstCharOffsetByLine,r=>e.endExclusive<=r))!==null&&i!==void 0?i:this.elements.length;return new ze(o,s)}};function mA(n){return n>=97&&n<=122||n>=65&&n<=90||n>=48&&n<=57}var Mj={0:0,1:0,2:0,3:10,4:2,5:30,6:3,7:10,8:10};function e8(n){return Mj[n]}function t8(n){return n===10?8:n===13?7:H0(n)?6:n>=97&&n<=122?0:n>=65&&n<=90?1:n>=48&&n<=57?2:n===-1?3:n===44||n===59?5:4}function n8(n,e,t,i,o,s){let{moves:r,excludedChanges:a}=Pj(n,e,t,s);if(!s.isValid())return[];let l=n.filter(d=>!a.has(d)),c=Oj(l,i,o,e,t,s);return L_(r,c),r=Fj(r),r=r.filter(d=>{let h=d.original.toOffsetRange().slice(e).map(f=>f.trim());return h.join(` +`).length>=15&&Rj(h,f=>f.length>=2)>=2}),r=Bj(n,r),r}function Rj(n,e){let t=0;for(let i of n)e(i)&&t++;return t}function Pj(n,e,t,i){let o=[],s=n.filter(l=>l.modified.isEmpty&&l.original.length>=3).map(l=>new am(l.original,e,l)),r=new Set(n.filter(l=>l.original.isEmpty&&l.modified.length>=3).map(l=>new am(l.modified,t,l))),a=new Set;for(let l of s){let c=-1,d;for(let h of r){let u=l.computeSimilarity(h);u>c&&(c=u,d=h)}if(c>.9&&d&&(r.delete(d),o.push(new So(l.range,d.range)),a.add(l.source),a.add(d.source)),!i.isValid())return{moves:o,excludedChanges:a}}return{moves:o,excludedChanges:a}}function Oj(n,e,t,i,o,s){let r=[],a=new Jg;for(let u of n)for(let f=u.original.startLineNumber;fu.modified.startLineNumber,ma));for(let u of n){let f=[];for(let g=u.modified.startLineNumber;g{for(let x of f)if(x.originalLineRange.endLineNumberExclusive+1===w.endLineNumberExclusive&&x.modifiedLineRange.endLineNumberExclusive+1===C.endLineNumberExclusive){x.originalLineRange=new Ne(x.originalLineRange.startLineNumber,w.endLineNumberExclusive),x.modifiedLineRange=new Ne(x.modifiedLineRange.startLineNumber,C.endLineNumberExclusive),S.push(x);return}let y={modifiedLineRange:C,originalLineRange:w};l.push(y),S.push(y)}),f=S}if(!s.isValid())return[]}l.sort(i9(Io(u=>u.modifiedLineRange.length,ma)));let c=new ur,d=new ur;for(let u of l){let f=u.modifiedLineRange.startLineNumber-u.originalLineRange.startLineNumber,g=c.subtractFrom(u.modifiedLineRange),m=d.subtractFrom(u.originalLineRange).getWithDelta(f),C=g.getIntersection(m);for(let S of C.ranges){if(S.length<3)continue;let w=S,y=S.delta(-f);r.push(new So(y,w)),c.addRange(w),d.addRange(y)}}r.sort(Io(u=>u.original.startLineNumber,ma));let h=new nm(n);for(let u=0;uT.original.startLineNumber<=f.original.startLineNumber),m=Mc(n,T=>T.modified.startLineNumber<=f.modified.startLineNumber),C=Math.max(f.original.startLineNumber-g.original.startLineNumber,f.modified.startLineNumber-m.modified.startLineNumber),S=h.findLastMonotonous(T=>T.original.startLineNumberT.modified.startLineNumberi.length||N>o.length||c.contains(N)||d.contains(T)||!i8(i[T-1],o[N-1],s))break}x>0&&(d.addRange(new Ne(f.original.startLineNumber-x,f.original.startLineNumber)),c.addRange(new Ne(f.modified.startLineNumber-x,f.modified.startLineNumber)));let k;for(k=0;ki.length||N>o.length||c.contains(N)||d.contains(T)||!i8(i[T-1],o[N-1],s))break}k>0&&(d.addRange(new Ne(f.original.endLineNumberExclusive,f.original.endLineNumberExclusive+k)),c.addRange(new Ne(f.modified.endLineNumberExclusive,f.modified.endLineNumberExclusive+k))),(x>0||k>0)&&(r[u]=new So(new Ne(f.original.startLineNumber-x,f.original.endLineNumberExclusive+k),new Ne(f.modified.startLineNumber-x,f.modified.endLineNumberExclusive+k)))}return r}function i8(n,e,t){if(n.trim()===e.trim())return!0;if(n.length>300&&e.length>300)return!1;let o=new lm().compute(new Qd([n],new ze(0,1),!1),new Qd([e],new ze(0,1),!1),t),s=0,r=Tn.invert(o.diffs,n.length);for(let d of r)d.seq1Range.forEach(h=>{H0(n.charCodeAt(h))||s++});function a(d){let h=0;for(let u=0;ue.length?n:e);return s/l>.6&&l>10}function Fj(n){if(n.length===0)return n;n.sort(Io(t=>t.original.startLineNumber,ma));let e=[n[0]];for(let t=1;t=0&&r>=0&&s+r<=2){e[e.length-1]=i.join(o);continue}e.push(o)}return e}function Bj(n,e){let t=new nm(n);return e=e.filter(i=>{let o=t.findLastMonotonous(a=>a.original.startLineNumbera.modified.startLineNumber0&&(a=a.delta(c))}o.push(a)}return i.length>0&&o.push(i[i.length-1]),o}function Wj(n,e,t){if(!n.getBoundaryScore||!e.getBoundaryScore)return t;for(let i=0;i0?t[i-1]:void 0,s=t[i],r=i+1=i.start&&n.seq2Range.start-r>=o.start&&t.isStronglyEqual(n.seq2Range.start-r,n.seq2Range.endExclusive-r)&&r<100;)r++;r--;let a=0;for(;n.seq1Range.start+ac&&(c=g,l=d)}return n.delta(l)}function r8(n,e,t){let i=[];for(let o of t){let s=i[i.length-1];if(!s){i.push(o);continue}o.seq1Range.start-s.seq1Range.endExclusive<=2||o.seq2Range.start-s.seq2Range.endExclusive<=2?i[i.length-1]=new Tn(s.seq1Range.join(o.seq1Range),s.seq2Range.join(o.seq2Range)):i.push(o)}return i}function a8(n,e,t){let i=Tn.invert(t,n.length),o=[],s=new Ws(0,0);function r(l,c){if(l.offset10;){let C=i[0];if(!(C.seq1Range.intersects(u.seq1Range)||C.seq2Range.intersects(u.seq2Range)))break;let w=n.findWordContaining(C.seq1Range.start),y=e.findWordContaining(C.seq2Range.start),x=new Tn(w,y),k=x.intersect(C);if(g+=k.seq1Range.length,m+=k.seq2Range.length,u=u.join(x),u.seq1Range.endExclusive>=C.seq1Range.endExclusive)i.shift();else break}g+m<(u.seq1Range.length+u.seq2Range.length)*2/3&&o.push(u),s=u.getEndExclusives()}for(;i.length>0;){let l=i.shift();l.seq1Range.isEmpty||(r(l.getStarts(),l),r(l.getEndExclusives().delta(-1),l))}return zj(t,o)}function zj(n,e){let t=[];for(;n.length>0||e.length>0;){let i=n[0],o=e[0],s;i&&(!o||i.seq1Range.start0&&t[t.length-1].seq1Range.endExclusive>=s.seq1Range.start?t[t.length-1]=t[t.length-1].join(s):t.push(s)}return t}function l8(n,e,t){let i=t;if(i.length===0)return i;let o=0,s;do{s=!1;let a=[i[0]];for(let l=1;l5||g.seq1Range.length+g.seq2Range.length>5)};var r=h;let c=i[l],d=a[a.length-1];h(d,c)?(s=!0,a[a.length-1]=a[a.length-1].join(c)):a.push(c)}i=a}while(o++<10&&s);return i}function c8(n,e,t){let i=t;if(i.length===0)return i;let o=0,s;do{s=!1;let l=[i[0]];for(let c=1;c5||C.length>500)return!1;let w=n.getText(C).trim();if(w.length>20||w.split(/\r\n|\r|\n/).length>1)return!1;let y=n.countLinesIn(g.seq1Range),x=g.seq1Range.length,k=e.countLinesIn(g.seq2Range),T=g.seq2Range.length,N=n.countLinesIn(m.seq1Range),M=m.seq1Range.length,W=e.countLinesIn(m.seq2Range),j=m.seq2Range.length,G=2*40+50;function V(z){return Math.min(z,G)}return Math.pow(Math.pow(V(y*40+x),1.5)+Math.pow(V(k*40+T),1.5),1.5)+Math.pow(Math.pow(V(N*40+M),1.5)+Math.pow(V(W*40+j),1.5),1.5)>(G**1.5)**1.5*1.3};var a=u;let d=i[c],h=l[l.length-1];u(h,d)?(s=!0,l[l.length-1]=l[l.length-1].join(d)):l.push(d)}i=l}while(o++<10&&s);let r=[];return YF(i,(l,c,d)=>{let h=c;function u(w){return w.length>0&&w.trim().length<=3&&c.seq1Range.length+c.seq2Range.length>100}let f=n.extendToFullLines(c.seq1Range),g=n.getText(new ze(f.start,c.seq1Range.start));u(g)&&(h=h.deltaStart(-g.length));let m=n.getText(new ze(c.seq1Range.endExclusive,f.endExclusive));u(m)&&(h=h.deltaEnd(m.length));let C=Tn.fromOffsetPairs(l?l.getEndExclusives():Ws.zero,d?d.getStarts():Ws.max),S=h.intersect(C);r.length>0&&S.getStarts().equals(r[r.length-1].getEndExclusives())?r[r.length-1]=r[r.length-1].join(S):r.push(S)}),r}_();v();b();var K0=class{constructor(e,t){this.trimmedHash=e,this.lines=t}getElement(e){return this.trimmedHash[e]}get length(){return this.trimmedHash.length}getBoundaryScore(e){let t=e===0?0:d8(this.lines[e-1]),i=e===this.lines.length?0:d8(this.lines[e]);return 1e3-(t+i)}getText(e){return this.lines.slice(e.start,e.endExclusive).join(` +`)}isStronglyEqual(e,t){return this.lines[e]===this.lines[t]}};function d8(n){let e=0;for(;ek===T))return new Xd([],[],!1);if(e.length===1&&e[0].length===0||t.length===1&&t[0].length===0)return new Xd([new xo(new Ne(1,e.length+1),new Ne(1,t.length+1),[new ts(new P(1,1,e.length,e[e.length-1].length+1),new P(1,1,t.length,t[t.length-1].length+1))])],[],!1);let o=i.maxComputationTimeMs===0?Il.instance:new dS(i.maxComputationTimeMs),s=!i.ignoreTrimWhitespace,r=new Map;function a(k){let T=r.get(k);return T===void 0&&(T=r.size,r.set(k,T)),T}let l=e.map(k=>a(k.trim())),c=t.map(k=>a(k.trim())),d=new K0(l,e),h=new K0(c,t),u=d.length+h.length<1700?this.dynamicProgrammingDiffing.compute(d,h,o,(k,T)=>e[k]===t[T]?t[T].length===0?.1:1+Math.log(1+t[T].length):.99):this.myersDiffingAlgorithm.compute(d,h),f=u.diffs,g=u.hitTimeout;f=U0(d,h,f),f=l8(d,h,f);let m=[],C=k=>{if(s)for(let T=0;Tk.seq1Range.start-S===k.seq2Range.start-w);let T=k.seq1Range.start-S;C(T),S=k.seq1Range.endExclusive,w=k.seq2Range.endExclusive;let N=this.refineDiff(e,t,k,o,s);N.hitTimeout&&(g=!0);for(let M of N.mappings)m.push(M)}C(e.length-S);let y=h8(m,e,t),x=[];return i.computeMoves&&(x=this.computeMoves(y,e,t,l,c,o,s)),Fr(()=>{function k(N,M){if(N.lineNumber<1||N.lineNumber>M.length)return!1;let W=M[N.lineNumber-1];return!(N.column<1||N.column>W.length+1)}function T(N,M){return!(N.startLineNumber<1||N.startLineNumber>M.length+1||N.endLineNumberExclusive<1||N.endLineNumberExclusive>M.length+1)}for(let N of y){if(!N.innerChanges)return!1;for(let M of N.innerChanges)if(!(k(M.modifiedRange.getStartPosition(),t)&&k(M.modifiedRange.getEndPosition(),t)&&k(M.originalRange.getStartPosition(),e)&&k(M.originalRange.getEndPosition(),e)))return!1;if(!T(N.modified,t)||!T(N.original,e))return!1}return!0}),new Xd(y,x,g)}computeMoves(e,t,i,o,s,r,a){return n8(e,t,i,o,s,r).map(d=>{let h=this.refineDiff(t,i,new Tn(d.original.toOffsetRange(),d.modified.toOffsetRange()),r,a),u=h8(h.mappings,t,i,!0);return new im(d,u)})}refineDiff(e,t,i,o,s){let r=new Qd(e,i.seq1Range,s),a=new Qd(t,i.seq2Range,s),l=r.length+a.length<500?this.dynamicProgrammingDiffing.compute(r,a,o):this.myersDiffingAlgorithm.compute(r,a,o),c=l.diffs;return c=U0(r,a,c),c=a8(r,a,c),c=r8(r,a,c),c=c8(r,a,c),{mappings:c.map(h=>new ts(r.translateRange(h.seq1Range),a.translateRange(h.seq2Range))),hitTimeout:l.hitTimeout}}};function h8(n,e,t,i=!1){let o=[];for(let s of ag(n.map(r=>Vj(r,e,t)),(r,a)=>r.original.overlapOrTouch(a.original)||r.modified.overlapOrTouch(a.modified))){let r=s[0],a=s[s.length-1];o.push(new xo(r.original.join(a.original),r.modified.join(a.modified),s.map(l=>l.innerChanges[0])))}return Fr(()=>!i&&o.length>0&&(o[0].modified.startLineNumber!==o[0].original.startLineNumber||t.length-o[o.length-1].modified.endLineNumberExclusive!==e.length-o[o.length-1].original.endLineNumberExclusive)?!1:qg(o,(s,r)=>r.original.startLineNumber-s.original.endLineNumberExclusive===r.modified.startLineNumber-s.modified.endLineNumberExclusive&&s.original.endLineNumberExclusive=t[n.modifiedRange.startLineNumber-1].length&&n.originalRange.startColumn-1>=e[n.originalRange.startLineNumber-1].length&&n.originalRange.startLineNumber<=n.originalRange.endLineNumber+o&&n.modifiedRange.startLineNumber<=n.modifiedRange.endLineNumber+o&&(i=1);let s=new Ne(n.originalRange.startLineNumber+i,n.originalRange.endLineNumber+1+o),r=new Ne(n.modifiedRange.startLineNumber+i,n.modifiedRange.endLineNumber+1+o);return new xo(s,r,[n])}var pA={getLegacy:()=>new lS,getDefault:()=>new cm};hs();_();v();b();gn();function g8(n){let e=[];for(let t of n){let i=Number(t);(i||i===0&&t.replace(/\s/g,"")!=="")&&e.push(i)}return e}function _A(n,e,t,i){return{red:n/255,blue:t/255,green:e/255,alpha:i}}function $0(n,e){let t=e.index,i=e[0].length;if(!t)return;let o=n.positionAt(t);return{startLineNumber:o.lineNumber,startColumn:o.column,endLineNumber:o.lineNumber,endColumn:o.column+i}}function Hj(n,e){if(!n)return;let t=Z.Format.CSS.parseHex(e);if(t)return{range:n,color:_A(t.rgba.r,t.rgba.g,t.rgba.b,t.rgba.a)}}function u8(n,e,t){if(!n||e.length!==1)return;let o=e[0].values(),s=g8(o);return{range:n,color:_A(s[0],s[1],s[2],t?s[3]:1)}}function f8(n,e,t){if(!n||e.length!==1)return;let o=e[0].values(),s=g8(o),r=new Z(new Tl(s[0],s[1]/100,s[2]/100,t?s[3]:1));return{range:n,color:_A(r.rgba.r,r.rgba.g,r.rgba.b,r.rgba.a)}}function q0(n,e){return typeof n=="string"?[...n.matchAll(e)]:n.findMatches(e)}function Uj(n){let e=[],i=q0(n,/\b(rgb|rgba|hsl|hsla)(\([0-9\s,.\%]*\))|(#)([A-Fa-f0-9]{3})\b|(#)([A-Fa-f0-9]{4})\b|(#)([A-Fa-f0-9]{6})\b|(#)([A-Fa-f0-9]{8})\b/gm);if(i.length>0)for(let o of i){let s=o.filter(c=>c!==void 0),r=s[1],a=s[2];if(!a)continue;let l;if(r==="rgb"){let c=/^\(\s*(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])\s*,\s*(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])\s*,\s*(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])\s*\)$/gm;l=u8($0(n,o),q0(a,c),!1)}else if(r==="rgba"){let c=/^\(\s*(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])\s*,\s*(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])\s*,\s*(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])\s*,\s*(0[.][0-9]+|[.][0-9]+|[01][.]|[01])\s*\)$/gm;l=u8($0(n,o),q0(a,c),!0)}else if(r==="hsl"){let c=/^\(\s*(36[0]|3[0-5][0-9]|[12][0-9][0-9]|[1-9]?[0-9])\s*,\s*(100|\d{1,2}[.]\d*|\d{1,2})%\s*,\s*(100|\d{1,2}[.]\d*|\d{1,2})%\s*\)$/gm;l=f8($0(n,o),q0(a,c),!1)}else if(r==="hsla"){let c=/^\(\s*(36[0]|3[0-5][0-9]|[12][0-9][0-9]|[1-9]?[0-9])\s*,\s*(100|\d{1,2}[.]\d*|\d{1,2})%\s*,\s*(100|\d{1,2}[.]\d*|\d{1,2})%\s*,\s*(0[.][0-9]+|[.][0-9]+|[01][.]|[01])\s*\)$/gm;l=f8($0(n,o),q0(a,c),!0)}else r==="#"&&(l=Hj($0(n,o),r+a));l&&e.push(l)}return e}function m8(n){return!n||typeof n.getValue!="function"||typeof n.positionAt!="function"?[]:Uj(n)}_();v();b();var p8=/\bMARK:\s*(.*)$/d,Kj=/^-+|-+$/g;function _8(n,e){var t;let i=[];if(e.findRegionSectionHeaders&&(!((t=e.foldingRules)===null||t===void 0)&&t.markers)){let o=$j(n,e);i=i.concat(o)}if(e.findMarkSectionHeaders){let o=qj(n);i=i.concat(o)}return i}function $j(n,e){let t=[],i=n.getLineCount();for(let o=1;o<=i;o++){let s=n.getLineContent(o),r=s.match(e.foldingRules.markers.start);if(r){let a={startLineNumber:o,startColumn:r[0].length+1,endLineNumber:o,endColumn:s.length+1};if(a.endColumn>a.startColumn){let l={range:a,...b8(s.substring(r[0].length)),shouldBeInComments:!1};(l.text||l.hasSeparatorLine)&&t.push(l)}}}return t}function qj(n){let e=[],t=n.getLineCount();for(let i=1;i<=t;i++){let o=n.getLineContent(i);jj(o,i,e)}return e}function jj(n,e,t){p8.lastIndex=0;let i=p8.exec(n);if(i){let o=i.indices[1][0]+1,s=i.indices[1][1]+1,r={startLineNumber:e,startColumn:o,endLineNumber:e,endColumn:s};if(r.endColumn>r.startColumn){let a={range:r,...b8(i[1]),shouldBeInComments:!0};(a.text||a.hasSeparatorLine)&&t.push(a)}}}function b8(n){n=n.trim();let e=n.startsWith("-");return n=n.replace(Kj,""),{text:n,hasSeparatorLine:e}}var bA=class extends jy{get uri(){return this._uri}get eol(){return this._eol}getValue(){return this.getText()}findMatches(e){let t=[];for(let i=0;ithis._lines.length)t=this._lines.length,i=this._lines[t-1].length+1,o=!0;else{let s=this._lines[t-1].length+1;i<1?(i=1,o=!0):i>s&&(i=s,o=!0)}return o?{lineNumber:t,column:i}:e}},Pu=class n{constructor(e,t){this._host=e,this._models=Object.create(null),this._foreignModuleFactory=t,this._foreignModule=null}dispose(){this._models=Object.create(null)}_getModel(e){return this._models[e]}_getModels(){let e=[];return Object.keys(this._models).forEach(t=>e.push(this._models[t])),e}acceptNewModel(e){this._models[e.url]=new bA(Oe.parse(e.url),e.lines,e.EOL,e.versionId)}acceptModelChanged(e,t){if(!this._models[e])return;this._models[e].onEvents(t)}acceptRemovedModel(e){this._models[e]&&delete this._models[e]}async computeUnicodeHighlights(e,t,i){let o=this._getModel(e);return o?tS.computeUnicodeHighlights(o,t,i):{ranges:[],hasMore:!1,ambiguousCharacterCount:0,invisibleCharacterCount:0,nonBasicAsciiCharacterCount:0}}async findSectionHeaders(e,t){let i=this._getModel(e);return i?_8(i,t):[]}async computeDiff(e,t,i,o){let s=this._getModel(e),r=this._getModel(t);return!s||!r?null:n.computeDiff(s,r,i,o)}static computeDiff(e,t,i,o){let s=o==="advanced"?pA.getDefault():pA.getLegacy(),r=e.getLinesContent(),a=t.getLinesContent(),l=s.computeDiff(r,a,i),c=l.changes.length>0?!1:this._modelsAreIdentical(e,t);function d(h){return h.map(u=>{var f;return[u.original.startLineNumber,u.original.endLineNumberExclusive,u.modified.startLineNumber,u.modified.endLineNumberExclusive,(f=u.innerChanges)===null||f===void 0?void 0:f.map(g=>[g.originalRange.startLineNumber,g.originalRange.startColumn,g.originalRange.endLineNumber,g.originalRange.endColumn,g.modifiedRange.startLineNumber,g.modifiedRange.startColumn,g.modifiedRange.endLineNumber,g.modifiedRange.endColumn])]})}return{identical:c,quitEarly:l.hitTimeout,changes:d(l.changes),moves:l.moves.map(h=>[h.lineRangeMapping.original.startLineNumber,h.lineRangeMapping.original.endLineNumberExclusive,h.lineRangeMapping.modified.startLineNumber,h.lineRangeMapping.modified.endLineNumberExclusive,d(h.changes)])}}static _modelsAreIdentical(e,t){let i=e.getLineCount(),o=t.getLineCount();if(i!==o)return!1;for(let s=1;s<=i;s++){let r=e.getLineContent(s),a=t.getLineContent(s);if(r!==a)return!1}return!0}async computeMoreMinimalEdits(e,t,i){let o=this._getModel(e);if(!o)return t;let s=[],r;t=t.slice(0).sort((l,c)=>{if(l.range&&c.range)return P.compareRangesUsingStarts(l.range,c.range);let d=l.range?0:1,h=c.range?0:1;return d-h});let a=0;for(let l=1;ln._diffLimit){s.push({range:l,text:c});continue}let u=B3(h,c,i),f=o.offsetAt(P.lift(l).getStartPosition());for(let g of u){let m=o.positionAt(f+g.originalStart),C=o.positionAt(f+g.originalStart+g.originalLength),S={text:c.substr(g.modifiedStart,g.modifiedLength),range:{startLineNumber:m.lineNumber,startColumn:m.column,endLineNumber:C.lineNumber,endColumn:C.column}};o.getValueInRange(S.range)!==S.text&&s.push(S)}}return typeof r=="number"&&s.push({eol:r,text:"",range:{startLineNumber:0,startColumn:0,endLineNumber:0,endColumn:0}}),s}async computeLinks(e){let t=this._getModel(e);return t?z3(t):null}async computeDefaultDocumentColors(e){let t=this._getModel(e);return t?m8(t):null}async textualSuggest(e,t,i,o){let s=new Er,r=new RegExp(i,o),a=new Set;e:for(let l of e){let c=this._getModel(l);if(c){for(let d of c.words(r))if(!(d===t||!isNaN(Number(d)))&&(a.add(d),a.size>n._suggestionsLimit))break e}}return{words:Array.from(a),duration:s.elapsed()}}async computeWordRanges(e,t,i,o){let s=this._getModel(e);if(!s)return Object.create(null);let r=new RegExp(i,o),a=Object.create(null);for(let l=t.startLineNumber;lthis._host.fhr(a,l)),getMirrorModels:()=>this._getModels()};return this._foreignModuleFactory?(this._foreignModule=this._foreignModuleFactory(r,t),Promise.resolve(dg(this._foreignModule))):Promise.reject(new Error("Unexpected usage"))}fmr(e,t){if(!this._foreignModule||typeof this._foreignModule[e]!="function")return Promise.reject(new Error("Missing requestHandler or method: "+e));try{return Promise.resolve(this._foreignModule[e].apply(this._foreignModule,t))}catch(i){return Promise.reject(i)}}};Pu._diffLimit=1e5;Pu._suggestionsLimit=1e4;typeof importScripts=="function"&&(globalThis.monaco=gw());_u();_();v();b();qe();var fS=De("textResourceConfigurationService"),gS=De("textResourcePropertiesService");wt();Aa();vg();xt();Ou();Bo();vo();ke();var Gj=function(n,e,t,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},j0=function(n,e){return function(t,i){e(t,i,n)}},v8=60*1e3,C8=5*60*1e3;function Fu(n,e){let t=n.getModel(e);return!(!t||t.isTooLargeForSyncing())}var mS=class extends H{constructor(e,t,i,o,s){super(),this._modelService=e,this._workerManager=this._register(new CA(this._modelService,o)),this._logService=i,this._register(s.linkProvider.register({language:"*",hasAccessToAllModels:!0},{provideLinks:(r,a)=>Fu(this._modelService,r.uri)?this._workerManager.withWorker().then(l=>l.computeLinks(r.uri)).then(l=>l&&{links:l}):Promise.resolve({links:[]})})),this._register(s.completionProvider.register("*",new vA(this._workerManager,t,this._modelService,o)))}dispose(){super.dispose()}canComputeUnicodeHighlights(e){return Fu(this._modelService,e)}computedUnicodeHighlights(e,t,i){return this._workerManager.withWorker().then(o=>o.computedUnicodeHighlights(e,t,i))}async computeDiff(e,t,i,o){let s=await this._workerManager.withWorker().then(l=>l.computeDiff(e,t,i,o));if(!s)return null;return{identical:s.identical,quitEarly:s.quitEarly,changes:a(s.changes),moves:s.moves.map(l=>new im(new So(new Ne(l[0],l[1]),new Ne(l[2],l[3])),a(l[4])))};function a(l){return l.map(c=>{var d;return new xo(new Ne(c[0],c[1]),new Ne(c[2],c[3]),(d=c[4])===null||d===void 0?void 0:d.map(h=>new ts(new P(h[0],h[1],h[2],h[3]),new P(h[4],h[5],h[6],h[7]))))})}}computeMoreMinimalEdits(e,t,i=!1){if(eu(t)){if(!Fu(this._modelService,e))return Promise.resolve(t);let o=Er.create(),s=this._workerManager.withWorker().then(r=>r.computeMoreMinimalEdits(e,t,i));return s.finally(()=>this._logService.trace("FORMAT#computeMoreMinimalEdits",e.toString(!0),o.elapsed())),Promise.race([s,kc(1e3).then(()=>t)])}else return Promise.resolve(void 0)}canNavigateValueSet(e){return Fu(this._modelService,e)}navigateValueSet(e,t,i){return this._workerManager.withWorker().then(o=>o.navigateValueSet(e,t,i))}canComputeWordRanges(e){return Fu(this._modelService,e)}computeWordRanges(e,t){return this._workerManager.withWorker().then(i=>i.computeWordRanges(e,t))}findSectionHeaders(e,t){return this._workerManager.withWorker().then(i=>i.findSectionHeaders(e,t))}};mS=Gj([j0(0,xn),j0(1,fS),j0(2,En),j0(3,yo),j0(4,Tt)],mS);var vA=class{constructor(e,t,i,o){this.languageConfigurationService=o,this._debugDisplayName="wordbasedCompletions",this._workerManager=e,this._configurationService=t,this._modelService=i}async provideCompletionItems(e,t){let i=this._configurationService.getValue(e.uri,t,"editor");if(i.wordBasedSuggestions==="off")return;let o=[];if(i.wordBasedSuggestions==="currentDocument")Fu(this._modelService,e.uri)&&o.push(e.uri);else for(let h of this._modelService.getModels())Fu(this._modelService,h.uri)&&(h===e?o.unshift(h.uri):(i.wordBasedSuggestions==="allDocuments"||h.getLanguageId()===e.getLanguageId())&&o.push(h.uri));if(o.length===0)return;let s=this.languageConfigurationService.getLanguageConfiguration(e.getLanguageId()).getWordDefinition(),r=e.getWordAtPosition(t),a=r?new P(t.lineNumber,r.startColumn,t.lineNumber,r.endColumn):P.fromPositions(t),l=a.setEndPosition(t.lineNumber,t.column),d=await(await this._workerManager.withWorker()).textualSuggest(o,r?.word,s);if(d)return{duration:d.duration,suggestions:d.words.map(h=>({kind:18,label:h,insertText:h,range:{insert:l,replace:a}}))}}},CA=class extends H{constructor(e,t){super(),this.languageConfigurationService=t,this._modelService=e,this._editorWorkerClient=null,this._lastWorkerUsedTime=new Date().getTime(),this._register(new Bd).cancelAndSet(()=>this._checkStopIdleWorker(),Math.round(C8/2),gt),this._register(this._modelService.onModelRemoved(o=>this._checkStopEmptyWorker()))}dispose(){this._editorWorkerClient&&(this._editorWorkerClient.dispose(),this._editorWorkerClient=null),super.dispose()}_checkStopEmptyWorker(){if(!this._editorWorkerClient)return;this._modelService.getModels().length===0&&(this._editorWorkerClient.dispose(),this._editorWorkerClient=null)}_checkStopIdleWorker(){if(!this._editorWorkerClient)return;new Date().getTime()-this._lastWorkerUsedTime>C8&&(this._editorWorkerClient.dispose(),this._editorWorkerClient=null)}withWorker(){return this._lastWorkerUsedTime=new Date().getTime(),this._editorWorkerClient||(this._editorWorkerClient=new Z0(this._modelService,!1,"editorWorkerService",this.languageConfigurationService)),Promise.resolve(this._editorWorkerClient)}},wA=class extends H{constructor(e,t,i){if(super(),this._syncedModels=Object.create(null),this._syncedModelsLastUsedTime=Object.create(null),this._proxy=e,this._modelService=t,!i){let o=new Fd;o.cancelAndSet(()=>this._checkStopModelSync(),Math.round(v8/2)),this._register(o)}}dispose(){for(let e in this._syncedModels)li(this._syncedModels[e]);this._syncedModels=Object.create(null),this._syncedModelsLastUsedTime=Object.create(null),super.dispose()}ensureSyncedResources(e,t){for(let i of e){let o=i.toString();this._syncedModels[o]||this._beginModelSync(i,t),this._syncedModels[o]&&(this._syncedModelsLastUsedTime[o]=new Date().getTime())}}_checkStopModelSync(){let e=new Date().getTime(),t=[];for(let i in this._syncedModelsLastUsedTime)e-this._syncedModelsLastUsedTime[i]>v8&&t.push(i);for(let i of t)this._stopModelSync(i)}_beginModelSync(e,t){let i=this._modelService.getModel(e);if(!i||!t&&i.isTooLargeForSyncing())return;let o=e.toString();this._proxy.acceptNewModel({url:i.uri.toString(),lines:i.getLinesContent(),EOL:i.getEOL(),versionId:i.getVersionId()});let s=new ae;s.add(i.onDidChangeContent(r=>{this._proxy.acceptModelChanged(o.toString(),r)})),s.add(i.onWillDispose(()=>{this._stopModelSync(o)})),s.add(be(()=>{this._proxy.acceptRemovedModel(o)})),this._syncedModels[o]=s}_stopModelSync(e){let t=this._syncedModels[e];delete this._syncedModels[e],delete this._syncedModelsLastUsedTime[e],li(t)}},pS=class{constructor(e){this._instance=e,this._proxyObj=Promise.resolve(this._instance)}dispose(){this._instance.dispose()}getProxyObject(){return this._proxyObj}},G0=class{constructor(e){this._workerClient=e}fhr(e,t){return this._workerClient.fhr(e,t)}},Z0=class extends H{constructor(e,t,i,o){super(),this.languageConfigurationService=o,this._disposed=!1,this._modelService=e,this._keepIdleModels=t,this._workerFactory=new T0(i),this._worker=null,this._modelManager=null}fhr(e,t){throw new Error("Not implemented!")}_getOrCreateWorker(){if(!this._worker)try{this._worker=this._register(new wy(this._workerFactory,"vs/editor/common/services/editorSimpleWorker",new G0(this)))}catch(e){I0(e),this._worker=new pS(new Pu(new G0(this),null))}return this._worker}_getProxy(){return this._getOrCreateWorker().getProxyObject().then(void 0,e=>(I0(e),this._worker=new pS(new Pu(new G0(this),null)),this._getOrCreateWorker().getProxyObject()))}_getOrCreateModelManager(e){return this._modelManager||(this._modelManager=this._register(new wA(e,this._modelService,this._keepIdleModels))),this._modelManager}async _withSyncedResources(e,t=!1){return this._disposed?Promise.reject(L9()):this._getProxy().then(i=>(this._getOrCreateModelManager(i).ensureSyncedResources(e,t),i))}computedUnicodeHighlights(e,t,i){return this._withSyncedResources([e]).then(o=>o.computeUnicodeHighlights(e.toString(),t,i))}computeDiff(e,t,i,o){return this._withSyncedResources([e,t],!0).then(s=>s.computeDiff(e.toString(),t.toString(),i,o))}computeMoreMinimalEdits(e,t,i){return this._withSyncedResources([e]).then(o=>o.computeMoreMinimalEdits(e.toString(),t,i))}computeLinks(e){return this._withSyncedResources([e]).then(t=>t.computeLinks(e.toString()))}computeDefaultDocumentColors(e){return this._withSyncedResources([e]).then(t=>t.computeDefaultDocumentColors(e.toString()))}async textualSuggest(e,t,i){let o=await this._withSyncedResources(e),s=i.source,r=i.flags;return o.textualSuggest(e.map(a=>a.toString()),t,s,r)}computeWordRanges(e,t){return this._withSyncedResources([e]).then(i=>{let o=this._modelService.getModel(e);if(!o)return Promise.resolve(null);let s=this.languageConfigurationService.getLanguageConfiguration(o.getLanguageId()).getWordDefinition(),r=s.source,a=s.flags;return i.computeWordRanges(e.toString(),t,r,a)})}navigateValueSet(e,t,i){return this._withSyncedResources([e]).then(o=>{let s=this._modelService.getModel(e);if(!s)return null;let r=this.languageConfigurationService.getLanguageConfiguration(s.getLanguageId()).getWordDefinition(),a=r.source,l=r.flags;return o.navigateValueSet(e.toString(),t,i,a,l)})}findSectionHeaders(e,t){return this._withSyncedResources([e]).then(i=>i.findSectionHeaders(e.toString(),t))}dispose(){super.dispose(),this._disposed=!0}};function w8(n,e,t){return new yA(n,e,t)}var yA=class extends Z0{constructor(e,t,i){super(e,i.keepIdleModels||!1,i.label,t),this._foreignModuleId=i.moduleId,this._foreignModuleCreateData=i.createData||null,this._foreignModuleHost=i.host||null,this._foreignProxy=null}fhr(e,t){if(!this._foreignModuleHost||typeof this._foreignModuleHost[e]!="function")return Promise.reject(new Error("Missing method "+e+" or missing main thread foreign host."));try{return Promise.resolve(this._foreignModuleHost[e].apply(this._foreignModuleHost,t))}catch(i){return Promise.reject(i)}}_getForeignProxy(){return this._foreignProxy||(this._foreignProxy=this._getProxy().then(e=>{let t=this._foreignModuleHost?dg(this._foreignModuleHost):[];return e.loadForeignModule(this._foreignModuleId,this._foreignModuleCreateData,t).then(i=>{this._foreignModuleCreateData=null;let o=(a,l)=>e.fmr(a,l),s=(a,l)=>function(){let c=Array.prototype.slice.call(arguments,0);return l(a,c)},r={};for(let a of i)r[a]=s(a,o);return r})})),this._foreignProxy}getProxy(){return this._getForeignProxy()}withSyncedResources(e){return this._withSyncedResources(e).then(t=>this.getProxy())}};_();v();b();var Rc={ICodeEditor:"vs.editor.ICodeEditor",IDiffEditor:"vs.editor.IDiffEditor"};Yo();Hr();lr();Ma();Y0();hr();_u();_();v();b();ot();Yo();Pc();_();v();b();Ge();ot();xu();_();v();b();ot();var $r=class n{constructor(e,t,i,o){this.startColumn=e,this.endColumn=t,this.className=i,this.type=o,this._lineDecorationBrand=void 0}static _equals(e,t){return e.startColumn===t.startColumn&&e.endColumn===t.endColumn&&e.className===t.className&&e.type===t.type}static equalsArr(e,t){let i=e.length,o=t.length;if(i!==o)return!1;for(let s=0;s=s||(a[l++]=new n(Math.max(1,c.startColumn-o+1),Math.min(r+1,c.endColumn-o+1),c.className,c.type));return a}static filter(e,t,i,o){if(e.length===0)return[];let s=[],r=0;for(let a=0,l=e.length;at||d.isEmpty()&&(c.type===0||c.type===3))continue;let h=d.startLineNumber===t?d.startColumn:i,u=d.endLineNumber===t?d.endColumn:o;s[r++]=new n(h,u,c.inlineClassName,c.type)}return s}static _typeCompare(e,t){let i=[2,0,1,3];return i[e]-i[t]}static compare(e,t){if(e.startColumn!==t.startColumn)return e.startColumn-t.startColumn;if(e.endColumn!==t.endColumn)return e.endColumn-t.endColumn;let i=n._typeCompare(e.type,t.type);return i!==0?i:e.className!==t.className?e.className0&&this.stopOffsets[0]0&&t=e){this.stopOffsets.splice(o,0,e),this.classNames.splice(o,0,t),this.metadata.splice(o,0,i);break}this.count++}},vS=class{static normalize(e,t){if(t.length===0)return[];let i=[],o=new xA,s=0;for(let r=0,a=t.length;r1){let m=e.charCodeAt(c-2);pi(m)&&c--}if(d>1){let m=e.charCodeAt(d-2);pi(m)&&d--}let f=c-1,g=d-2;s=o.consumeLowerThan(f,s,i),o.count===0&&(s=f),o.insert(g,h,u)}return o.consumeLowerThan(1073741824,s,i),i}};_();v();b();var $i=class{constructor(e,t,i,o){this.endIndex=e,this.type=t,this.metadata=i,this.containsRTL=o,this._linePartBrand=void 0}isWhitespace(){return!!(this.metadata&1)}isPseudoAfter(){return!!(this.metadata&4)}};var fm=class{constructor(e,t){this.startOffset=e,this.endOffset=t}equals(e){return this.startOffset===e.startOffset&&this.endOffset===e.endOffset}},qr=class{constructor(e,t,i,o,s,r,a,l,c,d,h,u,f,g,m,C,S,w,y){this.useMonospaceOptimizations=e,this.canUseHalfwidthRightwardsArrow=t,this.lineContent=i,this.continuesWithWrappedLine=o,this.isBasicASCII=s,this.containsRTL=r,this.fauxIndentLength=a,this.lineTokens=l,this.lineDecorations=c.sort($r.compare),this.tabSize=d,this.startVisibleColumn=h,this.spaceWidth=u,this.stopRenderingLineAfter=m,this.renderWhitespace=C==="all"?4:C==="boundary"?1:C==="selection"?2:C==="trailing"?3:0,this.renderControlCharacters=S,this.fontLigatures=w,this.selectionsOnLine=y&&y.sort((T,N)=>T.startOffset>>16}static getCharIndex(e){return(e&65535)>>>0}constructor(e,t){this.length=e,this._data=new Uint32Array(this.length),this._horizontalOffset=new Uint32Array(this.length)}setColumnInfo(e,t,i,o){let s=(t<<16|i<<0)>>>0;this._data[e-1]=s,this._horizontalOffset[e-1]=o}getHorizontalOffset(e){return this._horizontalOffset.length===0?0:this._horizontalOffset[e-1]}charOffsetToPartData(e){return this.length===0?0:e<0?this._data[0]:e>=this.length?this._data[this.length-1]:this._data[e]}getDomPosition(e){let t=this.charOffsetToPartData(e-1),i=n.getPartIndex(t),o=n.getCharIndex(t);return new X0(i,o)}getColumn(e,t){return this.partDataToCharOffset(e.partIndex,t,e.charIndex)+1}partDataToCharOffset(e,t,i){if(this.length===0)return 0;let o=(e<<16|i<<0)>>>0,s=0,r=this.length-1;for(;s+1>>1,C=this._data[m];if(C===o)return m;C>o?r=m:s=m}if(s===r)return s;let a=this._data[s],l=this._data[r];if(a===o)return s;if(l===o)return r;let c=n.getPartIndex(a),d=n.getCharIndex(a),h=n.getPartIndex(l),u;c!==h?u=t:u=n.getCharIndex(l);let f=i-d,g=u-i;return f<=g?s:r}},J0=class{constructor(e,t,i){this._renderLineOutputBrand=void 0,this.characterMapping=e,this.containsRTL=t,this.containsForeignElements=i}};function eb(n,e){if(n.lineContent.length===0){if(n.lineDecorations.length>0){e.appendString("");let t=0,i=0,o=0;for(let r of n.lineDecorations)(r.type===1||r.type===2)&&(e.appendString(''),r.type===1&&(o|=1,t++),r.type===2&&(o|=2,i++));e.appendString("");let s=new Q0(1,t+i);return s.setColumnInfo(1,t,0,0),new J0(s,!1,o)}return e.appendString(""),new J0(new Q0(0,0),!1,0)}return tG(Zj(n),e)}var LA=class{constructor(e,t,i,o){this.characterMapping=e,this.html=t,this.containsRTL=i,this.containsForeignElements=o}};function gm(n){let e=new Sl(1e4),t=eb(n,e);return new LA(t.characterMapping,e.build(),t.containsRTL,t.containsForeignElements)}var kA=class{constructor(e,t,i,o,s,r,a,l,c,d,h,u,f,g,m,C){this.fontIsMonospace=e,this.canUseHalfwidthRightwardsArrow=t,this.lineContent=i,this.len=o,this.isOverflowing=s,this.overflowingCharCount=r,this.parts=a,this.containsForeignElements=l,this.fauxIndentLength=c,this.tabSize=d,this.startVisibleColumn=h,this.containsRTL=u,this.spaceWidth=f,this.renderSpaceCharCode=g,this.renderWhitespace=m,this.renderControlCharacters=C}};function Zj(n){let e=n.lineContent,t,i,o;n.stopRenderingLineAfter!==-1&&n.stopRenderingLineAfter0){for(let a=0,l=n.lineDecorations.length;a0&&(s[r++]=new $i(i,"",0,!1));let a=i;for(let l=0,c=t.getCount();l=o){let f=e?Lc(n.substring(a,o)):!1;s[r++]=new $i(o,h,0,f);break}let u=e?Lc(n.substring(a,d)):!1;s[r++]=new $i(d,h,0,u),a=d}return s}function Xj(n,e,t){let i=0,o=[],s=0;if(t)for(let r=0,a=e.length;r=50&&(o[s++]=new $i(f+1,d,h,u),g=f+1,f=-1);g!==c&&(o[s++]=new $i(c,d,h,u))}else o[s++]=l;i=c}else for(let r=0,a=e.length;r50){let h=l.type,u=l.metadata,f=l.containsRTL,g=Math.ceil(d/50);for(let m=1;m=8234&&n<=8238||n>=8294&&n<=8297||n>=8206&&n<=8207||n===1564}function Qj(n,e){let t=[],i=new $i(0,"",0,!1),o=0;for(let s of e){let r=s.endIndex;for(;oi.endIndex&&(i=new $i(o,s.type,s.metadata,s.containsRTL),t.push(i)),i=new $i(o+1,"mtkcontrol",s.metadata,!1),t.push(i))}o>i.endIndex&&(i=new $i(r,s.type,s.metadata,s.containsRTL),t.push(i))}return t}function Jj(n,e,t,i){let o=n.continuesWithWrappedLine,s=n.fauxIndentLength,r=n.tabSize,a=n.startVisibleColumn,l=n.useMonospaceOptimizations,c=n.selectionsOnLine,d=n.renderWhitespace===1,h=n.renderWhitespace===3,u=n.renderSpaceWidth!==n.spaceWidth,f=[],g=0,m=0,C=i[m].type,S=i[m].containsRTL,w=i[m].endIndex,y=i.length,x=!1,k=Ri(e),T;k===-1?(x=!0,k=t,T=t):T=Os(e);let N=!1,M=0,W=c&&c[M],j=a%r;for(let V=s;V=W.endOffset&&(M++,W=c&&c[M]);let te;if(VT)te=!0;else if(z===9)te=!0;else if(z===32)if(d)if(N)te=!0;else{let ee=V+1V),te&&h&&(te=x||V>T),te&&S&&V>=k&&V<=T&&(te=!1),N){if(!te||!l&&j>=r){if(u){let ee=g>0?f[g-1].endIndex:s;for(let ce=ee+1;ce<=V;ce++)f[g++]=new $i(ce,"mtkw",1,!1)}else f[g++]=new $i(V,"mtkw",1,!1);j=j%r}}else(V===w||te&&V>s)&&(f[g++]=new $i(V,C,0,S),j=j%r);for(z===9?j=r:Ys(z)?j+=2:j++,N=te;V===w&&(m++,m0?e.charCodeAt(t-1):0,z=t>1?e.charCodeAt(t-2):0;V===32&&z!==32&&z!==9||(G=!0)}else G=!0;if(G)if(u){let V=g>0?f[g-1].endIndex:s;for(let z=V+1;z<=t;z++)f[g++]=new $i(z,"mtkw",1,!1)}else f[g++]=new $i(t,"mtkw",1,!1);else f[g++]=new $i(t,C,0,S);return f}function eG(n,e,t,i){i.sort($r.compare);let o=vS.normalize(n,i),s=o.length,r=0,a=[],l=0,c=0;for(let h=0,u=t.length;hc&&(c=w.startOffset,a[l++]=new $i(c,m,C,S)),w.endOffset+1<=g)c=w.endOffset+1,a[l++]=new $i(c,m+" "+w.className,C|w.metadata,S),r++;else{c=g,a[l++]=new $i(c,m+" "+w.className,C|w.metadata,S);break}}g>c&&(c=g,a[l++]=new $i(c,m,C,S))}let d=t[t.length-1].endIndex;if(r'):e.appendString("");for(let W=0,j=c.length;W=d&&(Pe+=Te)}}for(ce&&(e.appendString(' style="width:'),e.appendString(String(g*Se)),e.appendString('px"')),e.appendASCIICharCode(62);x1?e.appendCharCode(8594):e.appendCharCode(65515);for(let Te=2;Te<=Qe;Te++)e.appendCharCode(160)}else Pe=2,Qe=1,e.appendCharCode(m),e.appendCharCode(8204);T+=Pe,N+=Qe,x>=d&&(k+=Qe)}}else for(e.appendASCIICharCode(62);x=d&&(k+=Pe)}Ce?M++:M=0,x>=r&&!y&&G.isPseudoAfter()&&(y=!0,w.setColumnInfo(x+1,W,T,N)),e.appendString("")}return y||w.setColumnInfo(r+1,c.length-1,T,N),a&&(e.appendString(''),e.appendString(p("showMore","Show more ({0})",nG(l))),e.appendString("")),e.appendString(""),new J0(w,f,o)}function iG(n){return n.toString(16).toUpperCase().padStart(4,"0")}function nG(n){return n<1024?p("overflow.chars","{0} chars",n):n<1024*1024?`${(n/1024).toFixed(1)} KB`:`${(n/1024/1024).toFixed(1)} MB`}_();v();b();wt();ot();Ke();var tb=class{constructor(e,t,i,o){this._viewportBrand=void 0,this.top=e|0,this.left=t|0,this.width=i|0,this.height=o|0}},CS=class{constructor(e,t){this.tabSize=e,this.data=t}},Bu=class{constructor(e,t,i,o,s,r,a){this._viewLineDataBrand=void 0,this.content=e,this.continuesWithWrappedLine=t,this.minColumn=i,this.maxColumn=o,this.startVisibleColumn=s,this.tokens=r,this.inlineDecorations=a}},Wo=class n{constructor(e,t,i,o,s,r,a,l,c,d){this.minColumn=e,this.maxColumn=t,this.content=i,this.continuesWithWrappedLine=o,this.isBasicASCII=n.isBasicASCII(i,r),this.containsRTL=n.containsRTL(i,this.isBasicASCII,s),this.tokens=a,this.inlineDecorations=l,this.tabSize=c,this.startVisibleColumn=d}static isBasicASCII(e,t){return t?Ig(e):!0}static containsRTL(e,t,i){return!t&&i?Lc(e):!1}},Oc=class{constructor(e,t,i){this.range=e,this.inlineClassName=t,this.type=i}},wS=class{constructor(e,t,i,o){this.startOffset=e,this.endOffset=t,this.inlineClassName=i,this.inlineClassNameAffectsLetterSpacing=o}toInlineDecoration(e){return new Oc(new P(e,this.startOffset+1,e,this.endOffset+1),this.inlineClassName,this.inlineClassNameAffectsLetterSpacing?3:0)}},mm=class{constructor(e,t){this._viewModelDecorationBrand=void 0,this.range=e,this.options=t}},Wu=class n{constructor(e,t,i){this.color=e,this.zIndex=t,this.data=i}static compareByRenderingProps(e,t){return e.zIndex===t.zIndex?e.colort.color?1:0:e.zIndex-t.zIndex}static equals(e,t){return e.color===t.color&&e.zIndex===t.zIndex&&Ht(e.data,t.data)}static equalsArr(e,t){return Ht(e,t,n.equals)}};_();v();b();le();Yo();Y0();_();v();b();function oG(n){return Array.isArray(n)}function x8(n){return!oG(n)}function DA(n){return typeof n=="string"}function EA(n){return!DA(n)}function th(n){return!n}function Pa(n,e){return n.ignoreCase&&e?e.toLowerCase():e}function IA(n){return n.replace(/[&<>'"_]/g,"-")}function L8(n,e){console.log(`${n.languageId}: ${e}`)}function Kt(n,e){return new Error(`${n.languageId}: ${e}`)}function Nl(n,e,t,i,o){let s=/\$((\$)|(#)|(\d\d?)|[sS](\d\d?)|@(\w+))/g,r=null;return e.replace(s,function(a,l,c,d,h,u,f,g,m){return th(c)?th(d)?!th(h)&&h0;){let i=n.tokenizer[t];if(i)return i;let o=t.lastIndexOf(".");o<0?t=null:t=t.substr(0,o)}return null}function D8(n,e){let t=e;for(;t&&t.length>0;){if(n.stateNames[t])return!0;let o=t.lastIndexOf(".");o<0?t=null:t=t.substr(0,o)}return!1}Fo();var sG=function(n,e,t,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},rG=function(n,e){return function(t,i){e(t,i,n)}},TA,I8=5,zu=class{static create(e,t){return this._INSTANCE.create(e,t)}constructor(e){this._maxCacheDepth=e,this._entries=Object.create(null)}create(e,t){if(e!==null&&e.depth>=this._maxCacheDepth)return new _m(e,t);let i=_m.getStackElementId(e);i.length>0&&(i+="|"),i+=t;let o=this._entries[i];return o||(o=new _m(e,t),this._entries[i]=o,o)}};zu._INSTANCE=new zu(I8);var _m=class n{constructor(e,t){this.parent=e,this.state=t,this.depth=(this.parent?this.parent.depth:0)+1}static getStackElementId(e){let t="";for(;e!==null;)t.length>0&&(t+="|"),t+=e.state,e=e.parent;return t}static _equals(e,t){for(;e!==null&&t!==null;){if(e===t)return!0;if(e.state!==t.state)return!1;e=e.parent,t=t.parent}return e===null&&t===null}equals(e){return n._equals(this,e)}push(e){return zu.create(this,e)}pop(){return this.parent}popall(){let e=this;for(;e.parent;)e=e.parent;return e}switchTo(e){return zu.create(this.parent,e)}},pm=class n{constructor(e,t){this.languageId=e,this.state=t}equals(e){return this.languageId===e.languageId&&this.state.equals(e.state)}clone(){return this.state.clone()===this.state?this:new n(this.languageId,this.state)}},Al=class{static create(e,t){return this._INSTANCE.create(e,t)}constructor(e){this._maxCacheDepth=e,this._entries=Object.create(null)}create(e,t){if(t!==null)return new nb(e,t);if(e!==null&&e.depth>=this._maxCacheDepth)return new nb(e,t);let i=_m.getStackElementId(e),o=this._entries[i];return o||(o=new nb(e,null),this._entries[i]=o,o)}};Al._INSTANCE=new Al(I8);var nb=class n{constructor(e,t){this.stack=e,this.embeddedLanguageData=t}clone(){return(this.embeddedLanguageData?this.embeddedLanguageData.clone():null)===this.embeddedLanguageData?this:Al.create(this.stack,this.embeddedLanguageData)}equals(e){return!(e instanceof n)||!this.stack.equals(e.stack)?!1:this.embeddedLanguageData===null&&e.embeddedLanguageData===null?!0:this.embeddedLanguageData===null||e.embeddedLanguageData===null?!1:this.embeddedLanguageData.equals(e.embeddedLanguageData)}},NA=class{constructor(){this._tokens=[],this._languageId=null,this._lastTokenType=null,this._lastTokenLanguage=null}enterLanguage(e){this._languageId=e}emit(e,t){this._lastTokenType===t&&this._lastTokenLanguage===this._languageId||(this._lastTokenType=t,this._lastTokenLanguage=this._languageId,this._tokens.push(new xa(e,t,this._languageId)))}nestedLanguageTokenize(e,t,i,o){let s=i.languageId,r=i.state,a=Bt.get(s);if(!a)return this.enterLanguage(s),this.emit(o,""),r;let l=a.tokenize(e,t,r);if(o!==0)for(let c of l.tokens)this._tokens.push(new xa(c.offset+o,c.type,c.language));else this._tokens=this._tokens.concat(l.tokens);return this._lastTokenType=null,this._lastTokenLanguage=null,this._languageId=null,l.endState}finalize(e){return new Ad(this._tokens,e)}},AA=class n{constructor(e,t){this._languageService=e,this._theme=t,this._prependTokens=null,this._tokens=[],this._currentLanguageId=0,this._lastTokenMetadata=0}enterLanguage(e){this._currentLanguageId=this._languageService.languageIdCodec.encodeLanguageId(e)}emit(e,t){let i=this._theme.match(this._currentLanguageId,t)|1024;this._lastTokenMetadata!==i&&(this._lastTokenMetadata=i,this._tokens.push(e),this._tokens.push(i))}static _merge(e,t,i){let o=e!==null?e.length:0,s=t.length,r=i!==null?i.length:0;if(o===0&&s===0&&r===0)return new Uint32Array(0);if(o===0&&s===0)return i;if(s===0&&r===0)return e;let a=new Uint32Array(o+s+r);e!==null&&a.set(e);for(let l=0;l{if(r)return;let l=!1;for(let c=0,d=a.changedLanguages.length;c{a.affectsConfiguration("editor.maxTokenizationLineLength")&&(this._maxTokenizationLineLength=this._configurationService.getValue("editor.maxTokenizationLineLength",{overrideIdentifier:this._languageId}))}))}getLoadStatus(){let e=[];for(let t in this._embeddedLanguages){let i=Bt.get(t);if(i){if(i instanceof TA){let o=i.getLoadStatus();o.loaded===!1&&e.push(o.promise)}continue}Bt.isResolved(t)||e.push(Bt.getOrCreate(t))}return e.length===0?{loaded:!0}:{loaded:!1,promise:Promise.all(e).then(t=>{})}}getInitialState(){let e=zu.create(null,this._lexer.start);return Al.create(e,null)}tokenize(e,t,i){if(e.length>=this._maxTokenizationLineLength)return _S(this._languageId,i);let o=new NA,s=this._tokenize(e,t,i,o);return o.finalize(s)}tokenizeEncoded(e,t,i){if(e.length>=this._maxTokenizationLineLength)return hm(this._languageService.languageIdCodec.encodeLanguageId(this._languageId),i);let o=new AA(this._languageService,this._standaloneThemeService.getColorTheme().tokenTheme),s=this._tokenize(e,t,i,o);return o.finalize(s)}_tokenize(e,t,i,o){return i.embeddedLanguageData?this._nestedTokenize(e,t,i,0,o):this._myTokenize(e,t,i,0,o)}_findLeavingNestedLanguageOffset(e,t){let i=this._lexer.tokenizer[t.stack.state];if(!i&&(i=ib(this._lexer,t.stack.state),!i))throw Kt(this._lexer,"tokenizer state is not defined: "+t.stack.state);let o=-1,s=!1;for(let r of i){if(!EA(r.action)||r.action.nextEmbedded!=="@pop")continue;s=!0;let a=r.resolveRegex(t.stack.state),l=a.source;if(l.substr(0,4)==="^(?:"&&l.substr(l.length-1,1)===")"){let d=(a.ignoreCase?"i":"")+(a.unicode?"u":"");a=new RegExp(l.substr(4,l.length-5),d)}let c=e.search(a);c===-1||c!==0&&r.matchOnlyAtLineStart||(o===-1||c0&&s.nestedLanguageTokenize(a,!1,i.embeddedLanguageData,o);let l=e.substring(r);return this._myTokenize(l,t,i,o+r,s)}_safeRuleName(e){return e?e.name:"(unknown)"}_myTokenize(e,t,i,o,s){s.enterLanguage(this._languageId);let r=e.length,a=t&&this._lexer.includeLF?e+` +`:e,l=a.length,c=i.embeddedLanguageData,d=i.stack,h=0,u=null,f=!0;for(;f||h=l)break;f=!1;let W=this._lexer.tokenizer[S];if(!W&&(W=ib(this._lexer,S),!W))throw Kt(this._lexer,"tokenizer state is not defined: "+S);let j=a.substr(h);for(let G of W)if((h===0||!G.matchOnlyAtLineStart)&&(w=j.match(G.resolveRegex(S)),w)){y=w[0],x=G.action;break}}if(w||(w=[""],y=""),x||(h=this._lexer.maxStack)throw Kt(this._lexer,"maximum tokenizer stack size reached: ["+d.state+","+d.parent.state+",...]");d=d.push(S)}else if(x.next==="@pop"){if(d.depth<=1)throw Kt(this._lexer,"trying to pop an empty stack in rule: "+this._safeRuleName(k));d=d.pop()}else if(x.next==="@popall")d=d.popall();else{let W=Nl(this._lexer,x.next,y,w,S);if(W[0]==="@"&&(W=W.substr(1)),ib(this._lexer,W))d=d.push(W);else throw Kt(this._lexer,"trying to set a next state '"+W+"' that is undefined in rule: "+this._safeRuleName(k))}}x.log&&typeof x.log=="string"&&L8(this._lexer,this._lexer.languageId+": "+Nl(this._lexer,x.log,y,w,S))}if(N===null)throw Kt(this._lexer,"lexer rule has no well-defined action in rule: "+this._safeRuleName(k));let M=W=>{let j=this._languageService.getLanguageIdByLanguageName(W)||this._languageService.getLanguageIdByMimeType(W)||W,G=this._getNestedEmbeddedLanguageData(j);if(h0)throw Kt(this._lexer,"groups cannot be nested: "+this._safeRuleName(k));if(w.length!==N.length+1)throw Kt(this._lexer,"matched number of groups does not match the number of actions in rule: "+this._safeRuleName(k));let W=0;for(let j=1;jn}),bm=class{static colorizeElement(e,t,i,o){o=o||{};let s=o.theme||"vs",r=o.mimeType||i.getAttribute("lang")||i.getAttribute("data-lang");if(!r)return console.error("Mode not detected"),Promise.resolve();let a=t.getLanguageIdByMimeType(r)||r;e.setTheme(s);let l=i.firstChild?i.firstChild.nodeValue:"";i.className+=" "+s;let c=d=>{var h;let u=(h=MA?.createHTML(d))!==null&&h!==void 0?h:d;i.innerHTML=u};return this.colorize(t,l||"",a,o).then(c,d=>console.error(d))}static async colorize(e,t,i,o){let s=e.languageIdCodec,r=4;o&&typeof o.tabSize=="number"&&(r=o.tabSize),Tg(t)&&(t=t.substr(1));let a=Tr(t);if(!e.isRegisteredLanguageId(i))return T8(a,r,s);let l=await Bt.getOrCreate(i);return l?lG(a,r,l,s):T8(a,r,s)}static colorizeLine(e,t,i,o,s=4){let r=Wo.isBasicASCII(e,t),a=Wo.containsRTL(e,r,i);return gm(new qr(!1,!0,e,!1,r,a,0,o,[],s,0,0,0,0,-1,"none",!1,!1,null)).html}static colorizeModelLine(e,t,i=4){let o=e.getLineContent(t);e.tokenization.forceTokenization(t);let r=e.tokenization.getLineTokens(t).inflate();return this.colorizeLine(o,e.mightContainNonBasicASCII(),e.mightContainRTL(),r,i)}};function lG(n,e,t,i){return new Promise((o,s)=>{let r=()=>{let a=cG(n,e,t,i);if(t instanceof Vu){let l=t.getLoadStatus();if(l.loaded===!1){l.promise.then(r,s);return}}o(a)};r()})}function T8(n,e,t){let i=[],s=new Uint32Array(2);s[0]=0,s[1]=33587200;for(let r=0,a=n.length;r")}return i.join("")}function cG(n,e,t,i){let o=[],s=t.getInitialState();for(let r=0,a=n.length;r"),s=c.endState}return o.join("")}_();v();b();_();v();b();ke();var N8=2e4,Hu,yS,RA,SS,PA;function A8(n){Hu=document.createElement("div"),Hu.className="monaco-aria-container";let e=()=>{let i=document.createElement("div");return i.className="monaco-alert",i.setAttribute("role","alert"),i.setAttribute("aria-atomic","true"),Hu.appendChild(i),i};yS=e(),RA=e();let t=()=>{let i=document.createElement("div");return i.className="monaco-status",i.setAttribute("aria-live","polite"),i.setAttribute("aria-atomic","true"),Hu.appendChild(i),i};SS=t(),PA=t(),n.appendChild(Hu)}function ob(n){Hu&&(yS.textContent!==n?(Co(RA),xS(yS,n)):(Co(yS),xS(RA,n)))}function Uu(n){Hu&&(SS.textContent!==n?(Co(PA),xS(SS,n)):(Co(SS),xS(PA,n)))}function xS(n,e){Co(n),e.length>N8&&(e=e.substr(0,N8)),n.textContent=e,n.style.visibility="hidden",n.style.visibility="visible"}le();Or();_();v();b();_();v();b();_();v();b();qe();var LS=De("markerDecorationsService");Ud();var dG=function(n,e,t,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},hG=function(n,e){return function(t,i){e(t,i,n)}},sb=class{constructor(e,t){}dispose(){}};sb.ID="editor.contrib.markerDecorations";sb=dG([hG(1,LS)],sb);vy(sb.ID,sb,0);ke();xt();ye();le();er();_();v();b();ps();wt();ye();le();hs();Lt();OA();_();v();b();var Cm=class n{constructor(e,t){this.key=e,this.migrate=t}apply(e){let t=n._read(e,this.key),i=s=>n._read(e,s),o=(s,r)=>n._write(e,s,r);this.migrate(t,i,o)}static _read(e,t){if(typeof e>"u")return;let i=t.indexOf(".");if(i>=0){let o=t.substring(0,i);return this._read(e[o],t.substring(i+1))}return e[t]}static _write(e,t,i){let o=t.indexOf(".");if(o>=0){let s=t.substring(0,o);e[s]=e[s]||{},this._write(e[s],t.substring(o+1),i);return}e[t]=i}};Cm.items=[];function Oa(n,e){Cm.items.push(new Cm(n,e))}function ys(n,e){Oa(n,(t,i,o)=>{if(typeof t<"u"){for(let[s,r]of e)if(t===s){o(n,r);return}}})}function R8(n){Cm.items.forEach(e=>e.apply(n))}ys("wordWrap",[[!0,"on"],[!1,"off"]]);ys("lineNumbers",[[!0,"on"],[!1,"off"]]);ys("cursorBlinking",[["visible","solid"]]);ys("renderWhitespace",[[!0,"boundary"],[!1,"none"]]);ys("renderLineHighlight",[[!0,"line"],[!1,"none"]]);ys("acceptSuggestionOnEnter",[[!0,"on"],[!1,"off"]]);ys("tabCompletion",[[!1,"off"],[!0,"onlySnippets"]]);ys("hover",[[!0,{enabled:!0}],[!1,{enabled:!1}]]);ys("parameterHints",[[!0,{enabled:!0}],[!1,{enabled:!1}]]);ys("autoIndent",[[!1,"advanced"],[!0,"full"]]);ys("matchBrackets",[[!0,"always"],[!1,"never"]]);ys("renderFinalNewline",[[!0,"on"],[!1,"off"]]);ys("cursorSmoothCaretAnimation",[[!0,"on"],[!1,"off"]]);ys("occurrencesHighlight",[[!0,"singleFile"],[!1,"off"]]);ys("wordBasedSuggestions",[[!0,"matchingDocuments"],[!1,"off"]]);Oa("autoClosingBrackets",(n,e,t)=>{n===!1&&(t("autoClosingBrackets","never"),typeof e("autoClosingQuotes")>"u"&&t("autoClosingQuotes","never"),typeof e("autoSurround")>"u"&&t("autoSurround","never"))});Oa("renderIndentGuides",(n,e,t)=>{typeof n<"u"&&(t("renderIndentGuides",void 0),typeof e("guides.indentation")>"u"&&t("guides.indentation",!!n))});Oa("highlightActiveIndentGuide",(n,e,t)=>{typeof n<"u"&&(t("highlightActiveIndentGuide",void 0),typeof e("guides.highlightActiveIndentation")>"u"&&t("guides.highlightActiveIndentation",!!n))});var uG={method:"showMethods",function:"showFunctions",constructor:"showConstructors",deprecated:"showDeprecated",field:"showFields",variable:"showVariables",class:"showClasses",struct:"showStructs",interface:"showInterfaces",module:"showModules",property:"showProperties",event:"showEvents",operator:"showOperators",unit:"showUnits",value:"showValues",constant:"showConstants",enum:"showEnums",enumMember:"showEnumMembers",keyword:"showKeywords",text:"showWords",color:"showColors",file:"showFiles",reference:"showReferences",folder:"showFolders",typeParameter:"showTypeParameters",snippet:"showSnippets"};Oa("suggest.filteredTypes",(n,e,t)=>{if(n&&typeof n=="object"){for(let i of Object.entries(uG))n[i[0]]===!1&&typeof e(`suggest.${i[1]}`)>"u"&&t(`suggest.${i[1]}`,!1);t("suggest.filteredTypes",void 0)}});Oa("quickSuggestions",(n,e,t)=>{if(typeof n=="boolean"){let i=n?"on":"off";t("quickSuggestions",{comments:i,strings:i,other:i})}});Oa("experimental.stickyScroll.enabled",(n,e,t)=>{typeof n=="boolean"&&(t("experimental.stickyScroll.enabled",void 0),typeof e("stickyScroll.enabled")>"u"&&t("stickyScroll.enabled",n))});Oa("experimental.stickyScroll.maxLineCount",(n,e,t)=>{typeof n=="number"&&(t("experimental.stickyScroll.maxLineCount",void 0),typeof e("stickyScroll.maxLineCount")>"u"&&t("stickyScroll.maxLineCount",n))});Oa("codeActionsOnSave",(n,e,t)=>{if(n&&typeof n=="object"){let i=!1,o={};for(let s of Object.entries(n))typeof s[1]=="boolean"?(i=!0,o[s[0]]=s[1]?"explicit":"never"):o[s[0]]=s[1];i&&t("codeActionsOnSave",o)}});Oa("codeActionWidget.includeNearbyQuickfixes",(n,e,t)=>{typeof n=="boolean"&&(t("codeActionWidget.includeNearbyQuickfixes",void 0),typeof e("codeActionWidget.includeNearbyQuickFixes")>"u"&&t("codeActionWidget.includeNearbyQuickFixes",n))});Oa("lightbulb.enabled",(n,e,t)=>{typeof n=="boolean"&&t("lightbulb.enabled",n?void 0:"off")});_();v();b();ye();var FA=class{constructor(){this._tabFocus=!1,this._onDidChangeTabFocus=new B,this.onDidChangeTabFocus=this._onDidChangeTabFocus.event}getTabFocusMode(){return this._tabFocus}setTabFocusMode(e){this._tabFocus=e,this._onDidChangeTabFocus.fire(this._tabFocus)}},wm=new FA;_();v();b();Oi();qe();var ao=De("accessibilityService"),P8=new xe("accessibilityModeEnabled",!1);ke();var fG=function(n,e,t,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},gG=function(n,e){return function(t,i){e(t,i,n)}},kS=class extends H{constructor(e,t,i,o,s){super(),this._accessibilityService=s,this._onDidChange=this._register(new B),this.onDidChange=this._onDidChange.event,this._onDidChangeFast=this._register(new B),this.onDidChangeFast=this._onDidChangeFast.event,this._isDominatedByLongLines=!1,this._viewLineCount=1,this._lineNumbersDigitCount=1,this._reservedHeight=0,this._glyphMarginDecorationLaneCount=1,this._computeOptionsMemory=new A_,this.isSimpleWidget=e,this.contextMenuId=t,this._containerObserver=this._register(new vm(o,i.dimension)),this._targetWindowId=ge(o).vscodeWindowId,this._rawOptions=O8(i),this._validatedOptions=Ku.validateOptions(this._rawOptions),this.options=this._computeOptions(),this.options.get(13)&&this._containerObserver.startObserving(),this._register(Rr.onDidChangeZoomLevel(()=>this._recomputeOptions())),this._register(wm.onDidChangeTabFocus(()=>this._recomputeOptions())),this._register(this._containerObserver.onDidChange(()=>this._recomputeOptions())),this._register(C0.onDidChange(()=>this._recomputeOptions())),this._register(Kg.getInstance(ge(o)).onDidChange(()=>this._recomputeOptions())),this._register(this._accessibilityService.onDidChangeScreenReaderOptimized(()=>this._recomputeOptions()))}_recomputeOptions(){let e=this._computeOptions(),t=Ku.checkEquals(this.options,e);t!==null&&(this.options=e,this._onDidChangeFast.fire(t),this._onDidChange.fire(t))}_computeOptions(){let e=this._readEnvConfiguration(),t=mu.createFromValidatedSettings(this._validatedOptions,e.pixelRatio,this.isSimpleWidget),i=this._readFontInfo(t),o={memory:this._computeOptionsMemory,outerWidth:e.outerWidth,outerHeight:e.outerHeight-this._reservedHeight,fontInfo:i,extraEditorClassName:e.extraEditorClassName,isDominatedByLongLines:this._isDominatedByLongLines,viewLineCount:this._viewLineCount,lineNumbersDigitCount:this._lineNumbersDigitCount,emptySelectionClipboard:e.emptySelectionClipboard,pixelRatio:e.pixelRatio,tabFocusMode:wm.getTabFocusMode(),accessibilitySupport:e.accessibilitySupport,glyphMarginDecorationLaneCount:this._glyphMarginDecorationLaneCount};return Ku.computeOptions(this._validatedOptions,o)}_readEnvConfiguration(){return{extraEditorClassName:pG(),outerWidth:this._containerObserver.getWidth(),outerHeight:this._containerObserver.getHeight(),emptySelectionClipboard:La||wn,pixelRatio:Kg.getInstance(QT(this._targetWindowId,!0).window).value,accessibilitySupport:this._accessibilityService.isScreenReaderOptimized()?2:this._accessibilityService.getAccessibilitySupport()}}_readFontInfo(e){return C0.readFontInfo(QT(this._targetWindowId,!0).window,e)}getRawOptions(){return this._rawOptions}updateOptions(e){let t=O8(e);Ku.applyUpdate(this._rawOptions,t)&&(this._validatedOptions=Ku.validateOptions(this._rawOptions),this._recomputeOptions())}observeContainer(e){this._containerObserver.observe(e)}setIsDominatedByLongLines(e){this._isDominatedByLongLines!==e&&(this._isDominatedByLongLines=e,this._recomputeOptions())}setModelLineCount(e){let t=mG(e);this._lineNumbersDigitCount!==t&&(this._lineNumbersDigitCount=t,this._recomputeOptions())}setViewLineCount(e){this._viewLineCount!==e&&(this._viewLineCount=e,this._recomputeOptions())}setReservedHeight(e){this._reservedHeight!==e&&(this._reservedHeight=e,this._recomputeOptions())}setGlyphMarginDecorationLaneCount(e){this._glyphMarginDecorationLaneCount!==e&&(this._glyphMarginDecorationLaneCount=e,this._recomputeOptions())}};kS=fG([gG(4,ao)],kS);function mG(n){let e=0;for(;n;)n=Math.floor(n/10),e++;return e||1}function pG(){let n="";return!ms&&!yw&&(n+="no-user-select "),ms&&(n+="no-minimap-shadow ",n+="enable-user-select "),Be&&(n+="mac "),n}var BA=class{constructor(){this._values=[]}_read(e){return this._values[e]}get(e){return this._values[e]}_write(e,t){this._values[e]=t}},WA=class{constructor(){this._values=[]}_read(e){if(e>=this._values.length)throw new Error("Cannot read uninitialized value");return this._values[e]}get(e){return this._read(e)}_write(e,t){this._values[e]=t}},Ku=class n{static validateOptions(e){let t=new BA;for(let i of wd){let o=i.name==="_never_"?void 0:e[i.name];t._write(i.id,i.validate(o))}return t}static computeOptions(e,t){let i=new WA;for(let o of wd)i._write(o.id,o.compute(t,i,e._read(o.id)));return i}static _deepEquals(e,t){if(typeof e!="object"||typeof t!="object"||!e||!t)return e===t;if(Array.isArray(e)||Array.isArray(t))return Array.isArray(e)&&Array.isArray(t)?Ht(e,t):!1;if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let i in e)if(!n._deepEquals(e[i],t[i]))return!1;return!0}static checkEquals(e,t){let i=[],o=!1;for(let s of wd){let r=!n._deepEquals(e._read(s.id),t._read(s.id));i[s.id]=r,r&&(o=!0)}return o?new mg(i):null}static applyUpdate(e,t){let i=!1;for(let o of wd)if(t.hasOwnProperty(o.name)){let s=o.applyUpdate(e[o.name],t[o.name]);e[o.name]=s.newValue,i=i||s.didChange}return i}};function O8(n){let e=cl(n);return R8(e),e}Ud();Or();_();v();b();ke();_();v();b();var Ml;(function(n){let e={total:0,min:Number.MAX_VALUE,max:0},t={...e},i={...e},o={...e},s=0,r={keydown:0,input:0,render:0};function a(){S(),performance.mark("inputlatency/start"),performance.mark("keydown/start"),r.keydown=1,queueMicrotask(l)}n.onKeyDown=a;function l(){r.keydown===1&&(performance.mark("keydown/end"),r.keydown=2)}function c(){performance.mark("input/start"),r.input=1,C()}n.onBeforeInput=c;function d(){r.input===0&&c(),queueMicrotask(h)}n.onInput=d;function h(){r.input===1&&(performance.mark("input/end"),r.input=2)}function u(){S()}n.onKeyUp=u;function f(){S()}n.onSelectionChange=f;function g(){r.keydown===2&&r.input===2&&r.render===0&&(performance.mark("render/start"),r.render=1,queueMicrotask(m),C())}n.onRenderStart=g;function m(){r.render===1&&(performance.mark("render/end"),r.render=2)}function C(){setTimeout(S)}function S(){r.keydown===2&&r.input===2&&r.render===2&&(performance.mark("inputlatency/end"),performance.measure("keydown","keydown/start","keydown/end"),performance.measure("input","input/start","input/end"),performance.measure("render","render/start","render/end"),performance.measure("inputlatency","inputlatency/start","inputlatency/end"),w("keydown",e),w("input",t),w("render",i),w("inputlatency",o),s++,y())}function w(N,M){let W=performance.getEntriesByName(N)[0].duration;M.total+=W,M.min=Math.min(M.min,W),M.max=Math.max(M.max,W)}function y(){performance.clearMarks("keydown/start"),performance.clearMarks("keydown/end"),performance.clearMarks("input/start"),performance.clearMarks("input/end"),performance.clearMarks("render/start"),performance.clearMarks("render/end"),performance.clearMarks("inputlatency/start"),performance.clearMarks("inputlatency/end"),performance.clearMeasures("keydown"),performance.clearMeasures("input"),performance.clearMeasures("render"),performance.clearMeasures("inputlatency"),r.keydown=0,r.input=0,r.render=0}function x(){if(s===0)return;let N={keydown:k(e),input:k(t),render:k(i),total:k(o),sampleCount:s};return T(e),T(t),T(i),T(o),s=0,N}n.getAndClearMeasurements=x;function k(N){return{average:N.total/s,max:N.max,min:N.min}}function T(N){N.total=0,N.min=Number.MAX_VALUE,N.max=0}})(Ml||(Ml={}));xt();_();v();b();_();v();b();ke();_();v();b();ke();le();var Rl=class{constructor(){this._hooks=new ae,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let i=this._onStopCallback;this._onStopCallback=null,e&&i&&i(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,i,o,s){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=o,this._onStopCallback=s;let r=e;try{e.setPointerCapture(t),this._hooks.add(be(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{r=ge(e)}this._hooks.add($(r,se.POINTER_MOVE,a=>{if(a.buttons!==i){this.stopMonitoring(!0);return}a.preventDefault(),this._pointerMoveCallback(a)})),this._hooks.add($(r,se.POINTER_UP,a=>this.stopMonitoring(!0)))}};Qs();Gt();le();is();var lh=class{constructor(e,t){this.x=e,this.y=t,this._pageCoordinatesBrand=void 0}toClientCoordinates(e){return new db(this.x-e.scrollX,this.y-e.scrollY)}},db=class{constructor(e,t){this.clientX=e,this.clientY=t,this._clientCoordinatesBrand=void 0}toPageCoordinates(e){return new lh(this.clientX+e.scrollX,this.clientY+e.scrollY)}},JA=class{constructor(e,t,i,o){this.x=e,this.y=t,this.width=i,this.height=o,this._editorPagePositionBrand=void 0}},eM=class{constructor(e,t){this.x=e,this.y=t,this._positionRelativeToEditorBrand=void 0}};function VS(n){let e=Sn(n);return new JA(e.left,e.top,e.width,e.height)}function HS(n,e,t){let i=e.width/n.offsetWidth,o=e.height/n.offsetHeight,s=(t.x-e.x)/i,r=(t.y-e.y)/o;return new eM(s,r)}var Xr=class extends yn{constructor(e,t,i){super(ge(i),e),this._editorMouseEventBrand=void 0,this.isFromPointerCapture=t,this.pos=new lh(this.posx,this.posy),this.editorPos=VS(i),this.relativePos=HS(i,this.editorPos,this.pos)}},BS=class{constructor(e){this._editorViewDomNode=e}_create(e){return new Xr(e,!1,this._editorViewDomNode)}onContextMenu(e,t){return $(e,"contextmenu",i=>{t(this._create(i))})}onMouseUp(e,t){return $(e,"mouseup",i=>{t(this._create(i))})}onMouseDown(e,t){return $(e,se.MOUSE_DOWN,i=>{t(this._create(i))})}onPointerDown(e,t){return $(e,se.POINTER_DOWN,i=>{t(this._create(i),i.pointerId)})}onMouseLeave(e,t){return $(e,se.MOUSE_LEAVE,i=>{t(this._create(i))})}onMouseMove(e,t){return $(e,"mousemove",i=>t(this._create(i)))}},WS=class{constructor(e){this._editorViewDomNode=e}_create(e){return new Xr(e,!1,this._editorViewDomNode)}onPointerUp(e,t){return $(e,"pointerup",i=>{t(this._create(i))})}onPointerDown(e,t){return $(e,se.POINTER_DOWN,i=>{t(this._create(i),i.pointerId)})}onPointerLeave(e,t){return $(e,se.POINTER_LEAVE,i=>{t(this._create(i))})}onPointerMove(e,t){return $(e,"pointermove",i=>t(this._create(i)))}},zS=class extends H{constructor(e){super(),this._editorViewDomNode=e,this._globalPointerMoveMonitor=this._register(new Rl),this._keydownListener=null}startMonitoring(e,t,i,o,s){this._keydownListener=Ut(e.ownerDocument,"keydown",r=>{r.toKeyCodeChord().isModifierKey()||this._globalPointerMoveMonitor.stopMonitoring(!0,r.browserEvent)},!0),this._globalPointerMoveMonitor.startMonitoring(e,t,i,r=>{o(new Xr(r,!0,this._editorViewDomNode))},r=>{this._keydownListener.dispose(),s(r)})}stopMonitoring(){this._globalPointerMoveMonitor.stopMonitoring(!0)}},tM=class n{constructor(e){this._editor=e,this._instanceId=++n._idPool,this._counter=0,this._rules=new Map,this._garbageCollectionScheduler=new di(()=>this.garbageCollect(),1e3)}createClassNameRef(e){let t=this.getOrCreateRule(e);return t.increaseRefCount(),{className:t.className,dispose:()=>{t.decreaseRefCount(),this._garbageCollectionScheduler.schedule()}}}getOrCreateRule(e){let t=this.computeUniqueKey(e),i=this._rules.get(t);if(!i){let o=this._counter++;i=new iM(t,`dyn-rule-${this._instanceId}-${o}`,gu(this._editor.getContainerDomNode())?this._editor.getContainerDomNode():void 0,e),this._rules.set(t,i)}return i}computeUniqueKey(e){return JSON.stringify(e)}garbageCollect(){for(let e of this._rules.values())e.hasReferences()||(this._rules.delete(e.key),e.dispose())}};tM._idPool=0;var iM=class{constructor(e,t,i,o){this.key=e,this.className=t,this.properties=o,this._referenceCount=0,this._styleElementDisposables=new ae,this._styleElement=Xi(i,void 0,this._styleElementDisposables),this._styleElement.textContent=this.getCssText(this.className,this.properties)}getCssText(e,t){let i=`.${e} {`;for(let o in t){let s=t[o],r;typeof s=="object"?r=he(s.id):r=s;let a=bG(o);i+=` + ${a}: ${r};`}return i+=` +}`,i}dispose(){this._styleElementDisposables.dispose(),this._styleElement=void 0}increaseRefCount(){this._referenceCount++}decreaseRefCount(){this._referenceCount--}hasReferences(){return this._referenceCount>0}};function bG(n){return n.replace(/(^[A-Z])/,([e])=>e.toLowerCase()).replace(/([A-Z])/g,([e])=>`-${e.toLowerCase()}`)}_();v();b();_();v();b();le();var Qr=class extends H{constructor(){super(),this._shouldRender=!0}shouldRender(){return this._shouldRender}forceShouldRender(){this._shouldRender=!0}setShouldRender(){this._shouldRender=!0}onDidRender(){this._shouldRender=!1}onCompositionStart(e){return!1}onCompositionEnd(e){return!1}onConfigurationChanged(e){return!1}onCursorStateChanged(e){return!1}onDecorationsChanged(e){return!1}onFlushed(e){return!1}onFocusChanged(e){return!1}onLanguageConfigurationChanged(e){return!1}onLineMappingChanged(e){return!1}onLinesChanged(e){return!1}onLinesDeleted(e){return!1}onLinesInserted(e){return!1}onRevealRangeRequest(e){return!1}onScrollChanged(e){return!1}onThemeChanged(e){return!1}onTokensChanged(e){return!1}onTokensColorsChanged(e){return!1}onZonesChanged(e){return!1}handleEvents(e){let t=!1;for(let i=0,o=e.length;i=a.left?o.width=Math.max(o.width,a.left+a.width-o.left):(t[i++]=o,o=a)}return t[i++]=o,t}static _createHorizontalRangesFromClientRects(e,t,i){if(!e||e.length===0)return null;let o=[];for(let s=0,r=e.length;sl)return null;if(t=Math.min(l,Math.max(0,t)),o=Math.min(l,Math.max(0,o)),t===o&&i===s&&i===0&&!e.children[t].firstChild){let u=e.children[t].getClientRects();return r.markDidDomLayout(),this._createHorizontalRangesFromClientRects(u,r.clientRectDeltaLeft,r.clientRectScale)}t!==o&&o>0&&s===0&&(o--,s=1073741824);let c=e.children[t].firstChild,d=e.children[o].firstChild;if((!c||!d)&&(!c&&i===0&&t>0&&(c=e.children[t-1].firstChild,i=1073741824),!d&&s===0&&o>0&&(d=e.children[o-1].firstChild,s=1073741824)),!c||!d)return null;i=Math.min(c.textContent.length,Math.max(0,i)),s=Math.min(d.textContent.length,Math.max(0,s));let h=this._readClientRects(c,i,d,s,r.endNode);return r.markDidDomLayout(),this._createHorizontalRangesFromClientRects(h,r.clientRectDeltaLeft,r.clientRectScale)}};ch();var vG=function(){return md?!0:!(mi||wn||ms)}(),Fm=!0,ub=class{constructor(e,t){this.themeType=t;let i=e.options,o=i.get(50);i.get(38)==="off"?this.renderWhitespace=i.get(99):this.renderWhitespace="none",this.renderControlCharacters=i.get(94),this.spaceWidth=o.spaceWidth,this.middotWidth=o.middotWidth,this.wsmiddotWidth=o.wsmiddotWidth,this.useMonospaceOptimizations=o.isMonospace&&!i.get(33),this.canUseHalfwidthRightwardsArrow=o.canUseHalfwidthRightwardsArrow,this.lineHeight=i.get(67),this.stopRenderingLineAfter=i.get(117),this.fontLigatures=i.get(51)}equals(e){return this.themeType===e.themeType&&this.renderWhitespace===e.renderWhitespace&&this.renderControlCharacters===e.renderControlCharacters&&this.spaceWidth===e.spaceWidth&&this.middotWidth===e.middotWidth&&this.wsmiddotWidth===e.wsmiddotWidth&&this.useMonospaceOptimizations===e.useMonospaceOptimizations&&this.canUseHalfwidthRightwardsArrow===e.canUseHalfwidthRightwardsArrow&&this.lineHeight===e.lineHeight&&this.stopRenderingLineAfter===e.stopRenderingLineAfter&&this.fontLigatures===e.fontLigatures}},Jr=class n{constructor(e){this._options=e,this._isMaybeInvalid=!0,this._renderedViewLine=null}getDomNode(){return this._renderedViewLine&&this._renderedViewLine.domNode?this._renderedViewLine.domNode.domNode:null}setDomNode(e){if(this._renderedViewLine)this._renderedViewLine.domNode=$e(e);else throw new Error("I have no rendered view line to set the dom node to...")}onContentChanged(){this._isMaybeInvalid=!0}onTokensChanged(){this._isMaybeInvalid=!0}onDecorationsChanged(){this._isMaybeInvalid=!0}onOptionsChanged(e){this._isMaybeInvalid=!0,this._options=e}onSelectionChanged(){return Ol(this._options.themeType)||this._options.renderWhitespace==="selection"?(this._isMaybeInvalid=!0,!0):!1}renderLine(e,t,i,o,s){if(this._isMaybeInvalid===!1)return!1;this._isMaybeInvalid=!1;let r=o.getViewLineRenderingData(e),a=this._options,l=$r.filter(r.inlineDecorations,e,r.minColumn,r.maxColumn),c=null;if(Ol(a.themeType)||this._options.renderWhitespace==="selection"){let f=o.selections;for(let g of f){if(g.endLineNumbere)continue;let m=g.startLineNumber===e?g.startColumn:r.minColumn,C=g.endLineNumber===e?g.endColumn:r.maxColumn;m');let h=eb(d,s);s.appendString("");let u=null;return Fm&&vG&&r.isBasicASCII&&a.useMonospaceOptimizations&&h.containsForeignElements===0&&(u=new Om(this._renderedViewLine?this._renderedViewLine.domNode:null,d,h.characterMapping)),u||(u=S6(this._renderedViewLine?this._renderedViewLine.domNode:null,d,h.characterMapping,h.containsRTL,h.containsForeignElements)),this._renderedViewLine=u,!0}layoutLine(e,t,i){this._renderedViewLine&&this._renderedViewLine.domNode&&(this._renderedViewLine.domNode.setTop(t),this._renderedViewLine.domNode.setHeight(i))}getWidth(e){return this._renderedViewLine?this._renderedViewLine.getWidth(e):0}getWidthIsFast(){return this._renderedViewLine?this._renderedViewLine.getWidthIsFast():!0}needsMonospaceFontCheck(){return this._renderedViewLine?this._renderedViewLine instanceof Om:!1}monospaceAssumptionsAreValid(){return this._renderedViewLine&&this._renderedViewLine instanceof Om?this._renderedViewLine.monospaceAssumptionsAreValid():Fm}onMonospaceAssumptionsInvalidated(){this._renderedViewLine&&this._renderedViewLine instanceof Om&&(this._renderedViewLine=this._renderedViewLine.toSlowRenderedLine())}getVisibleRangesForRange(e,t,i,o){if(!this._renderedViewLine)return null;t=Math.min(this._renderedViewLine.input.lineContent.length+1,Math.max(1,t)),i=Math.min(this._renderedViewLine.input.lineContent.length+1,Math.max(1,i));let s=this._renderedViewLine.input.stopRenderingLineAfter;if(s!==-1&&t>s+1&&i>s+1)return new hb(!0,[new Ua(this.getWidth(o),0)]);s!==-1&&t>s+1&&(t=s+1),s!==-1&&i>s+1&&(i=s+1);let r=this._renderedViewLine.getVisibleRangesForRange(e,t,i,o);return r&&r.length>0?new hb(!1,r):null}getColumnOfNodeOffset(e,t){return this._renderedViewLine?this._renderedViewLine.getColumnOfNodeOffset(e,t):1}};Jr.CLASS_NAME="view-line";var Om=class{constructor(e,t,i){this._cachedWidth=-1,this.domNode=e,this.input=t;let o=Math.floor(t.lineContent.length/300);if(o>0){this._keyColumnPixelOffsetCache=new Float32Array(o);for(let s=0;s=2&&(console.warn("monospace assumptions have been violated, therefore disabling monospace optimizations!"),Fm=!1)}return Fm}toSlowRenderedLine(){return S6(this.domNode,this.input,this._characterMapping,!1,0)}getVisibleRangesForRange(e,t,i,o){let s=this._getColumnPixelOffset(e,t,o),r=this._getColumnPixelOffset(e,i,o);return[new Ua(s,r-s)]}_getColumnPixelOffset(e,t,i){if(t<=300){let c=this._characterMapping.getHorizontalOffset(t);return this._charWidth*c}let o=Math.floor((t-1)/300)-1,s=(o+1)*300+1,r=-1;if(this._keyColumnPixelOffsetCache&&(r=this._keyColumnPixelOffsetCache[o],r===-1&&(r=this._actualReadPixelOffset(e,s,i),this._keyColumnPixelOffsetCache[o]=r)),r===-1){let c=this._characterMapping.getHorizontalOffset(t);return this._charWidth*c}let a=this._characterMapping.getHorizontalOffset(s),l=this._characterMapping.getHorizontalOffset(t);return r+this._charWidth*(l-a)}_getReadingTarget(e){return e.domNode.firstChild}_actualReadPixelOffset(e,t,i){if(!this.domNode)return-1;let o=this._characterMapping.getDomPosition(t),s=Xu.readHorizontalRanges(this._getReadingTarget(this.domNode),o.partIndex,o.charIndex,o.partIndex,o.charIndex,i);return!s||s.length===0?-1:s[0].left}getColumnOfNodeOffset(e,t){return x6(this._characterMapping,e,t)}},qS=class{constructor(e,t,i,o,s){if(this.domNode=e,this.input=t,this._characterMapping=i,this._isWhitespaceOnly=/^\s*$/.test(t.lineContent),this._containsForeignElements=s,this._cachedWidth=-1,this._pixelOffsetCache=null,!o||this._characterMapping.length===0){this._pixelOffsetCache=new Float32Array(Math.max(2,this._characterMapping.length+1));for(let r=0,a=this._characterMapping.length;r<=a;r++)this._pixelOffsetCache[r]=-1}}_getReadingTarget(e){return e.domNode.firstChild}getWidth(e){return this.domNode?(this._cachedWidth===-1&&(this._cachedWidth=this._getReadingTarget(this.domNode).offsetWidth,e?.markDidDomLayout()),this._cachedWidth):0}getWidthIsFast(){return this._cachedWidth!==-1}getVisibleRangesForRange(e,t,i,o){if(!this.domNode)return null;if(this._pixelOffsetCache!==null){let s=this._readPixelOffset(this.domNode,e,t,o);if(s===-1)return null;let r=this._readPixelOffset(this.domNode,e,i,o);return r===-1?null:[new Ua(s,r-s)]}return this._readVisibleRangesForRange(this.domNode,e,t,i,o)}_readVisibleRangesForRange(e,t,i,o,s){if(i===o){let r=this._readPixelOffset(e,t,i,s);return r===-1?null:[new Ua(r,0)]}else return this._readRawVisibleRangesForRange(e,i,o,s)}_readPixelOffset(e,t,i,o){if(this._characterMapping.length===0){if(this._containsForeignElements===0||this._containsForeignElements===2)return 0;if(this._containsForeignElements===1)return this.getWidth(o);let s=this._getReadingTarget(e);return s.firstChild?(o.markDidDomLayout(),s.firstChild.offsetWidth):0}if(this._pixelOffsetCache!==null){let s=this._pixelOffsetCache[i];if(s!==-1)return s;let r=this._actualReadPixelOffset(e,t,i,o);return this._pixelOffsetCache[i]=r,r}return this._actualReadPixelOffset(e,t,i,o)}_actualReadPixelOffset(e,t,i,o){if(this._characterMapping.length===0){let l=Xu.readHorizontalRanges(this._getReadingTarget(e),0,0,0,0,o);return!l||l.length===0?-1:l[0].left}if(i===this._characterMapping.length&&this._isWhitespaceOnly&&this._containsForeignElements===0)return this.getWidth(o);let s=this._characterMapping.getDomPosition(i),r=Xu.readHorizontalRanges(this._getReadingTarget(e),s.partIndex,s.charIndex,s.partIndex,s.charIndex,o);if(!r||r.length===0)return-1;let a=r[0].left;if(this.input.isBasicASCII){let l=this._characterMapping.getHorizontalOffset(i),c=Math.round(this.input.spaceWidth*l);if(Math.abs(c-a)<=1)return c}return a}_readRawVisibleRangesForRange(e,t,i,o){if(t===1&&i===this._characterMapping.length)return[new Ua(0,this.getWidth(o))];let s=this._characterMapping.getDomPosition(t),r=this._characterMapping.getDomPosition(i);return Xu.readHorizontalRanges(this._getReadingTarget(e),s.partIndex,s.charIndex,r.partIndex,r.charIndex,o)}getColumnOfNodeOffset(e,t){return x6(this._characterMapping,e,t)}},oM=class extends qS{_readVisibleRangesForRange(e,t,i,o,s){let r=super._readVisibleRangesForRange(e,t,i,o,s);if(!r||r.length===0||i===o||i===1&&o===this._characterMapping.length)return r;if(!this.input.containsRTL){let a=this._readPixelOffset(e,t,o,s);if(a!==-1){let l=r[r.length-1];l.left=4&&e[0]===3&&e[3]===8}static isStrictChildOfViewLines(e){return e.length>4&&e[0]===3&&e[3]===8}static isChildOfScrollableElement(e){return e.length>=2&&e[0]===3&&e[1]===6}static isChildOfMinimap(e){return e.length>=2&&e[0]===3&&e[1]===9}static isChildOfContentWidgets(e){return e.length>=4&&e[0]===3&&e[3]===1}static isChildOfOverflowGuard(e){return e.length>=1&&e[0]===3}static isChildOfOverflowingContentWidgets(e){return e.length>=1&&e[0]===2}static isChildOfOverlayWidgets(e){return e.length>=2&&e[0]===3&&e[1]===4}static isChildOfOverflowingOverlayWidgets(e){return e.length>=1&&e[0]===5}},Bm=class n{constructor(e,t,i){this.viewModel=e.viewModel;let o=e.configuration.options;this.layoutInfo=o.get(145),this.viewDomNode=t.viewDomNode,this.lineHeight=o.get(67),this.stickyTabStops=o.get(116),this.typicalHalfwidthCharacterWidth=o.get(50).typicalHalfwidthCharacterWidth,this.lastRenderData=i,this._context=e,this._viewHelper=t}getZoneAtCoord(e){return n.getZoneAtCoord(this._context,e)}static getZoneAtCoord(e,t){let i=e.viewLayout.getWhitespaceAtVerticalOffset(t);if(i){let o=i.verticalOffset+i.height/2,s=e.viewModel.getLineCount(),r=null,a,l=null;return i.afterLineNumber!==s&&(l=new U(i.afterLineNumber+1,1)),i.afterLineNumber>0&&(r=new U(i.afterLineNumber,e.viewModel.getLineMaxColumn(i.afterLineNumber))),l===null?a=r:r===null?a=l:t=e.layoutInfo.glyphMarginLeft,this.isInContentArea=!this.isInMarginArea,this.mouseColumn=Math.max(0,Wm._getMouseColumn(this.mouseContentHorizontalOffset,e.typicalHalfwidthCharacterWidth))}},aM=class extends rM{get target(){return this._useHitTestTarget?this.hitTestResult.value.hitTarget:this._eventTarget}get targetPath(){return this._targetPathCacheElement!==this.target&&(this._targetPathCacheElement=this.target,this._targetPathCacheValue=Mn.collect(this.target,this._ctx.viewDomNode)),this._targetPathCacheValue}constructor(e,t,i,o,s){super(e,t,i,o),this.hitTestResult=new qn(()=>Wm.doHitTest(this._ctx,this)),this._targetPathCacheElement=null,this._targetPathCacheValue=new Uint8Array(0),this._ctx=e,this._eventTarget=s;let r=!!this._eventTarget;this._useHitTestTarget=!r}toString(){return`pos(${this.pos.x},${this.pos.y}), editorPos(${this.editorPos.x},${this.editorPos.y}), relativePos(${this.relativePos.x},${this.relativePos.y}), mouseVerticalOffset: ${this.mouseVerticalOffset}, mouseContentHorizontalOffset: ${this.mouseContentHorizontalOffset} + target: ${this.target?this.target.outerHTML:null}`}get wouldBenefitFromHitTestTargetSwitch(){return!this._useHitTestTarget&&this.hitTestResult.value.hitTarget!==null&&this.target!==this.hitTestResult.value.hitTarget}switchToHitTestTarget(){this._useHitTestTarget=!0}_getMouseColumn(e=null){return e&&e.columnr.contentLeft+r.width)continue;let a=e.getVerticalOffsetForLineNumber(r.position.lineNumber);if(a<=s&&s<=a+r.height)return t.fulfillContentText(r.position,null,{mightBeForeignElement:!1,injectedText:null})}}return null}static _hitTestViewZone(e,t){let i=e.getZoneAtCoord(t.mouseVerticalOffset);if(i){let o=t.isInContentArea?8:5;return t.fulfillViewZone(o,i.position,i)}return null}static _hitTestTextArea(e,t){return lo.isTextArea(t.targetPath)?e.lastRenderData.lastTextareaPosition?t.fulfillContentText(e.lastRenderData.lastTextareaPosition,null,{mightBeForeignElement:!1,injectedText:null}):t.fulfillTextarea():null}static _hitTestMargin(e,t){if(t.isInMarginArea){let i=e.getFullLineRangeAtCoord(t.mouseVerticalOffset),o=i.range.getStartPosition(),s=Math.abs(t.relativePos.x),r={isAfterLines:i.isAfterLines,glyphMarginLeft:e.layoutInfo.glyphMarginLeft,glyphMarginWidth:e.layoutInfo.glyphMarginWidth,lineNumbersWidth:e.layoutInfo.lineNumbersWidth,offsetX:s};if(s-=e.layoutInfo.glyphMarginLeft,s<=e.layoutInfo.glyphMarginWidth){let a=e.viewModel.coordinatesConverter.convertViewPositionToModelPosition(i.range.getStartPosition()),l=e.viewModel.glyphLanes.getLanesAtLine(a.lineNumber);return r.glyphMarginLane=l[Math.floor(s/e.lineHeight)],t.fulfillMargin(2,o,i.range,r)}return s-=e.layoutInfo.glyphMarginWidth,s<=e.layoutInfo.lineNumbersWidth?t.fulfillMargin(3,o,i.range,r):(s-=e.layoutInfo.lineNumbersWidth,t.fulfillMargin(4,o,i.range,r))}return null}static _hitTestViewLines(e,t){if(!lo.isChildOfViewLines(t.targetPath))return null;if(e.isInTopPadding(t.mouseVerticalOffset))return t.fulfillContentEmpty(new U(1,1),L6);if(e.isAfterLines(t.mouseVerticalOffset)||e.isInBottomPadding(t.mouseVerticalOffset)){let o=e.viewModel.getLineCount(),s=e.viewModel.getLineMaxColumn(o);return t.fulfillContentEmpty(new U(o,s),L6)}if(lo.isStrictChildOfViewLines(t.targetPath)){let o=e.getLineNumberAtVerticalOffset(t.mouseVerticalOffset);if(e.viewModel.getLineLength(o)===0){let r=e.getLineWidth(o),a=sM(t.mouseContentHorizontalOffset-r);return t.fulfillContentEmpty(new U(o,1),a)}let s=e.getLineWidth(o);if(t.mouseContentHorizontalOffset>=s){let r=sM(t.mouseContentHorizontalOffset-s),a=new U(o,e.viewModel.getLineMaxColumn(o));return t.fulfillContentEmpty(a,r)}}let i=t.hitTestResult.value;return i.type===1?n.createMouseTargetFromHitTestPosition(e,t,i.spanNode,i.position,i.injectedText):t.wouldBenefitFromHitTestTargetSwitch?(t.switchToHitTestTarget(),this._createMouseTarget(e,t)):t.fulfillUnknown()}static _hitTestMinimap(e,t){if(lo.isChildOfMinimap(t.targetPath)){let i=e.getLineNumberAtVerticalOffset(t.mouseVerticalOffset),o=e.viewModel.getLineMaxColumn(i);return t.fulfillScrollbar(new U(i,o))}return null}static _hitTestScrollbarSlider(e,t){if(lo.isChildOfScrollableElement(t.targetPath)&&t.target&&t.target.nodeType===1){let i=t.target.className;if(i&&/\b(slider|scrollbar)\b/.test(i)){let o=e.getLineNumberAtVerticalOffset(t.mouseVerticalOffset),s=e.viewModel.getLineMaxColumn(o);return t.fulfillScrollbar(new U(o,s))}}return null}static _hitTestScrollbar(e,t){if(lo.isChildOfScrollableElement(t.targetPath)){let i=e.getLineNumberAtVerticalOffset(t.mouseVerticalOffset),o=e.viewModel.getLineMaxColumn(i);return t.fulfillScrollbar(new U(i,o))}return null}getMouseColumn(e){let t=this._context.configuration.options,i=t.get(145),o=this._context.viewLayout.getCurrentScrollLeft()+e.x-i.contentLeft;return n._getMouseColumn(o,t.get(50).typicalHalfwidthCharacterWidth)}static _getMouseColumn(e,t){return e<0?1:Math.round(e/t)+1}static createMouseTargetFromHitTestPosition(e,t,i,o,s){let r=o.lineNumber,a=o.column,l=e.getLineWidth(r);if(t.mouseContentHorizontalOffset>l){let S=sM(t.mouseContentHorizontalOffset-l);return t.fulfillContentEmpty(o,S)}let c=e.visibleRangeForPosition(r,a);if(!c)return t.fulfillUnknown(o);let d=c.left;if(Math.abs(t.mouseContentHorizontalOffset-d)<1)return t.fulfillContentText(o,null,{mightBeForeignElement:!!s,injectedText:s});let h=[];if(h.push({offset:c.left,column:a}),a>1){let S=e.visibleRangeForPosition(r,a-1);S&&h.push({offset:S.left,column:a-1})}let u=e.viewModel.getLineMaxColumn(r);if(aS.offset-w.offset);let f=t.pos.toClientCoordinates(ge(e.viewDomNode)),g=i.getBoundingClientRect(),m=g.left<=f.clientX&&f.clientX<=g.right,C=null;for(let S=1;Ss)){let a=Math.floor((o+s)/2),l=t.pos.y+(a-t.mouseVerticalOffset);l<=t.editorPos.y&&(l=t.editorPos.y+1),l>=t.editorPos.y+t.editorPos.height&&(l=t.editorPos.y+t.editorPos.height-1);let c=new lh(t.pos.x,l),d=this._actualDoHitTestWithCaretRangeFromPoint(e,c.toClientCoordinates(ge(e.viewDomNode)));if(d.type===1)return d}return this._actualDoHitTestWithCaretRangeFromPoint(e,t.pos.toClientCoordinates(ge(e.viewDomNode)))}static _actualDoHitTestWithCaretRangeFromPoint(e,t){let i=Ec(e.viewDomNode),o;if(i?typeof i.caretRangeFromPoint>"u"?o=yG(i,t.clientX,t.clientY):o=i.caretRangeFromPoint(t.clientX,t.clientY):o=e.viewDomNode.ownerDocument.caretRangeFromPoint(t.clientX,t.clientY),!o||!o.startContainer)return new Fl;let s=o.startContainer;if(s.nodeType===s.TEXT_NODE){let r=s.parentNode,a=r?r.parentNode:null,l=a?a.parentNode:null;return(l&&l.nodeType===l.ELEMENT_NODE?l.className:null)===Jr.CLASS_NAME?ef.createFromDOMInfo(e,r,o.startOffset):new Fl(s.parentNode)}else if(s.nodeType===s.ELEMENT_NODE){let r=s.parentNode,a=r?r.parentNode:null;return(a&&a.nodeType===a.ELEMENT_NODE?a.className:null)===Jr.CLASS_NAME?ef.createFromDOMInfo(e,s,s.textContent.length):new Fl(s)}return new Fl}static _doHitTestWithCaretPositionFromPoint(e,t){let i=e.viewDomNode.ownerDocument.caretPositionFromPoint(t.clientX,t.clientY);if(i.offsetNode.nodeType===i.offsetNode.TEXT_NODE){let o=i.offsetNode.parentNode,s=o?o.parentNode:null,r=s?s.parentNode:null;return(r&&r.nodeType===r.ELEMENT_NODE?r.className:null)===Jr.CLASS_NAME?ef.createFromDOMInfo(e,i.offsetNode.parentNode,i.offset):new Fl(i.offsetNode.parentNode)}if(i.offsetNode.nodeType===i.offsetNode.ELEMENT_NODE){let o=i.offsetNode.parentNode,s=o&&o.nodeType===o.ELEMENT_NODE?o.className:null,r=o?o.parentNode:null,a=r&&r.nodeType===r.ELEMENT_NODE?r.className:null;if(s===Jr.CLASS_NAME){let l=i.offsetNode.childNodes[Math.min(i.offset,i.offsetNode.childNodes.length-1)];if(l)return ef.createFromDOMInfo(e,l,0)}else if(a===Jr.CLASS_NAME)return ef.createFromDOMInfo(e,i.offsetNode,0)}return new Fl(i.offsetNode)}static _snapToSoftTabBoundary(e,t){let i=t.getLineContent(e.lineNumber),{tabSize:o}=t.model.getOptions(),s=Ju.atomicPosition(i,e.column-1,o,2);return s!==-1?new U(e.lineNumber,s+1):e}static doHitTest(e,t){let i=new Fl;if(typeof e.viewDomNode.ownerDocument.caretRangeFromPoint=="function"?i=this._doHitTestWithCaretRangeFromPoint(e,t):e.viewDomNode.ownerDocument.caretPositionFromPoint&&(i=this._doHitTestWithCaretPositionFromPoint(e,t.pos.toClientCoordinates(ge(e.viewDomNode)))),i.type===1){let o=e.viewModel.getInjectedTextAt(i.position),s=e.viewModel.normalizePosition(i.position,2);(o||!s.equals(i.position))&&(i=new jS(s,i.spanNode,o))}return i}};function yG(n,e,t){let i=document.createRange(),o=n.elementFromPoint(e,t);if(o!==null){for(;o&&o.firstChild&&o.firstChild.nodeType!==o.firstChild.TEXT_NODE&&o.lastChild&&o.lastChild.firstChild;)o=o.lastChild;let s=o.getBoundingClientRect(),r=ge(o),a=r.getComputedStyle(o,null).getPropertyValue("font-style"),l=r.getComputedStyle(o,null).getPropertyValue("font-variant"),c=r.getComputedStyle(o,null).getPropertyValue("font-weight"),d=r.getComputedStyle(o,null).getPropertyValue("font-size"),h=r.getComputedStyle(o,null).getPropertyValue("line-height"),u=r.getComputedStyle(o,null).getPropertyValue("font-family"),f=`${a} ${l} ${c} ${d}/${h} ${u}`,g=o.innerText,m=s.left,C=0,S;if(e>s.left+s.width)C=g.length;else{let w=ZS.getInstance();for(let y=0;y=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},It;(function(n){n.Tap="-monaco-gesturetap",n.Change="-monaco-gesturechange",n.Start="-monaco-gesturestart",n.End="-monaco-gesturesend",n.Contextmenu="-monaco-gesturecontextmenu"})(It||(It={}));var ui=class n extends H{constructor(){super(),this.dispatched=!1,this.targets=new Ii,this.ignoreTargets=new Ii,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(ie.runAndSubscribe(fu,({window:e,disposables:t})=>{t.add($(e.document,"touchstart",i=>this.onTouchStart(i),{passive:!1})),t.add($(e.document,"touchend",i=>this.onTouchEnd(e,i))),t.add($(e.document,"touchmove",i=>this.onTouchMove(i),{passive:!1}))},{window:gt,disposables:this._store}))}static addTarget(e){if(!n.isTouchDevice())return H.None;n.INSTANCE||(n.INSTANCE=Ld(new n));let t=n.INSTANCE.targets.push(e);return be(t)}static ignoreTarget(e){if(!n.isTouchDevice())return H.None;n.INSTANCE||(n.INSTANCE=Ld(new n));let t=n.INSTANCE.ignoreTargets.push(e);return be(t)}static isTouchDevice(){return"ontouchstart"in gt||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(e){let t=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let i=0,o=e.targetTouches.length;i=n.HOLD_DELAY&&Math.abs(l.initialPageX-As(l.rollingPageX))<30&&Math.abs(l.initialPageY-As(l.rollingPageY))<30){let d=this.newGestureEvent(It.Contextmenu,l.initialTarget);d.pageX=As(l.rollingPageX),d.pageY=As(l.rollingPageY),this.dispatchEvent(d)}else if(o===1){let d=As(l.rollingPageX),h=As(l.rollingPageY),u=As(l.rollingTimestamps)-l.rollingTimestamps[0],f=d-l.rollingPageX[0],g=h-l.rollingPageY[0],m=[...this.targets].filter(C=>l.initialTarget instanceof Node&&C.contains(l.initialTarget));this.inertia(e,m,i,Math.abs(f)/u,f>0?1:-1,d,Math.abs(g)/u,g>0?1:-1,h)}this.dispatchEvent(this.newGestureEvent(It.End,l.initialTarget)),delete this.activeTouches[a.identifier]}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}newGestureEvent(e,t){let i=document.createEvent("CustomEvent");return i.initEvent(e,!1,!0),i.initialTarget=t,i.tapCount=0,i}dispatchEvent(e){if(e.type===It.Tap){let t=new Date().getTime(),i=0;t-this._lastSetTapCountTime>n.CLEAR_TAP_COUNT_TIME?i=1:i=2,this._lastSetTapCountTime=t,e.tapCount=i}else(e.type===It.Change||e.type===It.Contextmenu)&&(this._lastSetTapCountTime=0);if(e.initialTarget instanceof Node){for(let i of this.ignoreTargets)if(i.contains(e.initialTarget))return;let t=[];for(let i of this.targets)if(i.contains(e.initialTarget)){let o=0,s=e.initialTarget;for(;s&&s!==i;)o++,s=s.parentElement;t.push([o,i])}t.sort((i,o)=>i[0]-o[0]);for(let[i,o]of t)o.dispatchEvent(e),this.dispatched=!0}}inertia(e,t,i,o,s,r,a,l,c){this.handle=rn(e,()=>{let d=Date.now(),h=d-i,u=0,f=0,g=!0;o+=n.SCROLL_FRICTION*h,a+=n.SCROLL_FRICTION*h,o>0&&(g=!1,u=s*o*h),a>0&&(g=!1,f=l*a*h);let m=this.newGestureEvent(It.Change);m.translationX=u,m.translationY=f,t.forEach(C=>C.dispatchEvent(m)),g||this.inertia(e,t,d,o,s,r+u,a,l,c+f)})}onTouchMove(e){let t=Date.now();for(let i=0,o=e.changedTouches.length;i3&&(r.rollingPageX.shift(),r.rollingPageY.shift(),r.rollingTimestamps.shift()),r.rollingPageX.push(s.pageX),r.rollingPageY.push(s.pageY),r.rollingTimestamps.push(t)}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}};ui.SCROLL_FRICTION=-.005;ui.HOLD_DELAY=700;ui.CLEAR_TAP_COUNT_TIME=400;SG([Yt],ui,"isTouchDevice",null);vo();le();Lt();_();v();b();ke();Qs();le();Lt();ft();Kn();_();v();b();ps();ke();Qs();_();v();b();Qs();_();v();b();ke();_();v();b();_();v();b();ke();oo();Qs();le();var co=class extends H{onclick(e,t){this._register($(e,se.CLICK,i=>t(new yn(ge(e),i))))}onmousedown(e,t){this._register($(e,se.MOUSE_DOWN,i=>t(new yn(ge(e),i))))}onmouseover(e,t){this._register($(e,se.MOUSE_OVER,i=>t(new yn(ge(e),i))))}onmouseleave(e,t){this._register($(e,se.MOUSE_LEAVE,i=>t(new yn(ge(e),i))))}onkeydown(e,t){this._register($(e,se.KEY_DOWN,i=>t(new bt(i))))}onkeyup(e,t){this._register($(e,se.KEY_UP,i=>t(new bt(i))))}oninput(e,t){this._register($(e,se.INPUT,t))}onblur(e,t){this._register($(e,se.BLUR,t))}onfocus(e,t){this._register($(e,se.FOCUS,t))}ignoreGesture(e){return ui.ignoreTarget(e)}};Gt();Ln();ke();var dh=11,YS=class extends co{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=e.bgWidth+"px",this.bgDomNode.style.height=e.bgHeight+"px",typeof e.top<"u"&&(this.bgDomNode.style.top="0px"),typeof e.left<"u"&&(this.bgDomNode.style.left="0px"),typeof e.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof e.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=e.className,this.domNode.classList.add(...Xe.asClassNameArray(e.icon)),this.domNode.style.position="absolute",this.domNode.style.width=dh+"px",this.domNode.style.height=dh+"px",typeof e.top<"u"&&(this.domNode.style.top=e.top+"px"),typeof e.left<"u"&&(this.domNode.style.left=e.left+"px"),typeof e.bottom<"u"&&(this.domNode.style.bottom=e.bottom+"px"),typeof e.right<"u"&&(this.domNode.style.right=e.right+"px"),this._pointerMoveMonitor=this._register(new Rl),this._register(Ut(this.bgDomNode,se.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(Ut(this.domNode,se.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new Bd),this._pointerdownScheduleRepeatTimer=this._register(new Xo)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,ge(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,i=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}};_();v();b();Gt();le();var XS=class extends H{constructor(e,t,i){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=i,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new Xo)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{var e;(e=this._domNode)===null||e===void 0||e.setClassName(this._visibleClassName)},0))}_hide(e){var t;this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,(t=this._domNode)===null||t===void 0||t.setClassName(this._invisibleClassName+(e?" fade":"")))}};Lt();var xG=140,zm=class extends co{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new XS(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new Rl),this._shouldRender=!0,this.domNode=$e(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register($(this.domNode.domNode,se.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new YS(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,i,o){this.slider=$e(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof i=="number"&&this.slider.setWidth(i),typeof o=="number"&&this.slider.setHeight(o),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register($(this.slider.domNode,se.POINTER_DOWN,s=>{s.button===0&&(s.preventDefault(),this._sliderPointerDown(s))})),this.onclick(this.slider.domNode,s=>{s.leftButton&&s.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,i=t+this._scrollbarState.getSliderPosition(),o=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),s=this._sliderPointerPosition(e);i<=s&&s<=o?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,i;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,i=e.offsetY;else{let s=Sn(this.domNode.domNode);t=e.pageX-s.left,i=e.pageY-s.top}let o=this._pointerDownRelativePosition(t,i);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(o):this._scrollbarState.getDesiredScrollPositionFromOffset(o)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),i=this._sliderOrthogonalPointerPosition(e),o=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,s=>{let r=this._sliderOrthogonalPointerPosition(s),a=Math.abs(r-i);if(Li&&a>xG){this._setDesiredScrollPositionNow(o.getScrollPosition());return}let c=this._sliderPointerPosition(s)-t;this._setDesiredScrollPositionNow(o.getDesiredScrollPositionFromDelta(c))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}};_();v();b();var hh=class n{constructor(e,t,i,o,s,r){this._scrollbarSize=Math.round(t),this._oppositeScrollbarSize=Math.round(i),this._arrowSize=Math.round(e),this._visibleSize=o,this._scrollSize=s,this._scrollPosition=r,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new n(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(e){let t=Math.round(e);return this._visibleSize!==t?(this._visibleSize=t,this._refreshComputedValues(),!0):!1}setScrollSize(e){let t=Math.round(e);return this._scrollSize!==t?(this._scrollSize=t,this._refreshComputedValues(),!0):!1}setScrollPosition(e){let t=Math.round(e);return this._scrollPosition!==t?(this._scrollPosition=t,this._refreshComputedValues(),!0):!1}setScrollbarSize(e){this._scrollbarSize=Math.round(e)}setOppositeScrollbarSize(e){this._oppositeScrollbarSize=Math.round(e)}static _computeValues(e,t,i,o,s){let r=Math.max(0,i-e),a=Math.max(0,r-2*t),l=o>0&&o>i;if(!l)return{computedAvailableSize:Math.round(r),computedIsNeeded:l,computedSliderSize:Math.round(a),computedSliderRatio:0,computedSliderPosition:0};let c=Math.round(Math.max(20,Math.floor(i*a/o))),d=(a-c)/(o-i),h=s*d;return{computedAvailableSize:Math.round(r),computedIsNeeded:l,computedSliderSize:Math.round(c),computedSliderRatio:d,computedSliderPosition:Math.round(h)}}_refreshComputedValues(){let e=n._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=e.computedAvailableSize,this._computedIsNeeded=e.computedIsNeeded,this._computedSliderSize=e.computedSliderSize,this._computedSliderRatio=e.computedSliderRatio,this._computedSliderPosition=e.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize-this._computedSliderSize/2;return Math.round(t/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize,i=this._scrollPosition;return tthis._host.onMouseWheel(new Xs(null,1,0))}),this._createArrow({className:"scra",icon:ue.scrollbarButtonRight,top:a,left:void 0,bottom:void 0,right:r,bgWidth:t.arrowSize,bgHeight:t.horizontalScrollbarSize,onActivate:()=>this._host.onMouseWheel(new Xs(null,-1,0))})}this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}};_();v();b();Qs();$n();var JS=class extends zm{constructor(e,t,i){let o=e.getScrollDimensions(),s=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:i,scrollbarState:new hh(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,o.height,o.scrollHeight,s.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows){let r=(t.arrowSize-dh)/2,a=(t.verticalScrollbarSize-dh)/2;this._createArrow({className:"scra",icon:ue.scrollbarButtonUp,top:r,left:a,bottom:void 0,right:void 0,bgWidth:t.verticalScrollbarSize,bgHeight:t.arrowSize,onActivate:()=>this._host.onMouseWheel(new Xs(null,0,1))}),this._createArrow({className:"scra",icon:ue.scrollbarButtonDown,top:void 0,left:a,bottom:r,right:void 0,bgWidth:t.verticalScrollbarSize,bgHeight:t.arrowSize,onActivate:()=>this._host.onMouseWheel(new Xs(null,0,-1))})}this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}};Gt();ye();le();Lt();_();v();b();ye();le();var cM=class n{constructor(e,t,i,o,s,r,a){this._forceIntegerValues=e,this._scrollStateBrand=void 0,this._forceIntegerValues&&(t=t|0,i=i|0,o=o|0,s=s|0,r=r|0,a=a|0),this.rawScrollLeft=o,this.rawScrollTop=a,t<0&&(t=0),o+t>i&&(o=i-t),o<0&&(o=0),s<0&&(s=0),a+s>r&&(a=r-s),a<0&&(a=0),this.width=t,this.scrollWidth=i,this.scrollLeft=o,this.height=s,this.scrollHeight=r,this.scrollTop=a}equals(e){return this.rawScrollLeft===e.rawScrollLeft&&this.rawScrollTop===e.rawScrollTop&&this.width===e.width&&this.scrollWidth===e.scrollWidth&&this.scrollLeft===e.scrollLeft&&this.height===e.height&&this.scrollHeight===e.scrollHeight&&this.scrollTop===e.scrollTop}withScrollDimensions(e,t){return new n(this._forceIntegerValues,typeof e.width<"u"?e.width:this.width,typeof e.scrollWidth<"u"?e.scrollWidth:this.scrollWidth,t?this.rawScrollLeft:this.scrollLeft,typeof e.height<"u"?e.height:this.height,typeof e.scrollHeight<"u"?e.scrollHeight:this.scrollHeight,t?this.rawScrollTop:this.scrollTop)}withScrollPosition(e){return new n(this._forceIntegerValues,this.width,this.scrollWidth,typeof e.scrollLeft<"u"?e.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof e.scrollTop<"u"?e.scrollTop:this.rawScrollTop)}createScrollEvent(e,t){let i=this.width!==e.width,o=this.scrollWidth!==e.scrollWidth,s=this.scrollLeft!==e.scrollLeft,r=this.height!==e.height,a=this.scrollHeight!==e.scrollHeight,l=this.scrollTop!==e.scrollTop;return{inSmoothScrolling:t,oldWidth:e.width,oldScrollWidth:e.scrollWidth,oldScrollLeft:e.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:e.height,oldScrollHeight:e.scrollHeight,oldScrollTop:e.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:i,scrollWidthChanged:o,scrollLeftChanged:s,heightChanged:r,scrollHeightChanged:a,scrollTopChanged:l}}},gr=class extends H{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new B),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new cM(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){var i;let o=this._state.withScrollDimensions(e,t);this._setState(o,!!this._smoothScrolling),(i=this._smoothScrolling)===null||i===void 0||i.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let i=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===i.scrollLeft&&this._smoothScrolling.to.scrollTop===i.scrollTop)return;let o;t?o=new tx(this._smoothScrolling.from,i,this._smoothScrolling.startTime,this._smoothScrolling.duration):o=this._smoothScrolling.combine(this._state,i,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=o}else{let i=this._state.withScrollPosition(e);this._smoothScrolling=tx.start(this._state,i,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let i=this._state;i.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(i,t)))}},ex=class{constructor(e,t,i){this.scrollLeft=e,this.scrollTop=t,this.isDone=i}};function lM(n,e){let t=e-n;return function(i){return n+t*DG(i)}}function LG(n,e,t){return function(i){return i2.5*i){let s,r;return e0&&Math.abs(e.deltaY)>0)return 1;let i=.5;if((!this._isAlmostInt(e.deltaX)||!this._isAlmostInt(e.deltaY))&&(i+=.25),t){let o=Math.abs(e.deltaX),s=Math.abs(e.deltaY),r=Math.abs(t.deltaX),a=Math.abs(t.deltaY),l=Math.max(Math.min(o,r),1),c=Math.max(Math.min(s,a),1),d=Math.max(o,r),h=Math.max(s,a);d%l===0&&h%c===0&&(i-=.5)}return Math.min(Math.max(i,0),1)}_isAlmostInt(e){return Math.abs(Math.round(e)-e)<.01}};tf.INSTANCE=new tf;var fb=class extends co{get options(){return this._options}constructor(e,t,i){super(),this._onScroll=this._register(new B),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new B),e.style.overflow="hidden",this._options=IG(t),this._scrollable=i,this._register(this._scrollable.onScroll(s=>{this._onWillScroll.fire(s),this._onDidScroll(s),this._onScroll.fire(s)}));let o={onMouseWheel:s=>this._onMouseWheel(s),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new JS(this._scrollable,this._options,o)),this._horizontalScrollbar=this._register(new QS(this._scrollable,this._options,o)),this._domNode=document.createElement("div"),this._domNode.className="monaco-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.style.overflow="hidden",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=$e(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=$e(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=$e(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,s=>this._onMouseOver(s)),this.onmouseleave(this._listenOnDomNode,s=>this._onMouseLeave(s)),this._hideTimeout=this._register(new Xo),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}dispose(){this._mouseWheelToDispose=li(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,Be&&(this._options.className+=" mac"),this._domNode.className="monaco-scrollable-element "+this._options.className}updateOptions(e){typeof e.handleMouseWheel<"u"&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<"u"&&(this._options.horizontal=e.horizontal),typeof e.vertical<"u"&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<"u"&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new Xs(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=li(this._mouseWheelToDispose),e)){let i=o=>{this._onMouseWheel(new Xs(o))};this._mouseWheelToDispose.push($(this._listenOnDomNode,se.MOUSE_WHEEL,i,{passive:!1}))}}_onMouseWheel(e){var t;if(!((t=e.browserEvent)===null||t===void 0)&&t.defaultPrevented)return;let i=tf.INSTANCE;D6&&i.acceptStandardWheelEvent(e);let o=!1;if(e.deltaY||e.deltaX){let r=e.deltaY*this._options.mouseWheelScrollSensitivity,a=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&a+r===0?a=r=0:Math.abs(r)>=Math.abs(a)?a=0:r=0),this._options.flipAxes&&([r,a]=[a,r]);let l=!Be&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||l)&&!a&&(a=r,r=0),e.browserEvent&&e.browserEvent.altKey&&(a=a*this._options.fastScrollSensitivity,r=r*this._options.fastScrollSensitivity);let c=this._scrollable.getFutureScrollPosition(),d={};if(r){let h=k6*r,u=c.scrollTop-(h<0?Math.floor(h):Math.ceil(h));this._verticalScrollbar.writeScrollPosition(d,u)}if(a){let h=k6*a,u=c.scrollLeft-(h<0?Math.floor(h):Math.ceil(h));this._horizontalScrollbar.writeScrollPosition(d,u)}d=this._scrollable.validateScrollPosition(d),(c.scrollLeft!==d.scrollLeft||c.scrollTop!==d.scrollTop)&&(D6&&this._options.mouseWheelSmoothScroll&&i.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(d):this._scrollable.setScrollPositionNow(d),o=!0)}let s=o;!s&&this._options.alwaysConsumeMouseWheel&&(s=!0),!s&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(s=!0),s&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,i=e.scrollLeft>0,o=i?" left":"",s=t?" top":"",r=i||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${o}`),this._topShadowDomNode.setClassName(`shadow${s}`),this._topLeftShadowDomNode.setClassName(`shadow${r}${s}${o}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),EG)}},ix=class extends fb{constructor(e,t){t=t||{},t.mouseWheelSmoothScroll=!1;let i=new gr({forceIntegerValues:!0,smoothScrollDuration:0,scheduleAtNextAnimationFrame:o=>rn(ge(e),o)});super(e,t,i),this._register(i)}setScrollPosition(e){this._scrollable.setScrollPositionNow(e)}},Bl=class extends fb{constructor(e,t,i){super(e,t,i)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}},uh=class extends fb{constructor(e,t){t=t||{},t.mouseWheelSmoothScroll=!1;let i=new gr({forceIntegerValues:!1,smoothScrollDuration:0,scheduleAtNextAnimationFrame:o=>rn(ge(e),o)});super(e,t,i),this._register(i),this._element=e,this._register(this.onScroll(o=>{o.scrollTopChanged&&(this._element.scrollTop=o.scrollTop),o.scrollLeftChanged&&(this._element.scrollLeft=o.scrollLeft)})),this.scanDomNode()}setScrollPosition(e){this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}scanDomNode(){this.setScrollDimensions({width:this._element.clientWidth,scrollWidth:this._element.scrollWidth,height:this._element.clientHeight,scrollHeight:this._element.scrollHeight}),this.setScrollPosition({scrollLeft:this._element.scrollLeft,scrollTop:this._element.scrollTop})}};function IG(n){let e={lazyRender:typeof n.lazyRender<"u"?n.lazyRender:!1,className:typeof n.className<"u"?n.className:"",useShadows:typeof n.useShadows<"u"?n.useShadows:!0,handleMouseWheel:typeof n.handleMouseWheel<"u"?n.handleMouseWheel:!0,flipAxes:typeof n.flipAxes<"u"?n.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof n.consumeMouseWheelIfScrollbarIsNeeded<"u"?n.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof n.alwaysConsumeMouseWheel<"u"?n.alwaysConsumeMouseWheel:!1,scrollYToX:typeof n.scrollYToX<"u"?n.scrollYToX:!1,mouseWheelScrollSensitivity:typeof n.mouseWheelScrollSensitivity<"u"?n.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof n.fastScrollSensitivity<"u"?n.fastScrollSensitivity:5,scrollPredominantAxis:typeof n.scrollPredominantAxis<"u"?n.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof n.mouseWheelSmoothScroll<"u"?n.mouseWheelSmoothScroll:!0,arrowSize:typeof n.arrowSize<"u"?n.arrowSize:11,listenOnDomNode:typeof n.listenOnDomNode<"u"?n.listenOnDomNode:null,horizontal:typeof n.horizontal<"u"?n.horizontal:1,horizontalScrollbarSize:typeof n.horizontalScrollbarSize<"u"?n.horizontalScrollbarSize:10,horizontalSliderSize:typeof n.horizontalSliderSize<"u"?n.horizontalSliderSize:0,horizontalHasArrows:typeof n.horizontalHasArrows<"u"?n.horizontalHasArrows:!1,vertical:typeof n.vertical<"u"?n.vertical:1,verticalScrollbarSize:typeof n.verticalScrollbarSize<"u"?n.verticalScrollbarSize:10,verticalHasArrows:typeof n.verticalHasArrows<"u"?n.verticalHasArrows:!1,verticalSliderSize:typeof n.verticalSliderSize<"u"?n.verticalSliderSize:0,scrollByPage:typeof n.scrollByPage<"u"?n.scrollByPage:!1};return e.horizontalSliderSize=typeof n.horizontalSliderSize<"u"?n.horizontalSliderSize:e.horizontalScrollbarSize,e.verticalSliderSize=typeof n.verticalSliderSize<"u"?n.verticalSliderSize:e.verticalScrollbarSize,Be&&(e.className+=" mac"),e}var Vm=class extends Qr{constructor(e,t,i){super(),this._mouseLeaveMonitor=null,this._context=e,this.viewController=t,this.viewHelper=i,this.mouseTargetFactory=new Wm(this._context,i),this._mouseDownOperation=this._register(new hM(this._context,this.viewController,this.viewHelper,this.mouseTargetFactory,(r,a)=>this._createMouseTarget(r,a),r=>this._getMouseColumn(r))),this.lastMouseLeaveTime=-1,this._height=this._context.configuration.options.get(145).height;let o=new BS(this.viewHelper.viewDomNode);this._register(o.onContextMenu(this.viewHelper.viewDomNode,r=>this._onContextMenu(r,!0))),this._register(o.onMouseMove(this.viewHelper.viewDomNode,r=>{this._onMouseMove(r),this._mouseLeaveMonitor||(this._mouseLeaveMonitor=$(this.viewHelper.viewDomNode.ownerDocument,"mousemove",a=>{this.viewHelper.viewDomNode.contains(a.target)||this._onMouseLeave(new Xr(a,!1,this.viewHelper.viewDomNode))}))})),this._register(o.onMouseUp(this.viewHelper.viewDomNode,r=>this._onMouseUp(r))),this._register(o.onMouseLeave(this.viewHelper.viewDomNode,r=>this._onMouseLeave(r)));let s=0;this._register(o.onPointerDown(this.viewHelper.viewDomNode,(r,a)=>{s=a})),this._register($(this.viewHelper.viewDomNode,se.POINTER_UP,r=>{this._mouseDownOperation.onPointerUp()})),this._register(o.onMouseDown(this.viewHelper.viewDomNode,r=>this._onMouseDown(r,s))),this._setupMouseWheelZoomListener(),this._context.addEventHandler(this)}_setupMouseWheelZoomListener(){let e=tf.INSTANCE,t=0,i=Rr.getZoomLevel(),o=!1,s=0,r=l=>{if(this.viewController.emitMouseWheel(l),!this._context.configuration.options.get(76))return;let c=new Xs(l);if(e.acceptStandardWheelEvent(c),e.isPhysicalMouseWheel()){if(a(l)){let d=Rr.getZoomLevel(),h=c.deltaY>0?1:-1;Rr.setZoomLevel(d+h),c.preventDefault(),c.stopPropagation()}}else Date.now()-t>50&&(i=Rr.getZoomLevel(),o=a(l),s=0),t=Date.now(),s+=c.deltaY,o&&(Rr.setZoomLevel(i+s/5),c.preventDefault(),c.stopPropagation())};this._register($(this.viewHelper.viewDomNode,se.MOUSE_WHEEL,r,{capture:!0,passive:!1}));function a(l){return Be?(l.metaKey||l.ctrlKey)&&!l.shiftKey&&!l.altKey:l.ctrlKey&&!l.metaKey&&!l.shiftKey&&!l.altKey}}dispose(){this._context.removeEventHandler(this),this._mouseLeaveMonitor&&(this._mouseLeaveMonitor.dispose(),this._mouseLeaveMonitor=null),super.dispose()}onConfigurationChanged(e){if(e.hasChanged(145)){let t=this._context.configuration.options.get(145).height;this._height!==t&&(this._height=t,this._mouseDownOperation.onHeightChanged())}return!1}onCursorStateChanged(e){return this._mouseDownOperation.onCursorStateChanged(e),!1}onFocusChanged(e){return!1}getTargetAtClientPoint(e,t){let o=new db(e,t).toPageCoordinates(ge(this.viewHelper.viewDomNode)),s=VS(this.viewHelper.viewDomNode);if(o.ys.y+s.height||o.xs.x+s.width)return null;let r=HS(this.viewHelper.viewDomNode,s,o);return this.mouseTargetFactory.createMouseTarget(this.viewHelper.getLastRenderData(),s,o,r,null)}_createMouseTarget(e,t){let i=e.target;if(!this.viewHelper.viewDomNode.contains(i)){let o=Ec(this.viewHelper.viewDomNode);o&&(i=o.elementsFromPoint(e.posx,e.posy).find(s=>this.viewHelper.viewDomNode.contains(s)))}return this.mouseTargetFactory.createMouseTarget(this.viewHelper.getLastRenderData(),e.editorPos,e.pos,e.relativePos,t?i:null)}_getMouseColumn(e){return this.mouseTargetFactory.getMouseColumn(e.relativePos)}_onContextMenu(e,t){this.viewController.emitContextMenu({event:e,target:this._createMouseTarget(e,t)})}_onMouseMove(e){this.mouseTargetFactory.mouseTargetIsWidget(e)||e.preventDefault(),!(this._mouseDownOperation.isActive()||e.timestamp{e.preventDefault(),this.viewHelper.focusTextArea()};if(d&&(o||r&&a))h(),this._mouseDownOperation.start(i.type,e,t);else if(s)e.preventDefault();else if(l){let u=i.detail;d&&this.viewHelper.shouldSuppressMouseDownOnViewZone(u.viewZoneId)&&(h(),this._mouseDownOperation.start(i.type,e,t),e.preventDefault())}else c&&this.viewHelper.shouldSuppressMouseDownOnWidget(i.detail)&&(h(),e.preventDefault());this.viewController.emitMouseDown({event:e,target:i})}},hM=class extends H{constructor(e,t,i,o,s,r){super(),this._context=e,this._viewController=t,this._viewHelper=i,this._mouseTargetFactory=o,this._createMouseTarget=s,this._getMouseColumn=r,this._mouseMoveMonitor=this._register(new zS(this._viewHelper.viewDomNode)),this._topBottomDragScrolling=this._register(new uM(this._context,this._viewHelper,this._mouseTargetFactory,(a,l,c)=>this._dispatchMouse(a,l,c))),this._mouseState=new nx,this._currentSelection=new nt(1,1,1,1),this._isActive=!1,this._lastMouseEvent=null}dispose(){super.dispose()}isActive(){return this._isActive}_onMouseDownThenMove(e){this._lastMouseEvent=e,this._mouseState.setModifiers(e);let t=this._findMousePosition(e,!1);t&&(this._mouseState.isDragAndDrop?this._viewController.emitMouseDrag({event:e,target:t}):t.type===13&&(t.outsidePosition==="above"||t.outsidePosition==="below")?this._topBottomDragScrolling.start(t,e):(this._topBottomDragScrolling.stop(),this._dispatchMouse(t,!0,1)))}start(e,t,i){this._lastMouseEvent=t,this._mouseState.setStartedOnLineNumbers(e===3),this._mouseState.setStartButtons(t),this._mouseState.setModifiers(t);let o=this._findMousePosition(t,!0);if(!o||!o.position)return;this._mouseState.trySetCount(t.detail,o.position),t.detail=this._mouseState.count;let s=this._context.configuration.options;if(!s.get(91)&&s.get(35)&&!s.get(22)&&!this._mouseState.altKey&&t.detail<2&&!this._isActive&&!this._currentSelection.isEmpty()&&o.type===6&&o.position&&this._currentSelection.containsPosition(o.position)){this._mouseState.isDragAndDrop=!0,this._isActive=!0,this._mouseMoveMonitor.startMonitoring(this._viewHelper.viewLinesDomNode,i,t.buttons,r=>this._onMouseDownThenMove(r),r=>{let a=this._findMousePosition(this._lastMouseEvent,!1);Ia(r)?this._viewController.emitMouseDropCanceled():this._viewController.emitMouseDrop({event:this._lastMouseEvent,target:a?this._createMouseTarget(this._lastMouseEvent,!0):null}),this._stop()});return}this._mouseState.isDragAndDrop=!1,this._dispatchMouse(o,t.shiftKey,1),this._isActive||(this._isActive=!0,this._mouseMoveMonitor.startMonitoring(this._viewHelper.viewLinesDomNode,i,t.buttons,r=>this._onMouseDownThenMove(r),()=>this._stop()))}_stop(){this._isActive=!1,this._topBottomDragScrolling.stop()}onHeightChanged(){this._mouseMoveMonitor.stopMonitoring()}onPointerUp(){this._mouseMoveMonitor.stopMonitoring()}onCursorStateChanged(e){this._currentSelection=e.selections[0]}_getPositionOutsideEditor(e){let t=e.editorPos,i=this._context.viewModel,o=this._context.viewLayout,s=this._getMouseColumn(e);if(e.posyt.y+t.height){let a=e.posy-t.y-t.height,l=o.getCurrentScrollTop()+e.relativePos.y,c=Bm.getZoneAtCoord(this._context,l);if(c){let h=this._helpPositionJumpOverViewZone(c);if(h)return Rn.createOutsideEditor(s,h,"below",a)}let d=o.getLineNumberAtVerticalOffset(l);return Rn.createOutsideEditor(s,new U(d,i.getLineMaxColumn(d)),"below",a)}let r=o.getLineNumberAtVerticalOffset(o.getCurrentScrollTop()+e.relativePos.y);if(e.posxt.x+t.width){let a=e.posx-t.x-t.width;return Rn.createOutsideEditor(s,new U(r,i.getLineMaxColumn(r)),"right",a)}return null}_findMousePosition(e,t){let i=this._getPositionOutsideEditor(e);if(i)return i;let o=this._createMouseTarget(e,t);if(!o.position)return null;if(o.type===8||o.type===5){let r=this._helpPositionJumpOverViewZone(o.detail);if(r)return Rn.createViewZone(o.type,o.element,o.mouseColumn,r,o.detail)}return o}_helpPositionJumpOverViewZone(e){let t=new U(this._currentSelection.selectionStartLineNumber,this._currentSelection.selectionStartColumn),i=e.positionBefore,o=e.positionAfter;return i&&o?i.isBefore(t)?i:o:null}_dispatchMouse(e,t,i){e.position&&this._viewController.dispatchMouse({position:e.position,mouseColumn:e.mouseColumn,startedOnLineNumbers:this._mouseState.startedOnLineNumbers,revealType:i,inSelectionMode:t,mouseDownCount:this._mouseState.count,altKey:this._mouseState.altKey,ctrlKey:this._mouseState.ctrlKey,metaKey:this._mouseState.metaKey,shiftKey:this._mouseState.shiftKey,leftButton:this._mouseState.leftButton,middleButton:this._mouseState.middleButton,onInjectedText:e.type===6&&e.detail.injectedText!==null})}},uM=class extends H{constructor(e,t,i,o){super(),this._context=e,this._viewHelper=t,this._mouseTargetFactory=i,this._dispatchMouse=o,this._operation=null}dispose(){super.dispose(),this.stop()}start(e,t){this._operation?this._operation.setPosition(e,t):this._operation=new fM(this._context,this._viewHelper,this._mouseTargetFactory,this._dispatchMouse,e,t)}stop(){this._operation&&(this._operation.dispose(),this._operation=null)}},fM=class extends H{constructor(e,t,i,o,s,r){super(),this._context=e,this._viewHelper=t,this._mouseTargetFactory=i,this._dispatchMouse=o,this._position=s,this._mouseEvent=r,this._lastTime=Date.now(),this._animationFrameDisposable=rn(ge(r.browserEvent),()=>this._execute())}dispose(){this._animationFrameDisposable.dispose(),super.dispose()}setPosition(e,t){this._position=e,this._mouseEvent=t}_tick(){let e=Date.now(),t=e-this._lastTime;return this._lastTime=e,t}_getScrollSpeed(){let e=this._context.configuration.options.get(67),t=this._context.configuration.options.get(145).height/e,i=this._position.outsideDistance/e;return i<=1.5?Math.max(30,t*(1+i)):i<=3?Math.max(60,t*(2+i)):Math.max(200,t*(7+i))}_execute(){let e=this._context.configuration.options.get(67),t=this._getScrollSpeed(),i=this._tick(),o=t*(i/1e3)*e,s=this._position.outsidePosition==="above"?-o:o;this._context.viewModel.viewLayout.deltaScrollNow(0,s),this._viewHelper.renderNow();let r=this._context.viewLayout.getLinesViewportData(),a=this._position.outsidePosition==="above"?r.startLineNumber:r.endLineNumber,l;{let c=VS(this._viewHelper.viewDomNode),d=this._context.configuration.options.get(145).horizontalScrollbarHeight,h=new lh(this._mouseEvent.pos.x,c.y+c.height-d-.1),u=HS(this._viewHelper.viewDomNode,c,h);l=this._mouseTargetFactory.createMouseTarget(this._viewHelper.getLastRenderData(),c,h,u,null)}(!l.position||l.position.lineNumber!==a)&&(this._position.outsidePosition==="above"?l=Rn.createOutsideEditor(this._position.mouseColumn,new U(a,1),"above",this._position.outsideDistance):l=Rn.createOutsideEditor(this._position.mouseColumn,new U(a,this._context.viewModel.getLineMaxColumn(a)),"below",this._position.outsideDistance)),this._dispatchMouse(l,!0,2),this._animationFrameDisposable=rn(ge(l.element),()=>this._execute())}},nx=class n{get altKey(){return this._altKey}get ctrlKey(){return this._ctrlKey}get metaKey(){return this._metaKey}get shiftKey(){return this._shiftKey}get leftButton(){return this._leftButton}get middleButton(){return this._middleButton}get startedOnLineNumbers(){return this._startedOnLineNumbers}constructor(){this._altKey=!1,this._ctrlKey=!1,this._metaKey=!1,this._shiftKey=!1,this._leftButton=!1,this._middleButton=!1,this._startedOnLineNumbers=!1,this._lastMouseDownPosition=null,this._lastMouseDownPositionEqualCount=0,this._lastMouseDownCount=0,this._lastSetMouseDownCountTime=0,this.isDragAndDrop=!1}get count(){return this._lastMouseDownCount}setModifiers(e){this._altKey=e.altKey,this._ctrlKey=e.ctrlKey,this._metaKey=e.metaKey,this._shiftKey=e.shiftKey}setStartButtons(e){this._leftButton=e.leftButton,this._middleButton=e.middleButton}setStartedOnLineNumbers(e){this._startedOnLineNumbers=e}trySetCount(e,t){let i=new Date().getTime();i-this._lastSetMouseDownCountTime>n.CLEAR_MOUSE_DOWN_COUNT_TIME&&(e=1),this._lastSetMouseDownCountTime=i,e>this._lastMouseDownCount+1&&(e=this._lastMouseDownCount+1),this._lastMouseDownPosition&&this._lastMouseDownPosition.equals(t)?this._lastMouseDownPositionEqualCount++:this._lastMouseDownPositionEqualCount=1,this._lastMouseDownPosition=t,this._lastMouseDownCount=Math.min(e,this._lastMouseDownPositionEqualCount)}};nx.CLEAR_MOUSE_DOWN_COUNT_TIME=400;_();v();b();ps();ke();_();v();b();ye();var et=class{get event(){return this.emitter.event}constructor(e,t,i){let o=s=>this.emitter.fire(s);this.emitter=new B({onWillAddFirstListener:()=>e.addEventListener(t,o,i),onDidRemoveLastListener:()=>e.removeEventListener(t,o,i)})}dispose(){this.emitter.dispose()}};oo();Gt();ye();le();M0();ot();_();v();b();ot();Ke();var xs=!1,pn=class n{constructor(e,t,i,o,s){this.value=e,this.selectionStart=t,this.selectionEnd=i,this.selection=o,this.newlineCountBeforeSelection=s}toString(){return`[ <${this.value}>, selectionStart: ${this.selectionStart}, selectionEnd: ${this.selectionEnd}]`}static readFromTextArea(e,t){let i=e.getValue(),o=e.getSelectionStart(),s=e.getSelectionEnd(),r;if(t){let a=i.substring(0,o),l=t.value.substring(0,t.selectionStart);a===l&&(r=t.newlineCountBeforeSelection)}return new n(i,o,s,null,r)}collapseSelection(){return this.selectionStart===this.value.length?this:new n(this.value,this.value.length,this.value.length,null,void 0)}writeToTextArea(e,t,i){xs&&console.log(`writeToTextArea ${e}: ${this.toString()}`),t.setValue(e,this.value),i&&t.setSelectionRange(e,this.selectionStart,this.selectionEnd)}deduceEditorPosition(e){var t,i,o,s,r,a,l,c;if(e<=this.selectionStart){let u=this.value.substring(e,this.selectionStart);return this._finishDeduceEditorPosition((i=(t=this.selection)===null||t===void 0?void 0:t.getStartPosition())!==null&&i!==void 0?i:null,u,-1)}if(e>=this.selectionEnd){let u=this.value.substring(this.selectionEnd,e);return this._finishDeduceEditorPosition((s=(o=this.selection)===null||o===void 0?void 0:o.getEndPosition())!==null&&s!==void 0?s:null,u,1)}let d=this.value.substring(this.selectionStart,e);if(d.indexOf("\u2026")===-1)return this._finishDeduceEditorPosition((a=(r=this.selection)===null||r===void 0?void 0:r.getStartPosition())!==null&&a!==void 0?a:null,d,1);let h=this.value.substring(e,this.selectionEnd);return this._finishDeduceEditorPosition((c=(l=this.selection)===null||l===void 0?void 0:l.getEndPosition())!==null&&c!==void 0?c:null,h,-1)}_finishDeduceEditorPosition(e,t,i){let o=0,s=-1;for(;(s=t.indexOf(` +`,s+1))!==-1;)o++;return[e,i*t.length,o]}static deduceInput(e,t,i){if(!e)return{text:"",replacePrevCharCnt:0,replaceNextCharCnt:0,positionDelta:0};xs&&(console.log("------------------------deduceInput"),console.log(`PREVIOUS STATE: ${e.toString()}`),console.log(`CURRENT STATE: ${t.toString()}`));let o=Math.min(Y_(e.value,t.value),e.selectionStart,t.selectionStart),s=Math.min(X_(e.value,t.value),e.value.length-e.selectionEnd,t.value.length-t.selectionEnd),r=e.value.substring(o,e.value.length-s),a=t.value.substring(o,t.value.length-s),l=e.selectionStart-o,c=e.selectionEnd-o,d=t.selectionStart-o,h=t.selectionEnd-o;if(xs&&(console.log(`AFTER DIFFING PREVIOUS STATE: <${r}>, selectionStart: ${l}, selectionEnd: ${c}`),console.log(`AFTER DIFFING CURRENT STATE: <${a}>, selectionStart: ${d}, selectionEnd: ${h}`)),d===h){let f=e.selectionStart-o;return xs&&console.log(`REMOVE PREVIOUS: ${f} chars`),{text:a,replacePrevCharCnt:f,replaceNextCharCnt:0,positionDelta:0}}let u=c-l;return{text:a,replacePrevCharCnt:u,replaceNextCharCnt:0,positionDelta:0}}static deduceAndroidCompositionInput(e,t){if(!e)return{text:"",replacePrevCharCnt:0,replaceNextCharCnt:0,positionDelta:0};if(xs&&(console.log("------------------------deduceAndroidCompositionInput"),console.log(`PREVIOUS STATE: ${e.toString()}`),console.log(`CURRENT STATE: ${t.toString()}`)),e.value===t.value)return{text:"",replacePrevCharCnt:0,replaceNextCharCnt:0,positionDelta:t.selectionEnd-e.selectionEnd};let i=Math.min(Y_(e.value,t.value),e.selectionEnd),o=Math.min(X_(e.value,t.value),e.value.length-e.selectionEnd),s=e.value.substring(i,e.value.length-o),r=t.value.substring(i,t.value.length-o),a=e.selectionStart-i,l=e.selectionEnd-i,c=t.selectionStart-i,d=t.selectionEnd-i;return xs&&(console.log(`AFTER DIFFING PREVIOUS STATE: <${s}>, selectionStart: ${a}, selectionEnd: ${l}`),console.log(`AFTER DIFFING CURRENT STATE: <${r}>, selectionStart: ${c}, selectionEnd: ${d}`)),{text:r,replacePrevCharCnt:l,replaceNextCharCnt:s.length-l,positionDelta:d-r.length}}};pn.EMPTY=new pn("",0,0,null,void 0);var ox=class n{static _getPageOfLine(e,t){return Math.floor((e-1)/t)}static _getRangeForPage(e,t){let i=e*t,o=i+1,s=i+t;return new P(o,1,s+1,1)}static fromEditorSelection(e,t,i,o){let r=n._getPageOfLine(t.startLineNumber,i),a=n._getRangeForPage(r,i),l=n._getPageOfLine(t.endLineNumber,i),c=n._getRangeForPage(l,i),d=a.intersectRanges(new P(1,1,t.startLineNumber,t.startColumn));if(o&&e.getValueLengthInRange(d,1)>500){let S=e.modifyPosition(d.getEndPosition(),-500);d=P.fromPositions(S,d.getEndPosition())}let h=e.getValueInRange(d,1),u=e.getLineCount(),f=e.getLineMaxColumn(u),g=c.intersectRanges(new P(t.endLineNumber,t.endColumn,u,f));if(o&&e.getValueLengthInRange(g,1)>500){let S=e.modifyPosition(g.getStartPosition(),500);g=P.fromPositions(g.getStartPosition(),S)}let m=e.getValueInRange(g,1),C;if(r===l||r+1===l)C=e.getValueInRange(t,1);else{let S=a.intersectRanges(t),w=c.intersectRanges(t);C=e.getValueInRange(S,1)+"\u2026"+e.getValueInRange(w,1)}return o&&C.length>2*500&&(C=C.substring(0,500)+"\u2026"+C.substring(C.length-500,C.length)),new pn(h+C+m,h.length,h.length+C.length,t,d.endLineNumber-d.startLineNumber)}};Kn();Aa();var TG=function(n,e,t,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},E6=function(n,e){return function(t,i){e(t,i,n)}},gb;(function(n){n.Tap="-monaco-textarea-synthetic-tap"})(gb||(gb={}));var T6={forceCopyWithSyntaxHighlighting:!1},Hm=class{constructor(){this._lastState=null}set(e,t){this._lastState={lastCopiedValue:e,data:t}}get(e){return this._lastState&&this._lastState.lastCopiedValue===e?this._lastState.data:(this._lastState=null,null)}};Hm.INSTANCE=new Hm;var gM=class{constructor(){this._lastTypeTextLength=0}handleCompositionUpdate(e){e=e||"";let t={text:e,replacePrevCharCnt:this._lastTypeTextLength,replaceNextCharCnt:0,positionDelta:0};return this._lastTypeTextLength=e.length,t}},sx=class extends H{get textAreaState(){return this._textAreaState}constructor(e,t,i,o,s,r){super(),this._host=e,this._textArea=t,this._OS=i,this._browser=o,this._accessibilityService=s,this._logService=r,this._onFocus=this._register(new B),this.onFocus=this._onFocus.event,this._onBlur=this._register(new B),this.onBlur=this._onBlur.event,this._onKeyDown=this._register(new B),this.onKeyDown=this._onKeyDown.event,this._onKeyUp=this._register(new B),this.onKeyUp=this._onKeyUp.event,this._onCut=this._register(new B),this.onCut=this._onCut.event,this._onPaste=this._register(new B),this.onPaste=this._onPaste.event,this._onType=this._register(new B),this.onType=this._onType.event,this._onCompositionStart=this._register(new B),this.onCompositionStart=this._onCompositionStart.event,this._onCompositionUpdate=this._register(new B),this.onCompositionUpdate=this._onCompositionUpdate.event,this._onCompositionEnd=this._register(new B),this.onCompositionEnd=this._onCompositionEnd.event,this._onSelectionChangeRequest=this._register(new B),this.onSelectionChangeRequest=this._onSelectionChangeRequest.event,this._asyncFocusGainWriteScreenReaderContent=this._register(new no),this._asyncTriggerCut=this._register(new di(()=>this._onCut.fire(),0)),this._textAreaState=pn.EMPTY,this._selectionChangeListener=null,this._accessibilityService.isScreenReaderOptimized()&&this.writeNativeTextAreaContent("ctor"),this._register(ie.runAndSubscribe(this._accessibilityService.onDidChangeScreenReaderOptimized,()=>{this._accessibilityService.isScreenReaderOptimized()&&!this._asyncFocusGainWriteScreenReaderContent.value?this._asyncFocusGainWriteScreenReaderContent.value=this._register(new di(()=>this.writeNativeTextAreaContent("asyncFocusGain"),0)):this._asyncFocusGainWriteScreenReaderContent.clear()})),this._hasFocus=!1,this._currentComposition=null;let a=null;this._register(this._textArea.onKeyDown(l=>{let c=new bt(l);(c.keyCode===114||this._currentComposition&&c.keyCode===1)&&c.stopPropagation(),c.equals(9)&&c.preventDefault(),a=c,this._onKeyDown.fire(c)})),this._register(this._textArea.onKeyUp(l=>{let c=new bt(l);this._onKeyUp.fire(c)})),this._register(this._textArea.onCompositionStart(l=>{xs&&console.log("[compositionstart]",l);let c=new gM;if(this._currentComposition){this._currentComposition=c;return}if(this._currentComposition=c,this._OS===2&&a&&a.equals(114)&&this._textAreaState.selectionStart===this._textAreaState.selectionEnd&&this._textAreaState.selectionStart>0&&this._textAreaState.value.substr(this._textAreaState.selectionStart-1,1)===l.data&&(a.code==="ArrowRight"||a.code==="ArrowLeft")){xs&&console.log("[compositionstart] Handling long press case on macOS + arrow key",l),c.handleCompositionUpdate("x"),this._onCompositionStart.fire({data:l.data});return}if(this._browser.isAndroid){this._onCompositionStart.fire({data:l.data});return}this._onCompositionStart.fire({data:l.data})})),this._register(this._textArea.onCompositionUpdate(l=>{xs&&console.log("[compositionupdate]",l);let c=this._currentComposition;if(!c)return;if(this._browser.isAndroid){let h=pn.readFromTextArea(this._textArea,this._textAreaState),u=pn.deduceAndroidCompositionInput(this._textAreaState,h);this._textAreaState=h,this._onType.fire(u),this._onCompositionUpdate.fire(l);return}let d=c.handleCompositionUpdate(l.data);this._textAreaState=pn.readFromTextArea(this._textArea,this._textAreaState),this._onType.fire(d),this._onCompositionUpdate.fire(l)})),this._register(this._textArea.onCompositionEnd(l=>{xs&&console.log("[compositionend]",l);let c=this._currentComposition;if(!c)return;if(this._currentComposition=null,this._browser.isAndroid){let h=pn.readFromTextArea(this._textArea,this._textAreaState),u=pn.deduceAndroidCompositionInput(this._textAreaState,h);this._textAreaState=h,this._onType.fire(u),this._onCompositionEnd.fire();return}let d=c.handleCompositionUpdate(l.data);this._textAreaState=pn.readFromTextArea(this._textArea,this._textAreaState),this._onType.fire(d),this._onCompositionEnd.fire()})),this._register(this._textArea.onInput(l=>{if(xs&&console.log("[input]",l),this._textArea.setIgnoreSelectionChangeTime("received input event"),this._currentComposition)return;let c=pn.readFromTextArea(this._textArea,this._textAreaState),d=pn.deduceInput(this._textAreaState,c,this._OS===2);d.replacePrevCharCnt===0&&d.text.length===1&&(pi(d.text.charCodeAt(0))||d.text.charCodeAt(0)===127)||(this._textAreaState=c,(d.text!==""||d.replacePrevCharCnt!==0||d.replaceNextCharCnt!==0||d.positionDelta!==0)&&this._onType.fire(d))})),this._register(this._textArea.onCut(l=>{this._textArea.setIgnoreSelectionChangeTime("received cut event"),this._ensureClipboardGetsEditorSelection(l),this._asyncTriggerCut.schedule()})),this._register(this._textArea.onCopy(l=>{this._ensureClipboardGetsEditorSelection(l)})),this._register(this._textArea.onPaste(l=>{if(this._textArea.setIgnoreSelectionChangeTime("received paste event"),l.preventDefault(),!l.clipboardData)return;let[c,d]=I6.getTextData(l.clipboardData);c&&(d=d||Hm.INSTANCE.get(c),this._onPaste.fire({text:c,metadata:d}))})),this._register(this._textArea.onFocus(()=>{let l=this._hasFocus;this._setHasFocus(!0),this._accessibilityService.isScreenReaderOptimized()&&this._browser.isSafari&&!l&&this._hasFocus&&(this._asyncFocusGainWriteScreenReaderContent.value||(this._asyncFocusGainWriteScreenReaderContent.value=new di(()=>this.writeNativeTextAreaContent("asyncFocusGain"),0)),this._asyncFocusGainWriteScreenReaderContent.value.schedule())})),this._register(this._textArea.onBlur(()=>{this._currentComposition&&(this._currentComposition=null,this.writeNativeTextAreaContent("blurWithoutCompositionEnd"),this._onCompositionEnd.fire()),this._setHasFocus(!1)})),this._register(this._textArea.onSyntheticTap(()=>{this._browser.isAndroid&&this._currentComposition&&(this._currentComposition=null,this.writeNativeTextAreaContent("tapWithoutCompositionEnd"),this._onCompositionEnd.fire())}))}_installSelectionChangeListener(){let e=0;return $(this._textArea.ownerDocument,"selectionchange",t=>{if(Ml.onSelectionChange(),!this._hasFocus||this._currentComposition||!this._browser.isChrome)return;let i=Date.now(),o=i-e;if(e=i,o<5)return;let s=i-this._textArea.getIgnoreSelectionChangeTime();if(this._textArea.resetSelectionChangeTime(),s<100||!this._textAreaState.selection)return;let r=this._textArea.getValue();if(this._textAreaState.value!==r)return;let a=this._textArea.getSelectionStart(),l=this._textArea.getSelectionEnd();if(this._textAreaState.selectionStart===a&&this._textAreaState.selectionEnd===l)return;let c=this._textAreaState.deduceEditorPosition(a),d=this._host.deduceModelPosition(c[0],c[1],c[2]),h=this._textAreaState.deduceEditorPosition(l),u=this._host.deduceModelPosition(h[0],h[1],h[2]),f=new nt(d.lineNumber,d.column,u.lineNumber,u.column);this._onSelectionChangeRequest.fire(f)})}dispose(){super.dispose(),this._selectionChangeListener&&(this._selectionChangeListener.dispose(),this._selectionChangeListener=null)}focusTextArea(){this._setHasFocus(!0),this.refreshFocusState()}isFocused(){return this._hasFocus}refreshFocusState(){this._setHasFocus(this._textArea.hasFocus())}_setHasFocus(e){this._hasFocus!==e&&(this._hasFocus=e,this._selectionChangeListener&&(this._selectionChangeListener.dispose(),this._selectionChangeListener=null),this._hasFocus&&(this._selectionChangeListener=this._installSelectionChangeListener()),this._hasFocus&&this.writeNativeTextAreaContent("focusgain"),this._hasFocus?this._onFocus.fire():this._onBlur.fire())}_setAndWriteTextAreaState(e,t){this._hasFocus||(t=t.collapseSelection()),t.writeToTextArea(e,this._textArea,this._hasFocus),this._textAreaState=t}writeNativeTextAreaContent(e){!this._accessibilityService.isScreenReaderOptimized()&&e==="render"||this._currentComposition||(this._logService.trace(`writeTextAreaState(reason: ${e})`),this._setAndWriteTextAreaState(e,this._host.getScreenReaderContent()))}_ensureClipboardGetsEditorSelection(e){let t=this._host.getDataToCopy(),i={version:1,isFromEmptySelection:t.isFromEmptySelection,multicursorText:t.multicursorText,mode:t.mode};Hm.INSTANCE.set(this._browser.isFirefox?t.text.replace(/\r\n/g,` +`):t.text,i),e.preventDefault(),e.clipboardData&&I6.setTextData(e.clipboardData,t.text,t.html,i)}};sx=TG([E6(4,ao),E6(5,En)],sx);var I6={getTextData(n){let e=n.getData(rr.text),t=null,i=n.getData("vscode-editor-data");if(typeof i=="string")try{t=JSON.parse(i),t.version!==1&&(t=null)}catch{}return e.length===0&&t===null&&n.files.length>0?[Array.prototype.slice.call(n.files,0).map(s=>s.name).join(` +`),null]:[e,t]},setTextData(n,e,t,i){n.setData(rr.text,e),typeof t=="string"&&n.setData("text/html",t),n.setData("vscode-editor-data",JSON.stringify(i))}},rx=class extends H{get ownerDocument(){return this._actual.ownerDocument}constructor(e){super(),this._actual=e,this.onKeyDown=this._register(new et(this._actual,"keydown")).event,this.onKeyUp=this._register(new et(this._actual,"keyup")).event,this.onCompositionStart=this._register(new et(this._actual,"compositionstart")).event,this.onCompositionUpdate=this._register(new et(this._actual,"compositionupdate")).event,this.onCompositionEnd=this._register(new et(this._actual,"compositionend")).event,this.onBeforeInput=this._register(new et(this._actual,"beforeinput")).event,this.onInput=this._register(new et(this._actual,"input")).event,this.onCut=this._register(new et(this._actual,"cut")).event,this.onCopy=this._register(new et(this._actual,"copy")).event,this.onPaste=this._register(new et(this._actual,"paste")).event,this.onFocus=this._register(new et(this._actual,"focus")).event,this.onBlur=this._register(new et(this._actual,"blur")).event,this._onSyntheticTap=this._register(new B),this.onSyntheticTap=this._onSyntheticTap.event,this._ignoreSelectionChangeTime=0,this._register(this.onKeyDown(()=>Ml.onKeyDown())),this._register(this.onBeforeInput(()=>Ml.onBeforeInput())),this._register(this.onInput(()=>Ml.onInput())),this._register(this.onKeyUp(()=>Ml.onKeyUp())),this._register($(this._actual,gb.Tap,()=>this._onSyntheticTap.fire()))}hasFocus(){let e=Ec(this._actual);return e?e.activeElement===this._actual:this._actual.isConnected?Bi()===this._actual:!1}setIgnoreSelectionChangeTime(e){this._ignoreSelectionChangeTime=Date.now()}getIgnoreSelectionChangeTime(){return this._ignoreSelectionChangeTime}resetSelectionChangeTime(){this._ignoreSelectionChangeTime=0}getValue(){return this._actual.value}setValue(e,t){let i=this._actual;i.value!==t&&(this.setIgnoreSelectionChangeTime("setValue"),i.value=t)}getSelectionStart(){return this._actual.selectionDirection==="backward"?this._actual.selectionEnd:this._actual.selectionStart}getSelectionEnd(){return this._actual.selectionDirection==="backward"?this._actual.selectionStart:this._actual.selectionEnd}setSelectionRange(e,t,i){let o=this._actual,s=null,r=Ec(o);r?s=r.activeElement:s=Bi();let a=ge(s),l=s===o,c=o.selectionStart,d=o.selectionEnd;if(l&&c===t&&d===i){wn&&a.parent!==a&&o.focus();return}if(l){this.setIgnoreSelectionChangeTime("setSelectionRange"),o.setSelectionRange(t,i),wn&&a.parent!==a&&o.focus();return}try{let h=K7(o);this.setIgnoreSelectionChangeTime("setSelectionRange"),o.focus(),o.setSelectionRange(t,i),$7(o,h)}catch{}}};var mM=class extends Vm{constructor(e,t,i){super(e,t,i),this._register(ui.addTarget(this.viewHelper.linesContentDomNode)),this._register($(this.viewHelper.linesContentDomNode,It.Tap,s=>this.onTap(s))),this._register($(this.viewHelper.linesContentDomNode,It.Change,s=>this.onChange(s))),this._register($(this.viewHelper.linesContentDomNode,It.Contextmenu,s=>this._onContextMenu(new Xr(s,!1,this.viewHelper.viewDomNode),!1))),this._lastPointerType="mouse",this._register($(this.viewHelper.linesContentDomNode,"pointerdown",s=>{let r=s.pointerType;if(r==="mouse"){this._lastPointerType="mouse";return}else r==="touch"?this._lastPointerType="touch":this._lastPointerType="pen"}));let o=new WS(this.viewHelper.viewDomNode);this._register(o.onPointerMove(this.viewHelper.viewDomNode,s=>this._onMouseMove(s))),this._register(o.onPointerUp(this.viewHelper.viewDomNode,s=>this._onMouseUp(s))),this._register(o.onPointerLeave(this.viewHelper.viewDomNode,s=>this._onMouseLeave(s))),this._register(o.onPointerDown(this.viewHelper.viewDomNode,(s,r)=>this._onMouseDown(s,r)))}onTap(e){!e.initialTarget||!this.viewHelper.linesContentDomNode.contains(e.initialTarget)||(e.preventDefault(),this.viewHelper.focusTextArea(),this._dispatchGesture(e,!1))}onChange(e){this._lastPointerType==="touch"&&this._context.viewModel.viewLayout.deltaScrollNow(-e.translationX,-e.translationY),this._lastPointerType==="pen"&&this._dispatchGesture(e,!0)}_dispatchGesture(e,t){let i=this._createMouseTarget(new Xr(e,!1,this.viewHelper.viewDomNode),!1);i.position&&this.viewController.dispatchMouse({position:i.position,mouseColumn:i.position.column,startedOnLineNumbers:!1,revealType:1,mouseDownCount:e.tapCount,inSelectionMode:t,altKey:!1,ctrlKey:!1,metaKey:!1,shiftKey:!1,leftButton:!1,middleButton:!1,onInjectedText:i.type===6&&i.detail.injectedText!==null})}_onMouseDown(e,t){e.browserEvent.pointerType!=="touch"&&super._onMouseDown(e,t)}},pM=class extends Vm{constructor(e,t,i){super(e,t,i),this._register(ui.addTarget(this.viewHelper.linesContentDomNode)),this._register($(this.viewHelper.linesContentDomNode,It.Tap,o=>this.onTap(o))),this._register($(this.viewHelper.linesContentDomNode,It.Change,o=>this.onChange(o))),this._register($(this.viewHelper.linesContentDomNode,It.Contextmenu,o=>this._onContextMenu(new Xr(o,!1,this.viewHelper.viewDomNode),!1)))}onTap(e){e.preventDefault(),this.viewHelper.focusTextArea();let t=this._createMouseTarget(new Xr(e,!1,this.viewHelper.viewDomNode),!1);if(t.position){let i=document.createEvent("CustomEvent");i.initEvent(gb.Tap,!1,!0),this.viewHelper.dispatchTextAreaEvent(i),this.viewController.moveTo(t.position,1)}}onChange(e){this._context.viewModel.viewLayout.deltaScrollNow(-e.translationX,-e.translationY)}},ax=class extends H{constructor(e,t,i){super(),(Rs||C9&&J1)&&Ag.pointerEvents?this.handler=this._register(new mM(e,t,i)):gt.TouchEvent?this.handler=this._register(new pM(e,t,i)):this.handler=this._register(new Vm(e,t,i))}getTargetAtClientPoint(e,t){return this.handler.getTargetAtClientPoint(e,t)}};_();v();b();Ge();ps();Lt();ot();_();v();b();Lt();_();v();b();var ns=class extends Qr{};ft();Ke();Qi();$a();var rf=class n extends ns{constructor(e){super(),this._context=e,this._readConfig(),this._lastCursorModelPosition=new U(1,1),this._renderResult=null,this._activeLineNumber=1,this._context.addEventHandler(this)}_readConfig(){let e=this._context.configuration.options;this._lineHeight=e.get(67);let t=e.get(68);this._renderLineNumbers=t.renderType,this._renderCustomLineNumbers=t.renderFn,this._renderFinalNewline=e.get(95);let i=e.get(145);this._lineNumbersLeft=i.lineNumbersLeft,this._lineNumbersWidth=i.lineNumbersWidth}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(e){return this._readConfig(),!0}onCursorStateChanged(e){let t=e.selections[0].getPosition();this._lastCursorModelPosition=this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(t);let i=!1;return this._activeLineNumber!==t.lineNumber&&(this._activeLineNumber=t.lineNumber,i=!0),(this._renderLineNumbers===2||this._renderLineNumbers===3)&&(i=!0),i}onFlushed(e){return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return e.scrollTopChanged}onZonesChanged(e){return!0}onDecorationsChanged(e){return e.affectsLineNumber}_getLineRenderLineNumber(e){let t=this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(new U(e,1));if(t.column!==1)return"";let i=t.lineNumber;if(this._renderCustomLineNumbers)return this._renderCustomLineNumbers(i);if(this._renderLineNumbers===2){let o=Math.abs(this._lastCursorModelPosition.lineNumber-i);return o===0?''+i+"":String(o)}if(this._renderLineNumbers===3){if(this._lastCursorModelPosition.lineNumber===i||i%10===0)return String(i);let o=this._context.viewModel.getLineCount();return i===o?String(i):""}return String(i)}prepareRender(e){if(this._renderLineNumbers===0){this._renderResult=null;return}let t=mi?this._lineHeight%2===0?" lh-even":" lh-odd":"",i=e.visibleRange.startLineNumber,o=e.visibleRange.endLineNumber,s=this._context.viewModel.getDecorationsInViewport(e.visibleRange).filter(c=>!!c.options.lineNumberClassName);s.sort((c,d)=>P.compareRangesUsingEnds(c.range,d.range));let r=0,a=this._context.viewModel.getLineCount(),l=[];for(let c=i;c<=o;c++){let d=c-i,h=this._getLineRenderLineNumber(c),u="";for(;r${h}`}this._renderResult=l}render(e,t){if(!this._renderResult)return"";let i=t-e;return i<0||i>=this._renderResult.length?"":this._renderResult[i]}};rf.CLASS_NAME="line-numbers";Lo((n,e)=>{let t=n.getColor(R6),i=n.getColor($6);i?e.addRule(`.monaco-editor .line-numbers.dimmed-line-number { color: ${i}; }`):t&&e.addRule(`.monaco-editor .line-numbers.dimmed-line-number { color: ${t.transparent(.4)}; }`)});_();v();b();var fh=class n extends hi{constructor(e){super(e);let t=this._context.configuration.options,i=t.get(145);this._canUseLayerHinting=!t.get(32),this._contentLeft=i.contentLeft,this._glyphMarginLeft=i.glyphMarginLeft,this._glyphMarginWidth=i.glyphMarginWidth,this._domNode=$e(document.createElement("div")),this._domNode.setClassName(n.OUTER_CLASS_NAME),this._domNode.setPosition("absolute"),this._domNode.setAttribute("role","presentation"),this._domNode.setAttribute("aria-hidden","true"),this._glyphMarginBackgroundDomNode=$e(document.createElement("div")),this._glyphMarginBackgroundDomNode.setClassName(n.CLASS_NAME),this._domNode.appendChild(this._glyphMarginBackgroundDomNode)}dispose(){super.dispose()}getDomNode(){return this._domNode}onConfigurationChanged(e){let t=this._context.configuration.options,i=t.get(145);return this._canUseLayerHinting=!t.get(32),this._contentLeft=i.contentLeft,this._glyphMarginLeft=i.glyphMarginLeft,this._glyphMarginWidth=i.glyphMarginWidth,!0}onScrollChanged(e){return super.onScrollChanged(e)||e.scrollTopChanged}prepareRender(e){}render(e){this._domNode.setLayerHinting(this._canUseLayerHinting),this._domNode.setContain("strict");let t=e.scrollTop-e.bigNumbersDelta;this._domNode.setTop(-t);let i=Math.min(e.scrollHeight,1e6);this._domNode.setHeight(i),this._domNode.setWidth(this._contentLeft),this._glyphMarginBackgroundDomNode.setLeft(this._glyphMarginLeft),this._glyphMarginBackgroundDomNode.setWidth(this._glyphMarginWidth),this._glyphMarginBackgroundDomNode.setHeight(i)}};fh.CLASS_NAME="glyph-margin";fh.OUTER_CLASS_NAME="margin";W0();ft();Ke();Kn();_();v();b();var Bc="monaco-mouse-cursor-text";Yo();gn();_();v();b();ye();var wM=class{constructor(){this._onDidChange=new B,this.onDidChange=this._onDidChange.event,this._enabled=!0}get enabled(){return this._enabled}enable(){this._enabled=!0,this._onDidChange.fire()}disable(){this._enabled=!1,this._onDidChange.fire()}},af=new wM;_();v();b();qe();var fi=De("keybindingService");qe();var NG=function(n,e,t,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},hW=function(n,e){return function(t,i){e(t,i,n)}},SM=class{constructor(e,t,i,o,s){this._context=e,this.modelLineNumber=t,this.distanceToModelLineStart=i,this.widthOfHiddenLineTextBefore=o,this.distanceToModelLineEnd=s,this._visibleTextAreaBrand=void 0,this.startPosition=null,this.endPosition=null,this.visibleTextareaStart=null,this.visibleTextareaEnd=null,this._previousPresentation=null}prepareRender(e){let t=new U(this.modelLineNumber,this.distanceToModelLineStart+1),i=new U(this.modelLineNumber,this._context.viewModel.model.getLineMaxColumn(this.modelLineNumber)-this.distanceToModelLineEnd);this.startPosition=this._context.viewModel.coordinatesConverter.convertModelPositionToViewPosition(t),this.endPosition=this._context.viewModel.coordinatesConverter.convertModelPositionToViewPosition(i),this.startPosition.lineNumber===this.endPosition.lineNumber?(this.visibleTextareaStart=e.visibleRangeForPosition(this.startPosition),this.visibleTextareaEnd=e.visibleRangeForPosition(this.endPosition)):(this.visibleTextareaStart=null,this.visibleTextareaEnd=null)}definePresentation(e){return this._previousPresentation||(e?this._previousPresentation=e:this._previousPresentation={foreground:1,italic:!1,bold:!1,underline:!1,strikethrough:!1}),this._previousPresentation}},yM=wn,wx=class extends hi{constructor(e,t,i,o,s){super(e),this._keybindingService=o,this._instantiationService=s,this._primaryCursorPosition=new U(1,1),this._primaryCursorVisibleRange=null,this._viewController=t,this._visibleRangeProvider=i,this._scrollLeft=0,this._scrollTop=0;let r=this._context.configuration.options,a=r.get(145);this._setAccessibilityOptions(r),this._contentLeft=a.contentLeft,this._contentWidth=a.contentWidth,this._contentHeight=a.height,this._fontInfo=r.get(50),this._lineHeight=r.get(67),this._emptySelectionClipboard=r.get(37),this._copyWithSyntaxHighlighting=r.get(25),this._visibleTextArea=null,this._selections=[new nt(1,1,1,1)],this._modelSelections=[new nt(1,1,1,1)],this._lastRenderPosition=null,this.textArea=$e(document.createElement("textarea")),Mn.write(this.textArea,7),this.textArea.setClassName(`inputarea ${Bc}`),this.textArea.setAttribute("wrap",this._textAreaWrapping&&!this._visibleTextArea?"on":"off");let{tabSize:l}=this._context.viewModel.model.getOptions();this.textArea.domNode.style.tabSize=`${l*this._fontInfo.spaceWidth}px`,this.textArea.setAttribute("autocorrect","off"),this.textArea.setAttribute("autocapitalize","off"),this.textArea.setAttribute("autocomplete","off"),this.textArea.setAttribute("spellcheck","false"),this.textArea.setAttribute("aria-label",this._getAriaLabel(r)),this.textArea.setAttribute("aria-required",r.get(5)?"true":"false"),this.textArea.setAttribute("tabindex",String(r.get(124))),this.textArea.setAttribute("role","textbox"),this.textArea.setAttribute("aria-roledescription",p("editor","editor")),this.textArea.setAttribute("aria-multiline","true"),this.textArea.setAttribute("aria-autocomplete",r.get(91)?"none":"both"),this._ensureReadOnlyAttribute(),this.textAreaCover=$e(document.createElement("div")),this.textAreaCover.setPosition("absolute");let c={getLineCount:()=>this._context.viewModel.getLineCount(),getLineMaxColumn:u=>this._context.viewModel.getLineMaxColumn(u),getValueInRange:(u,f)=>this._context.viewModel.getValueInRange(u,f),getValueLengthInRange:(u,f)=>this._context.viewModel.getValueLengthInRange(u,f),modifyPosition:(u,f)=>this._context.viewModel.modifyPosition(u,f)},d={getDataToCopy:()=>{let u=this._context.viewModel.getPlainTextToCopy(this._modelSelections,this._emptySelectionClipboard,Li),f=this._context.viewModel.model.getEOL(),g=this._emptySelectionClipboard&&this._modelSelections.length===1&&this._modelSelections[0].isEmpty(),m=Array.isArray(u)?u:null,C=Array.isArray(u)?u.join(f):u,S,w=null;if(T6.forceCopyWithSyntaxHighlighting||this._copyWithSyntaxHighlighting&&C.length<65536){let y=this._context.viewModel.getRichTextToCopy(this._modelSelections,this._emptySelectionClipboard);y&&(S=y.html,w=y.mode)}return{isFromEmptySelection:g,multicursorText:m,text:C,html:S,mode:w}},getScreenReaderContent:()=>{if(this._accessibilitySupport===1){let u=this._selections[0];if(Be&&u.isEmpty()){let g=u.getStartPosition(),m=this._getWordBeforePosition(g);if(m.length===0&&(m=this._getCharacterBeforePosition(g)),m.length>0)return new pn(m,m.length,m.length,P.fromPositions(g),0)}let f=500;if(Be&&!u.isEmpty()&&c.getValueLengthInRange(u,0)0)return new pn(g,m,m,P.fromPositions(f),0)}return pn.EMPTY}return ox.fromEditorSelection(c,this._selections[0],this._accessibilityPageSize,this._accessibilitySupport===0)},deduceModelPosition:(u,f,g)=>this._context.viewModel.deduceModelPositionRelativeToViewPosition(u,f,g)},h=this._register(new rx(this.textArea.domNode));this._textAreaInput=this._register(this._instantiationService.createInstance(sx,d,h,po,{isAndroid:NT,isChrome:Pd,isFirefox:wn,isSafari:ms})),this._register(this._textAreaInput.onKeyDown(u=>{this._viewController.emitKeyDown(u)})),this._register(this._textAreaInput.onKeyUp(u=>{this._viewController.emitKeyUp(u)})),this._register(this._textAreaInput.onPaste(u=>{let f=!1,g=null,m=null;u.metadata&&(f=this._emptySelectionClipboard&&!!u.metadata.isFromEmptySelection,g=typeof u.metadata.multicursorText<"u"?u.metadata.multicursorText:null,m=u.metadata.mode),this._viewController.paste(u.text,f,g,m)})),this._register(this._textAreaInput.onCut(()=>{this._viewController.cut()})),this._register(this._textAreaInput.onType(u=>{u.replacePrevCharCnt||u.replaceNextCharCnt||u.positionDelta?(xs&&console.log(` => compositionType: <<${u.text}>>, ${u.replacePrevCharCnt}, ${u.replaceNextCharCnt}, ${u.positionDelta}`),this._viewController.compositionType(u.text,u.replacePrevCharCnt,u.replaceNextCharCnt,u.positionDelta)):(xs&&console.log(` => type: <<${u.text}>>`),this._viewController.type(u.text))})),this._register(this._textAreaInput.onSelectionChangeRequest(u=>{this._viewController.setSelection(u)})),this._register(this._textAreaInput.onCompositionStart(u=>{let f=this.textArea.domNode,g=this._modelSelections[0],{distanceToModelLineStart:m,widthOfHiddenTextBefore:C}=(()=>{let w=f.value.substring(0,Math.min(f.selectionStart,f.selectionEnd)),y=w.lastIndexOf(` +`),x=w.substring(y+1),k=x.lastIndexOf(" "),T=x.length-k-1,N=g.getStartPosition(),M=Math.min(N.column-1,T),W=N.column-1-M,j=x.substring(0,x.length-M),{tabSize:G}=this._context.viewModel.model.getOptions(),V=AG(this.textArea.domNode.ownerDocument,j,this._fontInfo,G);return{distanceToModelLineStart:W,widthOfHiddenTextBefore:V}})(),{distanceToModelLineEnd:S}=(()=>{let w=f.value.substring(Math.max(f.selectionStart,f.selectionEnd)),y=w.indexOf(` +`),x=y===-1?w:w.substring(0,y),k=x.indexOf(" "),T=k===-1?x.length:x.length-k-1,N=g.getEndPosition(),M=Math.min(this._context.viewModel.model.getLineMaxColumn(N.lineNumber)-N.column,T);return{distanceToModelLineEnd:this._context.viewModel.model.getLineMaxColumn(N.lineNumber)-N.column-M}})();this._context.viewModel.revealRange("keyboard",!0,P.fromPositions(this._selections[0].getStartPosition()),0,1),this._visibleTextArea=new SM(this._context,g.startLineNumber,m,C,S),this.textArea.setAttribute("wrap",this._textAreaWrapping&&!this._visibleTextArea?"on":"off"),this._visibleTextArea.prepareRender(this._visibleRangeProvider),this._render(),this.textArea.setClassName(`inputarea ${Bc} ime-input`),this._viewController.compositionStart(),this._context.viewModel.onCompositionStart()})),this._register(this._textAreaInput.onCompositionUpdate(u=>{this._visibleTextArea&&(this._visibleTextArea.prepareRender(this._visibleRangeProvider),this._render())})),this._register(this._textAreaInput.onCompositionEnd(()=>{this._visibleTextArea=null,this.textArea.setAttribute("wrap",this._textAreaWrapping&&!this._visibleTextArea?"on":"off"),this._render(),this.textArea.setClassName(`inputarea ${Bc}`),this._viewController.compositionEnd(),this._context.viewModel.onCompositionEnd()})),this._register(this._textAreaInput.onFocus(()=>{this._context.viewModel.setHasFocus(!0)})),this._register(this._textAreaInput.onBlur(()=>{this._context.viewModel.setHasFocus(!1)})),this._register(af.onDidChange(()=>{this._ensureReadOnlyAttribute()}))}writeScreenReaderContent(e){this._textAreaInput.writeNativeTextAreaContent(e)}dispose(){super.dispose()}_getAndroidWordAtPosition(e){let t='`~!@#$%^&*()-=+[{]}\\|;:",.<>/?',i=this._context.viewModel.getLineContent(e.lineNumber),o=xl(t,[]),s=!0,r=e.column,a=!0,l=e.column,c=0;for(;c<50&&(s||a);){if(s&&r<=1&&(s=!1),s){let d=i.charCodeAt(r-2);o.get(d)!==0?s=!1:r--}if(a&&l>i.length&&(a=!1),a){let d=i.charCodeAt(l-1);o.get(d)!==0?a=!1:l++}c++}return[i.substring(r-1,l-1),e.column-r]}_getWordBeforePosition(e){let t=this._context.viewModel.getLineContent(e.lineNumber),i=xl(this._context.configuration.options.get(131),[]),o=e.column,s=0;for(;o>1;){let r=t.charCodeAt(o-2);if(i.get(r)!==0||s>50)return t.substring(o-1,e.column-1);s++,o--}return t.substring(0,e.column-1)}_getCharacterBeforePosition(e){if(e.column>1){let i=this._context.viewModel.getLineContent(e.lineNumber).charAt(e.column-2);if(!pi(i.charCodeAt(0)))return i}return""}_getAriaLabel(e){var t,i,o;if(e.get(2)===1){let r=(t=this._keybindingService.lookupKeybinding("editor.action.toggleScreenReaderAccessibilityMode"))===null||t===void 0?void 0:t.getAriaLabel(),a=(i=this._keybindingService.lookupKeybinding("workbench.action.showCommands"))===null||i===void 0?void 0:i.getAriaLabel(),l=(o=this._keybindingService.lookupKeybinding("workbench.action.openGlobalKeybindings"))===null||o===void 0?void 0:o.getAriaLabel(),c=p("accessibilityModeOff","The editor is not accessible at this time.");return r?p("accessibilityOffAriaLabel","{0} To enable screen reader optimized mode, use {1}",c,r):a?p("accessibilityOffAriaLabelNoKb","{0} To enable screen reader optimized mode, open the quick pick with {1} and run the command Toggle Screen Reader Accessibility Mode, which is currently not triggerable via keyboard.",c,a):l?p("accessibilityOffAriaLabelNoKbs","{0} Please assign a keybinding for the command Toggle Screen Reader Accessibility Mode by accessing the keybindings editor with {1} and run it.",c,l):c}return e.get(4)}_setAccessibilityOptions(e){this._accessibilitySupport=e.get(2);let t=e.get(3);this._accessibilitySupport===2&&t===Ca.accessibilityPageSize.defaultValue?this._accessibilityPageSize=500:this._accessibilityPageSize=t;let o=e.get(145).wrappingColumn;if(o!==-1&&this._accessibilitySupport!==1){let s=e.get(50);this._textAreaWrapping=!0,this._textAreaWidth=Math.round(o*s.typicalHalfwidthCharacterWidth)}else this._textAreaWrapping=!1,this._textAreaWidth=yM?0:1}onConfigurationChanged(e){let t=this._context.configuration.options,i=t.get(145);this._setAccessibilityOptions(t),this._contentLeft=i.contentLeft,this._contentWidth=i.contentWidth,this._contentHeight=i.height,this._fontInfo=t.get(50),this._lineHeight=t.get(67),this._emptySelectionClipboard=t.get(37),this._copyWithSyntaxHighlighting=t.get(25),this.textArea.setAttribute("wrap",this._textAreaWrapping&&!this._visibleTextArea?"on":"off");let{tabSize:o}=this._context.viewModel.model.getOptions();return this.textArea.domNode.style.tabSize=`${o*this._fontInfo.spaceWidth}px`,this.textArea.setAttribute("aria-label",this._getAriaLabel(t)),this.textArea.setAttribute("aria-required",t.get(5)?"true":"false"),this.textArea.setAttribute("tabindex",String(t.get(124))),(e.hasChanged(34)||e.hasChanged(91))&&this._ensureReadOnlyAttribute(),e.hasChanged(2)&&this._textAreaInput.writeNativeTextAreaContent("strategy changed"),!0}onCursorStateChanged(e){return this._selections=e.selections.slice(0),this._modelSelections=e.modelSelections.slice(0),this._textAreaInput.writeNativeTextAreaContent("selection changed"),!0}onDecorationsChanged(e){return!0}onFlushed(e){return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return this._scrollLeft=e.scrollLeft,this._scrollTop=e.scrollTop,!0}onZonesChanged(e){return!0}isFocused(){return this._textAreaInput.isFocused()}focusTextArea(){this._textAreaInput.focusTextArea()}getLastRenderData(){return this._lastRenderPosition}setAriaOptions(e){e.activeDescendant?(this.textArea.setAttribute("aria-haspopup","true"),this.textArea.setAttribute("aria-autocomplete","list"),this.textArea.setAttribute("aria-activedescendant",e.activeDescendant)):(this.textArea.setAttribute("aria-haspopup","false"),this.textArea.setAttribute("aria-autocomplete","both"),this.textArea.removeAttribute("aria-activedescendant")),e.role&&this.textArea.setAttribute("role",e.role)}_ensureReadOnlyAttribute(){let e=this._context.configuration.options;!af.enabled||e.get(34)&&e.get(91)?this.textArea.setAttribute("readonly","true"):this.textArea.removeAttribute("readonly")}prepareRender(e){var t;this._primaryCursorPosition=new U(this._selections[0].positionLineNumber,this._selections[0].positionColumn),this._primaryCursorVisibleRange=e.visibleRangeForPosition(this._primaryCursorPosition),(t=this._visibleTextArea)===null||t===void 0||t.prepareRender(e)}render(e){this._textAreaInput.writeNativeTextAreaContent("render"),this._render()}_render(){var e;if(this._visibleTextArea){let o=this._visibleTextArea.visibleTextareaStart,s=this._visibleTextArea.visibleTextareaEnd,r=this._visibleTextArea.startPosition,a=this._visibleTextArea.endPosition;if(r&&a&&o&&s&&s.left>=this._scrollLeft&&o.left<=this._scrollLeft+this._contentWidth){let l=this._context.viewLayout.getVerticalOffsetForLineNumber(this._primaryCursorPosition.lineNumber)-this._scrollTop,c=this._newlinecount(this.textArea.domNode.value.substr(0,this.textArea.domNode.selectionStart)),d=this._visibleTextArea.widthOfHiddenLineTextBefore,h=this._contentLeft+o.left-this._scrollLeft,u=s.left-o.left+1;if(hthis._contentWidth&&(u=this._contentWidth);let f=this._context.viewModel.getViewLineData(r.lineNumber),g=f.tokens.findTokenIndexAtOffset(r.column-1),m=f.tokens.findTokenIndexAtOffset(a.column-1),C=g===m,S=this._visibleTextArea.definePresentation(C?f.tokens.getPresentation(g):null);this.textArea.domNode.scrollTop=c*this._lineHeight,this.textArea.domNode.scrollLeft=d,this._doRender({lastRenderPosition:null,top:l,left:h,width:u,height:this._lineHeight,useCover:!1,color:(Bt.getColorMap()||[])[S.foreground],italic:S.italic,bold:S.bold,underline:S.underline,strikethrough:S.strikethrough})}return}if(!this._primaryCursorVisibleRange){this._renderAtTopLeft();return}let t=this._contentLeft+this._primaryCursorVisibleRange.left-this._scrollLeft;if(tthis._contentLeft+this._contentWidth){this._renderAtTopLeft();return}let i=this._context.viewLayout.getVerticalOffsetForLineNumber(this._selections[0].positionLineNumber)-this._scrollTop;if(i<0||i>this._contentHeight){this._renderAtTopLeft();return}if(Be||this._accessibilitySupport===2){this._doRender({lastRenderPosition:this._primaryCursorPosition,top:i,left:this._textAreaWrapping?this._contentLeft:t,width:this._textAreaWidth,height:this._lineHeight,useCover:!1}),this.textArea.domNode.scrollLeft=this._primaryCursorVisibleRange.left;let o=(e=this._textAreaInput.textAreaState.newlineCountBeforeSelection)!==null&&e!==void 0?e:this._newlinecount(this.textArea.domNode.value.substr(0,this.textArea.domNode.selectionStart));this.textArea.domNode.scrollTop=o*this._lineHeight;return}this._doRender({lastRenderPosition:this._primaryCursorPosition,top:i,left:this._textAreaWrapping?this._contentLeft:t,width:this._textAreaWidth,height:yM?0:1,useCover:!1})}_newlinecount(e){let t=0,i=-1;do{if(i=e.indexOf(` +`,i+1),i===-1)break;t++}while(!0);return t}_renderAtTopLeft(){this._doRender({lastRenderPosition:null,top:0,left:0,width:this._textAreaWidth,height:yM?0:1,useCover:!0})}_doRender(e){this._lastRenderPosition=e.lastRenderPosition;let t=this.textArea,i=this.textAreaCover;Si(t,this._fontInfo),t.setTop(e.top),t.setLeft(e.left),t.setWidth(e.width),t.setHeight(e.height),t.setColor(e.color?Z.Format.CSS.formatHex(e.color):""),t.setFontStyle(e.italic?"italic":""),e.bold&&t.setFontWeight("bold"),t.setTextDecoration(`${e.underline?" underline":""}${e.strikethrough?" line-through":""}`),i.setTop(e.useCover?e.top:0),i.setLeft(e.useCover?e.left:0),i.setWidth(e.useCover?e.width:0),i.setHeight(e.useCover?e.height:0);let o=this._context.configuration.options;o.get(57)?i.setClassName("monaco-editor-background textAreaCover "+fh.OUTER_CLASS_NAME):o.get(68).renderType!==0?i.setClassName("monaco-editor-background textAreaCover "+rf.CLASS_NAME):i.setClassName("monaco-editor-background textAreaCover")}};wx=NG([hW(3,fi),hW(4,Ye)],wx);function AG(n,e,t,i){if(e.length===0)return 0;let o=n.createElement("div");o.style.position="absolute",o.style.top="-50000px",o.style.width="50000px";let s=n.createElement("span");Si(s,t),s.style.whiteSpace="pre",s.style.tabSize=`${i*t.spaceWidth}px`,s.append(e),o.appendChild(s),n.body.appendChild(o);let r=s.offsetWidth;return n.body.removeChild(o),r}_();v();b();_();v();b();Ge();ps();xi();Ud();Or();_();v();b();_();v();b();ft();Ke();Kn();Su();Ka();xM();var RG=()=>!0,PG=()=>!1,OG=n=>n===" "||n===" ",Wc=class{static shouldRecreate(e){return e.hasChanged(145)||e.hasChanged(131)||e.hasChanged(37)||e.hasChanged(77)||e.hasChanged(79)||e.hasChanged(80)||e.hasChanged(6)||e.hasChanged(7)||e.hasChanged(11)||e.hasChanged(9)||e.hasChanged(10)||e.hasChanged(14)||e.hasChanged(128)||e.hasChanged(50)||e.hasChanged(91)||e.hasChanged(130)}constructor(e,t,i,o){var s;this.languageConfigurationService=o,this._cursorMoveConfigurationBrand=void 0,this._languageId=e;let r=i.options,a=r.get(145),l=r.get(50);this.readOnly=r.get(91),this.tabSize=t.tabSize,this.indentSize=t.indentSize,this.insertSpaces=t.insertSpaces,this.stickyTabStops=r.get(116),this.lineHeight=l.lineHeight,this.typicalHalfwidthCharacterWidth=l.typicalHalfwidthCharacterWidth,this.pageSize=Math.max(1,Math.floor(a.height/this.lineHeight)-2),this.useTabStops=r.get(128),this.wordSeparators=r.get(131),this.emptySelectionClipboard=r.get(37),this.copyWithSyntaxHighlighting=r.get(25),this.multiCursorMergeOverlapping=r.get(77),this.multiCursorPaste=r.get(79),this.multiCursorLimit=r.get(80),this.autoClosingBrackets=r.get(6),this.autoClosingComments=r.get(7),this.autoClosingQuotes=r.get(11),this.autoClosingDelete=r.get(9),this.autoClosingOvertype=r.get(10),this.autoSurround=r.get(14),this.autoIndent=r.get(12),this.wordSegmenterLocales=r.get(130),this.surroundingPairs={},this._electricChars=null,this.shouldAutoCloseBefore={quote:this._getShouldAutoClose(e,this.autoClosingQuotes,!0),comment:this._getShouldAutoClose(e,this.autoClosingComments,!1),bracket:this._getShouldAutoClose(e,this.autoClosingBrackets,!1)},this.autoClosingPairs=this.languageConfigurationService.getLanguageConfiguration(e).getAutoClosingPairs();let c=this.languageConfigurationService.getLanguageConfiguration(e).getSurroundingPairs();if(c)for(let h of c)this.surroundingPairs[h.open]=h.close;let d=this.languageConfigurationService.getLanguageConfiguration(e).comments;this.blockCommentStartToken=(s=d?.blockCommentStartToken)!==null&&s!==void 0?s:null}get electricChars(){var e;if(!this._electricChars){this._electricChars={};let t=(e=this.languageConfigurationService.getLanguageConfiguration(this._languageId).electricCharacter)===null||e===void 0?void 0:e.getElectricCharacters();if(t)for(let i of t)this._electricChars[i]=!0}return this._electricChars}onElectricCharacter(e,t,i){let o=Kd(t,i-1),s=this.languageConfigurationService.getLanguageConfiguration(o.languageId).electricCharacter;return s?s.onElectricCharacter(e,o,i-o.firstCharOffset):null}normalizeIndentation(e){return yx(e,this.indentSize,this.insertSpaces)}_getShouldAutoClose(e,t,i){switch(t){case"beforeWhitespace":return OG;case"languageDefined":return this._getLanguageDefinedShouldAutoClose(e,i);case"always":return RG;case"never":return PG}}_getLanguageDefinedShouldAutoClose(e,t){let i=this.languageConfigurationService.getLanguageConfiguration(e).getAutoCloseBeforeSet(t);return o=>i.indexOf(o)!==-1}visibleColumnFromColumn(e,t){return oi.visibleColumnFromColumn(e.getLineContent(t.lineNumber),t.column,this.tabSize)}columnFromVisibleColumn(e,t,i){let o=oi.columnFromVisibleColumn(e.getLineContent(t),i,this.tabSize),s=e.getLineMinColumn(t);if(or?r:o}},mt=class n{static fromModelState(e){return new LM(e)}static fromViewState(e){return new kM(e)}static fromModelSelection(e){let t=nt.liftSelection(e),i=new Ji(P.fromPositions(t.getSelectionStart()),0,0,t.getPosition(),0);return n.fromModelState(i)}static fromModelSelections(e){let t=[];for(let i=0,o=e.length;is,c=o>r,d=or||So||C0&&o--,n.columnSelect(e,t,i.fromViewLineNumber,i.fromViewVisualColumn,i.toViewLineNumber,o)}static columnSelectRight(e,t,i){let o=0,s=Math.min(i.fromViewLineNumber,i.toViewLineNumber),r=Math.max(i.fromViewLineNumber,i.toViewLineNumber);for(let l=s;l<=r;l++){let c=t.getLineMaxColumn(l),d=e.visibleColumnFromColumn(t,new U(l,c));o=Math.max(o,d)}let a=i.toViewVisualColumn;return ae.getLineMinColumn(t.lineNumber))return t.delta(void 0,-ET(e.getLineContent(t.lineNumber),t.column-1));if(t.lineNumber>1){let i=t.lineNumber-1;return new U(i,e.getLineMaxColumn(i))}else return t}static leftPositionAtomicSoftTabs(e,t,i){if(t.column<=e.getLineIndentColumn(t.lineNumber)){let o=e.getLineMinColumn(t.lineNumber),s=e.getLineContent(t.lineNumber),r=Ju.atomicPosition(s,t.column-1,i,0);if(r!==-1&&r+1>=o)return new U(t.lineNumber,r+1)}return this.leftPosition(e,t)}static left(e,t,i){let o=e.stickyTabStops?n.leftPositionAtomicSoftTabs(t,i,e.tabSize):n.leftPosition(t,i);return new pb(o.lineNumber,o.column,0)}static moveLeft(e,t,i,o,s){let r,a;if(i.hasSelection()&&!o)r=i.selection.startLineNumber,a=i.selection.startColumn;else{let l=i.position.delta(void 0,-(s-1)),c=t.normalizePosition(n.clipPositionColumn(l,t),0),d=n.left(e,t,c);r=d.lineNumber,a=d.column}return i.move(o,r,a,0)}static clipPositionColumn(e,t){return new U(e.lineNumber,n.clipRange(e.column,t.getLineMinColumn(e.lineNumber),t.getLineMaxColumn(e.lineNumber)))}static clipRange(e,t,i){return ei?i:e}static rightPosition(e,t,i){return id?(i=d,a?o=t.getLineMaxColumn(i):o=Math.min(t.getLineMaxColumn(i),o)):o=e.columnFromVisibleColumn(t,i,c),f?s=0:s=c-oi.visibleColumnFromColumn(t.getLineContent(i),o,e.tabSize),l!==void 0){let g=new U(i,o),m=t.normalizePosition(g,l);s=s+(o-m.column),i=m.lineNumber,o=m.column}return new pb(i,o,s)}static down(e,t,i,o,s,r,a){return this.vertical(e,t,i,o,s,i+r,a,4)}static moveDown(e,t,i,o,s){let r,a;i.hasSelection()&&!o?(r=i.selection.endLineNumber,a=i.selection.endColumn):(r=i.position.lineNumber,a=i.position.column);let l=0,c;do if(c=n.down(e,t,r+l,a,i.leftoverVisibleColumns,s,!0),t.normalizePosition(new U(c.lineNumber,c.column),2).lineNumber>r)break;while(l++<10&&r+l1&&this._isBlankLine(t,s);)s--;for(;s>1&&!this._isBlankLine(t,s);)s--;return i.move(o,s,t.getLineMinColumn(s),0)}static moveToNextBlankLine(e,t,i,o){let s=t.getLineCount(),r=i.position.lineNumber;for(;r=u.length+1)return!1;let f=u.charAt(h.column-2),g=o.get(f);if(!g)return!1;if(Vl(f)){if(i==="never")return!1}else if(t==="never")return!1;let m=u.charAt(h.column-1),C=!1;for(let S of g)S.open===f&&S.close===m&&(C=!0);if(!C)return!1;if(e==="auto"){let S=!1;for(let w=0,y=a.length;w1){let s=t.getLineContent(o.lineNumber),r=Ri(s),a=r===-1?s.length+1:r+1;if(o.column<=a){let l=i.visibleColumnFromColumn(t,o),c=oi.prevIndentTabStop(l,i.indentSize),d=i.columnFromVisibleColumn(t,o.lineNumber,c);return new P(o.lineNumber,d,o.lineNumber,o.column)}}return P.fromPositions(n.getPositionAfterDeleteLeft(o,t),o)}static getPositionAfterDeleteLeft(e,t){if(e.column>1){let i=u7(e.column-1,t.getLineContent(e.lineNumber));return e.with(void 0,i+1)}else if(e.lineNumber>1){let i=e.lineNumber-1;return new U(i,t.getLineMaxColumn(i))}else return e}static cut(e,t,i){let o=[],s=null;i.sort((r,a)=>U.compare(r.getStartPosition(),a.getEndPosition()));for(let r=0,a=i.length;r1&&s?.endLineNumber!==c.lineNumber?(d=c.lineNumber-1,h=t.getLineMaxColumn(c.lineNumber-1),u=c.lineNumber,f=t.getLineMaxColumn(c.lineNumber)):(d=c.lineNumber,h=1,u=c.lineNumber,f=t.getLineMaxColumn(c.lineNumber));let g=new P(d,h,u,f);s=g,g.isEmpty()?o[r]=null:o[r]=new ho(g,"")}else o[r]=null;else o[r]=new ho(l,"")}return new Pn(0,o,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!0})}};_();v();b();xi();_();v();b();ot();W0();ft();Ke();var uo=class n{static _createWord(e,t,i,o,s){return{start:o,end:s,wordType:t,nextCharClass:i}}static _createIntlWord(e,t){return{start:e.index,end:e.index+e.segment.length,wordType:1,nextCharClass:t}}static _findPreviousWordOnLine(e,t,i){let o=t.getLineContent(i.lineNumber);return this._doFindPreviousWordOnLine(o,e,i)}static _doFindPreviousWordOnLine(e,t,i){let o=0,s=t.findPrevIntlWordBeforeOrAtOffset(e,i.column-2);for(let r=i.column-2;r>=0;r--){let a=e.charCodeAt(r),l=t.get(a);if(s&&r===s.index)return this._createIntlWord(s,l);if(l===0){if(o===2)return this._createWord(e,o,l,r+1,this._findEndOfWord(e,t,o,r+1));o=1}else if(l===2){if(o===1)return this._createWord(e,o,l,r+1,this._findEndOfWord(e,t,o,r+1));o=2}else if(l===1&&o!==0)return this._createWord(e,o,l,r+1,this._findEndOfWord(e,t,o,r+1))}return o!==0?this._createWord(e,o,1,0,this._findEndOfWord(e,t,o,0)):null}static _findEndOfWord(e,t,i,o){let s=t.findNextIntlWordAtOrAfterOffset(e,o),r=e.length;for(let a=o;a=0;r--){let a=e.charCodeAt(r),l=t.get(a);if(s&&r===s.index)return r;if(l===1||i===1&&l===2||i===2&&l===0)return r+1}return 0}static moveWordLeft(e,t,i,o){let s=i.lineNumber,r=i.column;r===1&&s>1&&(s=s-1,r=t.getLineMaxColumn(s));let a=n._findPreviousWordOnLine(e,t,new U(s,r));if(o===0)return new U(s,a?a.start+1:1);if(o===1)return a&&a.wordType===2&&a.end-a.start===1&&a.nextCharClass===0&&(a=n._findPreviousWordOnLine(e,t,new U(s,a.start+1))),new U(s,a?a.start+1:1);if(o===3){for(;a&&a.wordType===2;)a=n._findPreviousWordOnLine(e,t,new U(s,a.start+1));return new U(s,a?a.start+1:1)}return a&&r<=a.end+1&&(a=n._findPreviousWordOnLine(e,t,new U(s,a.start+1))),new U(s,a?a.end+1:1)}static _moveWordPartLeft(e,t){let i=t.lineNumber,o=e.getLineMaxColumn(i);if(t.column===1)return i>1?new U(i-1,e.getLineMaxColumn(i-1)):t;let s=e.getLineContent(i);for(let r=t.column-1;r>1;r--){let a=s.charCodeAt(r-2),l=s.charCodeAt(r-1);if(a===95&&l!==95)return new U(i,r);if(a===45&&l!==45)return new U(i,r);if((au(a)||Z_(a))&&ml(l))return new U(i,r);if(ml(a)&&ml(l)&&r+1=l.start+1&&(l=n._findNextWordOnLine(e,t,new U(s,l.end+1))),l?r=l.start+1:r=t.getLineMaxColumn(s);return new U(s,r)}static _moveWordPartRight(e,t){let i=t.lineNumber,o=e.getLineMaxColumn(i);if(t.column===o)return i1?c=1:(l--,c=o.getLineMaxColumn(l)):(d&&c<=d.end+1&&(d=n._findPreviousWordOnLine(i,o,new U(l,d.start+1))),d?c=d.end+1:c>1?c=1:(l--,c=o.getLineMaxColumn(l))),new P(l,c,a.lineNumber,a.column)}static deleteInsideWord(e,t,i){if(!i.isEmpty())return i;let o=new U(i.positionLineNumber,i.positionColumn),s=this._deleteInsideWordWhitespace(t,o);return s||this._deleteInsideWordDetermineDeleteRange(e,t,o)}static _charAtIsWhitespace(e,t){let i=e.charCodeAt(t);return i===32||i===9}static _deleteInsideWordWhitespace(e,t){let i=e.getLineContent(t.lineNumber),o=i.length;if(o===0)return null;let s=Math.max(t.column-2,0);if(!this._charAtIsWhitespace(i,s))return null;let r=Math.min(t.column-1,o-1);if(!this._charAtIsWhitespace(i,r))return null;for(;s>0&&this._charAtIsWhitespace(i,s-1);)s--;for(;r+11?new P(i.lineNumber-1,t.getLineMaxColumn(i.lineNumber-1),i.lineNumber,1):i.lineNumberh.start+1<=i.column&&i.column<=h.end+1,a=(h,u)=>(h=Math.min(h,i.column),u=Math.max(u,i.column),new P(i.lineNumber,h,i.lineNumber,u)),l=h=>{let u=h.start+1,f=h.end+1,g=!1;for(;f-11&&this._charAtIsWhitespace(o,u-2);)u--;return a(u,f)},c=n._findPreviousWordOnLine(e,t,i);if(c&&r(c))return l(c);let d=n._findNextWordOnLine(e,t,i);return d&&r(d)?l(d):c&&d?a(c.end+1,d.start+1):c?a(c.start+1,c.end+1):d?a(d.start+1,d.end+1):a(1,s+1)}static _deleteWordPartLeft(e,t){if(!t.isEmpty())return t;let i=t.getPosition(),o=n._moveWordPartLeft(e,i);return new P(i.lineNumber,i.column,o.lineNumber,o.column)}static _findFirstNonWhitespaceChar(e,t){let i=e.length;for(let o=t;o=u.start+1&&(u=n._findNextWordOnLine(i,o,new U(l,u.end+1))),u?c=u.start+1:c!!e)}ft();Ke();var On=class{static addCursorDown(e,t,i){let o=[],s=0;for(let r=0,a=t.length;rc&&(d=c,h=e.model.getLineMaxColumn(d)),mt.fromModelState(new Ji(new P(r.lineNumber,1,d,h),2,0,new U(d,h),0))}let l=t.modelState.selectionStart.getStartPosition().lineNumber;if(r.lineNumberl){let c=e.getLineCount(),d=a.lineNumber+1,h=1;return d>c&&(d=c,h=e.getLineMaxColumn(d)),mt.fromViewState(t.viewState.move(!0,d,h,0))}else{let c=t.modelState.selectionStart.getEndPosition();return mt.fromModelState(t.modelState.move(!0,c.lineNumber,c.column,0))}}static word(e,t,i,o){let s=e.model.validatePosition(o);return mt.fromModelState(uo.word(e.cursorConfig,e.model,t.modelState,i,s))}static cancelSelection(e,t){if(!t.modelState.hasSelection())return new mt(t.modelState,t.viewState);let i=t.viewState.position.lineNumber,o=t.viewState.position.column;return mt.fromViewState(new Ji(new P(i,o,i,o),0,0,new U(i,o),0))}static moveTo(e,t,i,o,s){if(i){if(t.modelState.selectionStartKind===1)return this.word(e,t,i,o);if(t.modelState.selectionStartKind===2)return this.line(e,t,i,o,s)}let r=e.model.validatePosition(o),a=s?e.coordinatesConverter.validateViewPosition(new U(s.lineNumber,s.column),r):e.coordinatesConverter.convertModelPositionToViewPosition(r);return mt.fromViewState(t.viewState.move(i,a.lineNumber,a.column,0))}static simpleMove(e,t,i,o,s,r){switch(i){case 0:return r===4?this._moveHalfLineLeft(e,t,o):this._moveLeft(e,t,o,s);case 1:return r===4?this._moveHalfLineRight(e,t,o):this._moveRight(e,t,o,s);case 2:return r===2?this._moveUpByViewLines(e,t,o,s):this._moveUpByModelLines(e,t,o,s);case 3:return r===2?this._moveDownByViewLines(e,t,o,s):this._moveDownByModelLines(e,t,o,s);case 4:return r===2?t.map(a=>mt.fromViewState(Ti.moveToPrevBlankLine(e.cursorConfig,e,a.viewState,o))):t.map(a=>mt.fromModelState(Ti.moveToPrevBlankLine(e.cursorConfig,e.model,a.modelState,o)));case 5:return r===2?t.map(a=>mt.fromViewState(Ti.moveToNextBlankLine(e.cursorConfig,e,a.viewState,o))):t.map(a=>mt.fromModelState(Ti.moveToNextBlankLine(e.cursorConfig,e.model,a.modelState,o)));case 6:return this._moveToViewMinColumn(e,t,o);case 7:return this._moveToViewFirstNonWhitespaceColumn(e,t,o);case 8:return this._moveToViewCenterColumn(e,t,o);case 9:return this._moveToViewMaxColumn(e,t,o);case 10:return this._moveToViewLastNonWhitespaceColumn(e,t,o);default:return null}}static viewportMove(e,t,i,o,s){let r=e.getCompletelyVisibleViewRange(),a=e.coordinatesConverter.convertViewRangeToModelRange(r);switch(i){case 11:{let l=this._firstLineNumberInRange(e.model,a,s),c=e.model.getLineFirstNonWhitespaceColumn(l);return[this._moveToModelPosition(e,t[0],o,l,c)]}case 13:{let l=this._lastLineNumberInRange(e.model,a,s),c=e.model.getLineFirstNonWhitespaceColumn(l);return[this._moveToModelPosition(e,t[0],o,l,c)]}case 12:{let l=Math.round((a.startLineNumber+a.endLineNumber)/2),c=e.model.getLineFirstNonWhitespaceColumn(l);return[this._moveToModelPosition(e,t[0],o,l,c)]}case 14:{let l=[];for(let c=0,d=t.length;ci.endLineNumber-1?r=i.endLineNumber-1:smt.fromViewState(Ti.moveLeft(e.cursorConfig,e,s.viewState,i,o)))}static _moveHalfLineLeft(e,t,i){let o=[];for(let s=0,r=t.length;smt.fromViewState(Ti.moveRight(e.cursorConfig,e,s.viewState,i,o)))}static _moveHalfLineRight(e,t,i){let o=[];for(let s=0,r=t.length;s1&&o.firstCharOffset===0){let m=qd(e,t.startLineNumber-1);m.languageId===o.languageId&&(c=m.getLineContent())}let d=s.onEnter(n,c,a,l);if(!d)return null;let h=d.indentAction,u=d.appendText,f=d.removeText||0;u?h===Vi.Indent&&(u=" "+u):h===Vi.Indent||h===Vi.IndentOutdent?u=" ":u="";let g=Vy(e,t.startLineNumber,t.startColumn);return f&&(g=g.substring(0,g.length-f)),{indentAction:h,appendText:u,removeText:f,indentation:g}}lr();var FG=function(n,e,t,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},BG=function(n,e){return function(t,i){e(t,i,n)}},Lx,DM=Object.create(null);function df(n,e){if(e<=0)return"";DM[n]||(DM[n]=["",n]);let t=DM[n];for(let i=t.length;i<=e;i++)t[i]=t[i-1]+n;return t[e]}var mh=Lx=class{static unshiftIndent(e,t,i,o,s){let r=oi.visibleColumnFromColumn(e,t,i);if(s){let a=df(" ",o),c=oi.prevIndentTabStop(r,o)/o;return df(a,c)}else{let a=" ",c=oi.prevRenderTabStop(r,i)/i;return df(a,c)}}static shiftIndent(e,t,i,o,s){let r=oi.visibleColumnFromColumn(e,t,i);if(s){let a=df(" ",o),c=oi.nextIndentTabStop(r,o)/o;return df(a,c)}else{let a=" ",c=oi.nextRenderTabStop(r,i)/i;return df(a,c)}}constructor(e,t,i){this._languageConfigurationService=i,this._opts=t,this._selection=e,this._selectionId=null,this._useLastEditRangeForCursorEndPosition=!1,this._selectionStartColumnStaysPut=!1}_addEditOperation(e,t,i){this._useLastEditRangeForCursorEndPosition?e.addTrackedEditOperation(t,i):e.addEditOperation(t,i)}getEditOperations(e,t){let i=this._selection.startLineNumber,o=this._selection.endLineNumber;this._selection.endColumn===1&&i!==o&&(o=o-1);let{tabSize:s,indentSize:r,insertSpaces:a}=this._opts,l=i===o;if(this._opts.useTabStops){this._selection.isEmpty()&&/^\s*$/.test(e.getLineContent(i))&&(this._useLastEditRangeForCursorEndPosition=!0);let c=0,d=0;for(let h=i;h<=o;h++,c=d){d=0;let u=e.getLineContent(h),f=Ri(u);if(this._opts.isUnshift&&(u.length===0||f===0)||!l&&!this._opts.isUnshift&&u.length===0)continue;if(f===-1&&(f=u.length),h>1&&oi.visibleColumnFromColumn(u,f+1,s)%r!==0&&e.tokenization.isCheapToTokenize(h-1)){let C=bb(this._opts.autoIndent,e,new P(h-1,e.getLineMaxColumn(h-1),h-1,e.getLineMaxColumn(h-1)),this._languageConfigurationService);if(C){if(d=c,C.appendText)for(let S=0,w=C.appendText.length;S1){let o,s=-1;for(o=e-1;o>=1;o--){if(n.tokenization.getLanguageIdAtPosition(o,0)!==i)return s;let r=n.getLineContent(o);if(t.shouldIgnore(r)||/^\s+$/.test(r)||r===""){s=o;continue}return o}}return-1}function vb(n,e,t,i=!0,o){if(n<4)return null;let s=o.getLanguageConfiguration(e.tokenization.getLanguageId()).indentRulesSupport;if(!s)return null;if(t<=1)return{indentation:"",action:null};for(let l=t-1;l>0&&e.getLineContent(l)==="";l--)if(l===1)return{indentation:"",action:null};let r=WG(e,t,s);if(r<0)return null;if(r<1)return{indentation:"",action:null};let a=e.getLineContent(r);if(s.shouldIncrease(a)||s.shouldIndentNextLine(a))return{indentation:jn(a),action:Vi.Indent,line:r};if(s.shouldDecrease(a))return{indentation:jn(a),action:null,line:r};{if(r===1)return{indentation:jn(e.getLineContent(r)),action:null,line:r};let l=r-1,c=s.getIndentMetadata(e.getLineContent(l));if(!(c&3)&&c&4){let d=0;for(let h=l-1;h>0;h--)if(!s.shouldIndentNextLine(e.getLineContent(h))){d=h;break}return{indentation:jn(e.getLineContent(d+1)),action:null,line:d+1}}if(i)return{indentation:jn(e.getLineContent(r)),action:null,line:r};for(let d=r;d>0;d--){let h=e.getLineContent(d);if(s.shouldIncrease(h))return{indentation:jn(h),action:Vi.Indent,line:d};if(s.shouldIndentNextLine(h)){let u=0;for(let f=d-1;f>0;f--)if(!s.shouldIndentNextLine(e.getLineContent(d))){u=f;break}return{indentation:jn(e.getLineContent(u+1)),action:null,line:u+1}}else if(s.shouldDecrease(h))return{indentation:jn(h),action:null,line:d}}return{indentation:jn(e.getLineContent(1)),action:null,line:1}}}function HEe(n,e,t,i,o,s){if(n<4)return null;let r=s.getLanguageConfiguration(t);if(!r)return null;let a=s.getLanguageConfiguration(t).indentRulesSupport;if(!a)return null;let l=vb(n,e,i,void 0,s),c=e.getLineContent(i);if(l){let d=l.line;if(d!==void 0){let h=!0;for(let u=d;u0&&s.getLanguageId(0)!==r.languageId?(l=!0,c=a.substr(0,t.startColumn-1-r.firstCharOffset)):c=s.getLineContent().substring(0,t.startColumn-1);let d;t.isEmpty()?d=a.substr(t.startColumn-1-r.firstCharOffset):d=qd(e,t.endLineNumber,t.endColumn).getLineContent().substr(t.endColumn-1-r.firstCharOffset);let h=o.getLanguageConfiguration(r.languageId).indentRulesSupport;if(!h)return null;let u=c,f=jn(c),g={tokenization:{getLineTokens:w=>e.tokenization.getLineTokens(w),getLanguageId:()=>e.getLanguageId(),getLanguageIdAtPosition:(w,y)=>e.getLanguageIdAtPosition(w,y)},getLineContent:w=>w===t.startLineNumber?u:e.getLineContent(w)},m=jn(s.getLineContent()),C=vb(n,g,t.startLineNumber+1,void 0,o);if(!C){let w=l?m:f;return{beforeEnter:w,afterEnter:w}}let S=l?m:C.indentation;return C.action===Vi.Indent&&(S=i.shiftIndent(S)),h.shouldDecrease(d)&&(S=i.unshiftIndent(S)),{beforeEnter:l?m:f,afterEnter:S}}function mW(n,e,t,i,o,s){if(n<4)return null;let r=qd(e,t.startLineNumber,t.startColumn);if(r.firstCharOffset)return null;let a=s.getLanguageConfiguration(r.languageId).indentRulesSupport;if(!a)return null;let l=r.getLineContent(),c=l.substr(0,t.startColumn-1-r.firstCharOffset),d;if(t.isEmpty()?d=l.substr(t.startColumn-1-r.firstCharOffset):d=qd(e,t.endLineNumber,t.endColumn).getLineContent().substr(t.endColumn-1-r.firstCharOffset),!a.shouldDecrease(c+d)&&a.shouldDecrease(c+i+d)){let h=vb(n,e,t.startLineNumber,!1,s);if(!h)return null;let u=h.indentation;return h.action!==Vi.Indent&&(u=o.unshiftIndent(u)),u}return null}function UEe(n,e,t){let i=t.getLanguageConfiguration(n.getLanguageId()).indentRulesSupport;return!i||e<1||e>n.getLineCount()?null:i.getIndentMetadata(n.getLineContent(e))}var ta=class n{static indent(e,t,i){if(t===null||i===null)return[];let o=[];for(let s=0,r=i.length;s1){let a;for(a=i-1;a>=1;a--){let d=t.getLineContent(a);if(Os(d)>=0)break}if(a<1)return null;let l=t.getLineMaxColumn(a),c=bb(e.autoIndent,t,new P(a,l,a,l),e.languageConfigurationService);c&&(s=c.indentation+c.appendText)}return o&&(o===Vi.Indent&&(s=n.shiftIndent(e,s)),o===Vi.Outdent&&(s=n.unshiftIndent(e,s)),s=e.normalizeIndentation(s)),s||null}static _replaceJumpToNextIndent(e,t,i,o){let s="",r=i.getStartPosition();if(e.insertSpaces){let a=e.visibleColumnFromColumn(t,r),l=e.indentSize,c=l-a%l;for(let d=0;dthis._compositionType(i,d,s,r,a,l));return new Pn(4,c,{shouldPushStackElementBefore:Ex(e,4),shouldPushStackElementAfter:!1})}static _compositionType(e,t,i,o,s,r){if(!t.isEmpty())return null;let a=t.getPosition(),l=Math.max(1,a.column-o),c=Math.min(e.getLineMaxColumn(a.lineNumber),a.column+s),d=new P(a.lineNumber,l,a.lineNumber,c);return e.getValueInRange(d)===i&&r===0?null:new cf(d,i,0,r)}static _typeCommand(e,t,i){return i?new lf(e,t,!0):new ho(e,t,!0)}static _enter(e,t,i,o){if(e.autoIndent===0)return n._typeCommand(o,` +`,i);if(!t.tokenization.isCheapToTokenize(o.getStartPosition().lineNumber)||e.autoIndent===1){let l=t.getLineContent(o.startLineNumber),c=jn(l).substring(0,o.startColumn-1);return n._typeCommand(o,` +`+e.normalizeIndentation(c),i)}let s=bb(e.autoIndent,t,o,e.languageConfigurationService);if(s){if(s.indentAction===Vi.None)return n._typeCommand(o,` +`+e.normalizeIndentation(s.indentation+s.appendText),i);if(s.indentAction===Vi.Indent)return n._typeCommand(o,` +`+e.normalizeIndentation(s.indentation+s.appendText),i);if(s.indentAction===Vi.IndentOutdent){let l=e.normalizeIndentation(s.indentation),c=e.normalizeIndentation(s.indentation+s.appendText),d=` +`+c+` +`+l;return i?new lf(o,d,!0):new cf(o,d,-1,c.length-l.length,!0)}else if(s.indentAction===Vi.Outdent){let l=n.unshiftIndent(e,s.indentation);return n._typeCommand(o,` +`+e.normalizeIndentation(l+s.appendText),i)}}let r=t.getLineContent(o.startLineNumber),a=jn(r).substring(0,o.startColumn-1);if(e.autoIndent>=4){let l=gW(e.autoIndent,t,o,{unshiftIndent:c=>n.unshiftIndent(e,c),shiftIndent:c=>n.shiftIndent(e,c),normalizeIndentation:c=>e.normalizeIndentation(c)},e.languageConfigurationService);if(l){let c=e.visibleColumnFromColumn(t,o.getEndPosition()),d=o.endColumn,h=t.getLineContent(o.endLineNumber),u=Ri(h);if(u>=0?o=o.setEndPosition(o.endLineNumber,Math.max(o.endColumn,u+1)):o=o.setEndPosition(o.endLineNumber,t.getLineMaxColumn(o.endLineNumber)),i)return new lf(o,` +`+e.normalizeIndentation(l.afterEnter),!0);{let f=0;return d<=u+1&&(e.insertSpaces||(c=Math.ceil(c/e.indentSize)),f=Math.min(c+1-e.normalizeIndentation(l.afterEnter).length-1,0)),new cf(o,` +`+e.normalizeIndentation(l.afterEnter),0,f,!0)}}}return n._typeCommand(o,` +`+e.normalizeIndentation(a),i)}static _isAutoIndentType(e,t,i){if(e.autoIndent<4)return!1;for(let o=0,s=i.length;on.shiftIndent(e,a),unshiftIndent:a=>n.unshiftIndent(e,a)},e.languageConfigurationService);if(r===null)return null;if(r!==e.normalizeIndentation(s)){let a=t.getLineFirstNonWhitespaceColumn(i.startLineNumber);return a===0?n._typeCommand(new P(i.startLineNumber,1,i.endLineNumber,i.endColumn),e.normalizeIndentation(r)+o,!1):n._typeCommand(new P(i.startLineNumber,1,i.endLineNumber,i.endColumn),e.normalizeIndentation(r)+t.getLineContent(i.startLineNumber).substring(a-1,i.startColumn-1)+o,!1)}return null}static _isAutoClosingOvertype(e,t,i,o,s){if(e.autoClosingOvertype==="never"||!e.autoClosingPairs.autoClosingPairsCloseSingleChar.has(s))return!1;for(let r=0,a=i.length;r2?d.charCodeAt(c.column-2):0)===92&&u)return!1;if(e.autoClosingOvertype==="auto"){let g=!1;for(let m=0,C=o.length;mt.startsWith(l.open)),a=s.some(l=>t.startsWith(l.close));return!r&&a}static _findAutoClosingPairOpen(e,t,i,o){let s=e.autoClosingPairs.autoClosingPairsOpenByEnd.get(o);if(!s)return null;let r=null;for(let a of s)if(r===null||a.open.length>r.open.length){let l=!0;for(let c of i)if(t.getValueInRange(new P(c.lineNumber,c.column-a.open.length+1,c.lineNumber,c.column))+o!==a.open){l=!1;break}l&&(r=a)}return r}static _findContainedAutoClosingPair(e,t){if(t.open.length<=1)return null;let i=t.close.charAt(t.close.length-1),o=e.autoClosingPairs.autoClosingPairsCloseByEnd.get(i)||[],s=null;for(let r of o)r.open!==t.open&&t.open.includes(r.open)&&t.close.endsWith(r.close)&&(!s||r.open.length>s.open.length)&&(s=r);return s}static _getAutoClosingPairClose(e,t,i,o,s){for(let g of i)if(!g.isEmpty())return null;let r=i.map(g=>{let m=g.getPosition();return s?{lineNumber:m.lineNumber,beforeColumn:m.column-o.length,afterColumn:m.column}:{lineNumber:m.lineNumber,beforeColumn:m.column,afterColumn:m.column}}),a=this._findAutoClosingPairOpen(e,t,r.map(g=>new U(g.lineNumber,g.beforeColumn)),o);if(!a)return null;let l,c;if(Vl(o)?(l=e.autoClosingQuotes,c=e.shouldAutoCloseBefore.quote):(e.blockCommentStartToken?a.open.includes(e.blockCommentStartToken):!1)?(l=e.autoClosingComments,c=e.shouldAutoCloseBefore.comment):(l=e.autoClosingBrackets,c=e.shouldAutoCloseBefore.bracket),l==="never")return null;let h=this._findContainedAutoClosingPair(e,a),u=h?h.close:"",f=!0;for(let g of r){let{lineNumber:m,beforeColumn:C,afterColumn:S}=g,w=t.getLineContent(m),y=w.substring(0,C-1),x=w.substring(S-1);if(x.startsWith(u)||(f=!1),x.length>0){let M=x.charAt(0);if(!n._isBeforeClosingBrace(e,x)&&!c(M))return null}if(a.open.length===1&&(o==="'"||o==='"')&&l!=="always"){let M=xl(e.wordSeparators,[]);if(y.length>0){let W=y.charCodeAt(y.length-1);if(M.get(W)===0)return null}}if(!t.tokenization.isCheapToTokenize(m))return null;t.tokenization.forceTokenization(m);let k=t.tokenization.getLineTokens(m),T=Kd(k,C-1);if(!a.shouldAutoClose(T,C-T.firstCharOffset))return null;let N=a.findNeutralCharacter();if(N){let M=t.tokenization.getTokenTypeIfInsertingCharacter(m,C,N);if(!a.isOK(M))return null}}return f?a.close.substring(0,a.close.length-u.length):a.close}static _runAutoClosingOpenCharType(e,t,i,o,s,r,a){let l=[];for(let c=0,d=o.length;cnew ho(new P(u.positionLineNumber,u.positionColumn,u.positionLineNumber,u.positionColumn+1),"",!1));return new Pn(4,h,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!1})}let d=this._getAutoClosingPairClose(t,i,s,l,!0);return d!==null?this._runAutoClosingOpenCharType(e,t,i,s,l,!0,d):null}static typeWithInterceptors(e,t,i,o,s,r,a){if(!e&&a===` +`){let d=[];for(let h=0,u=s.length;h{let o=t.get(Zt).getFocusedCodeEditor();return o&&o.hasTextFocus()?this._runEditorCommand(t,o,i):!1}),e.addImplementation(1e3,"generic-dom-input-textarea",(t,i)=>{let o=Bi();return o&&["input","textarea"].indexOf(o.tagName.toLowerCase())>=0?(this.runDOMCommand(o),!0):!1}),e.addImplementation(0,"generic-dom",(t,i)=>{let o=t.get(Zt).getActiveCodeEditor();return o?(o.focus(),this._runEditorCommand(t,o,i)):!1})}_runEditorCommand(e,t,i){let o=this.runEditorCommand(e,t,i);return o||!0}},ln;(function(n){class e extends _i{constructor(w){super(w),this._inSelectionMode=w.inSelectionMode}runCoreEditorCommand(w,y){if(!y.position)return;w.model.pushStackElement(),w.setCursorStates(y.source,3,[On.moveTo(w,w.getPrimaryCursorState(),this._inSelectionMode,y.position,y.viewPosition)])&&y.revealType!==2&&w.revealAllCursors(y.source,!0,!0)}}n.MoveTo=Je(new e({id:"_moveTo",inSelectionMode:!1,precondition:void 0})),n.MoveToSelect=Je(new e({id:"_moveToSelect",inSelectionMode:!0,precondition:void 0}));class t extends _i{runCoreEditorCommand(w,y){w.model.pushStackElement();let x=this._getColumnSelectResult(w,w.getPrimaryCursorState(),w.getCursorColumnSelectData(),y);x!==null&&(w.setCursorStates(y.source,3,x.viewStates.map(k=>mt.fromViewState(k))),w.setCursorColumnSelectData({isReal:!0,fromViewLineNumber:x.fromLineNumber,fromViewVisualColumn:x.fromVisualColumn,toViewLineNumber:x.toLineNumber,toViewVisualColumn:x.toVisualColumn}),x.reversed?w.revealTopMostCursor(y.source):w.revealBottomMostCursor(y.source))}}n.ColumnSelect=Je(new class extends t{constructor(){super({id:"columnSelect",precondition:void 0})}_getColumnSelectResult(S,w,y,x){if(typeof x.position>"u"||typeof x.viewPosition>"u"||typeof x.mouseColumn>"u")return null;let k=S.model.validatePosition(x.position),T=S.coordinatesConverter.validateViewPosition(new U(x.viewPosition.lineNumber,x.viewPosition.column),k),N=x.doColumnSelect?y.fromViewLineNumber:T.lineNumber,M=x.doColumnSelect?y.fromViewVisualColumn:x.mouseColumn-1;return gh.columnSelect(S.cursorConfig,S,N,M,T.lineNumber,x.mouseColumn-1)}}),n.CursorColumnSelectLeft=Je(new class extends t{constructor(){super({id:"cursorColumnSelectLeft",precondition:void 0,kbOpts:{weight:Et,kbExpr:_e.textInputFocus,primary:3599,linux:{primary:0}}})}_getColumnSelectResult(S,w,y,x){return gh.columnSelectLeft(S.cursorConfig,S,y)}}),n.CursorColumnSelectRight=Je(new class extends t{constructor(){super({id:"cursorColumnSelectRight",precondition:void 0,kbOpts:{weight:Et,kbExpr:_e.textInputFocus,primary:3601,linux:{primary:0}}})}_getColumnSelectResult(S,w,y,x){return gh.columnSelectRight(S.cursorConfig,S,y)}});class i extends t{constructor(w){super(w),this._isPaged=w.isPaged}_getColumnSelectResult(w,y,x,k){return gh.columnSelectUp(w.cursorConfig,w,x,this._isPaged)}}n.CursorColumnSelectUp=Je(new i({isPaged:!1,id:"cursorColumnSelectUp",precondition:void 0,kbOpts:{weight:Et,kbExpr:_e.textInputFocus,primary:3600,linux:{primary:0}}})),n.CursorColumnSelectPageUp=Je(new i({isPaged:!0,id:"cursorColumnSelectPageUp",precondition:void 0,kbOpts:{weight:Et,kbExpr:_e.textInputFocus,primary:3595,linux:{primary:0}}}));class o extends t{constructor(w){super(w),this._isPaged=w.isPaged}_getColumnSelectResult(w,y,x,k){return gh.columnSelectDown(w.cursorConfig,w,x,this._isPaged)}}n.CursorColumnSelectDown=Je(new o({isPaged:!1,id:"cursorColumnSelectDown",precondition:void 0,kbOpts:{weight:Et,kbExpr:_e.textInputFocus,primary:3602,linux:{primary:0}}})),n.CursorColumnSelectPageDown=Je(new o({isPaged:!0,id:"cursorColumnSelectPageDown",precondition:void 0,kbOpts:{weight:Et,kbExpr:_e.textInputFocus,primary:3596,linux:{primary:0}}}));class s extends _i{constructor(){super({id:"cursorMove",precondition:void 0,metadata:_b.metadata})}runCoreEditorCommand(w,y){let x=_b.parse(y);x&&this._runCursorMove(w,y.source,x)}_runCursorMove(w,y,x){w.model.pushStackElement(),w.setCursorStates(y,3,s._move(w,w.getCursorStates(),x)),w.revealAllCursors(y,!0)}static _move(w,y,x){let k=x.select,T=x.value;switch(x.direction){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10:return On.simpleMove(w,y,x.direction,k,T,x.unit);case 11:case 13:case 12:case 14:return On.viewportMove(w,y,x.direction,k,T);default:return null}}}n.CursorMoveImpl=s,n.CursorMove=Je(new s);class r extends _i{constructor(w){super(w),this._staticArgs=w.args}runCoreEditorCommand(w,y){let x=this._staticArgs;this._staticArgs.value===-1&&(x={direction:this._staticArgs.direction,unit:this._staticArgs.unit,select:this._staticArgs.select,value:y.pageSize||w.cursorConfig.pageSize}),w.model.pushStackElement(),w.setCursorStates(y.source,3,On.simpleMove(w,w.getCursorStates(),x.direction,x.select,x.value,x.unit)),w.revealAllCursors(y.source,!0)}}n.CursorLeft=Je(new r({args:{direction:0,unit:0,select:!1,value:1},id:"cursorLeft",precondition:void 0,kbOpts:{weight:Et,kbExpr:_e.textInputFocus,primary:15,mac:{primary:15,secondary:[288]}}})),n.CursorLeftSelect=Je(new r({args:{direction:0,unit:0,select:!0,value:1},id:"cursorLeftSelect",precondition:void 0,kbOpts:{weight:Et,kbExpr:_e.textInputFocus,primary:1039}})),n.CursorRight=Je(new r({args:{direction:1,unit:0,select:!1,value:1},id:"cursorRight",precondition:void 0,kbOpts:{weight:Et,kbExpr:_e.textInputFocus,primary:17,mac:{primary:17,secondary:[292]}}})),n.CursorRightSelect=Je(new r({args:{direction:1,unit:0,select:!0,value:1},id:"cursorRightSelect",precondition:void 0,kbOpts:{weight:Et,kbExpr:_e.textInputFocus,primary:1041}})),n.CursorUp=Je(new r({args:{direction:2,unit:2,select:!1,value:1},id:"cursorUp",precondition:void 0,kbOpts:{weight:Et,kbExpr:_e.textInputFocus,primary:16,mac:{primary:16,secondary:[302]}}})),n.CursorUpSelect=Je(new r({args:{direction:2,unit:2,select:!0,value:1},id:"cursorUpSelect",precondition:void 0,kbOpts:{weight:Et,kbExpr:_e.textInputFocus,primary:1040,secondary:[3088],mac:{primary:1040},linux:{primary:1040}}})),n.CursorPageUp=Je(new r({args:{direction:2,unit:2,select:!1,value:-1},id:"cursorPageUp",precondition:void 0,kbOpts:{weight:Et,kbExpr:_e.textInputFocus,primary:11}})),n.CursorPageUpSelect=Je(new r({args:{direction:2,unit:2,select:!0,value:-1},id:"cursorPageUpSelect",precondition:void 0,kbOpts:{weight:Et,kbExpr:_e.textInputFocus,primary:1035}})),n.CursorDown=Je(new r({args:{direction:3,unit:2,select:!1,value:1},id:"cursorDown",precondition:void 0,kbOpts:{weight:Et,kbExpr:_e.textInputFocus,primary:18,mac:{primary:18,secondary:[300]}}})),n.CursorDownSelect=Je(new r({args:{direction:3,unit:2,select:!0,value:1},id:"cursorDownSelect",precondition:void 0,kbOpts:{weight:Et,kbExpr:_e.textInputFocus,primary:1042,secondary:[3090],mac:{primary:1042},linux:{primary:1042}}})),n.CursorPageDown=Je(new r({args:{direction:3,unit:2,select:!1,value:-1},id:"cursorPageDown",precondition:void 0,kbOpts:{weight:Et,kbExpr:_e.textInputFocus,primary:12}})),n.CursorPageDownSelect=Je(new r({args:{direction:3,unit:2,select:!0,value:-1},id:"cursorPageDownSelect",precondition:void 0,kbOpts:{weight:Et,kbExpr:_e.textInputFocus,primary:1036}})),n.CreateCursor=Je(new class extends _i{constructor(){super({id:"createCursor",precondition:void 0})}runCoreEditorCommand(S,w){if(!w.position)return;let y;w.wholeLine?y=On.line(S,S.getPrimaryCursorState(),!1,w.position,w.viewPosition):y=On.moveTo(S,S.getPrimaryCursorState(),!1,w.position,w.viewPosition);let x=S.getCursorStates();if(x.length>1){let k=y.modelState?y.modelState.position:null,T=y.viewState?y.viewState.position:null;for(let N=0,M=x.length;NT&&(k=T);let N=new P(k,1,k,S.model.getLineMaxColumn(k)),M=0;if(y.at)switch(y.at){case Um.RawAtArgument.Top:M=3;break;case Um.RawAtArgument.Center:M=1;break;case Um.RawAtArgument.Bottom:M=4;break;default:break}let W=S.coordinatesConverter.convertModelRangeToViewRange(N);S.revealRange(w.source,!1,W,M,0)}}),n.SelectAll=new class extends yb{constructor(){super(d3)}runDOMCommand(S){wn&&(S.focus(),S.select()),S.ownerDocument.execCommand("selectAll")}runEditorCommand(S,w,y){let x=w._getViewModel();x&&this.runCoreEditorCommand(x,y)}runCoreEditorCommand(S,w){S.model.pushStackElement(),S.setCursorStates("keyboard",3,[On.selectAll(S,S.getPrimaryCursorState())])}},n.SetSelection=Je(new class extends _i{constructor(){super({id:"setSelection",precondition:void 0})}runCoreEditorCommand(S,w){w.selection&&(S.model.pushStackElement(),S.setCursorStates(w.source,3,[mt.fromModelSelection(w.selection)]))}})})(ln||(ln={}));var zG=Dt.and(_e.textInputFocus,_e.columnSelection);function Km(n,e){Cl.registerKeybindingRule({id:n,primary:e,when:zG,weight:Et+1})}Km(ln.CursorColumnSelectLeft.id,1039);Km(ln.CursorColumnSelectRight.id,1041);Km(ln.CursorColumnSelectUp.id,1040);Km(ln.CursorColumnSelectPageUp.id,1035);Km(ln.CursorColumnSelectDown.id,1042);Km(ln.CursorColumnSelectPageDown.id,1036);function bW(n){return n.register(),n}var vW;(function(n){class e extends yl{runEditorCommand(i,o,s){let r=o._getViewModel();r&&this.runCoreEditingCommand(o,r,s||{})}}n.CoreEditingCommand=e,n.LineBreakInsert=Je(new class extends e{constructor(){super({id:"lineBreakInsert",precondition:_e.writable,kbOpts:{weight:Et,kbExpr:_e.textInputFocus,primary:0,mac:{primary:301}}})}runCoreEditingCommand(t,i,o){t.pushUndoStop(),t.executeCommands(this.id,ta.lineBreakInsert(i.cursorConfig,i.model,i.getCursorStates().map(s=>s.modelState.selection)))}}),n.Outdent=Je(new class extends e{constructor(){super({id:"outdent",precondition:_e.writable,kbOpts:{weight:Et,kbExpr:Dt.and(_e.editorTextFocus,_e.tabDoesNotMoveFocus),primary:1026}})}runCoreEditingCommand(t,i,o){t.pushUndoStop(),t.executeCommands(this.id,ta.outdent(i.cursorConfig,i.model,i.getCursorStates().map(s=>s.modelState.selection))),t.pushUndoStop()}}),n.Tab=Je(new class extends e{constructor(){super({id:"tab",precondition:_e.writable,kbOpts:{weight:Et,kbExpr:Dt.and(_e.editorTextFocus,_e.tabDoesNotMoveFocus),primary:2}})}runCoreEditingCommand(t,i,o){t.pushUndoStop(),t.executeCommands(this.id,ta.tab(i.cursorConfig,i.model,i.getCursorStates().map(s=>s.modelState.selection))),t.pushUndoStop()}}),n.DeleteLeft=Je(new class extends e{constructor(){super({id:"deleteLeft",precondition:void 0,kbOpts:{weight:Et,kbExpr:_e.textInputFocus,primary:1,secondary:[1025],mac:{primary:1,secondary:[1025,294,257]}}})}runCoreEditingCommand(t,i,o){let[s,r]=zc.deleteLeft(i.getPrevEditOperationType(),i.cursorConfig,i.model,i.getCursorStates().map(a=>a.modelState.selection),i.getCursorAutoClosedCharacters());s&&t.pushUndoStop(),t.executeCommands(this.id,r),i.setPrevEditOperationType(2)}}),n.DeleteRight=Je(new class extends e{constructor(){super({id:"deleteRight",precondition:void 0,kbOpts:{weight:Et,kbExpr:_e.textInputFocus,primary:20,mac:{primary:20,secondary:[290,276]}}})}runCoreEditingCommand(t,i,o){let[s,r]=zc.deleteRight(i.getPrevEditOperationType(),i.cursorConfig,i.model,i.getCursorStates().map(a=>a.modelState.selection));s&&t.pushUndoStop(),t.executeCommands(this.id,r),i.setPrevEditOperationType(3)}}),n.Undo=new class extends yb{constructor(){super(_N)}runDOMCommand(t){t.ownerDocument.execCommand("undo")}runEditorCommand(t,i,o){if(!(!i.hasModel()||i.getOption(91)===!0))return i.getModel().undo()}},n.Redo=new class extends yb{constructor(){super(bN)}runDOMCommand(t){t.ownerDocument.execCommand("redo")}runEditorCommand(t,i,o){if(!(!i.hasModel()||i.getOption(91)===!0))return i.getModel().redo()}}})(vW||(vW={}));var Tx=class extends wu{constructor(e,t,i){super({id:e,precondition:void 0,metadata:i}),this._handlerId=t}runCommand(e,t){let i=e.get(Zt).getFocusedCodeEditor();i&&i.trigger("keyboard",this._handlerId,t)}};function hf(n,e){bW(new Tx("default:"+n,n)),bW(new Tx(n,n,e))}hf("type",{description:"Type",args:[{name:"args",schema:{type:"object",required:["text"],properties:{text:{type:"string"}}}}]});hf("replacePreviousChar");hf("compositionType");hf("compositionStart");hf("compositionEnd");hf("paste");hf("cut");ft();Lt();var Nx=class{constructor(e,t,i,o){this.configuration=e,this.viewModel=t,this.userInputEvents=i,this.commandDelegate=o}paste(e,t,i,o){this.commandDelegate.paste(e,t,i,o)}type(e){this.commandDelegate.type(e)}compositionType(e,t,i,o){this.commandDelegate.compositionType(e,t,i,o)}compositionStart(){this.commandDelegate.startComposition()}compositionEnd(){this.commandDelegate.endComposition()}cut(){this.commandDelegate.cut()}setSelection(e){ln.SetSelection.runCoreEditorCommand(this.viewModel,{source:"keyboard",selection:e})}_validateViewColumn(e){let t=this.viewModel.getLineMinColumn(e.lineNumber);return e.column=4?this._selectAll():e.mouseDownCount===3?this._hasMulticursorModifier(e)?e.inSelectionMode?this._lastCursorLineSelectDrag(e.position,e.revealType):this._lastCursorLineSelect(e.position,e.revealType):e.inSelectionMode?this._lineSelectDrag(e.position,e.revealType):this._lineSelect(e.position,e.revealType):e.mouseDownCount===2?e.onInjectedText||(this._hasMulticursorModifier(e)?this._lastCursorWordSelect(e.position,e.revealType):e.inSelectionMode?this._wordSelectDrag(e.position,e.revealType):this._wordSelect(e.position,e.revealType)):this._hasMulticursorModifier(e)?this._hasNonMulticursorModifier(e)||(e.shiftKey?this._columnSelect(e.position,e.mouseColumn,!0):e.inSelectionMode?this._lastCursorMoveToSelect(e.position,e.revealType):this._createCursor(e.position,!1)):e.inSelectionMode?e.altKey?this._columnSelect(e.position,e.mouseColumn,!0):o?this._columnSelect(e.position,e.mouseColumn,!0):this._moveToSelect(e.position,e.revealType):this.moveTo(e.position,e.revealType)}_usualArgs(e,t){return e=this._validateViewColumn(e),{source:"mouse",position:this._convertViewToModelPosition(e),viewPosition:e,revealType:t}}moveTo(e,t){ln.MoveTo.runCoreEditorCommand(this.viewModel,this._usualArgs(e,t))}_moveToSelect(e,t){ln.MoveToSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(e,t))}_columnSelect(e,t,i){e=this._validateViewColumn(e),ln.ColumnSelect.runCoreEditorCommand(this.viewModel,{source:"mouse",position:this._convertViewToModelPosition(e),viewPosition:e,mouseColumn:t,doColumnSelect:i})}_createCursor(e,t){e=this._validateViewColumn(e),ln.CreateCursor.runCoreEditorCommand(this.viewModel,{source:"mouse",position:this._convertViewToModelPosition(e),viewPosition:e,wholeLine:t})}_lastCursorMoveToSelect(e,t){ln.LastCursorMoveToSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(e,t))}_wordSelect(e,t){ln.WordSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(e,t))}_wordSelectDrag(e,t){ln.WordSelectDrag.runCoreEditorCommand(this.viewModel,this._usualArgs(e,t))}_lastCursorWordSelect(e,t){ln.LastCursorWordSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(e,t))}_lineSelect(e,t){ln.LineSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(e,t))}_lineSelectDrag(e,t){ln.LineSelectDrag.runCoreEditorCommand(this.viewModel,this._usualArgs(e,t))}_lastCursorLineSelect(e,t){ln.LastCursorLineSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(e,t))}_lastCursorLineSelectDrag(e,t){ln.LastCursorLineSelectDrag.runCoreEditorCommand(this.viewModel,this._usualArgs(e,t))}_selectAll(){ln.SelectAll.runCoreEditorCommand(this.viewModel,{source:"mouse"})}_convertViewToModelPosition(e){return this.viewModel.coordinatesConverter.convertViewPositionToModelPosition(e)}emitKeyDown(e){this.userInputEvents.emitKeyDown(e)}emitKeyUp(e){this.userInputEvents.emitKeyUp(e)}emitContextMenu(e){this.userInputEvents.emitContextMenu(e)}emitMouseMove(e){this.userInputEvents.emitMouseMove(e)}emitMouseLeave(e){this.userInputEvents.emitMouseLeave(e)}emitMouseUp(e){this.userInputEvents.emitMouseUp(e)}emitMouseDown(e){this.userInputEvents.emitMouseDown(e)}emitMouseDrag(e){this.userInputEvents.emitMouseDrag(e)}emitMouseDrop(e){this.userInputEvents.emitMouseDrop(e)}emitMouseDropCanceled(){this.userInputEvents.emitMouseDropCanceled()}emitMouseWheel(e){this.userInputEvents.emitMouseWheel(e)}};_();v();b();_();v();b();xt();xu();var Sb=class{constructor(e){this._createLine=e,this._set(1,[])}flush(){this._set(1,[])}_set(e,t){this._lines=t,this._rendLineNumberStart=e}_get(){return{rendLineNumberStart:this._rendLineNumberStart,lines:this._lines}}getStartLineNumber(){return this._rendLineNumberStart}getEndLineNumber(){return this._rendLineNumberStart+this._lines.length-1}getCount(){return this._lines.length}getLine(e){let t=e-this._rendLineNumberStart;if(t<0||t>=this._lines.length)throw new St("Illegal value for lineNumber");return this._lines[t]}onLinesDeleted(e,t){if(this.getCount()===0)return null;let i=this.getStartLineNumber(),o=this.getEndLineNumber();if(to)return null;let s=0,r=0;for(let l=i;l<=o;l++){let c=l-this._rendLineNumberStart;e<=l&&l<=t&&(r===0?(s=c,r=1):r++)}if(e=o&&a<=s&&(this._lines[a-this._rendLineNumberStart].onContentChanged(),r=!0);return r}onLinesInserted(e,t){if(this.getCount()===0)return null;let i=t-e+1,o=this.getStartLineNumber(),s=this.getEndLineNumber();if(e<=o)return this._rendLineNumberStart+=i,null;if(e>s)return null;if(i+e>s)return this._lines.splice(e-this._rendLineNumberStart,s-e+1);let r=[];for(let h=0;hi)continue;let l=Math.max(t,a.fromLineNumber),c=Math.min(i,a.toLineNumber);for(let d=l;d<=c;d++){let h=d-this._rendLineNumberStart;this._lines[h].onTokensChanged(),o=!0}}return o}},$m=class{constructor(e){this._host=e,this.domNode=this._createDomNode(),this._linesCollection=new Sb(()=>this._host.createVisibleLine())}_createDomNode(){let e=$e(document.createElement("div"));return e.setClassName("view-layer"),e.setPosition("absolute"),e.domNode.setAttribute("role","presentation"),e.domNode.setAttribute("aria-hidden","true"),e}onConfigurationChanged(e){return!!e.hasChanged(145)}onFlushed(e){return this._linesCollection.flush(),!0}onLinesChanged(e){return this._linesCollection.onLinesChanged(e.fromLineNumber,e.count)}onLinesDeleted(e){let t=this._linesCollection.onLinesDeleted(e.fromLineNumber,e.toLineNumber);if(t)for(let i=0,o=t.length;it){let r=t,a=Math.min(i,s.rendLineNumberStart-1);r<=a&&(this._insertLinesBefore(s,r,a,o,t),s.linesLength+=a-r+1)}else if(s.rendLineNumberStart0&&(this._removeLinesBefore(s,r),s.linesLength-=r)}if(s.rendLineNumberStart=t,s.rendLineNumberStart+s.linesLength-1i){let r=Math.max(0,i-s.rendLineNumberStart+1),l=s.linesLength-1-r+1;l>0&&(this._removeLinesAfter(s,l),s.linesLength-=l)}return this._finishRendering(s,!1,o),s}_renderUntouchedLines(e,t,i,o,s){let r=e.rendLineNumberStart,a=e.lines;for(let l=t;l<=i;l++){let c=r+l;a[l].layoutLine(c,o[c-s],this.viewportData.lineHeight)}}_insertLinesBefore(e,t,i,o,s){let r=[],a=0;for(let l=t;l<=i;l++)r[a++]=this.host.createVisibleLine();e.lines=r.concat(e.lines)}_removeLinesBefore(e,t){for(let i=0;i=0;a--){let l=e.lines[a];o[a]&&(l.setDomNode(r),r=r.previousSibling)}}_finishRenderingInvalidLines(e,t,i){let o=document.createElement("div");n._ttPolicy&&(t=n._ttPolicy.createHTML(t)),o.innerHTML=t;for(let s=0;sn});xb._sb=new Sl(1e5);var Ax=class extends hi{constructor(e){super(e),this._visibleLines=new $m(this),this.domNode=this._visibleLines.domNode;let i=this._context.configuration.options.get(50);Si(this.domNode,i),this._dynamicOverlays=[],this._isFocused=!1,this.domNode.setClassName("view-overlays")}shouldRender(){if(super.shouldRender())return!0;for(let e=0,t=this._dynamicOverlays.length;ei.shouldRender());for(let i=0,o=t.length;i'),s.appendString(r),s.appendString(""),!0)}layoutLine(e,t,i){this._domNode&&(this._domNode.setTop(t),this._domNode.setHeight(i))}},Mx=class extends Ax{constructor(e){super(e);let i=this._context.configuration.options.get(145);this._contentWidth=i.contentWidth,this.domNode.setHeight(0)}onConfigurationChanged(e){let i=this._context.configuration.options.get(145);return this._contentWidth=i.contentWidth,super.onConfigurationChanged(e)||!0}onScrollChanged(e){return super.onScrollChanged(e)||e.scrollWidthChanged}_viewOverlaysRender(e){super._viewOverlaysRender(e),this.domNode.setWidth(Math.max(e.scrollWidth,this._contentWidth))}},Rx=class extends Ax{constructor(e){super(e);let t=this._context.configuration.options,i=t.get(145);this._contentLeft=i.contentLeft,this.domNode.setClassName("margin-view-overlays"),this.domNode.setWidth(1),Si(this.domNode,t.get(50))}onConfigurationChanged(e){let t=this._context.configuration.options;Si(this.domNode,t.get(50));let i=t.get(145);return this._contentLeft=i.contentLeft,super.onConfigurationChanged(e)||!0}onScrollChanged(e){return super.onScrollChanged(e)||e.scrollHeightChanged}_viewOverlaysRender(e){super._viewOverlaysRender(e);let t=Math.min(e.scrollHeight,1e6);this.domNode.setHeight(t),this.domNode.setWidth(this._contentLeft)}};_();v();b();ft();var qm=class n{constructor(e){this.onKeyDown=null,this.onKeyUp=null,this.onContextMenu=null,this.onMouseMove=null,this.onMouseLeave=null,this.onMouseDown=null,this.onMouseUp=null,this.onMouseDrag=null,this.onMouseDrop=null,this.onMouseDropCanceled=null,this.onMouseWheel=null,this._coordinatesConverter=e}emitKeyDown(e){var t;(t=this.onKeyDown)===null||t===void 0||t.call(this,e)}emitKeyUp(e){var t;(t=this.onKeyUp)===null||t===void 0||t.call(this,e)}emitContextMenu(e){var t;(t=this.onContextMenu)===null||t===void 0||t.call(this,this._convertViewToModelMouseEvent(e))}emitMouseMove(e){var t;(t=this.onMouseMove)===null||t===void 0||t.call(this,this._convertViewToModelMouseEvent(e))}emitMouseLeave(e){var t;(t=this.onMouseLeave)===null||t===void 0||t.call(this,this._convertViewToModelMouseEvent(e))}emitMouseDown(e){var t;(t=this.onMouseDown)===null||t===void 0||t.call(this,this._convertViewToModelMouseEvent(e))}emitMouseUp(e){var t;(t=this.onMouseUp)===null||t===void 0||t.call(this,this._convertViewToModelMouseEvent(e))}emitMouseDrag(e){var t;(t=this.onMouseDrag)===null||t===void 0||t.call(this,this._convertViewToModelMouseEvent(e))}emitMouseDrop(e){var t;(t=this.onMouseDrop)===null||t===void 0||t.call(this,this._convertViewToModelMouseEvent(e))}emitMouseDropCanceled(){var e;(e=this.onMouseDropCanceled)===null||e===void 0||e.call(this)}emitMouseWheel(e){var t;(t=this.onMouseWheel)===null||t===void 0||t.call(this,e)}_convertViewToModelMouseEvent(e){return e.target?{event:e.event,target:this._convertViewToModelMouseTarget(e.target)}:e}_convertViewToModelMouseTarget(e){return n.convertViewToModelMouseTarget(e,this._coordinatesConverter)}static convertViewToModelMouseTarget(e,t){let i={...e};return i.position&&(i.position=t.convertViewPositionToModelPosition(i.position)),i.range&&(i.range=t.convertViewRangeToModelRange(i.range)),(i.type===5||i.type===8)&&(i.detail=this.convertViewToModelViewZoneData(i.detail,t)),i}static convertViewToModelViewZoneData(e,t){return{viewZoneId:e.viewZoneId,positionBefore:e.positionBefore?t.convertViewPositionToModelPosition(e.positionBefore):e.positionBefore,positionAfter:e.positionAfter?t.convertViewPositionToModelPosition(e.positionAfter):e.positionAfter,position:t.convertViewPositionToModelPosition(e.position),afterLineNumber:t.convertViewPositionToModelPosition(new U(e.afterLineNumber,1)).lineNumber}}};_();v();b();var Px=class extends hi{constructor(e){super(e),this.blocks=[],this.contentWidth=-1,this.contentLeft=0,this.domNode=$e(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this.domNode.setClassName("blockDecorations-container"),this.update()}update(){let e=!1,i=this._context.configuration.options.get(145),o=i.contentWidth-i.verticalScrollbarWidth;this.contentWidth!==o&&(this.contentWidth=o,e=!0);let s=i.contentLeft;return this.contentLeft!==s&&(this.contentLeft=s,e=!0),e}dispose(){super.dispose()}onConfigurationChanged(e){return this.update()}onScrollChanged(e){return e.scrollTopChanged||e.scrollLeftChanged}onDecorationsChanged(e){return!0}onZonesChanged(e){return!0}prepareRender(e){}render(e){var t;let i=0,o=e.getDecorationsInViewport();for(let s of o){if(!s.options.blockClassName)continue;let r=this.blocks[i];r||(r=this.blocks[i]=$e(document.createElement("div")),this.domNode.appendChild(r));let a,l;s.options.blockIsAfterEnd?(a=e.getVerticalOffsetAfterLineNumber(s.range.endLineNumber,!1),l=e.getVerticalOffsetAfterLineNumber(s.range.endLineNumber,!0)):(a=e.getVerticalOffsetForLineNumber(s.range.startLineNumber,!0),l=s.range.isEmpty()&&!s.options.blockDoesNotCollapse?e.getVerticalOffsetForLineNumber(s.range.startLineNumber,!1):e.getVerticalOffsetAfterLineNumber(s.range.endLineNumber,!0));let[c,d,h,u]=(t=s.options.blockPadding)!==null&&t!==void 0?t:[0,0,0,0];r.setClassName("blockDecorations-block "+s.options.blockClassName),r.setLeft(this.contentLeft-u),r.setWidth(this.contentWidth+u+d),r.setTop(a-e.scrollTop-c),r.setHeight(l-a+c+h),i++}for(let s=i;s0?this.domNode.setDisplay("block"):this.domNode.setDisplay("none"),this._cachedDomNodeOffsetWidth=-1,this._cachedDomNodeOffsetHeight=-1}_layoutBoxInViewport(e,t,i,o){let s=e.top,r=s,a=e.top+e.height,l=o.viewportHeight-a,c=s-i,d=r>=i,h=a,u=l>=i,f=e.left;return f+t>o.scrollLeft+o.viewportWidth&&(f=o.scrollLeft+o.viewportWidth-t),fc){let f=u-(c-o);u-=f,i-=f}if(u=S,x=f+i<=g.height-w;return this._fixedOverflowWidgets?{fitsAbove:y,aboveTop:Math.max(u,S),fitsBelow:x,belowTop:f,left:C}:{fitsAbove:y,aboveTop:a,fitsBelow:x,belowTop:l,left:m}}_prepareRenderWidgetAtExactPositionOverflowing(e){return new ff(e.top,e.left+this._contentLeft)}_getAnchorsCoordinates(e){var t,i;let o=a(this._primaryAnchor.viewPosition,this._affinity,this._lineHeight),s=((t=this._secondaryAnchor.viewPosition)===null||t===void 0?void 0:t.lineNumber)===((i=this._primaryAnchor.viewPosition)===null||i===void 0?void 0:i.lineNumber)?this._secondaryAnchor.viewPosition:null,r=a(s,this._affinity,this._lineHeight);return{primary:o,secondary:r};function a(l,c,d){if(!l)return null;let h=e.visibleRangeForPosition(l);if(!h)return null;let u=l.column===1&&c===3?0:h.left,f=e.getVerticalOffsetForLineNumber(l.lineNumber)-e.scrollTop;return new Fx(f,u,d)}}_reduceAnchorCoordinates(e,t,i){if(!t)return e;let o=this._context.configuration.options.get(50),s=t.left;return se.endLineNumber||this.domNode.setMaxWidth(this._maxWidth)}prepareRender(e){this._renderData=this._prepareRenderWidget(e)}render(e){if(!this._renderData){this._isVisible&&(this.domNode.removeAttribute("monaco-visible-content-widget"),this._isVisible=!1,this.domNode.setVisibility("hidden")),typeof this._actual.afterRender=="function"&&TM(this._actual.afterRender,this._actual,null);return}this.allowEditorOverflow?(this.domNode.setTop(this._renderData.coordinate.top),this.domNode.setLeft(this._renderData.coordinate.left)):(this.domNode.setTop(this._renderData.coordinate.top+e.scrollTop-e.bigNumbersDelta),this.domNode.setLeft(this._renderData.coordinate.left)),this._isVisible||(this.domNode.setVisibility("inherit"),this.domNode.setAttribute("monaco-visible-content-widget","true"),this._isVisible=!0),typeof this._actual.afterRender=="function"&&TM(this._actual.afterRender,this._actual,this._renderData.position)}},uf=class{constructor(e,t){this.modelPosition=e,this.viewPosition=t}},ff=class{constructor(e,t){this.top=e,this.left=t,this._coordinateBrand=void 0}},Fx=class{constructor(e,t,i){this.top=e,this.left=t,this.height=i,this._anchorCoordinateBrand=void 0}};function TM(n,e,...t){try{return n.call(e,...t)}catch{return null}}_();v();b();$a();wt();Qi();Kn();ch();ft();var Bx=class extends ns{constructor(e){super(),this._context=e;let t=this._context.configuration.options,i=t.get(145);this._renderLineHighlight=t.get(96),this._renderLineHighlightOnlyWhenFocus=t.get(97),this._wordWrap=i.isViewportWrapping,this._contentLeft=i.contentLeft,this._contentWidth=i.contentWidth,this._selectionIsEmpty=!0,this._focused=!1,this._cursorLineNumbers=[1],this._selections=[new nt(1,1,1,1)],this._renderData=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),super.dispose()}_readFromSelections(){let e=!1,t=new Set;for(let s of this._selections)t.add(s.positionLineNumber);let i=Array.from(t);i.sort((s,r)=>s-r),Ht(this._cursorLineNumbers,i)||(this._cursorLineNumbers=i,e=!0);let o=this._selections.every(s=>s.isEmpty());return this._selectionIsEmpty!==o&&(this._selectionIsEmpty=o,e=!0),e}onThemeChanged(e){return this._readFromSelections()}onConfigurationChanged(e){let t=this._context.configuration.options,i=t.get(145);return this._renderLineHighlight=t.get(96),this._renderLineHighlightOnlyWhenFocus=t.get(97),this._wordWrap=i.isViewportWrapping,this._contentLeft=i.contentLeft,this._contentWidth=i.contentWidth,!0}onCursorStateChanged(e){return this._selections=e.selections,this._readFromSelections()}onFlushed(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return e.scrollWidthChanged||e.scrollTopChanged}onZonesChanged(e){return!0}onFocusChanged(e){return this._renderLineHighlightOnlyWhenFocus?(this._focused=e.isFocused,!0):!1}prepareRender(e){if(!this._shouldRenderThis()){this._renderData=null;return}let t=e.visibleRange.startLineNumber,i=e.visibleRange.endLineNumber,o=[];for(let r=t;r<=i;r++){let a=r-t;o[a]=""}if(this._wordWrap){let r=this._renderOne(e,!1);for(let a of this._cursorLineNumbers){let l=this._context.viewModel.coordinatesConverter,c=l.convertViewPositionToModelPosition(new U(a,1)).lineNumber,d=l.convertModelPositionToViewPosition(new U(c,1)).lineNumber,h=l.convertModelPositionToViewPosition(new U(c,this._context.viewModel.model.getLineMaxColumn(c))).lineNumber,u=Math.max(d,t),f=Math.min(h,i);for(let g=u;g<=f;g++){let m=g-t;o[m]=r}}}let s=this._renderOne(e,!0);for(let r of this._cursorLineNumbers){if(ri)continue;let a=r-t;o[a]=s}this._renderData=o}render(e,t){if(!this._renderData)return"";let i=t-e;return i>=this._renderData.length?"":this._renderData[i]}_shouldRenderInMargin(){return(this._renderLineHighlight==="gutter"||this._renderLineHighlight==="all")&&(!this._renderLineHighlightOnlyWhenFocus||this._focused)}_shouldRenderInContent(){return(this._renderLineHighlight==="line"||this._renderLineHighlight==="all")&&this._selectionIsEmpty&&(!this._renderLineHighlightOnlyWhenFocus||this._focused)}},Wx=class extends Bx{_renderOne(e,t){return`
`}_shouldRenderThis(){return this._shouldRenderInContent()}_shouldRenderOther(){return this._shouldRenderInMargin()}},zx=class extends Bx{_renderOne(e,t){return`
`}_shouldRenderThis(){return!0}_shouldRenderOther(){return this._shouldRenderInContent()}};Lo((n,e)=>{let t=n.getColor(vM);if(t&&(e.addRule(`.monaco-editor .view-overlays .current-line { background-color: ${t}; }`),e.addRule(`.monaco-editor .margin-view-overlays .current-line-margin { background-color: ${t}; border: none; }`)),!t||t.isTransparent()||n.defines(CM)){let i=n.getColor(CM);i&&(e.addRule(`.monaco-editor .view-overlays .current-line-exact { border: 2px solid ${i}; }`),e.addRule(`.monaco-editor .margin-view-overlays .current-line-exact-margin { border: 2px solid ${i}; }`),Ol(n.type)&&(e.addRule(".monaco-editor .view-overlays .current-line-exact { border-width: 1px; }"),e.addRule(".monaco-editor .margin-view-overlays .current-line-exact-margin { border-width: 1px; }")))}});_();v();b();Ke();var Vx=class extends ns{constructor(e){super(),this._context=e;let t=this._context.configuration.options;this._typicalHalfwidthCharacterWidth=t.get(50).typicalHalfwidthCharacterWidth,this._renderResult=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(e){let t=this._context.configuration.options;return this._typicalHalfwidthCharacterWidth=t.get(50).typicalHalfwidthCharacterWidth,!0}onDecorationsChanged(e){return!0}onFlushed(e){return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return e.scrollTopChanged||e.scrollWidthChanged}onZonesChanged(e){return!0}prepareRender(e){let t=e.getDecorationsInViewport(),i=[],o=0;for(let l=0,c=t.length;l{if(l.options.zIndexc.options.zIndex)return 1;let d=l.options.className,h=c.options.className;return dh?1:P.compareRangesUsingStarts(l.range,c.range)});let s=e.visibleRange.startLineNumber,r=e.visibleRange.endLineNumber,a=[];for(let l=s;l<=r;l++){let c=l-s;a[c]=""}this._renderWholeLineDecorations(e,i,a),this._renderNormalDecorations(e,i,a),this._renderResult=a}_renderWholeLineDecorations(e,t,i){let o=e.visibleRange.startLineNumber,s=e.visibleRange.endLineNumber;for(let r=0,a=t.length;r',d=Math.max(l.range.startLineNumber,o),h=Math.min(l.range.endLineNumber,s);for(let u=d;u<=h;u++){let f=u-o;i[f]+=c}}}_renderNormalDecorations(e,t,i){var o;let s=e.visibleRange.startLineNumber,r=null,a=!1,l=null,c=!1;for(let d=0,h=t.length;d';a[u]+=S}}}render(e,t){if(!this._renderResult)return"";let i=t-e;return i<0||i>=this._renderResult.length?"":this._renderResult[i]}};_();v();b();ke();Qi();var Hx=class extends hi{constructor(e,t,i,o){super(e);let s=this._context.configuration.options,r=s.get(103),a=s.get(75),l=s.get(40),c=s.get(106),d={listenOnDomNode:i.domNode,className:"editor-scrollable "+mb(e.theme.type),useShadows:!1,lazyRender:!0,vertical:r.vertical,horizontal:r.horizontal,verticalHasArrows:r.verticalHasArrows,horizontalHasArrows:r.horizontalHasArrows,verticalScrollbarSize:r.verticalScrollbarSize,verticalSliderSize:r.verticalSliderSize,horizontalScrollbarSize:r.horizontalScrollbarSize,horizontalSliderSize:r.horizontalSliderSize,handleMouseWheel:r.handleMouseWheel,alwaysConsumeMouseWheel:r.alwaysConsumeMouseWheel,arrowSize:r.arrowSize,mouseWheelScrollSensitivity:a,fastScrollSensitivity:l,scrollPredominantAxis:c,scrollByPage:r.scrollByPage};this.scrollbar=this._register(new Bl(t.domNode,d,this._context.viewLayout.getScrollable())),Mn.write(this.scrollbar.getDomNode(),6),this.scrollbarDomNode=$e(this.scrollbar.getDomNode()),this.scrollbarDomNode.setPosition("absolute"),this._setLayout();let h=(u,f,g)=>{let m={};if(f){let C=u.scrollTop;C&&(m.scrollTop=this._context.viewLayout.getCurrentScrollTop()+C,u.scrollTop=0)}if(g){let C=u.scrollLeft;C&&(m.scrollLeft=this._context.viewLayout.getCurrentScrollLeft()+C,u.scrollLeft=0)}this._context.viewModel.viewLayout.setScrollPosition(m,1)};this._register($(i.domNode,"scroll",u=>h(i.domNode,!0,!0))),this._register($(t.domNode,"scroll",u=>h(t.domNode,!0,!1))),this._register($(o.domNode,"scroll",u=>h(o.domNode,!0,!1))),this._register($(this.scrollbarDomNode.domNode,"scroll",u=>h(this.scrollbarDomNode.domNode,!0,!1)))}dispose(){super.dispose()}_setLayout(){let e=this._context.configuration.options,t=e.get(145);this.scrollbarDomNode.setLeft(t.contentLeft),e.get(73).side==="right"?this.scrollbarDomNode.setWidth(t.contentWidth+t.minimap.minimapWidth):this.scrollbarDomNode.setWidth(t.contentWidth),this.scrollbarDomNode.setHeight(t.height)}getOverviewRulerLayoutInfo(){return this.scrollbar.getOverviewRulerLayoutInfo()}getDomNode(){return this.scrollbarDomNode}delegateVerticalScrollbarPointerDown(e){this.scrollbar.delegateVerticalScrollbarPointerDown(e)}delegateScrollFromMouseWheelEvent(e){this.scrollbar.delegateScrollFromMouseWheelEvent(e)}onConfigurationChanged(e){if(e.hasChanged(103)||e.hasChanged(75)||e.hasChanged(40)){let t=this._context.configuration.options,i=t.get(103),o=t.get(75),s=t.get(40),r=t.get(106),a={vertical:i.vertical,horizontal:i.horizontal,verticalScrollbarSize:i.verticalScrollbarSize,horizontalScrollbarSize:i.horizontalScrollbarSize,scrollByPage:i.scrollByPage,handleMouseWheel:i.handleMouseWheel,mouseWheelScrollSensitivity:o,fastScrollSensitivity:s,scrollPredominantAxis:r};this.scrollbar.updateOptions(a)}return e.hasChanged(145)&&this._setLayout(),!0}onScrollChanged(e){return!0}onThemeChanged(e){return this.scrollbar.updateClassName("editor-scrollable "+mb(this._context.theme.type)),!0}prepareRender(e){}render(e){this.scrollbar.renderNow()}};_();v();b();wt();ft();Ke();hr();var gf=class{constructor(e,t,i,o,s){this.startLineNumber=e,this.endLineNumber=t,this.className=i,this.tooltip=o,this._decorationToRenderBrand=void 0,this.zIndex=s??0}},AM=class{constructor(e,t,i){this.className=e,this.zIndex=t,this.tooltip=i}},MM=class{constructor(){this.decorations=[]}add(e){this.decorations.push(e)}getDecorations(){return this.decorations}},jm=class extends ns{_render(e,t,i){let o=[];for(let a=e;a<=t;a++){let l=a-e;o[l]=new MM}if(i.length===0)return o;i.sort((a,l)=>a.className===l.className?a.startLineNumber===l.startLineNumber?a.endLineNumber-l.endLineNumber:a.startLineNumber-l.startLineNumber:a.classNameo)continue;let c=Math.max(a,i),d=this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(new U(c,0)),h=this._context.viewModel.glyphLanes.getLanesAtLine(d.lineNumber).indexOf(s.preference.lane);t.push(new PM(c,h,s.preference.zIndex,s))}}_collectSortedGlyphRenderRequests(e){let t=[];return this._collectDecorationBasedGlyphRenderRequest(e,t),this._collectWidgetBasedGlyphRenderRequest(e,t),t.sort((i,o)=>i.lineNumber===o.lineNumber?i.laneIndex===o.laneIndex?i.zIndex===o.zIndex?o.type===i.type?i.type===0&&o.type===0?i.className0;){let o=t.peek();if(!o)break;let s=t.takeWhile(a=>a.lineNumber===o.lineNumber&&a.laneIndex===o.laneIndex);if(!s||s.length===0)break;let r=s[0];if(r.type===0){let a=[];for(let l of s){if(l.zIndex!==r.zIndex||l.type!==r.type)break;(a.length===0||a[a.length-1]!==l.className)&&a.push(l.className)}i.push(r.accept(a.join(" ")))}else r.widget.renderInfo={lineNumber:r.lineNumber,laneIndex:r.laneIndex}}this._decorationGlyphsToRender=i}render(e){if(!this._glyphMargin){for(let i of Object.values(this._widgets))i.domNode.setDisplay("none");for(;this._managedDomNodes.length>0;){let i=this._managedDomNodes.pop();i?.domNode.remove()}return}let t=Math.round(this._glyphMarginWidth/this._glyphMarginDecorationLaneCount);for(let i of Object.values(this._widgets))if(!i.renderInfo)i.domNode.setDisplay("none");else{let o=e.viewportData.relativeVerticalOffset[i.renderInfo.lineNumber-e.viewportData.startLineNumber],s=this._glyphMarginLeft+i.renderInfo.laneIndex*this._lineHeight;i.domNode.setDisplay("block"),i.domNode.setTop(o),i.domNode.setLeft(s),i.domNode.setWidth(t),i.domNode.setHeight(this._lineHeight)}for(let i=0;ithis._decorationGlyphsToRender.length;){let i=this._managedDomNodes.pop();i?.domNode.remove()}}},RM=class{constructor(e,t,i,o){this.lineNumber=e,this.laneIndex=t,this.zIndex=i,this.className=o,this.type=0}accept(e){return new OM(this.lineNumber,this.laneIndex,e)}},PM=class{constructor(e,t,i,o){this.lineNumber=e,this.laneIndex=t,this.zIndex=i,this.widget=o,this.type=1}},OM=class{constructor(e,t,i){this.lineNumber=e,this.laneIndex=t,this.combinedClassName=i}};_();v();b();$a();Qi();ft();wt();xi();BM();Kx();var qx=class extends ns{constructor(e){super(),this._context=e,this._primaryPosition=null;let t=this._context.configuration.options,i=t.get(146),o=t.get(50);this._spaceWidth=o.spaceWidth,this._maxIndentLeft=i.wrappingColumn===-1?-1:i.wrappingColumn*o.typicalHalfwidthCharacterWidth,this._bracketPairGuideOptions=t.get(16),this._renderResult=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(e){let t=this._context.configuration.options,i=t.get(146),o=t.get(50);return this._spaceWidth=o.spaceWidth,this._maxIndentLeft=i.wrappingColumn===-1?-1:i.wrappingColumn*o.typicalHalfwidthCharacterWidth,this._bracketPairGuideOptions=t.get(16),!0}onCursorStateChanged(e){var t;let o=e.selections[0].getPosition();return!((t=this._primaryPosition)===null||t===void 0)&&t.equals(o)?!1:(this._primaryPosition=o,!0)}onDecorationsChanged(e){return!0}onFlushed(e){return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return e.scrollTopChanged}onZonesChanged(e){return!0}onLanguageConfigurationChanged(e){return!0}prepareRender(e){var t,i,o,s;if(!this._bracketPairGuideOptions.indentation&&this._bracketPairGuideOptions.bracketPairs===!1){this._renderResult=null;return}let r=e.visibleRange.startLineNumber,a=e.visibleRange.endLineNumber,l=e.scrollWidth,c=this._primaryPosition,d=this.getGuidesByLine(r,Math.min(a+1,this._context.viewModel.getLineCount()),c),h=[];for(let u=r;u<=a;u++){let f=u-r,g=d[f],m="",C=(i=(t=e.visibleRangeForPosition(new U(u,1)))===null||t===void 0?void 0:t.left)!==null&&i!==void 0?i:0;for(let S of g){let w=S.column===-1?C+(S.visibleColumn-1)*this._spaceWidth:e.visibleRangeForPosition(new U(u,S.column)).left;if(w>l||this._maxIndentLeft>0&&w>this._maxIndentLeft)break;let y=S.horizontalLine?S.horizontalLine.top?"horizontal-top":"horizontal-bottom":"vertical",x=S.horizontalLine?((s=(o=e.visibleRangeForPosition(new U(u,S.horizontalLine.endColumn)))===null||o===void 0?void 0:o.left)!==null&&s!==void 0?s:w+this._spaceWidth)-w:this._spaceWidth;m+=`
`}h[f]=m}this._renderResult=h}getGuidesByLine(e,t,i){let o=this._bracketPairGuideOptions.bracketPairs!==!1?this._context.viewModel.getBracketGuidesInRangeByLine(e,t,i,{highlightActive:this._bracketPairGuideOptions.highlightActiveBracketPair,horizontalGuides:this._bracketPairGuideOptions.bracketPairsHorizontal===!0?Vc.Enabled:this._bracketPairGuideOptions.bracketPairsHorizontal==="active"?Vc.EnabledForActive:Vc.Disabled,includeInactive:this._bracketPairGuideOptions.bracketPairs===!0}):null,s=this._bracketPairGuideOptions.indentation?this._context.viewModel.getLinesIndentGuides(e,t):null,r=0,a=0,l=0;if(this._bracketPairGuideOptions.highlightActiveIndentation!==!1&&i){let h=this._context.viewModel.getActiveIndentGuide(i.lineNumber,e,t);r=h.startLineNumber,a=h.endLineNumber,l=h.indent}let{indentSize:c}=this._context.viewModel.model.getOptions(),d=[];for(let h=e;h<=t;h++){let u=new Array;d.push(u);let f=o?o[h-e]:[],g=new mo(f),m=s?s[h-e]:0;for(let C=1;C<=m;C++){let S=(C-1)*c+1,w=(this._bracketPairGuideOptions.highlightActiveIndentation==="always"||f.length===0)&&r<=h&&h<=a&&C===l;u.push(...g.takeWhile(x=>x.visibleColumn!0)||[])}return d}render(e,t){if(!this._renderResult)return"";let i=t-e;return i<0||i>=this._renderResult.length?"":this._renderResult[i]}};function Zm(n){if(!(n&&n.isTransparent()))return n}Lo((n,e)=>{let t=[{bracketColor:mx,guideColor:J6,guideColorActive:sW},{bracketColor:px,guideColor:eW,guideColorActive:rW},{bracketColor:_x,guideColor:tW,guideColorActive:aW},{bracketColor:bx,guideColor:iW,guideColorActive:lW},{bracketColor:vx,guideColor:nW,guideColorActive:cW},{bracketColor:Cx,guideColor:oW,guideColorActive:dW}],i=new Lb,o=[{indentColor:of,indentColorActive:sf},{indentColor:P6,indentColorActive:z6},{indentColor:O6,indentColorActive:V6},{indentColor:F6,indentColorActive:H6},{indentColor:B6,indentColorActive:U6},{indentColor:W6,indentColorActive:K6}],s=t.map(a=>{var l,c;let d=n.getColor(a.bracketColor),h=n.getColor(a.guideColor),u=n.getColor(a.guideColorActive),f=Zm((l=Zm(h))!==null&&l!==void 0?l:d?.transparent(.3)),g=Zm((c=Zm(u))!==null&&c!==void 0?c:d);if(!(!f||!g))return{guideColor:f,guideColorActive:g}}).filter(bc),r=o.map(a=>{let l=n.getColor(a.indentColor),c=n.getColor(a.indentColorActive),d=Zm(l),h=Zm(c);if(!(!d||!h))return{indentColor:d,indentColorActive:h}}).filter(bc);if(s.length>0){for(let a=0;a<30;a++){let l=s[a%s.length];e.addRule(`.monaco-editor .${i.getInlineClassNameOfLevel(a).replace(/ /g,".")} { --guide-color: ${l.guideColor}; --guide-color-active: ${l.guideColorActive}; }`)}e.addRule(".monaco-editor .vertical { box-shadow: 1px 0 0 0 var(--guide-color) inset; }"),e.addRule(".monaco-editor .horizontal-top { border-top: 1px solid var(--guide-color); }"),e.addRule(".monaco-editor .horizontal-bottom { border-bottom: 1px solid var(--guide-color); }"),e.addRule(`.monaco-editor .vertical.${i.activeClassName} { box-shadow: 1px 0 0 0 var(--guide-color-active) inset; }`),e.addRule(`.monaco-editor .horizontal-top.${i.activeClassName} { border-top: 1px solid var(--guide-color-active); }`),e.addRule(`.monaco-editor .horizontal-bottom.${i.activeClassName} { border-bottom: 1px solid var(--guide-color-active); }`)}if(r.length>0){for(let a=0;a<30;a++){let l=r[a%r.length];e.addRule(`.monaco-editor .lines-content .core-guide-indent.lvl-${a} { --indent-color: ${l.indentColor}; --indent-color-active: ${l.indentColorActive}; }`)}e.addRule(".monaco-editor .lines-content .core-guide-indent { box-shadow: 1px 0 0 0 var(--indent-color) inset; }"),e.addRule(".monaco-editor .lines-content .core-guide-indent.indent-active { box-shadow: 1px 0 0 0 var(--indent-color-active) inset; }")}});_();v();b();Gt();Lt();_();v();b();var Ym=class{get didDomLayout(){return this._didDomLayout}readClientRect(){if(!this._clientRectRead){this._clientRectRead=!0;let e=this._domNode.getBoundingClientRect();this.markDidDomLayout(),this._clientRectDeltaLeft=e.left,this._clientRectScale=e.width/this._domNode.offsetWidth}}get clientRectDeltaLeft(){return this._clientRectRead||this.readClientRect(),this._clientRectDeltaLeft}get clientRectScale(){return this._clientRectRead||this.readClientRect(),this._clientRectScale}constructor(e,t){this._domNode=e,this.endNode=t,this._didDomLayout=!1,this._clientRectDeltaLeft=0,this._clientRectScale=1,this._clientRectRead=!1}markDidDomLayout(){this._didDomLayout=!0}};ft();Ke();var WM=class{constructor(){this._currentVisibleRange=new P(1,1,1,1)}getCurrentVisibleRange(){return this._currentVisibleRange}setCurrentVisibleRange(e){this._currentVisibleRange=e}},zM=class{constructor(e,t,i,o,s,r,a){this.minimalReveal=e,this.lineNumber=t,this.startColumn=i,this.endColumn=o,this.startScrollTop=s,this.stopScrollTop=r,this.scrollType=a,this.type="range",this.minLineNumber=t,this.maxLineNumber=t}},VM=class{constructor(e,t,i,o,s){this.minimalReveal=e,this.selections=t,this.startScrollTop=i,this.stopScrollTop=o,this.scrollType=s,this.type="selections";let r=t[0].startLineNumber,a=t[0].endLineNumber;for(let l=1,c=t.length;l{this._updateLineWidthsSlow()},200),this._asyncCheckMonospaceFontAssumptions=new di(()=>{this._checkMonospaceFontAssumptions()},2e3),this._lastRenderedData=new WM,this._horizontalRevealRequest=null,this._stickyScrollEnabled=o.get(115).enabled,this._maxNumberStickyLines=o.get(115).maxLineCount}dispose(){this._asyncUpdateLineWidths.dispose(),this._asyncCheckMonospaceFontAssumptions.dispose(),super.dispose()}getDomNode(){return this.domNode}createVisibleLine(){return new Jr(this._viewLineOptions)}onConfigurationChanged(e){this._visibleLines.onConfigurationChanged(e),e.hasChanged(146)&&(this._maxLineWidth=0);let t=this._context.configuration.options,i=t.get(50),o=t.get(146);return this._lineHeight=t.get(67),this._typicalHalfwidthCharacterWidth=i.typicalHalfwidthCharacterWidth,this._isViewportWrapping=o.isViewportWrapping,this._revealHorizontalRightPadding=t.get(100),this._cursorSurroundingLines=t.get(29),this._cursorSurroundingLinesStyle=t.get(30),this._canUseLayerHinting=!t.get(32),this._stickyScrollEnabled=t.get(115).enabled,this._maxNumberStickyLines=t.get(115).maxLineCount,Si(this.domNode,i),this._onOptionsMaybeChanged(),e.hasChanged(145)&&(this._maxLineWidth=0),!0}_onOptionsMaybeChanged(){let e=this._context.configuration,t=new ub(e,this._context.theme.type);if(!this._viewLineOptions.equals(t)){this._viewLineOptions=t;let i=this._visibleLines.getStartLineNumber(),o=this._visibleLines.getEndLineNumber();for(let s=i;s<=o;s++)this._visibleLines.getVisibleLine(s).onOptionsChanged(this._viewLineOptions);return!0}return!1}onCursorStateChanged(e){let t=this._visibleLines.getStartLineNumber(),i=this._visibleLines.getEndLineNumber(),o=!1;for(let s=t;s<=i;s++)o=this._visibleLines.getVisibleLine(s).onSelectionChanged()||o;return o}onDecorationsChanged(e){{let t=this._visibleLines.getStartLineNumber(),i=this._visibleLines.getEndLineNumber();for(let o=t;o<=i;o++)this._visibleLines.getVisibleLine(o).onDecorationsChanged()}return!0}onFlushed(e){let t=this._visibleLines.onFlushed(e);return this._maxLineWidth=0,t}onLinesChanged(e){return this._visibleLines.onLinesChanged(e)}onLinesDeleted(e){return this._visibleLines.onLinesDeleted(e)}onLinesInserted(e){return this._visibleLines.onLinesInserted(e)}onRevealRangeRequest(e){let t=this._computeScrollTopToRevealRange(this._context.viewLayout.getFutureViewport(),e.source,e.minimalReveal,e.range,e.selections,e.verticalType);if(t===-1)return!1;let i=this._context.viewLayout.validateScrollPosition({scrollTop:t});e.revealHorizontal?e.range&&e.range.startLineNumber!==e.range.endLineNumber?i={scrollTop:i.scrollTop,scrollLeft:0}:e.range?this._horizontalRevealRequest=new zM(e.minimalReveal,e.range.startLineNumber,e.range.startColumn,e.range.endColumn,this._context.viewLayout.getCurrentScrollTop(),i.scrollTop,e.scrollType):e.selections&&e.selections.length>0&&(this._horizontalRevealRequest=new VM(e.minimalReveal,e.selections,this._context.viewLayout.getCurrentScrollTop(),i.scrollTop,e.scrollType)):this._horizontalRevealRequest=null;let s=Math.abs(this._context.viewLayout.getCurrentScrollTop()-i.scrollTop)<=this._lineHeight?1:e.scrollType;return this._context.viewModel.viewLayout.setScrollPosition(i,s),!0}onScrollChanged(e){if(this._horizontalRevealRequest&&e.scrollLeftChanged&&(this._horizontalRevealRequest=null),this._horizontalRevealRequest&&e.scrollTopChanged){let t=Math.min(this._horizontalRevealRequest.startScrollTop,this._horizontalRevealRequest.stopScrollTop),i=Math.max(this._horizontalRevealRequest.startScrollTop,this._horizontalRevealRequest.stopScrollTop);(e.scrollTopi)&&(this._horizontalRevealRequest=null)}return this.domNode.setWidth(e.scrollWidth),this._visibleLines.onScrollChanged(e)||!0}onTokensChanged(e){return this._visibleLines.onTokensChanged(e)}onZonesChanged(e){return this._context.viewModel.viewLayout.setMaxLineWidth(this._maxLineWidth),this._visibleLines.onZonesChanged(e)}onThemeChanged(e){return this._onOptionsMaybeChanged()}getPositionFromDOMInfo(e,t){let i=this._getViewLineDomNode(e);if(i===null)return null;let o=this._getLineNumberFor(i);if(o===-1||o<1||o>this._context.viewModel.getLineCount())return null;if(this._context.viewModel.getLineMaxColumn(o)===1)return new U(o,1);let s=this._visibleLines.getStartLineNumber(),r=this._visibleLines.getEndLineNumber();if(or)return null;let a=this._visibleLines.getVisibleLine(o).getColumnOfNodeOffset(e,t),l=this._context.viewModel.getLineMinColumn(o);return ai)return-1;let o=new Ym(this.domNode.domNode,this._textRangeRestingSpot),s=this._visibleLines.getVisibleLine(e).getWidth(o);return this._updateLineWidthsSlowIfDomDidLayout(o),s}linesVisibleRangesForRange(e,t){if(this.shouldRender())return null;let i=e.endLineNumber,o=P.intersectRanges(e,this._lastRenderedData.getCurrentVisibleRange());if(!o)return null;let s=[],r=0,a=new Ym(this.domNode.domNode,this._textRangeRestingSpot),l=0;t&&(l=this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(new U(o.startLineNumber,1)).lineNumber);let c=this._visibleLines.getStartLineNumber(),d=this._visibleLines.getEndLineNumber();for(let h=o.startLineNumber;h<=o.endLineNumber;h++){if(hd)continue;let u=h===o.startLineNumber?o.startColumn:1,f=h!==o.endLineNumber,g=f?this._context.viewModel.getLineMaxColumn(h):o.endColumn,m=this._visibleLines.getVisibleLine(h).getVisibleRangesForRange(h,u,g,a);if(m){if(t&&hthis._visibleLines.getEndLineNumber())return null;let o=new Ym(this.domNode.domNode,this._textRangeRestingSpot),s=this._visibleLines.getVisibleLine(e).getVisibleRangesForRange(e,t,i,o);return this._updateLineWidthsSlowIfDomDidLayout(o),s}visibleRangeForPosition(e){let t=this._visibleRangesForLineRange(e.lineNumber,e.column,e.column);return t?new $S(t.outsideRenderedLine,t.ranges[0].left):null}_updateLineWidthsFast(){return this._updateLineWidths(!0)}_updateLineWidthsSlow(){this._updateLineWidths(!1)}_updateLineWidthsSlowIfDomDidLayout(e){e.didDomLayout&&(this._asyncUpdateLineWidths.isScheduled()||(this._asyncUpdateLineWidths.cancel(),this._updateLineWidthsSlow()))}_updateLineWidths(e){let t=this._visibleLines.getStartLineNumber(),i=this._visibleLines.getEndLineNumber(),o=1,s=!0;for(let r=t;r<=i;r++){let a=this._visibleLines.getVisibleLine(r);if(e&&!a.getWidthIsFast()){s=!1;continue}o=Math.max(o,a.getWidth(null))}return s&&t===1&&i===this._context.viewModel.getLineCount()&&(this._maxLineWidth=0),this._ensureMaxLineWidth(o),s}_checkMonospaceFontAssumptions(){let e=-1,t=-1,i=this._visibleLines.getStartLineNumber(),o=this._visibleLines.getEndLineNumber();for(let s=i;s<=o;s++){let r=this._visibleLines.getVisibleLine(s);if(r.needsMonospaceFontCheck()){let a=r.getWidth(null);a>t&&(t=a,e=s)}}if(e!==-1&&!this._visibleLines.getVisibleLine(e).monospaceAssumptionsAreValid())for(let s=i;s<=o;s++)this._visibleLines.getVisibleLine(s).onMonospaceAssumptionsInvalidated()}prepareRender(){throw new Error("Not supported")}render(){throw new Error("Not supported")}renderText(e){if(this._visibleLines.renderLines(e),this._lastRenderedData.setCurrentVisibleRange(e.visibleRange),this.domNode.setWidth(this._context.viewLayout.getScrollWidth()),this.domNode.setHeight(Math.min(this._context.viewLayout.getScrollHeight(),1e6)),this._horizontalRevealRequest){let i=this._horizontalRevealRequest;if(e.startLineNumber<=i.minLineNumber&&i.maxLineNumber<=e.endLineNumber){this._horizontalRevealRequest=null,this.onDidRender();let o=this._computeScrollLeftToReveal(i);o&&(this._isViewportWrapping||this._ensureMaxLineWidth(o.maxHorizontalOffset),this._context.viewModel.viewLayout.setScrollPosition({scrollLeft:o.scrollLeft},i.scrollType))}}if(this._updateLineWidthsFast()?this._asyncUpdateLineWidths.cancel():this._asyncUpdateLineWidths.schedule(),mi&&!this._asyncCheckMonospaceFontAssumptions.isScheduled()){let i=this._visibleLines.getStartLineNumber(),o=this._visibleLines.getEndLineNumber();for(let s=i;s<=o;s++)if(this._visibleLines.getVisibleLine(s).needsMonospaceFontCheck()){this._asyncCheckMonospaceFontAssumptions.schedule();break}}this._linesContent.setLayerHinting(this._canUseLayerHinting),this._linesContent.setContain("strict");let t=this._context.viewLayout.getCurrentScrollTop()-e.bigNumbersDelta;this._linesContent.setTop(-t),this._linesContent.setLeft(-this._context.viewLayout.getCurrentScrollLeft())}_ensureMaxLineWidth(e){let t=Math.ceil(e);this._maxLineWidth0){let S=s[0].startLineNumber,w=s[0].endLineNumber;for(let y=1,x=s.length;yl){if(!d)return-1;C=h}else if(r===5||r===6)if(r===6&&a<=h&&u<=c)C=a;else{let S=Math.max(5*this._lineHeight,l*.2),w=h-S,y=u-l;C=Math.max(y,w)}else if(r===1||r===2)if(r===2&&a<=h&&u<=c)C=a;else{let S=(h+u)/2;C=Math.max(0,S-l/2)}else C=this._computeMinimumScrolling(a,c,h,u,r===3,r===4);return C}_computeScrollLeftToReveal(e){let t=this._context.viewLayout.getCurrentViewport(),i=this._context.configuration.options.get(145),o=t.left,s=o+t.width-i.verticalScrollbarWidth,r=1073741824,a=0;if(e.type==="range"){let c=this._visibleRangesForLineRange(e.lineNumber,e.startColumn,e.endColumn);if(!c)return null;for(let d of c.ranges)r=Math.min(r,Math.round(d.left)),a=Math.max(a,Math.round(d.left+d.width))}else for(let c of e.selections){if(c.startLineNumber!==c.endLineNumber)return null;let d=this._visibleRangesForLineRange(c.startLineNumber,c.startColumn,c.endColumn);if(!d)return null;for(let h of d.ranges)r=Math.min(r,Math.round(h.left)),a=Math.max(a,Math.round(h.left+h.width))}return e.minimalReveal||(r=Math.max(0,r-n.HORIZONTAL_EXTRA_PX),a+=this._revealHorizontalRightPadding),e.type==="selections"&&a-r>t.width?null:{scrollLeft:this._computeMinimumScrolling(o,s,r,a),maxHorizontalOffset:a}}_computeMinimumScrolling(e,t,i,o,s,r){e=e|0,t=t|0,i=i|0,o=o|0,s=!!s,r=!!r;let a=t-e;if(o-it)return Math.max(0,o-a)}else return i;return e}};kb.HORIZONTAL_EXTRA_PX=30;_();v();b();var jx=class extends jm{constructor(e){super(),this._context=e;let i=this._context.configuration.options.get(145);this._decorationsLeft=i.decorationsLeft,this._decorationsWidth=i.decorationsWidth,this._renderResult=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(e){let i=this._context.configuration.options.get(145);return this._decorationsLeft=i.decorationsLeft,this._decorationsWidth=i.decorationsWidth,!0}onDecorationsChanged(e){return!0}onFlushed(e){return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return e.scrollTopChanged}onZonesChanged(e){return!0}_getDecorations(e){var t,i;let o=e.getDecorationsInViewport(),s=[],r=0;for(let a=0,l=o.length;a',l=[];for(let c=t;c<=i;c++){let d=c-t,h=o[d].getDecorations(),u="";for(let f of h){let g='
';s[a]=c}this._renderResult=s}render(e,t){return this._renderResult?this._renderResult[t-e]:""}};_();v();b();ke();le();Lt();ot();Ke();_();v();b();var mr=class n{constructor(e,t,i,o){this._rgba8Brand=void 0,this.r=n._clamp(e),this.g=n._clamp(t),this.b=n._clamp(i),this.a=n._clamp(o)}equals(e){return this.r===e.r&&this.g===e.g&&this.b===e.b&&this.a===e.a}static _clamp(e){return e<0?0:e>255?255:e|0}};mr.Empty=new mr(0,0,0,0);_();v();b();ye();le();Yo();var mf=class n extends H{static getInstance(){return this._INSTANCE||(this._INSTANCE=Ld(new n)),this._INSTANCE}constructor(){super(),this._onDidChange=new B,this.onDidChange=this._onDidChange.event,this._updateColorMap(),this._register(Bt.onDidChange(e=>{e.changedColorMap&&this._updateColorMap()}))}_updateColorMap(){let e=Bt.getColorMap();if(!e){this._colors=[mr.Empty],this._backgroundIsLight=!0;return}this._colors=[mr.Empty];for(let i=1;i=.5,this._onDidChange.fire(void 0)}getColor(e){return(e<1||e>=this._colors.length)&&(e=2),this._colors[e]}backgroundIsLight(){return this._backgroundIsLight}};mf._INSTANCE=null;is();Kn();_();v();b();_();v();b();_();v();b();var yW=(()=>{let n=[];for(let e=32;e<=126;e++)n.push(e);return n.push(65533),n})(),SW=(n,e)=>(n-=32,n<0||n>96?e<=2?(n+96)%96:95:n);F0();var Db=class n{constructor(e,t){this.scale=t,this._minimapCharRendererBrand=void 0,this.charDataNormal=n.soften(e,12/15),this.charDataLight=n.soften(e,50/60)}static soften(e,t){let i=new Uint8ClampedArray(e.length);for(let o=0,s=e.length;oe.width||i+g>e.height){console.warn("bad render request outside image data");return}let m=d?this.charDataLight:this.charDataNormal,C=SW(o,c),S=e.width*4,w=a.r,y=a.g,x=a.b,k=s.r-w,T=s.g-y,N=s.b-x,M=Math.max(r,l),W=e.data,j=C*u*f,G=i*S+t*4;for(let V=0;Ve.width||i+h>e.height){console.warn("bad render request outside image data");return}let u=e.width*4,f=.5*(s/255),g=r.r,m=r.g,C=r.b,S=o.r-g,w=o.g-m,y=o.b-C,x=g+S*f,k=m+w*f,T=C+y*f,N=Math.max(s,a),M=e.data,W=i*u+t*4;for(let j=0;j{let e=new Uint8ClampedArray(n.length/2);for(let t=0;t>1]=xW[n[t]]<<4|xW[n[t+1]]&15;return e},HM={1:wa(()=>LW("0000511D6300CF609C709645A78432005642574171487021003C451900274D35D762755E8B629C5BA856AF57BA649530C167D1512A272A3F6038604460398526BCA2A968DB6F8957C768BE5FBE2FB467CF5D8D5B795DC7625B5DFF50DE64C466DB2FC47CD860A65E9A2EB96CB54CE06DA763AB2EA26860524D3763536601005116008177A8705E53AB738E6A982F88BAA35B5F5B626D9C636B449B737E5B7B678598869A662F6B5B8542706C704C80736A607578685B70594A49715A4522E792")),2:wa(()=>LW("000000000000000055394F383D2800008B8B1F210002000081B1CBCBCC820000847AAF6B9AAF2119BE08B8881AD60000A44FD07DCCF107015338130C00000000385972265F390B406E2437634B4B48031B12B8A0847000001E15B29A402F0000000000004B33460B00007A752C2A0000000000004D3900000084394B82013400ABA5CFC7AD9C0302A45A3E5A98AB000089A43382D97900008BA54AA087A70A0248A6A7AE6DBE0000BF6F94987EA40A01A06DCFA7A7A9030496C32F77891D0000A99FB1A0AFA80603B29AB9CA75930D010C0948354D3900000C0948354F37460D0028BE673D8400000000AF9D7B6E00002B007AA8933400007AA642675C2700007984CFB9C3985B768772A8A6B7B20000CAAECAAFC4B700009F94A6009F840009D09F9BA4CA9C0000CC8FC76DC87F0000C991C472A2000000A894A48CA7B501079BA2C9C69BA20000B19A5D3FA89000005CA6009DA2960901B0A7F0669FB200009D009E00B7890000DAD0F5D092820000D294D4C48BD10000B5A7A4A3B1A50402CAB6CBA6A2000000B5A7A4A3B1A8044FCDADD19D9CB00000B7778F7B8AAE0803C9AB5D3F5D3F00009EA09EA0BAB006039EA0989A8C7900009B9EF4D6B7C00000A9A7816CACA80000ABAC84705D3F000096DA635CDC8C00006F486F266F263D4784006124097B00374F6D2D6D2D6D4A3A95872322000000030000000000008D8939130000000000002E22A5C9CBC70600AB25C0B5C9B400061A2DB04CA67001082AA6BEBEBFC606002321DACBC19E03087AA08B6768380000282FBAC0B8CA7A88AD25BBA5A29900004C396C5894A6000040485A6E356E9442A32CD17EADA70000B4237923628600003E2DE9C1D7B500002F25BBA5A2990000231DB6AFB4A804023025C0B5CAB588062B2CBDBEC0C706882435A75CA20000002326BD6A82A908048B4B9A5A668000002423A09CB4BB060025259C9D8A7900001C1FCAB2C7C700002A2A9387ABA200002626A4A47D6E9D14333163A0C87500004B6F9C2D643A257049364936493647358A34438355497F1A0000A24C1D590000D38DFFBDD4CD3126"))};F0();var Zx=class n{static create(e,t){if(this.lastCreated&&e===this.lastCreated.scale&&t===this.lastFontFamily)return this.lastCreated;let i;return HM[e]?i=new Db(HM[e](),e):i=n.createFromSampleData(n.createSampleData(t).data,e),this.lastFontFamily=t,this.lastCreated=i,i}static createSampleData(e){let t=document.createElement("canvas"),i=t.getContext("2d");t.style.height="16px",t.height=16,t.width=96*10,t.style.width=96*10+"px",i.fillStyle="#ffffff",i.font=`bold 16px ${e}`,i.textBaseline="middle";let o=0;for(let s of yW)i.fillText(String.fromCharCode(s),o,16/2),o+=10;return i.getImageData(0,0,96*10,16)}static createFromSampleData(e,t){if(e.length!==61440)throw new Error("Unexpected source in MinimapCharRenderer");let o=n._downsample(e,t);return new Db(o,t)}static _downsampleChar(e,t,i,o,s){let r=1*s,a=2*s,l=o,c=0;for(let d=0;d0){let c=255/l;for(let d=0;dZx.create(this.fontScale,l.fontFamily)),this.defaultBackgroundColor=i.getColor(2),this.backgroundColor=n._getMinimapBackground(t,this.defaultBackgroundColor),this.foregroundAlpha=n._getMinimapForegroundOpacity(t)}static _getMinimapBackground(e,t){let i=e.getColor(gB);return i?new mr(i.rgba.r,i.rgba.g,i.rgba.b,Math.round(255*i.rgba.a)):t}static _getMinimapForegroundOpacity(e){let t=e.getColor(mB);return t?mr._clamp(Math.round(255*t.rgba.a)):255}static _getSectionHeaderColor(e,t){let i=e.getColor(Zu);return i?new mr(i.rgba.r,i.rgba.g,i.rgba.b,Math.round(255*i.rgba.a)):t}equals(e){return this.renderMinimap===e.renderMinimap&&this.size===e.size&&this.minimapHeightIsEditorHeight===e.minimapHeightIsEditorHeight&&this.scrollBeyondLastLine===e.scrollBeyondLastLine&&this.paddingTop===e.paddingTop&&this.paddingBottom===e.paddingBottom&&this.showSlider===e.showSlider&&this.autohide===e.autohide&&this.pixelRatio===e.pixelRatio&&this.typicalHalfwidthCharacterWidth===e.typicalHalfwidthCharacterWidth&&this.lineHeight===e.lineHeight&&this.minimapLeft===e.minimapLeft&&this.minimapWidth===e.minimapWidth&&this.minimapHeight===e.minimapHeight&&this.canvasInnerWidth===e.canvasInnerWidth&&this.canvasInnerHeight===e.canvasInnerHeight&&this.canvasOuterWidth===e.canvasOuterWidth&&this.canvasOuterHeight===e.canvasOuterHeight&&this.isSampling===e.isSampling&&this.editorHeight===e.editorHeight&&this.fontScale===e.fontScale&&this.minimapLineHeight===e.minimapLineHeight&&this.minimapCharWidth===e.minimapCharWidth&&this.sectionHeaderFontSize===e.sectionHeaderFontSize&&this.defaultBackgroundColor&&this.defaultBackgroundColor.equals(e.defaultBackgroundColor)&&this.backgroundColor&&this.backgroundColor.equals(e.backgroundColor)&&this.foregroundAlpha===e.foregroundAlpha}},UM=class n{constructor(e,t,i,o,s,r,a,l,c){this.scrollTop=e,this.scrollHeight=t,this.sliderNeeded=i,this._computedSliderRatio=o,this.sliderTop=s,this.sliderHeight=r,this.topPaddingLineCount=a,this.startLineNumber=l,this.endLineNumber=c}getDesiredScrollTopFromDelta(e){return Math.round(this.scrollTop+e/this._computedSliderRatio)}getDesiredScrollTopFromTouchLocation(e){return Math.round((e-this.sliderHeight/2)/this._computedSliderRatio)}intersectWithViewport(e){let t=Math.max(this.startLineNumber,e.startLineNumber),i=Math.min(this.endLineNumber,e.endLineNumber);return t>i?null:[t,i]}getYForLineNumber(e,t){return+(e-this.startLineNumber+this.topPaddingLineCount)*t}static create(e,t,i,o,s,r,a,l,c,d,h){let u=e.pixelRatio,f=e.minimapLineHeight,g=Math.floor(e.canvasInnerHeight/f),m=e.lineHeight;if(e.minimapHeightIsEditorHeight){let T=l*e.lineHeight+e.paddingTop+e.paddingBottom;e.scrollBeyondLastLine&&(T+=Math.max(0,s-e.lineHeight-e.paddingBottom));let N=Math.max(1,Math.floor(s*s/T)),M=Math.max(0,e.minimapHeight-N),W=M/(d-s),j=c*W,G=M>0,V=Math.floor(e.canvasInnerHeight/e.minimapLineHeight),z=Math.floor(e.paddingTop/e.lineHeight);return new n(c,d,G,W,j,N,z,1,Math.min(a,V))}let C;if(r&&i!==a){let T=i-t+1;C=Math.floor(T*f/u)}else{let T=s/m;C=Math.floor(T*f/u)}let S=Math.floor(e.paddingTop/m),w=Math.floor(e.paddingBottom/m);if(e.scrollBeyondLastLine){let T=s/m;w=Math.max(w,T-1)}let y;if(w>0){let T=s/m;y=(S+a+w-T-1)*f/u}else y=Math.max(0,(S+a)*f/u-C);y=Math.min(e.minimapHeight-C,y);let x=y/(d-s),k=c*x;if(g>=S+a+w){let T=y>0;return new n(c,d,T,x,k,C,S,1,a)}else{let T;t>1?T=t+S:T=Math.max(1,c/m);let N,M=Math.max(1,Math.floor(T-k*u/f));Mc&&(M=Math.min(M,h.startLineNumber),N=Math.max(N,h.topPaddingLineCount)),h.scrollTop=e.paddingTop?G=(t-M+N+j)*f/u:G=c/e.paddingTop*(N+j)*f/u,new n(c,d,!0,x,G,C,N,M,W)}}},Xm=class{constructor(e){this.dy=e}onContentChanged(){this.dy=-1}onTokensChanged(){this.dy=-1}};Xm.INVALID=new Xm(-1);var Xx=class{constructor(e,t,i){this.renderedLayout=e,this._imageData=t,this._renderedLines=new Sb(()=>Xm.INVALID),this._renderedLines._set(e.startLineNumber,i)}linesEquals(e){if(!this.scrollEquals(e))return!1;let i=this._renderedLines._get().lines;for(let o=0,s=i.length;o1){for(let S=0,w=o-1;S0&&this.minimapLines[i-1]>=e;)i--;let o=this.modelLineToMinimapLine(t)-1;for(;o+1t)return null}return[i+1,o+1]}decorationLineRangeToMinimapLineRange(e,t){let i=this.modelLineToMinimapLine(e),o=this.modelLineToMinimapLine(t);return e!==t&&o===i&&(o===this.minimapLines.length?i>1&&i--:o++),[i,o]}onLinesDeleted(e){let t=e.toLineNumber-e.fromLineNumber+1,i=this.minimapLines.length,o=0;for(let s=this.minimapLines.length-1;s>=0&&!(this.minimapLines[s]=0&&!(this.minimapLines[i]0,scrollWidth:e.scrollWidth,scrollHeight:e.scrollHeight,viewportStartLineNumber:t,viewportEndLineNumber:i,viewportStartLineNumberVerticalOffset:e.getVerticalOffsetForLineNumber(t),scrollTop:e.scrollTop,scrollLeft:e.scrollLeft,viewportWidth:e.viewportWidth,viewportHeight:e.viewportHeight};this._actual.render(o)}_recreateLineSampling(){this._minimapSelections=null;let e=!!this._samplingState,[t,i]=Qx.compute(this.options,this._context.viewModel.getLineCount(),this._samplingState);if(this._samplingState=t,e&&this._samplingState)for(let o of i)switch(o.type){case"deleted":this._actual.onLinesDeleted(o.deleteFromLineNumber,o.deleteToLineNumber);break;case"inserted":this._actual.onLinesInserted(o.insertFromLineNumber,o.insertToLineNumber);break;case"flush":this._actual.onFlushed();break}}getLineCount(){return this._samplingState?this._samplingState.minimapLines.length:this._context.viewModel.getLineCount()}getRealLineCount(){return this._context.viewModel.getLineCount()}getLineContent(e){return this._samplingState?this._context.viewModel.getLineContent(this._samplingState.minimapLines[e-1]):this._context.viewModel.getLineContent(e)}getLineMaxColumn(e){return this._samplingState?this._context.viewModel.getLineMaxColumn(this._samplingState.minimapLines[e-1]):this._context.viewModel.getLineMaxColumn(e)}getMinimapLinesRenderingData(e,t,i){if(this._samplingState){let o=[];for(let s=0,r=t-e+1;s{var s;return!(!((s=o.options.minimap)===null||s===void 0)&&s.sectionHeaderStyle)});if(this._samplingState){let o=[];for(let s of i){if(!s.options.minimap)continue;let r=s.range,a=this._samplingState.modelLineToMinimapLine(r.startLineNumber),l=this._samplingState.modelLineToMinimapLine(r.endLineNumber);o.push(new mm(new P(a,r.startColumn,l,r.endColumn),s.options))}return o}return i}getSectionHeaderDecorationsInViewport(e,t){let i=this.options.minimapLineHeight,s=this.options.sectionHeaderFontSize/i;return e=Math.floor(Math.max(1,e-s)),this._getMinimapDecorationsInViewport(e,t).filter(r=>{var a;return!!(!((a=r.options.minimap)===null||a===void 0)&&a.sectionHeaderStyle)})}_getMinimapDecorationsInViewport(e,t){let i;if(this._samplingState){let o=this._samplingState.minimapLines[e-1],s=this._samplingState.minimapLines[t-1];i=new P(o,1,s,this._context.viewModel.getLineMaxColumn(s))}else i=new P(e,1,t,this._context.viewModel.getLineMaxColumn(t));return this._context.viewModel.getMinimapDecorationsInRange(i)}getSectionHeaderText(e,t){var i;let o=(i=e.options.minimap)===null||i===void 0?void 0:i.sectionHeaderText;if(!o)return null;let s=this._sectionHeaderCache.get(o);if(s)return s;let r=t(o);return this._sectionHeaderCache.set(o,r),r}getOptions(){return this._context.viewModel.model.getOptions()}revealLineNumber(e){this._samplingState&&(e=this._samplingState.minimapLines[e-1]),this._context.viewModel.revealRange("mouse",!1,new P(e,1,e,1),1,0)}setScrollTop(e){this._context.viewModel.viewLayout.setScrollPosition({scrollTop:e},1)}},$M=class n extends H{constructor(e,t){super(),this._renderDecorations=!1,this._gestureInProgress=!1,this._theme=e,this._model=t,this._lastRenderData=null,this._buffers=null,this._selectionColor=this._theme.getColor(jA),this._domNode=$e(document.createElement("div")),Mn.write(this._domNode,9),this._domNode.setClassName(this._getMinimapDomNodeClassName()),this._domNode.setPosition("absolute"),this._domNode.setAttribute("role","presentation"),this._domNode.setAttribute("aria-hidden","true"),this._shadow=$e(document.createElement("div")),this._shadow.setClassName("minimap-shadow-hidden"),this._domNode.appendChild(this._shadow),this._canvas=$e(document.createElement("canvas")),this._canvas.setPosition("absolute"),this._canvas.setLeft(0),this._domNode.appendChild(this._canvas),this._decorationsCanvas=$e(document.createElement("canvas")),this._decorationsCanvas.setPosition("absolute"),this._decorationsCanvas.setClassName("minimap-decorations-layer"),this._decorationsCanvas.setLeft(0),this._domNode.appendChild(this._decorationsCanvas),this._slider=$e(document.createElement("div")),this._slider.setPosition("absolute"),this._slider.setClassName("minimap-slider"),this._slider.setLayerHinting(!0),this._slider.setContain("strict"),this._domNode.appendChild(this._slider),this._sliderHorizontal=$e(document.createElement("div")),this._sliderHorizontal.setPosition("absolute"),this._sliderHorizontal.setClassName("minimap-slider-horizontal"),this._slider.appendChild(this._sliderHorizontal),this._applyLayout(),this._pointerDownListener=Ut(this._domNode.domNode,se.POINTER_DOWN,i=>{if(i.preventDefault(),this._model.options.renderMinimap===0||!this._lastRenderData)return;if(this._model.options.size!=="proportional"){if(i.button===0&&this._lastRenderData){let c=Sn(this._slider.domNode),d=c.top+c.height/2;this._startSliderDragging(i,d,this._lastRenderData.renderedLayout)}return}let s=this._model.options.minimapLineHeight,r=this._model.options.canvasInnerHeight/this._model.options.canvasOuterHeight*i.offsetY,l=Math.floor(r/s)+this._lastRenderData.renderedLayout.startLineNumber-this._lastRenderData.renderedLayout.topPaddingLineCount;l=Math.min(l,this._model.getLineCount()),this._model.revealLineNumber(l)}),this._sliderPointerMoveMonitor=new Rl,this._sliderPointerDownListener=Ut(this._slider.domNode,se.POINTER_DOWN,i=>{i.preventDefault(),i.stopPropagation(),i.button===0&&this._lastRenderData&&this._startSliderDragging(i,i.pageY,this._lastRenderData.renderedLayout)}),this._gestureDisposable=ui.addTarget(this._domNode.domNode),this._sliderTouchStartListener=$(this._domNode.domNode,It.Start,i=>{i.preventDefault(),i.stopPropagation(),this._lastRenderData&&(this._slider.toggleClassName("active",!0),this._gestureInProgress=!0,this.scrollDueToTouchEvent(i))},{passive:!1}),this._sliderTouchMoveListener=$(this._domNode.domNode,It.Change,i=>{i.preventDefault(),i.stopPropagation(),this._lastRenderData&&this._gestureInProgress&&this.scrollDueToTouchEvent(i)},{passive:!1}),this._sliderTouchEndListener=Ut(this._domNode.domNode,It.End,i=>{i.preventDefault(),i.stopPropagation(),this._gestureInProgress=!1,this._slider.toggleClassName("active",!1)})}_startSliderDragging(e,t,i){if(!e.target||!(e.target instanceof Element))return;let o=e.pageX;this._slider.toggleClassName("active",!0);let s=(r,a)=>{let l=Sn(this._domNode.domNode),c=Math.min(Math.abs(a-o),Math.abs(a-l.left),Math.abs(a-l.left-l.width));if(Li&&c>VG){this._model.setScrollTop(i.scrollTop);return}let d=r-t;this._model.setScrollTop(i.getDesiredScrollTopFromDelta(d))};e.pageY!==t&&s(e.pageY,o),this._sliderPointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,r=>s(r.pageY,r.pageX),()=>{this._slider.toggleClassName("active",!1)})}scrollDueToTouchEvent(e){let t=this._domNode.domNode.getBoundingClientRect().top,i=this._lastRenderData.renderedLayout.getDesiredScrollTopFromTouchLocation(e.pageY-t);this._model.setScrollTop(i)}dispose(){this._pointerDownListener.dispose(),this._sliderPointerMoveMonitor.dispose(),this._sliderPointerDownListener.dispose(),this._gestureDisposable.dispose(),this._sliderTouchStartListener.dispose(),this._sliderTouchMoveListener.dispose(),this._sliderTouchEndListener.dispose(),super.dispose()}_getMinimapDomNodeClassName(){let e=["minimap"];return this._model.options.showSlider==="always"?e.push("slider-always"):e.push("slider-mouseover"),this._model.options.autohide&&e.push("autohide"),e.join(" ")}getDomNode(){return this._domNode}_applyLayout(){this._domNode.setLeft(this._model.options.minimapLeft),this._domNode.setWidth(this._model.options.minimapWidth),this._domNode.setHeight(this._model.options.minimapHeight),this._shadow.setHeight(this._model.options.minimapHeight),this._canvas.setWidth(this._model.options.canvasOuterWidth),this._canvas.setHeight(this._model.options.canvasOuterHeight),this._canvas.domNode.width=this._model.options.canvasInnerWidth,this._canvas.domNode.height=this._model.options.canvasInnerHeight,this._decorationsCanvas.setWidth(this._model.options.canvasOuterWidth),this._decorationsCanvas.setHeight(this._model.options.canvasOuterHeight),this._decorationsCanvas.domNode.width=this._model.options.canvasInnerWidth,this._decorationsCanvas.domNode.height=this._model.options.canvasInnerHeight,this._slider.setWidth(this._model.options.minimapWidth)}_getBuffer(){return this._buffers||this._model.options.canvasInnerWidth>0&&this._model.options.canvasInnerHeight>0&&(this._buffers=new KM(this._canvas.domNode.getContext("2d"),this._model.options.canvasInnerWidth,this._model.options.canvasInnerHeight,this._model.options.backgroundColor)),this._buffers?this._buffers.getBuffer():null}onDidChangeOptions(){this._lastRenderData=null,this._buffers=null,this._applyLayout(),this._domNode.setClassName(this._getMinimapDomNodeClassName())}onSelectionChanged(){return this._renderDecorations=!0,!0}onDecorationsChanged(){return this._renderDecorations=!0,!0}onFlushed(){return this._lastRenderData=null,!0}onLinesChanged(e,t){return this._lastRenderData?this._lastRenderData.onLinesChanged(e,t):!1}onLinesDeleted(e,t){var i;return(i=this._lastRenderData)===null||i===void 0||i.onLinesDeleted(e,t),!0}onLinesInserted(e,t){var i;return(i=this._lastRenderData)===null||i===void 0||i.onLinesInserted(e,t),!0}onScrollChanged(){return this._renderDecorations=!0,!0}onThemeChanged(){return this._selectionColor=this._theme.getColor(jA),this._renderDecorations=!0,!0}onTokensChanged(e){return this._lastRenderData?this._lastRenderData.onTokensChanged(e):!1}onTokensColorsChanged(){return this._lastRenderData=null,this._buffers=null,!0}onZonesChanged(){return this._lastRenderData=null,!0}render(e){if(this._model.options.renderMinimap===0){this._shadow.setClassName("minimap-shadow-hidden"),this._sliderHorizontal.setWidth(0),this._sliderHorizontal.setHeight(0);return}e.scrollLeft+e.viewportWidth>=e.scrollWidth?this._shadow.setClassName("minimap-shadow-hidden"):this._shadow.setClassName("minimap-shadow-visible");let i=UM.create(this._model.options,e.viewportStartLineNumber,e.viewportEndLineNumber,e.viewportStartLineNumberVerticalOffset,e.viewportHeight,e.viewportContainsWhitespaceGaps,this._model.getLineCount(),this._model.getRealLineCount(),e.scrollTop,e.scrollHeight,this._lastRenderData?this._lastRenderData.renderedLayout:null);this._slider.setDisplay(i.sliderNeeded?"block":"none"),this._slider.setTop(i.sliderTop),this._slider.setHeight(i.sliderHeight),this._sliderHorizontal.setLeft(0),this._sliderHorizontal.setWidth(this._model.options.minimapWidth),this._sliderHorizontal.setTop(0),this._sliderHorizontal.setHeight(i.sliderHeight),this.renderDecorations(i),this._lastRenderData=this.renderLines(i)}renderDecorations(e){if(this._renderDecorations){this._renderDecorations=!1;let t=this._model.getSelections();t.sort(P.compareRangesUsingStarts);let i=this._model.getMinimapDecorationsInViewport(e.startLineNumber,e.endLineNumber);i.sort((u,f)=>(u.options.zIndex||0)-(f.options.zIndex||0));let{canvasInnerWidth:o,canvasInnerHeight:s}=this._model.options,r=this._model.options.minimapLineHeight,a=this._model.options.minimapCharWidth,l=this._model.getOptions().tabSize,c=this._decorationsCanvas.domNode.getContext("2d");c.clearRect(0,0,o,s);let d=new eL(e.startLineNumber,e.endLineNumber,!1);this._renderSelectionLineHighlights(c,t,d,e,r),this._renderDecorationsLineHighlights(c,i,d,e,r);let h=new eL(e.startLineNumber,e.endLineNumber,null);this._renderSelectionsHighlights(c,t,h,e,r,l,a,o),this._renderDecorationsHighlights(c,i,h,e,r,l,a,o),this._renderSectionHeaders(e)}}_renderSelectionLineHighlights(e,t,i,o,s){if(!this._selectionColor||this._selectionColor.isTransparent())return;e.fillStyle=this._selectionColor.transparent(.5).toString();let r=0,a=0;for(let l of t){let c=o.intersectWithViewport(l);if(!c)continue;let[d,h]=c;for(let g=d;g<=h;g++)i.set(g,!0);let u=o.getYForLineNumber(d,s),f=o.getYForLineNumber(h,s);a>=u||(a>r&&e.fillRect(va,r,e.canvas.width,a-r),r=u),a=f}a>r&&e.fillRect(va,r,e.canvas.width,a-r)}_renderDecorationsLineHighlights(e,t,i,o,s){let r=new Map;for(let a=t.length-1;a>=0;a--){let l=t[a],c=l.options.minimap;if(!c||c.position!==1)continue;let d=o.intersectWithViewport(l.range);if(!d)continue;let[h,u]=d,f=c.getColor(this._theme.value);if(!f||f.isTransparent())continue;let g=r.get(f.toString());g||(g=f.transparent(.5).toString(),r.set(f.toString(),g)),e.fillStyle=g;for(let m=h;m<=u;m++){if(i.has(m))continue;i.set(m,!0);let C=o.getYForLineNumber(h,s);e.fillRect(va,C,e.canvas.width,s)}}}_renderSelectionsHighlights(e,t,i,o,s,r,a,l){if(!(!this._selectionColor||this._selectionColor.isTransparent()))for(let c of t){let d=o.intersectWithViewport(c);if(!d)continue;let[h,u]=d;for(let f=h;f<=u;f++)this.renderDecorationOnLine(e,i,c,this._selectionColor,o,f,s,s,r,a,l)}}_renderDecorationsHighlights(e,t,i,o,s,r,a,l){for(let c of t){let d=c.options.minimap;if(!d)continue;let h=o.intersectWithViewport(c.range);if(!h)continue;let[u,f]=h,g=d.getColor(this._theme.value);if(!(!g||g.isTransparent()))for(let m=u;m<=f;m++)switch(d.position){case 1:this.renderDecorationOnLine(e,i,c.range,g,o,m,s,s,r,a,l);continue;case 2:{let C=o.getYForLineNumber(m,s),S=2;this.renderDecoration(e,g,S,C,HG,s);continue}}}}renderDecorationOnLine(e,t,i,o,s,r,a,l,c,d,h){let u=s.getYForLineNumber(r,l);if(u+a<0||u>this._model.options.canvasInnerHeight)return;let{startLineNumber:f,endLineNumber:g}=i,m=f===r?i.startColumn:1,C=g===r?i.endColumn:this._model.getLineMaxColumn(r),S=this.getXOffsetForPosition(t,r,m,c,d,h),w=this.getXOffsetForPosition(t,r,C,c,d,h);this.renderDecoration(e,o,S,u,w-S,a)}getXOffsetForPosition(e,t,i,o,s,r){if(i===1)return va;if((i-1)*s>=r)return r;let l=e.get(t);if(!l){let c=this._model.getLineContent(t);l=[va];let d=va;for(let h=1;h=r){l[h]=r;break}l[h]=g,d=g}e.set(t,l)}return i-1m.range.startLineNumber-C.range.startLineNumber);let g=n._fitSectionHeader.bind(null,u,r-va);for(let m of f){let C=e.getYForLineNumber(m.range.startLineNumber,i)+o,S=C-o,w=S+2,y=this._model.getSectionHeaderText(m,g);n._renderSectionLabel(u,y,((t=m.options.minimap)===null||t===void 0?void 0:t.sectionHeaderStyle)===2,l,d,r,S,s,C,w)}}static _fitSectionHeader(e,t,i){if(!i)return i;let o="\u2026",s=e.measureText(i).width,r=e.measureText(o).width;if(s<=t||s<=r)return i;let a=i.length,l=s/i.length,c=Math.floor((t-r)/l)-1,d=Math.ceil(c/2);for(;d>0&&/\s/.test(i[d-1]);)--d;return i.substring(0,d)+o+i.substring(a-(c-d))}static _renderSectionLabel(e,t,i,o,s,r,a,l,c,d){t&&(e.fillStyle=o,e.fillRect(0,a,r,l),e.fillStyle=s,e.fillText(t,va,c)),i&&(e.beginPath(),e.moveTo(0,d),e.lineTo(r,d),e.closePath(),e.stroke())}renderLines(e){let t=e.startLineNumber,i=e.endLineNumber,o=this._model.options.minimapLineHeight;if(this._lastRenderData&&this._lastRenderData.linesEquals(e)){let ee=this._lastRenderData._get();return new Xx(e,ee.imageData,ee.lines)}let s=this._getBuffer();if(!s)return null;let[r,a,l]=n._renderUntouchedLines(s,e.topPaddingLineCount,t,i,o,this._lastRenderData),c=this._model.getMinimapLinesRenderingData(t,i,l),d=this._model.getOptions().tabSize,h=this._model.options.defaultBackgroundColor,u=this._model.options.backgroundColor,f=this._model.options.foregroundAlpha,g=this._model.tokensColorTracker,m=g.backgroundIsLight(),C=this._model.options.renderMinimap,S=this._model.options.charRenderer(),w=this._model.options.fontScale,y=this._model.options.minimapCharWidth,k=(C===1?2:3)*w,T=o>k?Math.floor((o-k)/2):0,N=u.a/255,M=new mr(Math.round((u.r-h.r)*N+h.r),Math.round((u.g-h.g)*N+h.g),Math.round((u.b-h.b)*N+h.b),255),W=e.topPaddingLineCount*o,j=[];for(let ee=0,ce=i-t+1;ee=0&&Gw)return;let V=C.charCodeAt(k);if(V===9){let z=u-(k+T)%u;T+=z-1,x+=z*r}else if(V===32)x+=r;else{let z=Ys(V)?2:1;for(let te=0;tew)return}}}}},eL=class{constructor(e,t,i){this._startLineNumber=e,this._endLineNumber=t,this._defaultValue=i,this._values=[];for(let o=0,s=this._endLineNumber-this._startLineNumber+1;othis._endLineNumber||(this._values[e-this._startLineNumber]=t)}get(e){return ethis._endLineNumber?this._defaultValue:this._values[e-this._startLineNumber]}};_();v();b();ke();var tL=class extends hi{constructor(e,t){super(e),this._viewDomNode=t;let o=this._context.configuration.options.get(145);this._widgets={},this._verticalScrollbarWidth=o.verticalScrollbarWidth,this._minimapWidth=o.minimap.minimapWidth,this._horizontalScrollbarHeight=o.horizontalScrollbarHeight,this._editorHeight=o.height,this._editorWidth=o.width,this._viewDomNodeRect={top:0,left:0,width:0,height:0},this._domNode=$e(document.createElement("div")),Mn.write(this._domNode,4),this._domNode.setClassName("overlayWidgets"),this.overflowingOverlayWidgetsDomNode=$e(document.createElement("div")),Mn.write(this.overflowingOverlayWidgetsDomNode,5),this.overflowingOverlayWidgetsDomNode.setClassName("overflowingOverlayWidgets")}dispose(){super.dispose(),this._widgets={}}getDomNode(){return this._domNode}onConfigurationChanged(e){let i=this._context.configuration.options.get(145);return this._verticalScrollbarWidth=i.verticalScrollbarWidth,this._minimapWidth=i.minimap.minimapWidth,this._horizontalScrollbarHeight=i.horizontalScrollbarHeight,this._editorHeight=i.height,this._editorWidth=i.width,!0}addWidget(e){let t=$e(e.getDomNode());this._widgets[e.getId()]={widget:e,preference:null,domNode:t},t.setPosition("absolute"),t.setAttribute("widgetId",e.getId()),e.allowEditorOverflow?this.overflowingOverlayWidgetsDomNode.appendChild(t):this._domNode.appendChild(t),this.setShouldRender(),this._updateMaxMinWidth()}setWidgetPosition(e,t){let i=this._widgets[e.getId()];return i.preference===t?(this._updateMaxMinWidth(),!1):(i.preference=t,this.setShouldRender(),this._updateMaxMinWidth(),!0)}removeWidget(e){let t=e.getId();if(this._widgets.hasOwnProperty(t)){let o=this._widgets[t].domNode.domNode;delete this._widgets[t],o.remove(),this.setShouldRender(),this._updateMaxMinWidth()}}_updateMaxMinWidth(){var e,t;let i=0,o=Object.keys(this._widgets);for(let s=0,r=o.length;s=3){let s=Math.floor(o/3),r=Math.floor(o/3),a=o-s-r,l=e,c=l+s,d=l+s+a;return[[0,l,c,l,d,l,c,l],[0,s,a,s+a,r,s+a+r,a+r,s+a+r]]}else if(i===2){let s=Math.floor(o/2),r=o-s,a=e,l=a+s;return[[0,a,a,a,l,a,a,a],[0,s,s,s,r,s+r,s+r,s+r]]}else{let s=e,r=o;return[[0,s,s,s,s,s,s,s],[0,r,r,r,r,r,r,r]]}}equals(e){return this.lineHeight===e.lineHeight&&this.pixelRatio===e.pixelRatio&&this.overviewRulerLanes===e.overviewRulerLanes&&this.renderBorder===e.renderBorder&&this.borderColor===e.borderColor&&this.hideCursor===e.hideCursor&&this.cursorColorSingle===e.cursorColorSingle&&this.cursorColorPrimary===e.cursorColorPrimary&&this.cursorColorSecondary===e.cursorColorSecondary&&this.themeType===e.themeType&&Z.equals(this.backgroundColor,e.backgroundColor)&&this.top===e.top&&this.right===e.right&&this.domWidth===e.domWidth&&this.domHeight===e.domHeight&&this.canvasWidth===e.canvasWidth&&this.canvasHeight===e.canvasHeight}},iL=class extends hi{constructor(e){super(e),this._actualShouldRender=0,this._renderedDecorations=[],this._renderedCursorPositions=[],this._domNode=$e(document.createElement("canvas")),this._domNode.setClassName("decorationsOverviewRuler"),this._domNode.setPosition("absolute"),this._domNode.setLayerHinting(!0),this._domNode.setContain("strict"),this._domNode.setAttribute("aria-hidden","true"),this._updateSettings(!1),this._tokensColorTrackerListener=Bt.onDidChange(t=>{t.changedColorMap&&this._updateSettings(!0)}),this._cursorPositions=[{position:new U(1,1),color:this._settings.cursorColorSingle}]}dispose(){super.dispose(),this._tokensColorTrackerListener.dispose()}_updateSettings(e){let t=new qM(this._context.configuration,this._context.theme);return this._settings&&this._settings.equals(t)?!1:(this._settings=t,this._domNode.setTop(this._settings.top),this._domNode.setRight(this._settings.right),this._domNode.setWidth(this._settings.domWidth),this._domNode.setHeight(this._settings.domHeight),this._domNode.domNode.width=this._settings.canvasWidth,this._domNode.domNode.height=this._settings.canvasHeight,e&&this._render(),!0)}_markRenderingIsNeeded(){return this._actualShouldRender=2,!0}_markRenderingIsMaybeNeeded(){return this._actualShouldRender=1,!0}onConfigurationChanged(e){return this._updateSettings(!1)?this._markRenderingIsNeeded():!1}onCursorStateChanged(e){this._cursorPositions=[];for(let t=0,i=e.selections.length;t1&&(o=t===0?this._settings.cursorColorPrimary:this._settings.cursorColorSecondary),this._cursorPositions.push({position:e.selections[t].getPosition(),color:o})}return this._cursorPositions.sort((t,i)=>U.compare(t.position,i.position)),this._markRenderingIsMaybeNeeded()}onDecorationsChanged(e){return e.affectsOverviewRuler?this._markRenderingIsMaybeNeeded():!1}onFlushed(e){return this._markRenderingIsNeeded()}onScrollChanged(e){return e.scrollHeightChanged?this._markRenderingIsNeeded():!1}onZonesChanged(e){return this._markRenderingIsNeeded()}onThemeChanged(e){return this._updateSettings(!1)?this._markRenderingIsNeeded():!1}getDomNode(){return this._domNode.domNode}prepareRender(e){}render(e){this._render(),this._actualShouldRender=0}_render(){let e=this._settings.backgroundColor;if(this._settings.overviewRulerLanes===0){this._domNode.setBackgroundColor(e?Z.Format.CSS.formatHexA(e):""),this._domNode.setDisplay("none");return}let t=this._context.viewModel.getAllOverviewRulerDecorations(this._context.theme);if(t.sort(Wu.compareByRenderingProps),this._actualShouldRender===1&&!Wu.equalsArr(this._renderedDecorations,t)&&(this._actualShouldRender=2),this._actualShouldRender===1&&!Ht(this._renderedCursorPositions,this._cursorPositions,(g,m)=>g.position.lineNumber===m.position.lineNumber&&g.color===m.color)&&(this._actualShouldRender=2),this._actualShouldRender===1)return;this._renderedDecorations=t,this._renderedCursorPositions=this._cursorPositions,this._domNode.setDisplay("block");let i=this._settings.canvasWidth,o=this._settings.canvasHeight,s=this._settings.lineHeight,r=this._context.viewLayout,a=this._context.viewLayout.getScrollHeight(),l=o/a,c=6*this._settings.pixelRatio|0,d=c/2|0,h=this._domNode.domNode.getContext("2d");e?e.isOpaque()?(h.fillStyle=Z.Format.CSS.formatHexA(e),h.fillRect(0,0,i,o)):(h.clearRect(0,0,i,o),h.fillStyle=Z.Format.CSS.formatHexA(e),h.fillRect(0,0,i,o)):h.clearRect(0,0,i,o);let u=this._settings.x,f=this._settings.w;for(let g of t){let m=g.color,C=g.data;h.fillStyle=m;let S=0,w=0,y=0;for(let x=0,k=C.length/3;xo&&(V=o-d),W=V-d,j=V+d}W>y+1||T!==S?(x!==0&&h.fillRect(u[S],w,f[S],y-w),S=T,w=W,y=j):j>y&&(y=j)}h.fillRect(u[S],w,f[S],y-w)}if(!this._settings.hideCursor){let g=2*this._settings.pixelRatio|0,m=g/2|0,C=this._settings.x[7],S=this._settings.w[7],w=-100,y=-100,x=null;for(let k=0,T=this._cursorPositions.length;ko&&(W=o-m);let j=W-m,G=j+g;j>y+1||N!==x?(k!==0&&x&&h.fillRect(C,w,S,y-w),w=j,y=G):G>y&&(y=G),x=N,h.fillStyle=N}x&&h.fillRect(C,w,S,y-w)}this._settings.renderBorder&&this._settings.borderColor&&this._settings.overviewRulerLanes>0&&(h.beginPath(),h.lineWidth=1,h.strokeStyle=this._settings.borderColor,h.moveTo(0,0),h.lineTo(0,o),h.stroke(),h.moveTo(0,0),h.lineTo(i,0),h.stroke())}};_();v();b();_();v();b();var nL=class{constructor(e,t,i){this._colorZoneBrand=void 0,this.from=e|0,this.to=t|0,this.colorId=i|0}static compare(e,t){return e.colorId===t.colorId?e.from===t.from?e.to-t.to:e.from-t.from:e.colorId-t.colorId}},Eb=class{constructor(e,t,i,o){this._overviewRulerZoneBrand=void 0,this.startLineNumber=e,this.endLineNumber=t,this.heightInLines=i,this.color=o,this._colorZone=null}static compare(e,t){return e.color===t.color?e.startLineNumber===t.startLineNumber?e.heightInLines===t.heightInLines?e.endLineNumber-t.endLineNumber:e.heightInLines-t.heightInLines:e.startLineNumber-t.startLineNumber:e.colori&&(m=i-C);let S=d.color,w=this._color2Id[S];w||(w=++this._lastAssignedId,this._color2Id[S]=w,this._id2Color[w]=S);let y=new nL(m-C,m+C,w);d.setColorZone(y),a.push(y)}return this._colorZonesInvalid=!1,a.sort(nL.compare),a}};var sL=class extends Qr{constructor(e,t){super(),this._context=e;let i=this._context.configuration.options;this._domNode=$e(document.createElement("canvas")),this._domNode.setClassName(t),this._domNode.setPosition("absolute"),this._domNode.setLayerHinting(!0),this._domNode.setContain("strict"),this._zoneManager=new oL(o=>this._context.viewLayout.getVerticalOffsetForLineNumber(o)),this._zoneManager.setDOMWidth(0),this._zoneManager.setDOMHeight(0),this._zoneManager.setOuterHeight(this._context.viewLayout.getScrollHeight()),this._zoneManager.setLineHeight(i.get(67)),this._zoneManager.setPixelRatio(i.get(143)),this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),super.dispose()}onConfigurationChanged(e){let t=this._context.configuration.options;return e.hasChanged(67)&&(this._zoneManager.setLineHeight(t.get(67)),this._render()),e.hasChanged(143)&&(this._zoneManager.setPixelRatio(t.get(143)),this._domNode.setWidth(this._zoneManager.getDOMWidth()),this._domNode.setHeight(this._zoneManager.getDOMHeight()),this._domNode.domNode.width=this._zoneManager.getCanvasWidth(),this._domNode.domNode.height=this._zoneManager.getCanvasHeight(),this._render()),!0}onFlushed(e){return this._render(),!0}onScrollChanged(e){return e.scrollHeightChanged&&(this._zoneManager.setOuterHeight(e.scrollHeight),this._render()),!0}onZonesChanged(e){return this._render(),!0}getDomNode(){return this._domNode.domNode}setLayout(e){this._domNode.setTop(e.top),this._domNode.setRight(e.right);let t=!1;t=this._zoneManager.setDOMWidth(e.width)||t,t=this._zoneManager.setDOMHeight(e.height)||t,t&&(this._domNode.setWidth(this._zoneManager.getDOMWidth()),this._domNode.setHeight(this._zoneManager.getDOMHeight()),this._domNode.domNode.width=this._zoneManager.getCanvasWidth(),this._domNode.domNode.height=this._zoneManager.getCanvasHeight(),this._render())}setZones(e){this._zoneManager.setZones(e),this._render()}_render(){if(this._zoneManager.getOuterHeight()===0)return!1;let e=this._zoneManager.getCanvasWidth(),t=this._zoneManager.getCanvasHeight(),i=this._zoneManager.resolveColorZones(),o=this._zoneManager.getId2Color(),s=this._domNode.domNode.getContext("2d");return s.clearRect(0,0,e,t),i.length>0&&this._renderOneLane(s,i,o,e),!0}_renderOneLane(e,t,i,o){let s=0,r=0,a=0;for(let l of t){let c=l.colorId,d=l.from,h=l.to;c!==s?(e.fillRect(0,r,o,a-r),s=c,e.fillStyle=i[s],r=d,a=h):a>=d?a=Math.max(a,h):(e.fillRect(0,r,o,a-r),r=d,a=h)}e.fillRect(0,r,o,a-r)}};_();v();b();var rL=class extends hi{constructor(e){super(e),this.domNode=$e(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this.domNode.setClassName("view-rulers"),this._renderedRulers=[];let t=this._context.configuration.options;this._rulers=t.get(102),this._typicalHalfwidthCharacterWidth=t.get(50).typicalHalfwidthCharacterWidth}dispose(){super.dispose()}onConfigurationChanged(e){let t=this._context.configuration.options;return this._rulers=t.get(102),this._typicalHalfwidthCharacterWidth=t.get(50).typicalHalfwidthCharacterWidth,!0}onScrollChanged(e){return e.scrollHeightChanged}prepareRender(e){}_ensureRulersCount(){let e=this._renderedRulers.length,t=this._rulers.length;if(e===t)return;if(e0;){let a=$e(document.createElement("div"));a.setClassName("view-ruler"),a.setWidth(s),this.domNode.appendChild(a),this._renderedRulers.push(a),r--}return}let i=e-t;for(;i>0;){let o=this._renderedRulers.pop();this.domNode.removeChild(o),i--}}render(e){this._ensureRulersCount();for(let t=0,i=this._rulers.length;t0;return this._shouldShow!==e?(this._shouldShow=e,!0):!1}getDomNode(){return this._domNode}_updateWidth(){let t=this._context.configuration.options.get(145);t.minimap.renderMinimap===0||t.minimap.minimapWidth>0&&t.minimap.minimapLeft===0?this._width=t.width:this._width=t.width-t.verticalScrollbarWidth}onConfigurationChanged(e){let i=this._context.configuration.options.get(103);return this._useShadows=i.useShadows,this._updateWidth(),this._updateShouldShow(),!0}onScrollChanged(e){return this._scrollTop=e.scrollTop,this._updateShouldShow()}prepareRender(e){}render(e){this._domNode.setWidth(this._width),this._domNode.setClassName(this._shouldShow?"scroll-decoration":"")}};_();v();b();is();Qi();var jM=class{constructor(e){this.left=e.left,this.width=e.width,this.startStyle=null,this.endStyle=null}},GM=class{constructor(e,t){this.lineNumber=e,this.ranges=t}};function UG(n){return new jM(n)}function KG(n){return new GM(n.lineNumber,n.ranges.map(UG))}var qa=class n extends ns{constructor(e){super(),this._previousFrameVisibleRangesWithStyle=[],this._context=e;let t=this._context.configuration.options;this._roundedSelection=t.get(101),this._typicalHalfwidthCharacterWidth=t.get(50).typicalHalfwidthCharacterWidth,this._selections=[],this._renderResult=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(e){let t=this._context.configuration.options;return this._roundedSelection=t.get(101),this._typicalHalfwidthCharacterWidth=t.get(50).typicalHalfwidthCharacterWidth,!0}onCursorStateChanged(e){return this._selections=e.selections.slice(0),!0}onDecorationsChanged(e){return!0}onFlushed(e){return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return e.scrollTopChanged}onZonesChanged(e){return!0}_visibleRangesHaveGaps(e){for(let t=0,i=e.length;t1)return!0;return!1}_enrichVisibleRangesWithStyle(e,t,i){let o=this._typicalHalfwidthCharacterWidth/4,s=null,r=null;if(i&&i.length>0&&t.length>0){let a=t[0].lineNumber;if(a===e.startLineNumber)for(let c=0;!s&&c=0;c--)i[c].lineNumber===l&&(r=i[c].ranges[0]);s&&!s.startStyle&&(s=null),r&&!r.startStyle&&(r=null)}for(let a=0,l=t.length;a0){let g=t[a-1].ranges[0].left,m=t[a-1].ranges[0].left+t[a-1].ranges[0].width;lL(d-g)g&&(u.top=1),lL(h-m)'}_actualRenderOneSelection(e,t,i,o){if(o.length===0)return;let s=!!o[0].ranges[0].startStyle,r=o[0].lineNumber,a=o[o.length-1].lineNumber;for(let l=0,c=o.length;l1,c)}this._previousFrameVisibleRangesWithStyle=s,this._renderResult=t.map(([r,a])=>r+a)}render(e,t){if(!this._renderResult)return"";let i=t-e;return i<0||i>=this._renderResult.length?"":this._renderResult[i]}};qa.SELECTION_CLASS_NAME="selected-text";qa.SELECTION_TOP_LEFT="top-left-radius";qa.SELECTION_BOTTOM_LEFT="bottom-left-radius";qa.SELECTION_TOP_RIGHT="top-right-radius";qa.SELECTION_BOTTOM_RIGHT="bottom-right-radius";qa.EDITOR_BACKGROUND_CLASS_NAME="monaco-editor-background";qa.ROUNDED_PIECE_WIDTH=10;Lo((n,e)=>{let t=n.getColor(X8);t&&!t.isTransparent()&&e.addRule(`.monaco-editor .view-line span.inline-selected-text { color: ${t}; }`)});function lL(n){return n<0?-n:n}_();v();b();Gt();_();v();b();ke();ot();ft();Ke();var cL=class{constructor(e,t,i,o,s,r,a){this.top=e,this.left=t,this.paddingLeft=i,this.width=o,this.height=s,this.textContent=r,this.textContentClassName=a}},Hl;(function(n){n[n.Single=0]="Single",n[n.MultiPrimary=1]="MultiPrimary",n[n.MultiSecondary=2]="MultiSecondary"})(Hl||(Hl={}));var Ib=class{constructor(e,t){this._context=e;let i=this._context.configuration.options,o=i.get(50);this._cursorStyle=i.get(28),this._lineHeight=i.get(67),this._typicalHalfwidthCharacterWidth=o.typicalHalfwidthCharacterWidth,this._lineCursorWidth=Math.min(i.get(31),this._typicalHalfwidthCharacterWidth),this._isVisible=!0,this._domNode=$e(document.createElement("div")),this._domNode.setClassName(`cursor ${Bc}`),this._domNode.setHeight(this._lineHeight),this._domNode.setTop(0),this._domNode.setLeft(0),Si(this._domNode,o),this._domNode.setDisplay("none"),this._position=new U(1,1),this._pluralityClass="",this.setPlurality(t),this._lastRenderedContent="",this._renderData=null}getDomNode(){return this._domNode}getPosition(){return this._position}setPlurality(e){switch(e){default:case Hl.Single:this._pluralityClass="";break;case Hl.MultiPrimary:this._pluralityClass="cursor-primary";break;case Hl.MultiSecondary:this._pluralityClass="cursor-secondary";break}}show(){this._isVisible||(this._domNode.setVisibility("inherit"),this._isVisible=!0)}hide(){this._isVisible&&(this._domNode.setVisibility("hidden"),this._isVisible=!1)}onConfigurationChanged(e){let t=this._context.configuration.options,i=t.get(50);return this._cursorStyle=t.get(28),this._lineHeight=t.get(67),this._typicalHalfwidthCharacterWidth=i.typicalHalfwidthCharacterWidth,this._lineCursorWidth=Math.min(t.get(31),this._typicalHalfwidthCharacterWidth),Si(this._domNode,i),!0}onCursorPositionChanged(e,t){return t?this._domNode.domNode.style.transitionProperty="none":this._domNode.domNode.style.transitionProperty="",this._position=e,!0}_getGraphemeAwarePosition(){let{lineNumber:e,column:t}=this._position,i=this._context.viewModel.getLineContent(e),[o,s]=d7(i,t-1);return[new U(e,o+1),i.substring(o,s)]}_prepareRender(e){let t="",i="",[o,s]=this._getGraphemeAwarePosition();if(this._cursorStyle===on.Line||this._cursorStyle===on.LineThin){let u=e.visibleRangeForPosition(o);if(!u||u.outsideRenderedLine)return null;let f=ge(this._domNode.domNode),g;this._cursorStyle===on.Line?(g=iN(f,this._lineCursorWidth>0?this._lineCursorWidth:2),g>2&&(t=s,i=this._getTokenClassName(o))):g=iN(f,1);let m=u.left,C=0;g>=2&&m>=1&&(C=1,m-=C);let S=e.getVerticalOffsetForLineNumber(o.lineNumber)-e.bigNumbersDelta;return new cL(S,m,C,g,this._lineHeight,t,i)}let r=e.linesVisibleRangesForRange(new P(o.lineNumber,o.column,o.lineNumber,o.column+s.length),!1);if(!r||r.length===0)return null;let a=r[0];if(a.outsideRenderedLine||a.ranges.length===0)return null;let l=a.ranges[0],c=s===" "?this._typicalHalfwidthCharacterWidth:l.width<1?this._typicalHalfwidthCharacterWidth:l.width;this._cursorStyle===on.Block&&(t=s,i=this._getTokenClassName(o));let d=e.getVerticalOffsetForLineNumber(o.lineNumber)-e.bigNumbersDelta,h=this._lineHeight;return(this._cursorStyle===on.Underline||this._cursorStyle===on.UnderlineThin)&&(d+=this._lineHeight-2,h=2),new cL(d,l.left,0,c,h,t,i)}_getTokenClassName(e){let t=this._context.viewModel.getViewLineData(e.lineNumber),i=t.tokens.findTokenIndexAtOffset(e.column-1);return t.tokens.getClassName(i)}prepareRender(e){this._renderData=this._prepareRender(e)}render(e){return this._renderData?(this._lastRenderedContent!==this._renderData.textContent&&(this._lastRenderedContent=this._renderData.textContent,this._domNode.domNode.textContent=this._lastRenderedContent),this._domNode.setClassName(`cursor ${this._pluralityClass} ${Bc} ${this._renderData.textContentClassName}`),this._domNode.setDisplay("block"),this._domNode.setTop(this._renderData.top),this._domNode.setLeft(this._renderData.left),this._domNode.setPaddingLeft(this._renderData.paddingLeft),this._domNode.setWidth(this._renderData.width),this._domNode.setLineHeight(this._renderData.height),this._domNode.setHeight(this._renderData.height),{domNode:this._domNode.domNode,position:this._position,contentLeft:this._renderData.left,height:this._renderData.height,width:2}):(this._domNode.setDisplay("none"),null)}};$a();Qi();ch();ke();var Tb=class n extends hi{constructor(e){super(e);let t=this._context.configuration.options;this._readOnly=t.get(91),this._cursorBlinking=t.get(26),this._cursorStyle=t.get(28),this._cursorSmoothCaretAnimation=t.get(27),this._selectionIsEmpty=!0,this._isComposingInput=!1,this._isVisible=!1,this._primaryCursor=new Ib(this._context,Hl.Single),this._secondaryCursors=[],this._renderData=[],this._domNode=$e(document.createElement("div")),this._domNode.setAttribute("role","presentation"),this._domNode.setAttribute("aria-hidden","true"),this._updateDomClassName(),this._domNode.appendChild(this._primaryCursor.getDomNode()),this._startCursorBlinkAnimation=new Xo,this._cursorFlatBlinkInterval=new Bd,this._blinkingEnabled=!1,this._editorHasFocus=!1,this._updateBlinking()}dispose(){super.dispose(),this._startCursorBlinkAnimation.dispose(),this._cursorFlatBlinkInterval.dispose()}getDomNode(){return this._domNode}onCompositionStart(e){return this._isComposingInput=!0,this._updateBlinking(),!0}onCompositionEnd(e){return this._isComposingInput=!1,this._updateBlinking(),!0}onConfigurationChanged(e){let t=this._context.configuration.options;this._readOnly=t.get(91),this._cursorBlinking=t.get(26),this._cursorStyle=t.get(28),this._cursorSmoothCaretAnimation=t.get(27),this._updateBlinking(),this._updateDomClassName(),this._primaryCursor.onConfigurationChanged(e);for(let i=0,o=this._secondaryCursors.length;it.length){let s=this._secondaryCursors.length-t.length;for(let r=0;r{for(let o=0,s=e.ranges.length;o{this._isVisible?this._hide():this._show()},n.BLINK_INTERVAL,ge(this._domNode.domNode)):this._startCursorBlinkAnimation.setIfNotSet(()=>{this._blinkingEnabled=!0,this._updateDomClassName()},n.BLINK_INTERVAL))}_updateDomClassName(){this._domNode.setClassName(this._getClassName())}_getClassName(){let e="cursors-layer";switch(this._selectionIsEmpty||(e+=" has-selection"),this._cursorStyle){case on.Line:e+=" cursor-line-style";break;case on.Block:e+=" cursor-block-style";break;case on.Underline:e+=" cursor-underline-style";break;case on.LineThin:e+=" cursor-line-thin-style";break;case on.BlockOutline:e+=" cursor-block-outline-style";break;case on.UnderlineThin:e+=" cursor-underline-thin-style";break;default:e+=" cursor-line-style"}if(this._blinkingEnabled)switch(this._getCursorBlinking()){case 1:e+=" cursor-blink";break;case 2:e+=" cursor-smooth";break;case 3:e+=" cursor-phase";break;case 4:e+=" cursor-expand";break;case 5:e+=" cursor-solid";break;default:e+=" cursor-solid"}else e+=" cursor-solid";return(this._cursorSmoothCaretAnimation==="on"||this._cursorSmoothCaretAnimation==="explicit")&&(e+=" cursor-smooth-caret-animation"),e}_show(){this._primaryCursor.show();for(let e=0,t=this._secondaryCursors.length;e{let t=[{class:".cursor",foreground:ea,background:Wl},{class:".cursor-primary",foreground:fx,background:A6},{class:".cursor-secondary",foreground:gx,background:M6}];for(let i of t){let o=n.getColor(i.foreground);if(o){let s=n.getColor(i.background);s||(s=o.opposite()),e.addRule(`.monaco-editor .cursors-layer ${i.class} { background-color: ${o}; border-color: ${o}; color: ${s}; }`),Ol(n.type)&&e.addRule(`.monaco-editor .cursors-layer.has-selection ${i.class} { border-left: 1px solid ${s}; border-right: 1px solid ${s}; }`)}}});_();v();b();xt();ft();var ZM=()=>{throw new Error("Invalid change accessor")},dL=class extends hi{constructor(e){super(e);let t=this._context.configuration.options,i=t.get(145);this._lineHeight=t.get(67),this._contentWidth=i.contentWidth,this._contentLeft=i.contentLeft,this.domNode=$e(document.createElement("div")),this.domNode.setClassName("view-zones"),this.domNode.setPosition("absolute"),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this.marginDomNode=$e(document.createElement("div")),this.marginDomNode.setClassName("margin-view-zones"),this.marginDomNode.setPosition("absolute"),this.marginDomNode.setAttribute("role","presentation"),this.marginDomNode.setAttribute("aria-hidden","true"),this._zones={}}dispose(){super.dispose(),this._zones={}}_recomputeWhitespacesProps(){let e=this._context.viewLayout.getWhitespaces(),t=new Map;for(let o of e)t.set(o.id,o);let i=!1;return this._context.viewModel.changeWhitespace(o=>{let s=Object.keys(this._zones);for(let r=0,a=s.length;r{let o={addZone:s=>(t=!0,this._addZone(i,s)),removeZone:s=>{s&&(t=this._removeZone(i,s)||t)},layoutZone:s=>{s&&(t=this._layoutZone(i,s)||t)}};$G(e,o),o.addZone=ZM,o.removeZone=ZM,o.layoutZone=ZM}),t}_addZone(e,t){let i=this._computeWhitespaceProps(t),s={whitespaceId:e.insertWhitespace(i.afterViewLineNumber,this._getZoneOrdinal(t),i.heightInPx,i.minWidthInPx),delegate:t,isInHiddenArea:i.isInHiddenArea,isVisible:!1,domNode:$e(t.domNode),marginDomNode:t.marginDomNode?$e(t.marginDomNode):null};return this._safeCallOnComputedHeight(s.delegate,i.heightInPx),s.domNode.setPosition("absolute"),s.domNode.domNode.style.width="100%",s.domNode.setDisplay("none"),s.domNode.setAttribute("monaco-view-zone",s.whitespaceId),this.domNode.appendChild(s.domNode),s.marginDomNode&&(s.marginDomNode.setPosition("absolute"),s.marginDomNode.domNode.style.width="100%",s.marginDomNode.setDisplay("none"),s.marginDomNode.setAttribute("monaco-view-zone",s.whitespaceId),this.marginDomNode.appendChild(s.marginDomNode)),this._zones[s.whitespaceId]=s,this.setShouldRender(),s.whitespaceId}_removeZone(e,t){if(this._zones.hasOwnProperty(t)){let i=this._zones[t];return delete this._zones[t],e.removeWhitespace(i.whitespaceId),i.domNode.removeAttribute("monaco-visible-view-zone"),i.domNode.removeAttribute("monaco-view-zone"),i.domNode.domNode.parentNode.removeChild(i.domNode.domNode),i.marginDomNode&&(i.marginDomNode.removeAttribute("monaco-visible-view-zone"),i.marginDomNode.removeAttribute("monaco-view-zone"),i.marginDomNode.domNode.parentNode.removeChild(i.marginDomNode.domNode)),this.setShouldRender(),!0}return!1}_layoutZone(e,t){if(this._zones.hasOwnProperty(t)){let i=this._zones[t],o=this._computeWhitespaceProps(i.delegate);return i.isInHiddenArea=o.isInHiddenArea,e.changeOneWhitespace(i.whitespaceId,o.afterViewLineNumber,o.heightInPx),this._safeCallOnComputedHeight(i.delegate,o.heightInPx),this.setShouldRender(),!0}return!1}shouldSuppressMouseDownOnViewZone(e){return this._zones.hasOwnProperty(e)?!!this._zones[e].delegate.suppressMouseDown:!1}_heightInPixels(e){return typeof e.heightInPx=="number"?e.heightInPx:typeof e.heightInLines=="number"?this._lineHeight*e.heightInLines:this._lineHeight}_minWidthInPixels(e){return typeof e.minWidthInPx=="number"?e.minWidthInPx:0}_safeCallOnComputedHeight(e,t){if(typeof e.onComputedHeight=="function")try{e.onComputedHeight(t)}catch(i){ut(i)}}_safeCallOnDomNodeTop(e,t){if(typeof e.onDomNodeTop=="function")try{e.onDomNodeTop(t)}catch(i){ut(i)}}prepareRender(e){}render(e){let t=e.viewportData.whitespaceViewportData,i={},o=!1;for(let r of t)this._zones[r.id].isInHiddenArea||(i[r.id]=r,o=!0);let s=Object.keys(this._zones);for(let r=0,a=s.length;ra)continue;let f=u.startLineNumber===a?u.startColumn:c.minColumn,g=u.endLineNumber===a?u.endColumn:c.maxColumn;f=j.endOffset&&(W++,j=i&&i[W]),z!==9&&z!==32||u&&!T&&V<=M)continue;if(h&&V>=N&&V<=M&&z===32){let ee=V-1>=0?a.charCodeAt(V-1):0,ce=V+1=0?a.charCodeAt(V-1):0;if(z===32&&ee!==32&&ee!==9)continue}if(i&&(!j||j.startOffset>V||j.endOffset<=V))continue;let te=e.visibleRangeForPosition(new U(t,V+1));te&&(r?(G=Math.max(G,te.left),z===9?k+=this._renderArrow(f,C,te.left):k+=``):z===9?k+=`
${x?"\uFFEB":"\u2192"}
`:k+=`
${String.fromCharCode(y)}
`)}return r?(G=Math.round(G+C),``+k+""):k}_renderArrow(e,t,i){let o=t/7,s=t,r=e/2,a=i,l={x:0,y:o/2},c={x:100/125*s,y:l.y},d={x:c.x-.2*c.x,y:c.y+.2*c.x},h={x:d.x+.1*c.x,y:d.y+.1*c.x},u={x:h.x+.35*c.x,y:h.y-.35*c.x},f={x:u.x,y:-u.y},g={x:h.x,y:-h.y},m={x:d.x,y:-d.y},C={x:c.x,y:-c.y},S={x:l.x,y:-l.y};return``}render(e,t){if(!this._renderResult)return"";let i=t-e;return i<0||i>=this._renderResult.length?"":this._renderResult[i]}},uL=class{constructor(e){let t=e.options,i=t.get(50),o=t.get(38);o==="off"?(this.renderWhitespace="none",this.renderWithSVG=!1):o==="svg"?(this.renderWhitespace=t.get(99),this.renderWithSVG=!0):(this.renderWhitespace=t.get(99),this.renderWithSVG=!1),this.spaceWidth=i.spaceWidth,this.middotWidth=i.middotWidth,this.wsmiddotWidth=i.wsmiddotWidth,this.canUseHalfwidthRightwardsArrow=i.canUseHalfwidthRightwardsArrow,this.lineHeight=t.get(67),this.stopRenderingLineAfter=t.get(117)}equals(e){return this.renderWhitespace===e.renderWhitespace&&this.renderWithSVG===e.renderWithSVG&&this.spaceWidth===e.spaceWidth&&this.middotWidth===e.middotWidth&&this.wsmiddotWidth===e.wsmiddotWidth&&this.canUseHalfwidthRightwardsArrow===e.canUseHalfwidthRightwardsArrow&&this.lineHeight===e.lineHeight&&this.stopRenderingLineAfter===e.stopRenderingLineAfter}};ft();Ke();Kn();hr();_();v();b();Ke();var fL=class{constructor(e,t,i,o){this.selections=e,this.startLineNumber=t.startLineNumber|0,this.endLineNumber=t.endLineNumber|0,this.relativeVerticalOffset=t.relativeVerticalOffset,this.bigNumbersDelta=t.bigNumbersDelta|0,this.lineHeight=t.lineHeight|0,this.whitespaceViewportData=i,this._model=o,this.visibleRange=new P(t.startLineNumber,this._model.getLineMinColumn(t.startLineNumber),t.endLineNumber,this._model.getLineMaxColumn(t.endLineNumber))}getViewLineRenderingData(e){return this._model.getViewportViewLineRenderingData(this.visibleRange,e)}getDecorationsInViewport(){return this._model.getDecorationsInViewport(this.visibleRange)}};_();v();b();_();v();b();var gL=class{get type(){return this._theme.type}get value(){return this._theme}constructor(e){this._theme=e}update(e){this._theme=e}getColor(e){return this._theme.getColor(e)}};var mL=class{constructor(e,t,i){this.configuration=e,this.theme=new gL(t),this.viewModel=i,this.viewLayout=i.viewLayout}addEventHandler(e){this.viewModel.addViewEventHandler(e)}removeEventHandler(e){this.viewModel.removeViewEventHandler(e)}};qe();Qi();var qG=function(n,e,t,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},jG=function(n,e){return function(t,i){e(t,i,n)}},pL=class extends Qr{constructor(e,t,i,o,s,r,a){super(),this._instantiationService=a,this._shouldRecomputeGlyphMarginLanes=!1,this._selections=[new nt(1,1,1,1)],this._renderAnimationFrame=null;let l=new Nx(t,o,s,e);this._context=new mL(t,i,o),this._context.addEventHandler(this),this._viewParts=[],this._textAreaHandler=this._instantiationService.createInstance(wx,this._context,l,this._createTextAreaHandlerHelper()),this._viewParts.push(this._textAreaHandler),this._linesContent=$e(document.createElement("div")),this._linesContent.setClassName("lines-content monaco-editor-background"),this._linesContent.setPosition("absolute"),this.domNode=$e(document.createElement("div")),this.domNode.setClassName(this._getEditorClassName()),this.domNode.setAttribute("role","code"),this._overflowGuardContainer=$e(document.createElement("div")),Mn.write(this._overflowGuardContainer,3),this._overflowGuardContainer.setClassName("overflow-guard"),this._scrollbar=new Hx(this._context,this._linesContent,this.domNode,this._overflowGuardContainer),this._viewParts.push(this._scrollbar),this._viewLines=new kb(this._context,this._linesContent),this._viewZones=new dL(this._context),this._viewParts.push(this._viewZones);let c=new iL(this._context);this._viewParts.push(c);let d=new aL(this._context);this._viewParts.push(d);let h=new Mx(this._context);this._viewParts.push(h),h.addDynamicOverlay(new Wx(this._context)),h.addDynamicOverlay(new qa(this._context)),h.addDynamicOverlay(new qx(this._context)),h.addDynamicOverlay(new Vx(this._context)),h.addDynamicOverlay(new hL(this._context));let u=new Rx(this._context);this._viewParts.push(u),u.addDynamicOverlay(new zx(this._context)),u.addDynamicOverlay(new Gx(this._context)),u.addDynamicOverlay(new jx(this._context)),u.addDynamicOverlay(new rf(this._context)),this._glyphMarginWidgets=new Ux(this._context),this._viewParts.push(this._glyphMarginWidgets);let f=new fh(this._context);f.getDomNode().appendChild(this._viewZones.marginDomNode),f.getDomNode().appendChild(u.getDomNode()),f.getDomNode().appendChild(this._glyphMarginWidgets.domNode),this._viewParts.push(f),this._contentWidgets=new Ox(this._context,this.domNode),this._viewParts.push(this._contentWidgets),this._viewCursors=new Tb(this._context),this._viewParts.push(this._viewCursors),this._overlayWidgets=new tL(this._context,this.domNode),this._viewParts.push(this._overlayWidgets);let g=new rL(this._context);this._viewParts.push(g);let m=new Px(this._context);this._viewParts.push(m);let C=new Jx(this._context);if(this._viewParts.push(C),c){let S=this._scrollbar.getOverviewRulerLayoutInfo();S.parent.insertBefore(c.getDomNode(),S.insertBefore)}this._linesContent.appendChild(h.getDomNode()),this._linesContent.appendChild(g.domNode),this._linesContent.appendChild(this._viewZones.domNode),this._linesContent.appendChild(this._viewLines.getDomNode()),this._linesContent.appendChild(this._contentWidgets.domNode),this._linesContent.appendChild(this._viewCursors.getDomNode()),this._overflowGuardContainer.appendChild(f.getDomNode()),this._overflowGuardContainer.appendChild(this._scrollbar.getDomNode()),this._overflowGuardContainer.appendChild(d.getDomNode()),this._overflowGuardContainer.appendChild(this._textAreaHandler.textArea),this._overflowGuardContainer.appendChild(this._textAreaHandler.textAreaCover),this._overflowGuardContainer.appendChild(this._overlayWidgets.getDomNode()),this._overflowGuardContainer.appendChild(C.getDomNode()),this._overflowGuardContainer.appendChild(m.domNode),this.domNode.appendChild(this._overflowGuardContainer),r?(r.appendChild(this._contentWidgets.overflowingContentWidgetsDomNode.domNode),r.appendChild(this._overlayWidgets.overflowingOverlayWidgetsDomNode.domNode)):(this.domNode.appendChild(this._contentWidgets.overflowingContentWidgetsDomNode),this.domNode.appendChild(this._overlayWidgets.overflowingOverlayWidgetsDomNode)),this._applyLayout(),this._pointerHandler=this._register(new ax(this._context,l,this._createPointerHandlerHelper()))}_computeGlyphMarginLanes(){let e=this._context.viewModel.model,t=this._context.viewModel.glyphLanes,i=[],o=0;i=i.concat(e.getAllMarginDecorations().map(s=>{var r,a,l;let c=(a=(r=s.options.glyphMargin)===null||r===void 0?void 0:r.position)!==null&&a!==void 0?a:dr.Center;return o=Math.max(o,s.range.endLineNumber),{range:s.range,lane:c,persist:(l=s.options.glyphMargin)===null||l===void 0?void 0:l.persistLane}})),i=i.concat(this._glyphMarginWidgets.getWidgets().map(s=>{let r=e.validateRange(s.preference.range);return o=Math.max(o,r.endLineNumber),{range:r,lane:s.preference.lane}})),i.sort((s,r)=>P.compareRangesUsingStarts(s.range,r.range)),t.reset(o);for(let s of i)t.push(s.lane,s.range,s.persist);return t}_createPointerHandlerHelper(){return{viewDomNode:this.domNode.domNode,linesContentDomNode:this._linesContent.domNode,viewLinesDomNode:this._viewLines.getDomNode().domNode,focusTextArea:()=>{this.focus()},dispatchTextAreaEvent:e=>{this._textAreaHandler.textArea.domNode.dispatchEvent(e)},getLastRenderData:()=>{let e=this._viewCursors.getLastRenderData()||[],t=this._textAreaHandler.getLastRenderData();return new GS(e,t)},renderNow:()=>{this.render(!0,!1)},shouldSuppressMouseDownOnViewZone:e=>this._viewZones.shouldSuppressMouseDownOnViewZone(e),shouldSuppressMouseDownOnWidget:e=>this._contentWidgets.shouldSuppressMouseDownOnWidget(e),getPositionFromDOMInfo:(e,t)=>(this._flushAccumulatedAndRenderNow(),this._viewLines.getPositionFromDOMInfo(e,t)),visibleRangeForPosition:(e,t)=>(this._flushAccumulatedAndRenderNow(),this._viewLines.visibleRangeForPosition(new U(e,t))),getLineWidth:e=>(this._flushAccumulatedAndRenderNow(),this._viewLines.getLineWidth(e))}}_createTextAreaHandlerHelper(){return{visibleRangeForPosition:e=>(this._flushAccumulatedAndRenderNow(),this._viewLines.visibleRangeForPosition(e))}}_applyLayout(){let t=this._context.configuration.options.get(145);this.domNode.setWidth(t.width),this.domNode.setHeight(t.height),this._overflowGuardContainer.setWidth(t.width),this._overflowGuardContainer.setHeight(t.height),this._linesContent.setWidth(16777216),this._linesContent.setHeight(16777216)}_getEditorClassName(){let e=this._textAreaHandler.isFocused()?" focused":"";return this._context.configuration.options.get(142)+" "+mb(this._context.theme.type)+e}handleEvents(e){super.handleEvents(e),this._scheduleRender()}onConfigurationChanged(e){return this.domNode.setClassName(this._getEditorClassName()),this._applyLayout(),!1}onCursorStateChanged(e){return this._selections=e.selections,!1}onDecorationsChanged(e){return e.affectsGlyphMargin&&(this._shouldRecomputeGlyphMarginLanes=!0),!1}onFocusChanged(e){return this.domNode.setClassName(this._getEditorClassName()),!1}onThemeChanged(e){return this._context.theme.update(e.theme),this.domNode.setClassName(this._getEditorClassName()),!1}dispose(){this._renderAnimationFrame!==null&&(this._renderAnimationFrame.dispose(),this._renderAnimationFrame=null),this._contentWidgets.overflowingContentWidgetsDomNode.domNode.remove(),this._context.removeEventHandler(this),this._viewLines.dispose();for(let e of this._viewParts)e.dispose();super.dispose()}_scheduleRender(){if(this._store.isDisposed)throw new St;if(this._renderAnimationFrame===null){let e=this._createCoordinatedRendering();this._renderAnimationFrame=Nb.INSTANCE.scheduleCoordinatedRendering({window:ge(this.domNode.domNode),prepareRenderText:()=>{if(this._store.isDisposed)throw new St;try{return e.prepareRenderText()}finally{this._renderAnimationFrame=null}},renderText:()=>{if(this._store.isDisposed)throw new St;return e.renderText()},prepareRender:(t,i)=>{if(this._store.isDisposed)throw new St;return e.prepareRender(t,i)},render:(t,i)=>{if(this._store.isDisposed)throw new St;return e.render(t,i)}})}}_flushAccumulatedAndRenderNow(){let e=this._createCoordinatedRendering();ph(()=>e.prepareRenderText());let t=ph(()=>e.renderText());if(t){let[i,o]=t;ph(()=>e.prepareRender(i,o)),ph(()=>e.render(i,o))}}_getViewPartsToRender(){let e=[],t=0;for(let i of this._viewParts)i.shouldRender()&&(e[t++]=i);return e}_createCoordinatedRendering(){return{prepareRenderText:()=>{if(this._shouldRecomputeGlyphMarginLanes){this._shouldRecomputeGlyphMarginLanes=!1;let e=this._computeGlyphMarginLanes();this._context.configuration.setGlyphMarginDecorationLaneCount(e.requiredLanes)}Ml.onRenderStart()},renderText:()=>{if(!this.domNode.domNode.isConnected)return null;let e=this._getViewPartsToRender();if(!this._viewLines.shouldRender()&&e.length===0)return null;let t=this._context.viewLayout.getLinesViewportData();this._context.viewModel.setViewport(t.startLineNumber,t.endLineNumber,t.centeredLineNumber);let i=new fL(this._selections,t,this._context.viewLayout.getWhitespaceViewportData(),this._context.viewModel);return this._contentWidgets.shouldRender()&&this._contentWidgets.onBeforeRender(i),this._viewLines.shouldRender()&&(this._viewLines.renderText(i),this._viewLines.onDidRender(),e=this._getViewPartsToRender()),[e,new US(this._context.viewLayout,i,this._viewLines)]},prepareRender:(e,t)=>{for(let i of e)i.prepareRender(t)},render:(e,t)=>{for(let i of e)i.render(t),i.onDidRender()}}}delegateVerticalScrollbarPointerDown(e){this._scrollbar.delegateVerticalScrollbarPointerDown(e)}delegateScrollFromMouseWheelEvent(e){this._scrollbar.delegateScrollFromMouseWheelEvent(e)}restoreState(e){this._context.viewModel.viewLayout.setScrollPosition({scrollTop:e.scrollTop,scrollLeft:e.scrollLeft},1),this._context.viewModel.visibleLinesStabilized()}getOffsetForColumn(e,t){let i=this._context.viewModel.model.validatePosition({lineNumber:e,column:t}),o=this._context.viewModel.coordinatesConverter.convertModelPositionToViewPosition(i);this._flushAccumulatedAndRenderNow();let s=this._viewLines.visibleRangeForPosition(new U(o.lineNumber,o.column));return s?s.left:-1}getTargetAtClientPoint(e,t){let i=this._pointerHandler.getTargetAtClientPoint(e,t);return i?qm.convertViewToModelMouseTarget(i,this._context.viewModel.coordinatesConverter):null}createOverviewRuler(e){return new sL(this._context,e)}change(e){this._viewZones.changeViewZones(e),this._scheduleRender()}render(e,t){if(t){this._viewLines.forceShouldRender();for(let i of this._viewParts)i.forceShouldRender()}e?this._flushAccumulatedAndRenderNow():this._scheduleRender()}writeScreenReaderContent(e){this._textAreaHandler.writeScreenReaderContent(e)}focus(){this._textAreaHandler.focusTextArea()}isFocused(){return this._textAreaHandler.isFocused()}setAriaOptions(e){this._textAreaHandler.setAriaOptions(e)}addContentWidget(e){this._contentWidgets.addWidget(e.widget),this.layoutContentWidget(e),this._scheduleRender()}layoutContentWidget(e){var t,i,o,s,r,a,l,c;this._contentWidgets.setWidgetPosition(e.widget,(i=(t=e.position)===null||t===void 0?void 0:t.position)!==null&&i!==void 0?i:null,(s=(o=e.position)===null||o===void 0?void 0:o.secondaryPosition)!==null&&s!==void 0?s:null,(a=(r=e.position)===null||r===void 0?void 0:r.preference)!==null&&a!==void 0?a:null,(c=(l=e.position)===null||l===void 0?void 0:l.positionAffinity)!==null&&c!==void 0?c:null),this._scheduleRender()}removeContentWidget(e){this._contentWidgets.removeWidget(e.widget),this._scheduleRender()}addOverlayWidget(e){this._overlayWidgets.addWidget(e.widget),this.layoutOverlayWidget(e),this._scheduleRender()}layoutOverlayWidget(e){let t=e.position?e.position.preference:null;this._overlayWidgets.setWidgetPosition(e.widget,t)&&this._scheduleRender()}removeOverlayWidget(e){this._overlayWidgets.removeWidget(e.widget),this._scheduleRender()}addGlyphMarginWidget(e){this._glyphMarginWidgets.addWidget(e.widget),this._shouldRecomputeGlyphMarginLanes=!0,this._scheduleRender()}layoutGlyphMarginWidget(e){let t=e.position;this._glyphMarginWidgets.setWidgetPosition(e.widget,t)&&(this._shouldRecomputeGlyphMarginLanes=!0,this._scheduleRender())}removeGlyphMarginWidget(e){this._glyphMarginWidgets.removeWidget(e.widget),this._shouldRecomputeGlyphMarginLanes=!0,this._scheduleRender()}};pL=qG([jG(6,Ye)],pL);function ph(n){try{return n()}catch(e){return ut(e),null}}var Nb=class{constructor(){this._coordinatedRenderings=[],this._animationFrameRunners=new Map}scheduleCoordinatedRendering(e){return this._coordinatedRenderings.push(e),this._scheduleRender(e.window),{dispose:()=>{let t=this._coordinatedRenderings.indexOf(e);if(t!==-1&&(this._coordinatedRenderings.splice(t,1),this._coordinatedRenderings.length===0)){for(let[i,o]of this._animationFrameRunners)o.dispose();this._animationFrameRunners.clear()}}}}_scheduleRender(e){if(!this._animationFrameRunners.has(e)){let t=()=>{this._animationFrameRunners.delete(e),this._onRenderScheduled()};this._animationFrameRunners.set(e,JT(e,t,100))}}_onRenderScheduled(){let e=this._coordinatedRenderings.slice(0);this._coordinatedRenderings=[];for(let i of e)ph(()=>i.prepareRenderText());let t=[];for(let i=0,o=e.length;is.renderText())}for(let i=0,o=e.length;is.prepareRender(a,l))}for(let i=0,o=e.length;is.render(a,l))}}};Nb.INSTANCE=new Nb;_();v();b();ot();xi();xu();_();v();b();Na();ft();hr();var Uc=class{constructor(e,t,i,o,s){this.injectionOffsets=e,this.injectionOptions=t,this.breakOffsets=i,this.breakOffsetsVisibleColumn=o,this.wrappedTextIndentLength=s}getOutputLineCount(){return this.breakOffsets.length}getMinOutputOffset(e){return e>0?this.wrappedTextIndentLength:0}getLineLength(e){let t=e>0?this.breakOffsets[e-1]:0,o=this.breakOffsets[e]-t;return e>0&&(o+=this.wrappedTextIndentLength),o}getMaxOutputOffset(e){return this.getLineLength(e)}translateToInputOffset(e,t){e>0&&(t=Math.max(0,t-this.wrappedTextIndentLength));let o=e===0?t:this.breakOffsets[e-1]+t;if(this.injectionOffsets!==null)for(let s=0;sthis.injectionOffsets[s];s++)o0?this.breakOffsets[s-1]:0,t===0)if(e<=r)o=s-1;else if(e>l)i=s+1;else break;else if(e=l)i=s+1;else break}let a=e-r;return s>0&&(a+=this.wrappedTextIndentLength),new Qm(s,a)}normalizeOutputPosition(e,t,i){if(this.injectionOffsets!==null){let o=this.outputPositionToOffsetInInputWithInjections(e,t),s=this.normalizeOffsetInInputWithInjectionsAroundInjections(o,i);if(s!==o)return this.offsetInInputWithInjectionsToOutputPosition(s,i)}if(i===0){if(e>0&&t===this.getMinOutputOffset(e))return new Qm(e-1,this.getMaxOutputOffset(e-1))}else if(i===1){let o=this.getOutputLineCount()-1;if(e0&&(t=Math.max(0,t-this.wrappedTextIndentLength)),(e>0?this.breakOffsets[e-1]:0)+t}normalizeOffsetInInputWithInjectionsAroundInjections(e,t){let i=this.getInjectedTextAtOffset(e);if(!i)return e;if(t===2){if(e===i.offsetInInputWithInjections+i.length&&DW(this.injectionOptions[i.injectedTextIndex].cursorStops))return i.offsetInInputWithInjections+i.length;{let o=i.offsetInInputWithInjections;if(EW(this.injectionOptions[i.injectedTextIndex].cursorStops))return o;let s=i.injectedTextIndex-1;for(;s>=0&&this.injectionOffsets[s]===this.injectionOffsets[i.injectedTextIndex]&&!(DW(this.injectionOptions[s].cursorStops)||(o-=this.injectionOptions[s].content.length,EW(this.injectionOptions[s].cursorStops)));)s--;return o}}else if(t===1||t===4){let o=i.offsetInInputWithInjections+i.length,s=i.injectedTextIndex;for(;s+1=0&&this.injectionOffsets[s-1]===this.injectionOffsets[s];)o-=this.injectionOptions[s-1].content.length,s--;return o}$g(t)}getInjectedText(e,t){let i=this.outputPositionToOffsetInInputWithInjections(e,t),o=this.getInjectedTextAtOffset(i);return o?{options:this.injectionOptions[o.injectedTextIndex]}:null}getInjectedTextAtOffset(e){let t=this.injectionOffsets,i=this.injectionOptions;if(t!==null){let o=0;for(let s=0;se)break;if(e<=l)return{injectedTextIndex:s,offsetInInputWithInjections:a,length:r};o+=r}}}};function DW(n){return n==null?!0:n===Nu.Right||n===Nu.Both}function EW(n){return n==null?!0:n===Nu.Left||n===Nu.Both}var Qm=class{constructor(e,t){this.outputLineIndex=e,this.outputOffset=t}toString(){return`${this.outputLineIndex}:${this.outputOffset}`}toPosition(e){return new U(e+this.outputLineIndex,this.outputOffset+1)}};bh();var YM=Bs("domLineBreaksComputer",{createHTML:n=>n}),wL=class n{static create(e){return new n(new WeakRef(e))}constructor(e){this.targetWindow=e}createLineBreaksComputer(e,t,i,o,s){let r=[],a=[];return{addRequest:(l,c,d)=>{r.push(l),a.push(c)},finalize:()=>ZG(G1(this.targetWindow.deref()),r,e,t,i,o,s,a)}}};function ZG(n,e,t,i,o,s,r,a){var l;function c(j){let G=a[j];if(G){let V=Ls.applyInjectedText(e[j],G),z=G.map(ee=>ee.options),te=G.map(ee=>ee.column-1);return new Uc(te,z,[V.length],[],0)}else return null}if(o===-1){let j=[];for(let G=0,V=e.length;Gd?(V=0,z=0):te=d-Ce}let ee=G.substr(V),ce=YG(ee,z,i,te,m,f);C[j]=V,S[j]=z,w[j]=ee,y[j]=ce[0],x[j]=ce[1]}let k=m.build(),T=(l=YM?.createHTML(k))!==null&&l!==void 0?l:k;g.innerHTML=T,g.style.position="absolute",g.style.top="10000",r==="keepAll"?(g.style.wordBreak="keep-all",g.style.overflowWrap="anywhere"):(g.style.wordBreak="inherit",g.style.overflowWrap="break-word"),n.document.body.appendChild(g);let N=document.createRange(),M=Array.prototype.slice.call(g.children,0),W=[];for(let j=0;jPe.options),Se=pe.map(Pe=>Pe.column-1)):(Ce=null,Se=null),W[j]=new Uc(Se,Ce,V,ce,te)}return n.document.body.removeChild(g),W}function YG(n,e,t,i,o,s){if(s!==0){let u=String(s);o.appendString('
');let r=n.length,a=e,l=0,c=[],d=[],h=0");for(let u=0;u"),c[u]=l,d[u]=a;let f=h;h=u+1"),c[n.length]=l,d[n.length]=a,o.appendString("
"),[c,d]}function XG(n,e,t,i){if(t.length<=1)return null;let o=Array.prototype.slice.call(e.children,0),s=[];try{QM(n,o,i,0,null,t.length-1,null,s)}catch(r){return console.log(r),null}return s.length===0?null:(s.push(t.length),s)}function QM(n,e,t,i,o,s,r,a){if(i===s||(o=o||XM(n,e,t[i],t[i+1]),r=r||XM(n,e,t[s],t[s+1]),Math.abs(o[0].top-r[0].top)<=.1))return;if(i+1===s){a.push(s);return}let l=i+(s-i)/2|0,c=XM(n,e,t[l],t[l+1]);QM(n,e,t,i,o,l,c,a),QM(n,e,t,l,c,s,r,a)}function XM(n,e,t,i){return n.setStart(e[t/16384|0].firstChild,t%16384),n.setEnd(e[i/16384|0].firstChild,i%16384),n.getClientRects()}_();v();b();ke();xt();le();var yL=class extends H{constructor(){super(),this._editor=null,this._instantiationService=null,this._instances=this._register(new xd),this._pending=new Map,this._finishedInstantiation=[],this._finishedInstantiation[0]=!1,this._finishedInstantiation[1]=!1,this._finishedInstantiation[2]=!1,this._finishedInstantiation[3]=!1}initialize(e,t,i){this._editor=e,this._instantiationService=i;for(let o of t){if(this._pending.has(o.id)){ut(new Error(`Cannot have two contributions with the same id ${o.id}`));continue}this._pending.set(o.id,o)}this._instantiateSome(0),this._register(m0(ge(this._editor.getDomNode()),()=>{this._instantiateSome(1)})),this._register(m0(ge(this._editor.getDomNode()),()=>{this._instantiateSome(2)})),this._register(m0(ge(this._editor.getDomNode()),()=>{this._instantiateSome(3)},5e3))}saveViewState(){let e={};for(let[t,i]of this._instances)typeof i.saveViewState=="function"&&(e[t]=i.saveViewState());return e}restoreViewState(e){for(let[t,i]of this._instances)typeof i.restoreViewState=="function"&&i.restoreViewState(e[t])}get(e){return this._instantiateById(e),this._instances.get(e)||null}onBeforeInteractionEvent(){this._instantiateSome(2)}onAfterModelAttached(){var e;return m0(ge((e=this._editor)===null||e===void 0?void 0:e.getDomNode()),()=>{this._instantiateSome(1)},50)}_instantiateSome(e){if(this._finishedInstantiation[e])return;this._finishedInstantiation[e]=!0;let t=this._findPendingContributionsByInstantiation(e);for(let i of t)this._instantiateById(i.id)}_findPendingContributionsByInstantiation(e){let t=[];for(let[,i]of this._pending)i.instantiation===e&&t.push(i);return t}_instantiateById(e){let t=this._pending.get(e);if(t){if(this._pending.delete(e),!this._instantiationService||!this._editor)throw new Error("Cannot instantiate contributions before being initialized!");try{let i=this._instantiationService.createInstance(t.ctor,this._editor);this._instances.set(t.id,i),typeof i.restoreViewState=="function"&&t.instantiation!==0&&console.warn(`Editor contribution '${t.id}' should be eager instantiated because it uses saveViewState / restoreViewState.`)}catch(i){ut(i)}}}};Ka();$a();ft();Ke();Kn();_();v();b();var ep=class{constructor(e,t,i,o,s,r,a){this.id=e,this.label=t,this.alias=i,this.metadata=o,this._precondition=s,this._run=r,this._contextKeyService=a}isSupported(){return this._contextKeyService.contextMatchesRules(this._precondition)}run(e){return this.isSupported()?this._run(e):Promise.resolve(void 0)}};wb();lr();sv();Ou();_();v();b();ot();Gy();bh();var tk=class n{static create(e){return new n(e.get(134),e.get(133))}constructor(e,t){this.classifier=new n4(e,t)}createLineBreaksComputer(e,t,i,o,s){let r=[],a=[],l=[];return{addRequest:(c,d,h)=>{r.push(c),a.push(d),l.push(h)},finalize:()=>{let c=e.typicalFullwidthCharacterWidth/e.typicalHalfwidthCharacterWidth,d=[];for(let h=0,u=r.length;h=0&&e<256?this._asciiMap[e]:e>=12352&&e<=12543||e>=13312&&e<=19903||e>=19968&&e<=40959?3:this._map.get(e)||this._defaultValue}},o4=[],s4=[];function kZ(n,e,t,i,o,s,r,a){if(o===-1)return null;let l=t.length;if(l<=1)return null;let c=a==="keepAll",d=e.breakOffsets,h=e.breakOffsetsVisibleColumn,u=Dz(t,i,o,s,r),f=o-u,g=o4,m=s4,C=0,S=0,w=0,y=o,x=d.length,k=0;if(k>=0){let T=Math.abs(h[k]-y);for(;k+1=T)break;T=N,k++}}for(;kT&&(T=S,N=w);let M=0,W=0,j=0,G=0;if(N<=y){let z=N,te=T===0?0:t.charCodeAt(T-1),ee=T===0?0:n.get(te),ce=!0;for(let Ce=T;CeS&&r4(te,ee,pe,Pe,c)&&(M=Se,W=z),z+=Qe,z>y){Se>S?(j=Se,G=z-Qe):(j=Ce+1,G=z),z-W>f&&(M=0),ce=!1;break}te=pe,ee=Pe}if(ce){C>0&&(g[C]=d[d.length-1],m[C]=h[d.length-1],C++);break}}if(M===0){let z=N,te=t.charCodeAt(T),ee=n.get(te),ce=!1;for(let Ce=T-1;Ce>=S;Ce--){let Se=Ce+1,pe=t.charCodeAt(Ce);if(pe===9){ce=!0;break}let Pe,Qe;if(Rd(pe)?(Ce--,Pe=0,Qe=2):(Pe=n.get(pe),Qe=Ys(pe)?s:1),z<=y){if(j===0&&(j=Se,G=z),z<=y-f)break;if(r4(pe,Pe,te,ee,c)){M=Se,W=z;break}}z-=Qe,te=pe,ee=Pe}if(M!==0){let Ce=f-(G-W);if(Ce<=i){let Se=t.charCodeAt(j),pe;pi(Se)?pe=2:pe=rv(Se,G,i,s),Ce-pe<0&&(M=0)}}if(ce){k--;continue}}if(M===0&&(M=j,W=G),M<=S){let z=t.charCodeAt(S);pi(z)?(M=S+2,W=w+2):(M=S+1,W=w+rv(z,w,i,s))}for(S=M,g[C]=M,w=W,m[C]=W,C++,y=W+f;k<0||k=V)break;V=z,k++}}return C===0?null:(g.length=C,m.length=C,o4=e.breakOffsets,s4=e.breakOffsetsVisibleColumn,e.breakOffsets=g,e.breakOffsetsVisibleColumn=m,e.wrappedTextIndentLength=u,e)}function DZ(n,e,t,i,o,s,r,a){let l=Ls.applyInjectedText(e,t),c,d;if(t&&t.length>0?(c=t.map(W=>W.options),d=t.map(W=>W.column-1)):(c=null,d=null),o===-1)return c?new Uc(d,c,[l.length],[],0):null;let h=l.length;if(h<=1)return c?new Uc(d,c,[l.length],[],0):null;let u=a==="keepAll",f=Dz(l,i,o,s,r),g=o-f,m=[],C=[],S=0,w=0,y=0,x=o,k=l.charCodeAt(0),T=n.get(k),N=rv(k,0,i,s),M=1;pi(k)&&(N+=1,k=l.charCodeAt(1),T=n.get(k),M++);for(let W=M;Wx&&((w===0||N-y>g)&&(w=j,y=N-z),m[S]=w,C[S]=y,S++,x=y+g,w=0),k=G,T=V}return S===0&&(!t||t.length===0)?null:(m[S]=h,C[S]=N,new Uc(d,c,m,C,f))}function rv(n,e,t,i){return n===9?t-e%t:Ys(n)||n<32?i:1}function kz(n,e){return e-n%e}function r4(n,e,t,i,o){return t!==32&&(e===2&&i!==2||e!==1&&i===1||!o&&e===3&&i!==2||!o&&i===3&&e!==1)}function Dz(n,e,t,i,o){let s=0;if(o!==0){let r=Ri(n);if(r!==-1){for(let l=0;lt&&(s=0)}}return s}_();v();b();wt();Gt();gn();le();Lt();ot();_();v();b();xt();ot();_();v();b();wt();Dl();_();v();b();ft();Ke();Kn();var av=class n{constructor(e){this._selTrackedRange=null,this._trackSelection=!0,this._setState(e,new Ji(new P(1,1,1,1),0,0,new U(1,1),0),new Ji(new P(1,1,1,1),0,0,new U(1,1),0))}dispose(e){this._removeTrackedRange(e)}startTrackingSelection(e){this._trackSelection=!0,this._updateTrackedRange(e)}stopTrackingSelection(e){this._trackSelection=!1,this._removeTrackedRange(e)}_updateTrackedRange(e){this._trackSelection&&(this._selTrackedRange=e.model._setTrackedRange(this._selTrackedRange,this.modelState.selection,0))}_removeTrackedRange(e){this._selTrackedRange=e.model._setTrackedRange(this._selTrackedRange,null,0)}asCursorState(){return new mt(this.modelState,this.viewState)}readSelectionFromMarkers(e){let t=e.model._getTrackedRange(this._selTrackedRange);return this.modelState.selection.isEmpty()&&!t.isEmpty()?nt.fromRange(t.collapseToEnd(),this.modelState.selection.getDirection()):nt.fromRange(t,this.modelState.selection.getDirection())}ensureValidState(e){this._setState(e,this.modelState,this.viewState)}setState(e,t,i){this._setState(e,t,i)}static _validatePositionWithCache(e,t,i,o){return t.equals(i)?o:e.normalizePosition(t,2)}static _validateViewState(e,t){let i=t.position,o=t.selectionStart.getStartPosition(),s=t.selectionStart.getEndPosition(),r=e.normalizePosition(i,2),a=this._validatePositionWithCache(e,o,i,r),l=this._validatePositionWithCache(e,s,o,a);return i.equals(r)&&o.equals(a)&&s.equals(l)?t:new Ji(P.fromPositions(a,l),t.selectionStartKind,t.selectionStartLeftoverVisibleColumns+o.column-a.column,r,t.leftoverVisibleColumns+i.column-r.column)}_setState(e,t,i){if(i&&(i=n._validateViewState(e.viewModel,i)),t){let o=e.model.validateRange(t.selectionStart),s=t.selectionStart.equalsRange(o)?t.selectionStartLeftoverVisibleColumns:0,r=e.model.validatePosition(t.position),a=t.position.equals(r)?t.leftoverVisibleColumns:0;t=new Ji(o,t.selectionStartKind,s,r,a)}else{if(!i)return;let o=e.model.validateRange(e.coordinatesConverter.convertViewRangeToModelRange(i.selectionStart)),s=e.model.validatePosition(e.coordinatesConverter.convertViewPositionToModelPosition(i.position));t=new Ji(o,i.selectionStartKind,i.selectionStartLeftoverVisibleColumns,s,i.leftoverVisibleColumns)}if(i){let o=e.coordinatesConverter.validateViewRange(i.selectionStart,t.selectionStart),s=e.coordinatesConverter.validateViewPosition(i.position,t.position);i=new Ji(o,t.selectionStartKind,t.selectionStartLeftoverVisibleColumns,s,t.leftoverVisibleColumns)}else{let o=e.coordinatesConverter.convertModelPositionToViewPosition(new U(t.selectionStart.startLineNumber,t.selectionStart.startColumn)),s=e.coordinatesConverter.convertModelPositionToViewPosition(new U(t.selectionStart.endLineNumber,t.selectionStart.endColumn)),r=new P(o.lineNumber,o.column,s.lineNumber,s.column),a=e.coordinatesConverter.convertModelPositionToViewPosition(t.position);i=new Ji(r,t.selectionStartKind,t.selectionStartLeftoverVisibleColumns,a,t.leftoverVisibleColumns)}this.modelState=t,this.viewState=i,this._updateTrackedRange(e)}};ft();Ke();Kn();var lv=class{constructor(e){this.context=e,this.cursors=[new av(e)],this.lastAddedCursorIndex=0}dispose(){for(let e of this.cursors)e.dispose(this.context)}startTrackingSelections(){for(let e of this.cursors)e.startTrackingSelection(this.context)}stopTrackingSelections(){for(let e of this.cursors)e.stopTrackingSelection(this.context)}updateContext(e){this.context=e}ensureValidState(){for(let e of this.cursors)e.ensureValidState(this.context)}readSelectionFromMarkers(){return this.cursors.map(e=>e.readSelectionFromMarkers(this.context))}getAll(){return this.cursors.map(e=>e.asCursorState())}getViewPositions(){return this.cursors.map(e=>e.viewState.position)}getTopMostViewPosition(){return Z3(this.cursors,Io(e=>e.viewState.position,U.compare)).viewState.position}getBottomMostViewPosition(){return G3(this.cursors,Io(e=>e.viewState.position,U.compare)).viewState.position}getSelections(){return this.cursors.map(e=>e.modelState.selection)}getViewSelections(){return this.cursors.map(e=>e.viewState.selection)}setSelections(e){this.setStates(mt.fromModelSelections(e))}getPrimaryCursor(){return this.cursors[0].asCursorState()}setStates(e){e!==null&&(this.cursors[0].setState(this.context,e[0].modelState,e[0].viewState),this._setSecondaryStates(e.slice(1)))}_setSecondaryStates(e){let t=this.cursors.length-1,i=e.length;if(ti){let o=t-i;for(let s=0;s=e+1&&this.lastAddedCursorIndex--,this.cursors[e+1].dispose(this.context),this.cursors.splice(e+1,1)}normalize(){if(this.cursors.length===1)return;let e=this.cursors.slice(0),t=[];for(let i=0,o=e.length;ii.selection,P.compareRangesUsingStarts));for(let i=0;ih&&m.index--;e.splice(h,1),t.splice(d,1),this._removeSecondaryCursor(h-1),i--}}}};_();v();b();var cv=class{constructor(e,t,i,o){this._cursorContextBrand=void 0,this.model=e,this.viewModel=t,this.coordinatesConverter=i,this.cursorConfig=o}};Ke();Kn();bh();_();v();b();var ik=class{constructor(){this.type=0}},nk=class{constructor(){this.type=1}},ok=class{constructor(e){this.type=2,this._source=e}hasChanged(e){return this._source.hasChanged(e)}},sk=class{constructor(e,t,i){this.selections=e,this.modelSelections=t,this.reason=i,this.type=3}},Xl=class{constructor(e){this.type=4,e?(this.affectsMinimap=e.affectsMinimap,this.affectsOverviewRuler=e.affectsOverviewRuler,this.affectsGlyphMargin=e.affectsGlyphMargin,this.affectsLineNumber=e.affectsLineNumber):(this.affectsMinimap=!0,this.affectsOverviewRuler=!0,this.affectsGlyphMargin=!0,this.affectsLineNumber=!0)}},yf=class{constructor(){this.type=5}},rk=class{constructor(e){this.type=6,this.isFocused=e}},ak=class{constructor(){this.type=7}},Sf=class{constructor(){this.type=8}},dv=class{constructor(e,t){this.fromLineNumber=e,this.count=t,this.type=9}},fp=class{constructor(e,t){this.type=10,this.fromLineNumber=e,this.toLineNumber=t}},gp=class{constructor(e,t){this.type=11,this.fromLineNumber=e,this.toLineNumber=t}},Yc=class{constructor(e,t,i,o,s,r,a){this.source=e,this.minimalReveal=t,this.range=i,this.selections=o,this.verticalType=s,this.revealHorizontal=r,this.scrollType=a,this.type=12}},lk=class{constructor(e){this.type=13,this.scrollWidth=e.scrollWidth,this.scrollLeft=e.scrollLeft,this.scrollHeight=e.scrollHeight,this.scrollTop=e.scrollTop,this.scrollWidthChanged=e.scrollWidthChanged,this.scrollLeftChanged=e.scrollLeftChanged,this.scrollHeightChanged=e.scrollHeightChanged,this.scrollTopChanged=e.scrollTopChanged}},ck=class{constructor(e){this.theme=e,this.type=14}},dk=class{constructor(e){this.type=15,this.ranges=e}},hk=class{constructor(){this.type=16}},uk=class{constructor(){this.type=17}};le();_();v();b();ye();le();var fk=class extends H{constructor(){super(),this._onEvent=this._register(new B),this.onEvent=this._onEvent.event,this._eventHandlers=[],this._viewEventQueue=null,this._isConsumingViewEventQueue=!1,this._collector=null,this._collectorCnt=0,this._outgoingEvents=[]}emitOutgoingEvent(e){this._addOutgoingEvent(e),this._emitOutgoingEvents()}_addOutgoingEvent(e){for(let t=0,i=this._outgoingEvents.length;t0;){if(this._collector||this._isConsumingViewEventQueue)return;let e=this._outgoingEvents.shift();e.isNoOp()||this._onEvent.fire(e)}}addViewEventHandler(e){for(let t=0,i=this._eventHandlers.length;t0&&this._emitMany(t)}this._emitOutgoingEvents()}emitSingleViewEvent(e){try{this.beginEmitViewEvents().emitViewEvent(e)}finally{this.endEmitViewEvents()}}_emitMany(e){this._viewEventQueue?this._viewEventQueue=this._viewEventQueue.concat(e):this._viewEventQueue=e,this._isConsumingViewEventQueue||this._consumeViewEventQueue()}_consumeViewEventQueue(){try{this._isConsumingViewEventQueue=!0,this._doConsumeQueue()}finally{this._isConsumingViewEventQueue=!1}}_doConsumeQueue(){for(;this._viewEventQueue;){let e=this._viewEventQueue;this._viewEventQueue=null;let t=this._eventHandlers.slice(0);for(let i of t)i.handleEvents(e)}}},a4=class{constructor(){this.viewEvents=[],this.outgoingEvents=[]}emitViewEvent(e){this.viewEvents.push(e)}emitOutgoingEvent(e){this.outgoingEvents.push(e)}},gk=class n{constructor(e,t,i,o){this.kind=0,this._oldContentWidth=e,this._oldContentHeight=t,this.contentWidth=i,this.contentHeight=o,this.contentWidthChanged=this._oldContentWidth!==this.contentWidth,this.contentHeightChanged=this._oldContentHeight!==this.contentHeight}isNoOp(){return!this.contentWidthChanged&&!this.contentHeightChanged}attemptToMerge(e){return e.kind!==this.kind?null:new n(this._oldContentWidth,this._oldContentHeight,e.contentWidth,e.contentHeight)}},mk=class n{constructor(e,t){this.kind=1,this.oldHasFocus=e,this.hasFocus=t}isNoOp(){return this.oldHasFocus===this.hasFocus}attemptToMerge(e){return e.kind!==this.kind?null:new n(this.oldHasFocus,e.hasFocus)}},pk=class n{constructor(e,t,i,o,s,r,a,l){this.kind=2,this._oldScrollWidth=e,this._oldScrollLeft=t,this._oldScrollHeight=i,this._oldScrollTop=o,this.scrollWidth=s,this.scrollLeft=r,this.scrollHeight=a,this.scrollTop=l,this.scrollWidthChanged=this._oldScrollWidth!==this.scrollWidth,this.scrollLeftChanged=this._oldScrollLeft!==this.scrollLeft,this.scrollHeightChanged=this._oldScrollHeight!==this.scrollHeight,this.scrollTopChanged=this._oldScrollTop!==this.scrollTop}isNoOp(){return!this.scrollWidthChanged&&!this.scrollLeftChanged&&!this.scrollHeightChanged&&!this.scrollTopChanged}attemptToMerge(e){return e.kind!==this.kind?null:new n(this._oldScrollWidth,this._oldScrollLeft,this._oldScrollHeight,this._oldScrollTop,e.scrollWidth,e.scrollLeft,e.scrollHeight,e.scrollTop)}},_k=class{constructor(){this.kind=3}isNoOp(){return!1}attemptToMerge(e){return e.kind!==this.kind?null:this}},bk=class{constructor(){this.kind=4}isNoOp(){return!1}attemptToMerge(e){return e.kind!==this.kind?null:this}},vk=class n{constructor(e,t,i,o,s,r,a){this.kind=6,this.oldSelections=e,this.selections=t,this.oldModelVersionId=i,this.modelVersionId=o,this.source=s,this.reason=r,this.reachedMaxCursorCount=a}static _selectionsAreEqual(e,t){if(!e&&!t)return!0;if(!e||!t)return!1;let i=e.length,o=t.length;if(i!==o)return!1;for(let s=0;s0){let e=this._cursors.getSelections();for(let t=0;tr&&(o=o.slice(0,r),s=!0);let a=hv.from(this._model,this);return this._cursors.setStates(o),this._cursors.normalize(),this._columnSelectData=null,this._validateAutoClosedActions(),this._emitStateChangedIfNecessary(e,t,i,a,s)}setCursorColumnSelectData(e){this._columnSelectData=e}revealAll(e,t,i,o,s,r){let a=this._cursors.getViewPositions(),l=null,c=null;a.length>1?c=this._cursors.getViewSelections():l=P.fromPositions(a[0],a[0]),e.emitViewEvent(new Yc(t,i,l,c,o,s,r))}revealPrimary(e,t,i,o,s,r){let l=[this._cursors.getPrimaryCursor().viewState.selection];e.emitViewEvent(new Yc(t,i,null,l,o,s,r))}saveState(){let e=[],t=this._cursors.getSelections();for(let i=0,o=t.length;i0){let s=mt.fromModelSelections(i.resultingSelection);this.setStates(e,"modelChange",i.isUndoing?5:i.isRedoing?6:2,s)&&this.revealAll(e,"modelChange",!1,0,!0,0)}else{let s=this._cursors.readSelectionFromMarkers();this.setStates(e,"modelChange",2,mt.fromModelSelections(s))}}}getSelection(){return this._cursors.getPrimaryCursor().modelState.selection}getTopMostViewPosition(){return this._cursors.getTopMostViewPosition()}getBottomMostViewPosition(){return this._cursors.getBottomMostViewPosition()}getCursorColumnSelectData(){if(this._columnSelectData)return this._columnSelectData;let e=this._cursors.getPrimaryCursor(),t=e.viewState.selectionStart.getStartPosition(),i=e.viewState.position;return{isReal:!1,fromViewLineNumber:t.lineNumber,fromViewVisualColumn:this.context.cursorConfig.visibleColumnFromColumn(this._viewModel,t),toViewLineNumber:i.lineNumber,toViewVisualColumn:this.context.cursorConfig.visibleColumnFromColumn(this._viewModel,i)}}getSelections(){return this._cursors.getSelections()}setSelections(e,t,i,o){this.setStates(e,t,o,mt.fromModelSelections(i))}getPrevEditOperationType(){return this._prevEditOperationType}setPrevEditOperationType(e){this._prevEditOperationType=e}_pushAutoClosedAction(e,t){let i=[],o=[];for(let a=0,l=e.length;a0&&this._pushAutoClosedAction(i,o),this._prevEditOperationType=e.type}e.shouldPushStackElementAfter&&this._model.pushStackElement()}_interpretCommandResult(e){(!e||e.length===0)&&(e=this._cursors.readSelectionFromMarkers()),this._columnSelectData=null,this._cursors.setSelections(e),this._cursors.normalize()}_emitStateChangedIfNecessary(e,t,i,o,s){let r=hv.from(this._model,this);if(r.equals(o))return!1;let a=this._cursors.getSelections(),l=this._cursors.getViewSelections();if(e.emitViewEvent(new sk(l,a,i)),!o||o.cursorState.length!==r.cursorState.length||r.cursorState.some((c,d)=>!c.modelState.equals(o.cursorState[d].modelState))){let c=o?o.cursorState.map(h=>h.modelState.selection):null,d=o?o.modelVersionId:0;e.emitOutgoingEvent(new vk(c,a,d,r.modelVersionId,t||"keyboard",i,s))}return!0}_findAutoClosingPairs(e){if(!e.length)return null;let t=[];for(let i=0,o=e.length;i=0)return null;let r=s.text.match(/([)\]}>'"`])([^)\]}>'"`]*)$/);if(!r)return null;let a=r[1],l=this.context.cursorConfig.autoClosingPairs.autoClosingPairsCloseSingleChar.get(a);if(!l||l.length!==1)return null;let c=l[0].open,d=s.text.length-r[2].length-1,h=s.text.lastIndexOf(c,d-1);if(h===-1)return null;t.push([h,d])}return t}executeEdits(e,t,i,o){let s=null;t==="snippet"&&(s=this._findAutoClosingPairs(i)),s&&(i[0]._isTracked=!0);let r=[],a=[],l=this._model.pushEditOperations(this.getSelections(),i,c=>{if(s)for(let h=0,u=s.length;h0&&this._pushAutoClosedAction(r,a)}_executeEdit(e,t,i,o=0){if(this.context.cursorConfig.readOnly)return;let s=hv.from(this._model,this);this._cursors.stopTrackingSelections(),this._isHandling=!0;try{this._cursors.ensureValidState(),e()}catch(r){ut(r)}this._isHandling=!1,this._cursors.startTrackingSelections(),this._validateAutoClosedActions(),this._emitStateChangedIfNecessary(t,i,o,s,!1)&&this.revealAll(t,i,!1,0,!0,0)}getAutoClosedCharacters(){return Ek.getAllAutoClosedCharacters(this._autoClosedActions)}startComposition(e){this._compositionState=new d4(this._model,this.getSelections())}endComposition(e,t){let i=this._compositionState?this._compositionState.deduceOutcome(this._model,this.getSelections()):null;this._compositionState=null,this._executeEdit(()=>{t==="keyboard"&&this._executeEditOperation(ta.compositionEndWithInterceptors(this._prevEditOperationType,this.context.cursorConfig,this._model,i,this.getSelections(),this.getAutoClosedCharacters()))},e,t)}type(e,t,i){this._executeEdit(()=>{if(i==="keyboard"){let o=t.length,s=0;for(;s{let c=l.getPosition();return new nt(c.lineNumber,c.column+s,c.lineNumber,c.column+s)});this.setSelections(e,r,a,0)}return}this._executeEdit(()=>{this._executeEditOperation(ta.compositionType(this._prevEditOperationType,this.context.cursorConfig,this._model,this.getSelections(),t,i,o,s))},e,r)}paste(e,t,i,o,s){this._executeEdit(()=>{this._executeEditOperation(ta.paste(this.context.cursorConfig,this._model,this.getSelections(),t,i,o||[]))},e,s,4)}cut(e,t){this._executeEdit(()=>{this._executeEditOperation(zc.cut(this.context.cursorConfig,this._model,this.getSelections()))},e,t)}executeCommand(e,t,i){this._executeEdit(()=>{this._cursors.killSecondaryCursors(),this._executeEditOperation(new Pn(0,[t],{shouldPushStackElementBefore:!1,shouldPushStackElementAfter:!1}))},e,i)}executeCommands(e,t,i){this._executeEdit(()=>{this._executeEditOperation(new Pn(0,t,{shouldPushStackElementBefore:!1,shouldPushStackElementAfter:!1}))},e,i)}},hv=class n{static from(e,t){return new n(e.getVersionId(),t.getCursorStates())}constructor(e,t){this.modelVersionId=e,this.cursorState=t}equals(e){if(!e||this.modelVersionId!==e.modelVersionId||this.cursorState.length!==e.cursorState.length)return!1;for(let t=0,i=this.cursorState.length;t=t.length||!t[i].strictContainsRange(e[i]))return!1;return!0}},l4=class{static executeCommands(e,t,i){let o={model:e,selectionsBefore:t,trackedRanges:[],trackedRangesDirection:[]},s=this._innerExecuteCommands(o,i);for(let r=0,a=o.trackedRanges.length;r0&&(r[0]._isTracked=!0);let a=e.model.pushEditOperations(e.selectionsBefore,r,c=>{let d=[];for(let f=0;ff.identifier.minor-g.identifier.minor,u=[];for(let f=0;f0?(d[f].sort(h),u[f]=t[f].computeCursorState(e.model,{getInverseEditOperations:()=>d[f],getTrackedSelection:g=>{let m=parseInt(g,10),C=e.model._getTrackedRange(e.trackedRanges[m]);return e.trackedRangesDirection[m]===0?new nt(C.startLineNumber,C.startColumn,C.endLineNumber,C.endColumn):new nt(C.endLineNumber,C.endColumn,C.startLineNumber,C.startColumn)}})):u[f]=e.selectionsBefore[f];return u});a||(a=e.selectionsBefore);let l=[];for(let c in s)s.hasOwnProperty(c)&&l.push(parseInt(c,10));l.sort((c,d)=>d-c);for(let c of l)a.splice(c,1);return a}static _arrayIsEmpty(e){for(let t=0,i=e.length;t{P.isEmpty(h)&&u===""||o.push({identifier:{major:t,minor:s++},range:h,text:u,forceMoveMarkers:f,isAutoWhitespaceEdit:i.insertsAutoWhitespace})},a=!1,d={addEditOperation:r,addTrackedEditOperation:(h,u,f)=>{a=!0,r(h,u,f)},trackSelection:(h,u)=>{let f=nt.liftSelection(h),g;if(f.isEmpty())if(typeof u=="boolean")u?g=2:g=3;else{let S=e.model.getLineMaxColumn(f.startLineNumber);f.startColumn===S?g=2:g=3}else g=1;let m=e.trackedRanges.length,C=e.model._setTrackedRange(null,f,g);return e.trackedRanges[m]=C,e.trackedRangesDirection[m]=f.getDirection(),m.toString()}};try{i.getEditOperations(e.model,d)}catch(h){return ut(h),{operations:[],hadTrackedEditOperation:!1}}return{operations:o,hadTrackedEditOperation:a}}static _getLoserCursorMap(e){e=e.slice(0),e.sort((i,o)=>-P.compareRangesUsingEnds(i.range,o.range));let t={};for(let i=1;is.identifier.major?r=o.identifier.major:r=s.identifier.major,t[r.toString()]=!0;for(let a=0;a0&&i--}}return t}},c4=class{constructor(e,t,i){this.text=e,this.startSelection=t,this.endSelection=i}},d4=class n{static _capture(e,t){let i=[];for(let o of t){if(o.startLineNumber!==o.endLineNumber)return null;i.push(new c4(e.getLineContent(o.startLineNumber),o.startColumn-1,o.endColumn-1))}return i}constructor(e,t){this._original=n._capture(e,t)}deduceOutcome(e,t){if(!this._original)return null;let i=n._capture(e,t);if(!i||this._original.length!==i.length)return null;let o=[];for(let s=0,r=this._original.length;seh,tokenizeEncoded:(n,e,t)=>hm(0,t)};async function Nz(n,e,t){if(!t)return Tz(e,n.languageIdCodec,Iz);let i=await Bt.getOrCreate(t);return Tz(e,n.languageIdCodec,i||Iz)}function Az(n,e,t,i,o,s,r){let a="
",l=i,c=0,d=!0;for(let h=0,u=e.getCount();h0;)r&&d?(g+=" ",d=!1):(g+=" ",d=!0),C--;break}case 60:g+="<",d=!1;break;case 62:g+=">",d=!1;break;case 38:g+="&",d=!1;break;case 0:g+="�",d=!1;break;case 65279:case 8232:case 8233:case 133:g+="\uFFFD",d=!1;break;case 13:g+="​",d=!1;break;case 32:r&&d?(g+=" ",d=!1):(g+=" ",d=!0);break;default:g+=String.fromCharCode(m),d=!1}}if(a+=`${g}`,f>o||l>=o)break}return a+="
",a}function Tz(n,e,t){let i='
',o=Tr(n),s=t.getInitialState();for(let r=0,a=o.length;r0&&(i+="
");let c=t.tokenizeEncoded(l,!0,s);Hi.convertToEndOffset(c.tokens,l.length);let h=new Hi(c.tokens,l,e).inflate(),u=0;for(let f=0,g=h.getCount();f${hu(l.substring(u,C))}`,u=C}s=c.endState}return i+="
",i}_();v();b();ye();le();_();v();b();ot();var h4=class{constructor(){this._hasPending=!1,this._inserts=[],this._changes=[],this._removes=[]}insert(e){this._hasPending=!0,this._inserts.push(e)}change(e){this._hasPending=!0,this._changes.push(e)}remove(e){this._hasPending=!0,this._removes.push(e)}mustCommit(){return this._hasPending}commit(e){if(!this._hasPending)return;let t=this._inserts,i=this._changes,o=this._removes;this._hasPending=!1,this._inserts=[],this._changes=[],this._removes=[],e._commitPendingChanges(t,i,o)}},u4=class{constructor(e,t,i,o,s){this.id=e,this.afterLineNumber=t,this.ordinal=i,this.height=o,this.minWidth=s,this.prefixSum=0}},uv=class n{constructor(e,t,i,o){this._instanceId=Cw(++n.INSTANCE_COUNT),this._pendingChanges=new h4,this._lastWhitespaceId=0,this._arr=[],this._prefixSumValidIndex=-1,this._minWidth=-1,this._lineCount=e,this._lineHeight=t,this._paddingTop=i,this._paddingBottom=o}static findInsertionIndex(e,t,i){let o=0,s=e.length;for(;o>>1;t===e[r].afterLineNumber?i{t=!0,o=o|0,s=s|0,r=r|0,a=a|0;let l=this._instanceId+ ++this._lastWhitespaceId;return this._pendingChanges.insert(new u4(l,o,s,r,a)),l},changeOneWhitespace:(o,s,r)=>{t=!0,s=s|0,r=r|0,this._pendingChanges.change({id:o,newAfterLineNumber:s,newHeight:r})},removeWhitespace:o=>{t=!0,this._pendingChanges.remove({id:o})}})}finally{this._pendingChanges.commit(this)}return t}_commitPendingChanges(e,t,i){if((e.length>0||i.length>0)&&(this._minWidth=-1),e.length+t.length+i.length<=1){for(let l of e)this._insertWhitespace(l);for(let l of t)this._changeOneWhitespace(l.id,l.newAfterLineNumber,l.newHeight);for(let l of i){let c=this._findWhitespaceIndex(l.id);c!==-1&&this._removeWhitespace(c)}return}let o=new Set;for(let l of i)o.add(l.id);let s=new Map;for(let l of t)s.set(l.id,l);let r=l=>{let c=[];for(let d of l)if(!o.has(d.id)){if(s.has(d.id)){let h=s.get(d.id);d.afterLineNumber=h.newAfterLineNumber,d.height=h.newHeight}c.push(d)}return c},a=r(this._arr).concat(r(e));a.sort((l,c)=>l.afterLineNumber===c.afterLineNumber?l.ordinal-c.ordinal:l.afterLineNumber-c.afterLineNumber),this._arr=a,this._prefixSumValidIndex=-1}_checkPendingChanges(){this._pendingChanges.mustCommit()&&this._pendingChanges.commit(this)}_insertWhitespace(e){let t=n.findInsertionIndex(this._arr,e.afterLineNumber,e.ordinal);this._arr.splice(t,0,e),this._prefixSumValidIndex=Math.min(this._prefixSumValidIndex,t-1)}_findWhitespaceIndex(e){let t=this._arr;for(let i=0,o=t.length;it&&(this._arr[i].afterLineNumber-=t-e+1)}}onLinesInserted(e,t){this._checkPendingChanges(),e=e|0,t=t|0,this._lineCount+=t-e+1;for(let i=0,o=this._arr.length;i=t.length||t[a+1].afterLineNumber>=e)return a;i=a+1|0}else o=a-1|0}return-1}_findFirstWhitespaceAfterLineNumber(e){e=e|0;let i=this._findLastWhitespaceBeforeLineNumber(e)+1;return i1?i=this._lineHeight*(e-1):i=0;let o=this.getWhitespaceAccumulatedHeightBeforeLineNumber(e-(t?1:0));return i+o+this._paddingTop}getVerticalOffsetAfterLineNumber(e,t=!1){this._checkPendingChanges(),e=e|0;let i=this._lineHeight*e,o=this.getWhitespaceAccumulatedHeightBeforeLineNumber(e+(t?1:0));return i+o+this._paddingTop}getWhitespaceMinWidth(){if(this._checkPendingChanges(),this._minWidth===-1){let e=0;for(let t=0,i=this._arr.length;tt}isInTopPadding(e){return this._paddingTop===0?!1:(this._checkPendingChanges(),e=t-this._paddingBottom}getLineNumberAtOrAfterVerticalOffset(e){if(this._checkPendingChanges(),e=e|0,e<0)return 1;let t=this._lineCount|0,i=this._lineHeight,o=1,s=t;for(;o=a+i)o=r+1;else{if(e>=a)return r;s=r}}return o>t?t:o}getLinesViewportData(e,t){this._checkPendingChanges(),e=e|0,t=t|0;let i=this._lineHeight,o=this.getLineNumberAtOrAfterVerticalOffset(e)|0,s=this.getVerticalOffsetForLineNumber(o)|0,r=this._lineCount|0,a=this.getFirstWhitespaceIndexAfterLineNumber(o)|0,l=this.getWhitespacesCount()|0,c,d;a===-1?(a=l,d=r+1,c=0):(d=this.getAfterLineNumberForWhitespaceIndex(a)|0,c=this.getHeightForWhitespaceIndex(a)|0);let h=s,u=h,f=5e5,g=0;s>=f&&(g=Math.floor(s/f)*f,g=Math.floor(g/i)*i,u-=g);let m=[],C=e+(t-e)/2,S=-1;for(let k=o;k<=r;k++){if(S===-1){let T=h,N=h+i;(T<=C&&CC)&&(S=k)}for(h+=i,m[k-o]=u,u+=i;d===k;)u+=c,h+=c,a++,a>=l?d=r+1:(d=this.getAfterLineNumberForWhitespaceIndex(a)|0,c=this.getHeightForWhitespaceIndex(a)|0);if(h>=t){r=k;break}}S===-1&&(S=r);let w=this.getVerticalOffsetForLineNumber(r)|0,y=o,x=r;return yt&&x--,{bigNumbersDelta:g,startLineNumber:o,endLineNumber:r,relativeVerticalOffset:m,centeredLineNumber:S,completelyVisibleStartLineNumber:y,completelyVisibleEndLineNumber:x,lineHeight:this._lineHeight}}getVerticalOffsetForWhitespaceIndex(e){this._checkPendingChanges(),e=e|0;let t=this.getAfterLineNumberForWhitespaceIndex(e),i;t>=1?i=this._lineHeight*t:i=0;let o;return e>0?o=this.getWhitespacesAccumulatedHeight(e-1):o=0,i+o+this._paddingTop}getWhitespaceIndexAtOrAfterVerticallOffset(e){this._checkPendingChanges(),e=e|0;let t=0,i=this.getWhitespacesCount()-1;if(i<0)return-1;let o=this.getVerticalOffsetForWhitespaceIndex(i),s=this.getHeightForWhitespaceIndex(i);if(e>=o+s)return-1;for(;t=a+l)t=r+1;else{if(e>=a)return r;i=r}}return t}getWhitespaceAtVerticalOffset(e){this._checkPendingChanges(),e=e|0;let t=this.getWhitespaceIndexAtOrAfterVerticallOffset(e);if(t<0||t>=this.getWhitespacesCount())return null;let i=this.getVerticalOffsetForWhitespaceIndex(t);if(i>e)return null;let o=this.getHeightForWhitespaceIndex(t),s=this.getIdForWhitespaceIndex(t),r=this.getAfterLineNumberForWhitespaceIndex(t);return{id:s,afterLineNumber:r,verticalOffset:i,height:o}}getWhitespaceViewportData(e,t){this._checkPendingChanges(),e=e|0,t=t|0;let i=this.getWhitespaceIndexAtOrAfterVerticallOffset(e),o=this.getWhitespacesCount()-1;if(i<0)return[];let s=[];for(let r=i;r<=o;r++){let a=this.getVerticalOffsetForWhitespaceIndex(r),l=this.getHeightForWhitespaceIndex(r);if(a>=t)break;s.push({id:this.getIdForWhitespaceIndex(r),afterLineNumber:this.getAfterLineNumberForWhitespaceIndex(r),verticalOffset:a,height:l})}return s}getWhitespaces(){return this._checkPendingChanges(),this._arr.slice(0)}getWhitespacesCount(){return this._checkPendingChanges(),this._arr.length}getIdForWhitespaceIndex(e){return this._checkPendingChanges(),e=e|0,this._arr[e].id}getAfterLineNumberForWhitespaceIndex(e){return this._checkPendingChanges(),e=e|0,this._arr[e].afterLineNumber}getHeightForWhitespaceIndex(e){return this._checkPendingChanges(),e=e|0,this._arr[e].height}};uv.INSTANCE_COUNT=0;var EZ=125,xf=class{constructor(e,t,i,o){e=e|0,t=t|0,i=i|0,o=o|0,e<0&&(e=0),t<0&&(t=0),i<0&&(i=0),o<0&&(o=0),this.width=e,this.contentWidth=t,this.scrollWidth=Math.max(e,t),this.height=i,this.contentHeight=o,this.scrollHeight=Math.max(i,o)}equals(e){return this.width===e.width&&this.contentWidth===e.contentWidth&&this.height===e.height&&this.contentHeight===e.contentHeight}},f4=class extends H{constructor(e,t){super(),this._onDidContentSizeChange=this._register(new B),this.onDidContentSizeChange=this._onDidContentSizeChange.event,this._dimensions=new xf(0,0,0,0),this._scrollable=this._register(new gr({forceIntegerValues:!0,smoothScrollDuration:e,scheduleAtNextAnimationFrame:t})),this.onDidScroll=this._scrollable.onScroll}getScrollable(){return this._scrollable}setSmoothScrollDuration(e){this._scrollable.setSmoothScrollDuration(e)}validateScrollPosition(e){return this._scrollable.validateScrollPosition(e)}getScrollDimensions(){return this._dimensions}setScrollDimensions(e){if(this._dimensions.equals(e))return;let t=this._dimensions;this._dimensions=e,this._scrollable.setScrollDimensions({width:e.width,scrollWidth:e.scrollWidth,height:e.height,scrollHeight:e.scrollHeight},!0);let i=t.contentWidth!==e.contentWidth,o=t.contentHeight!==e.contentHeight;(i||o)&&this._onDidContentSizeChange.fire(new gk(t.contentWidth,t.contentHeight,e.contentWidth,e.contentHeight))}getFutureScrollPosition(){return this._scrollable.getFutureScrollPosition()}getCurrentScrollPosition(){return this._scrollable.getCurrentScrollPosition()}setScrollPositionNow(e){this._scrollable.setScrollPositionNow(e)}setScrollPositionSmooth(e){this._scrollable.setScrollPositionSmooth(e)}hasPendingScrollAnimation(){return this._scrollable.hasPendingScrollAnimation()}},Ik=class extends H{constructor(e,t,i){super(),this._configuration=e;let o=this._configuration.options,s=o.get(145),r=o.get(84);this._linesLayout=new uv(t,o.get(67),r.top,r.bottom),this._maxLineWidth=0,this._overlayWidgetsMinWidth=0,this._scrollable=this._register(new f4(0,i)),this._configureSmoothScrollDuration(),this._scrollable.setScrollDimensions(new xf(s.contentWidth,0,s.height,0)),this.onDidScroll=this._scrollable.onDidScroll,this.onDidContentSizeChange=this._scrollable.onDidContentSizeChange,this._updateHeight()}dispose(){super.dispose()}getScrollable(){return this._scrollable.getScrollable()}onHeightMaybeChanged(){this._updateHeight()}_configureSmoothScrollDuration(){this._scrollable.setSmoothScrollDuration(this._configuration.options.get(114)?EZ:0)}onConfigurationChanged(e){let t=this._configuration.options;if(e.hasChanged(67)&&this._linesLayout.setLineHeight(t.get(67)),e.hasChanged(84)){let i=t.get(84);this._linesLayout.setPadding(i.top,i.bottom)}if(e.hasChanged(145)){let i=t.get(145),o=i.contentWidth,s=i.height,r=this._scrollable.getScrollDimensions(),a=r.contentWidth;this._scrollable.setScrollDimensions(new xf(o,r.contentWidth,s,this._getContentHeight(o,s,a)))}else this._updateHeight();e.hasChanged(114)&&this._configureSmoothScrollDuration()}onFlushed(e){this._linesLayout.onFlushed(e)}onLinesDeleted(e,t){this._linesLayout.onLinesDeleted(e,t)}onLinesInserted(e,t){this._linesLayout.onLinesInserted(e,t)}_getHorizontalScrollbarHeight(e,t){let o=this._configuration.options.get(103);return o.horizontal===2||e>=t?0:o.horizontalScrollbarSize}_getContentHeight(e,t,i){let o=this._configuration.options,s=this._linesLayout.getLinesTotalHeight();return o.get(105)?s+=Math.max(0,t-o.get(67)-o.get(84).bottom):o.get(103).ignoreHorizontalScrollbarInContentHeight||(s+=this._getHorizontalScrollbarHeight(e,i)),s}_updateHeight(){let e=this._scrollable.getScrollDimensions(),t=e.width,i=e.height,o=e.contentWidth;this._scrollable.setScrollDimensions(new xf(t,e.contentWidth,i,this._getContentHeight(t,i,o)))}getCurrentViewport(){let e=this._scrollable.getScrollDimensions(),t=this._scrollable.getCurrentScrollPosition();return new tb(t.scrollTop,t.scrollLeft,e.width,e.height)}getFutureViewport(){let e=this._scrollable.getScrollDimensions(),t=this._scrollable.getFutureScrollPosition();return new tb(t.scrollTop,t.scrollLeft,e.width,e.height)}_computeContentWidth(){let e=this._configuration.options,t=this._maxLineWidth,i=e.get(146),o=e.get(50),s=e.get(145);if(i.isViewportWrapping){let r=e.get(73);return t>s.contentWidth+o.typicalHalfwidthCharacterWidth&&r.enabled&&r.side==="right"?t+s.verticalScrollbarWidth:t}else{let r=e.get(104)*o.typicalHalfwidthCharacterWidth,a=this._linesLayout.getWhitespaceMinWidth();return Math.max(t+r+s.verticalScrollbarWidth,a,this._overlayWidgetsMinWidth)}}setMaxLineWidth(e){this._maxLineWidth=e,this._updateContentWidth()}setOverlayWidgetsMinWidth(e){this._overlayWidgetsMinWidth=e,this._updateContentWidth()}_updateContentWidth(){let e=this._scrollable.getScrollDimensions();this._scrollable.setScrollDimensions(new xf(e.width,this._computeContentWidth(),e.height,e.contentHeight)),this._updateHeight()}saveState(){let e=this._scrollable.getFutureScrollPosition(),t=e.scrollTop,i=this._linesLayout.getLineNumberAtOrAfterVerticalOffset(t),o=this._linesLayout.getWhitespaceAccumulatedHeightBeforeLineNumber(i);return{scrollTop:t,scrollTopWithoutViewZones:t-o,scrollLeft:e.scrollLeft}}changeWhitespace(e){let t=this._linesLayout.changeWhitespace(e);return t&&this.onHeightMaybeChanged(),t}getVerticalOffsetForLineNumber(e,t=!1){return this._linesLayout.getVerticalOffsetForLineNumber(e,t)}getVerticalOffsetAfterLineNumber(e,t=!1){return this._linesLayout.getVerticalOffsetAfterLineNumber(e,t)}isAfterLines(e){return this._linesLayout.isAfterLines(e)}isInTopPadding(e){return this._linesLayout.isInTopPadding(e)}isInBottomPadding(e){return this._linesLayout.isInBottomPadding(e)}getLineNumberAtVerticalOffset(e){return this._linesLayout.getLineNumberAtOrAfterVerticalOffset(e)}getWhitespaceAtVerticalOffset(e){return this._linesLayout.getWhitespaceAtVerticalOffset(e)}getLinesViewportData(){let e=this.getCurrentViewport();return this._linesLayout.getLinesViewportData(e.top,e.top+e.height)}getLinesViewportDataAtScrollTop(e){let t=this._scrollable.getScrollDimensions();return e+t.height>t.scrollHeight&&(e=t.scrollHeight-t.height),e<0&&(e=0),this._linesLayout.getLinesViewportData(e,e+t.height)}getWhitespaceViewportData(){let e=this.getCurrentViewport();return this._linesLayout.getWhitespaceViewportData(e.top,e.top+e.height)}getWhitespaces(){return this._linesLayout.getWhitespaces()}getContentWidth(){return this._scrollable.getScrollDimensions().contentWidth}getScrollWidth(){return this._scrollable.getScrollDimensions().scrollWidth}getContentHeight(){return this._scrollable.getScrollDimensions().contentHeight}getScrollHeight(){return this._scrollable.getScrollDimensions().scrollHeight}getCurrentScrollLeft(){return this._scrollable.getCurrentScrollPosition().scrollLeft}getCurrentScrollTop(){return this._scrollable.getCurrentScrollPosition().scrollTop}validateScrollPosition(e){return this._scrollable.validateScrollPosition(e)}setScrollPosition(e,t){t===1?this._scrollable.setScrollPositionNow(e):this._scrollable.setScrollPositionSmooth(e)}hasPendingScrollAnimation(){return this._scrollable.hasPendingScrollAnimation()}deltaScrollNow(e,t){let i=this._scrollable.getCurrentScrollPosition();this._scrollable.setScrollPositionNow({scrollLeft:i.scrollLeft+e,scrollTop:i.scrollTop+t})}};_();v();b();ft();Ke();var Tk=class{constructor(e,t,i,o,s){this.editorId=e,this.model=t,this.configuration=i,this._linesCollection=o,this._coordinatesConverter=s,this._decorationsCache=Object.create(null),this._cachedModelDecorationsResolver=null,this._cachedModelDecorationsResolverViewRange=null}_clearCachedModelDecorationsResolver(){this._cachedModelDecorationsResolver=null,this._cachedModelDecorationsResolverViewRange=null}dispose(){this._decorationsCache=Object.create(null),this._clearCachedModelDecorationsResolver()}reset(){this._decorationsCache=Object.create(null),this._clearCachedModelDecorationsResolver()}onModelDecorationsChanged(){this._decorationsCache=Object.create(null),this._clearCachedModelDecorationsResolver()}onLineMappingChanged(){this._decorationsCache=Object.create(null),this._clearCachedModelDecorationsResolver()}_getOrCreateViewModelDecoration(e){let t=e.id,i=this._decorationsCache[t];if(!i){let o=e.range,s=e.options,r;if(s.isWholeLine){let a=this._coordinatesConverter.convertModelPositionToViewPosition(new U(o.startLineNumber,1),0,!1,!0),l=this._coordinatesConverter.convertModelPositionToViewPosition(new U(o.endLineNumber,this.model.getLineMaxColumn(o.endLineNumber)),1);r=new P(a.lineNumber,a.column,l.lineNumber,l.column)}else r=this._coordinatesConverter.convertModelRangeToViewRange(o,1);i=new mm(r,s),this._decorationsCache[t]=i}return i}getMinimapDecorationsInRange(e){return this._getDecorationsInRange(e,!0,!1).decorations}getDecorationsViewportData(e){let t=this._cachedModelDecorationsResolver!==null;return t=t&&e.equalsRange(this._cachedModelDecorationsResolverViewRange),t||(this._cachedModelDecorationsResolver=this._getDecorationsInRange(e,!1,!1),this._cachedModelDecorationsResolverViewRange=e),this._cachedModelDecorationsResolver}getInlineDecorationsOnLine(e,t=!1,i=!1){let o=new P(e,this._linesCollection.getViewLineMinColumn(e),e,this._linesCollection.getViewLineMaxColumn(e));return this._getDecorationsInRange(o,t,i).inlineDecorations[0]}_getDecorationsInRange(e,t,i){let o=this._linesCollection.getDecorationsInRange(e,this.editorId,nu(this.configuration.options),t,i),s=e.startLineNumber,r=e.endLineNumber,a=[],l=0,c=[];for(let d=s;d<=r;d++)c[d-s]=[];for(let d=0,h=o.length;dt===1)}function NZ(n,e){return Mz(n,e.range,t=>t===2)}function Mz(n,e,t){for(let i=e.startLineNumber;i<=e.endLineNumber;i++){let o=n.tokenization.getLineTokens(i),s=i===e.startLineNumber,r=i===e.endLineNumber,a=s?o.findTokenIndexAtOffset(e.startColumn-1):0;for(;ae.endColumn-1);){if(!t(o.getStandardTokenType(a)))return!1;a++}}return!0}_();v();b();wt();ft();Ke();Kx();sv();bh();_();v();b();Pc();ft();bh();function Nk(n,e){return n===null?e?mp.INSTANCE:pp.INSTANCE:new m4(n,e)}var m4=class{constructor(e,t){this._projectionData=e,this._isVisible=t}isVisible(){return this._isVisible}setVisible(e){return this._isVisible=e,this}getProjectionData(){return this._projectionData}getViewLineCount(){return this._isVisible?this._projectionData.getOutputLineCount():0}getViewLineContent(e,t,i){this._assertVisible();let o=i>0?this._projectionData.breakOffsets[i-1]:0,s=this._projectionData.breakOffsets[i],r;if(this._projectionData.injectionOffsets!==null){let a=this._projectionData.injectionOffsets.map((c,d)=>new Ls(0,0,c+1,this._projectionData.injectionOptions[d],0));r=Ls.applyInjectedText(e.getLineContent(t),a).substring(o,s)}else r=e.getValueInRange({startLineNumber:t,startColumn:o+1,endLineNumber:t,endColumn:s+1});return i>0&&(r=Rz(this._projectionData.wrappedTextIndentLength)+r),r}getViewLineLength(e,t,i){return this._assertVisible(),this._projectionData.getLineLength(i)}getViewLineMinColumn(e,t,i){return this._assertVisible(),this._projectionData.getMinOutputOffset(i)+1}getViewLineMaxColumn(e,t,i){return this._assertVisible(),this._projectionData.getMaxOutputOffset(i)+1}getViewLineData(e,t,i){let o=new Array;return this.getViewLinesData(e,t,i,1,0,[!0],o),o[0]}getViewLinesData(e,t,i,o,s,r,a){this._assertVisible();let l=this._projectionData,c=l.injectionOffsets,d=l.injectionOptions,h=null;if(c){h=[];let f=0,g=0;for(let m=0;m0?l.breakOffsets[m-1]:0,w=l.breakOffsets[m];for(;gw)break;if(S0?l.wrappedTextIndentLength:0,M=N+Math.max(x-S,0),W=N+Math.min(k-S,w-S);M!==W&&C.push(new wS(M,W,T.inlineClassName,T.inlineClassNameAffectsLetterSpacing))}}if(k<=w)f+=y,g++;else break}}}let u;c?u=e.tokenization.getLineTokens(t).withInserted(c.map((f,g)=>({offset:f,text:d[g].content,tokenMetadata:Hi.defaultTokenMetadata}))):u=e.tokenization.getLineTokens(t);for(let f=i;f0?o.wrappedTextIndentLength:0,r=i>0?o.breakOffsets[i-1]:0,a=o.breakOffsets[i],l=e.sliceAndInflate(r,a,s),c=l.getLineContent();i>0&&(c=Rz(o.wrappedTextIndentLength)+c);let d=this._projectionData.getMinOutputOffset(i)+1,h=c.length+1,u=i+1=g4.length)for(let e=1;e<=n;e++)g4[e]=AZ(e);return g4[n]}function AZ(n){return new Array(n+1).join(" ")}var Ak=class{constructor(e,t,i,o,s,r,a,l,c,d){this._editorId=e,this.model=t,this._validModelVersionId=-1,this._domLineBreaksComputerFactory=i,this._monospaceLineBreaksComputerFactory=o,this.fontInfo=s,this.tabSize=r,this.wrappingStrategy=a,this.wrappingColumn=l,this.wrappingIndent=c,this.wordBreak=d,this._constructLines(!0,null)}dispose(){this.hiddenAreasDecorationIds=this.model.deltaDecorations(this.hiddenAreasDecorationIds,[])}createCoordinatesConverter(){return new p4(this)}_constructLines(e,t){this.modelLineProjections=[],e&&(this.hiddenAreasDecorationIds=this.model.deltaDecorations(this.hiddenAreasDecorationIds,[]));let i=this.model.getLinesContent(),o=this.model.getInjectedTextDecorations(this._editorId),s=i.length,r=this.createLineBreaksComputer(),a=new mo(Ls.fromDecorations(o));for(let m=0;mS.lineNumber===m+1);r.addRequest(i[m],C,t?t[m]:null)}let l=r.finalize(),c=[],d=this.hiddenAreasDecorationIds.map(m=>this.model.getDecorationRange(m)).sort(P.compareRangesUsingStarts),h=1,u=0,f=-1,g=f+1=h&&C<=u,w=Nk(l[m],!S);c[m]=w.getViewLineCount(),this.modelLineProjections[m]=w}this._validModelVersionId=this.model.getVersionId(),this.projectedModelLineLineCounts=new $y(c)}getHiddenAreas(){return this.hiddenAreasDecorationIds.map(e=>this.model.getDecorationRange(e))}setHiddenAreas(e){let t=e.map(u=>this.model.validateRange(u)),i=MZ(t),o=this.hiddenAreasDecorationIds.map(u=>this.model.getDecorationRange(u)).sort(P.compareRangesUsingStarts);if(i.length===o.length){let u=!1;for(let f=0;f({range:u,options:qi.EMPTY}));this.hiddenAreasDecorationIds=this.model.deltaDecorations(this.hiddenAreasDecorationIds,s);let r=i,a=1,l=0,c=-1,d=c+1=a&&f<=l?this.modelLineProjections[u].isVisible()&&(this.modelLineProjections[u]=this.modelLineProjections[u].setVisible(!1),g=!0):(h=!0,this.modelLineProjections[u].isVisible()||(this.modelLineProjections[u]=this.modelLineProjections[u].setVisible(!0),g=!0)),g){let m=this.modelLineProjections[u].getViewLineCount();this.projectedModelLineLineCounts.setValue(u,m)}}return h||this.setHiddenAreas([]),!0}modelPositionIsVisible(e,t){return e<1||e>this.modelLineProjections.length?!1:this.modelLineProjections[e-1].isVisible()}getModelLineViewLineCount(e){return e<1||e>this.modelLineProjections.length?1:this.modelLineProjections[e-1].getViewLineCount()}setTabSize(e){return this.tabSize===e?!1:(this.tabSize=e,this._constructLines(!1,null),!0)}setWrappingSettings(e,t,i,o,s){let r=this.fontInfo.equals(e),a=this.wrappingStrategy===t,l=this.wrappingColumn===i,c=this.wrappingIndent===o,d=this.wordBreak===s;if(r&&a&&l&&c&&d)return!1;let h=r&&a&&!l&&c&&d;this.fontInfo=e,this.wrappingStrategy=t,this.wrappingColumn=i,this.wrappingIndent=o,this.wordBreak=s;let u=null;if(h){u=[];for(let f=0,g=this.modelLineProjections.length;f2&&!this.modelLineProjections[t-2].isVisible(),r=t===1?1:this.projectedModelLineLineCounts.getPrefixSum(t-1)+1,a=0,l=[],c=[];for(let d=0,h=o.length;dl?(d=this.projectedModelLineLineCounts.getPrefixSum(t-1)+1,h=d+l-1,g=h+1,m=g+(s-l)-1,c=!0):st?t:e|0}getActiveIndentGuide(e,t,i){e=this._toValidViewLineNumber(e),t=this._toValidViewLineNumber(t),i=this._toValidViewLineNumber(i);let o=this.convertViewPositionToModelPosition(e,this.getViewLineMinColumn(e)),s=this.convertViewPositionToModelPosition(t,this.getViewLineMinColumn(t)),r=this.convertViewPositionToModelPosition(i,this.getViewLineMinColumn(i)),a=this.model.guides.getActiveIndentGuide(o.lineNumber,s.lineNumber,r.lineNumber),l=this.convertModelPositionToViewPosition(a.startLineNumber,1),c=this.convertModelPositionToViewPosition(a.endLineNumber,this.model.getLineMaxColumn(a.endLineNumber));return{startLineNumber:l.lineNumber,endLineNumber:c.lineNumber,indent:a.indent}}getViewLineInfo(e){e=this._toValidViewLineNumber(e);let t=this.projectedModelLineLineCounts.getIndexOf(e-1),i=t.index,o=t.remainder;return new Mk(i+1,o)}getMinColumnOfViewLine(e){return this.modelLineProjections[e.modelLineNumber-1].getViewLineMinColumn(this.model,e.modelLineNumber,e.modelLineWrappedLineIdx)}getMaxColumnOfViewLine(e){return this.modelLineProjections[e.modelLineNumber-1].getViewLineMaxColumn(this.model,e.modelLineNumber,e.modelLineWrappedLineIdx)}getModelStartPositionOfViewLine(e){let t=this.modelLineProjections[e.modelLineNumber-1],i=t.getViewLineMinColumn(this.model,e.modelLineNumber,e.modelLineWrappedLineIdx),o=t.getModelColumnOfViewPosition(e.modelLineWrappedLineIdx,i);return new U(e.modelLineNumber,o)}getModelEndPositionOfViewLine(e){let t=this.modelLineProjections[e.modelLineNumber-1],i=t.getViewLineMaxColumn(this.model,e.modelLineNumber,e.modelLineWrappedLineIdx),o=t.getModelColumnOfViewPosition(e.modelLineWrappedLineIdx,i);return new U(e.modelLineNumber,o)}getViewLineInfosGroupedByModelRanges(e,t){let i=this.getViewLineInfo(e),o=this.getViewLineInfo(t),s=new Array,r=this.getModelStartPositionOfViewLine(i),a=new Array;for(let l=i.modelLineNumber;l<=o.modelLineNumber;l++){let c=this.modelLineProjections[l-1];if(c.isVisible()){let d=l===i.modelLineNumber?i.modelLineWrappedLineIdx:0,h=l===o.modelLineNumber?o.modelLineWrappedLineIdx+1:c.getViewLineCount();for(let u=d;u{if(f.forWrappedLinesAfterColumn!==-1&&this.modelLineProjections[d.modelLineNumber-1].getViewPositionOfModelPosition(0,f.forWrappedLinesAfterColumn).lineNumber>=d.modelLineWrappedLineIdx||f.forWrappedLinesBeforeOrAtColumn!==-1&&this.modelLineProjections[d.modelLineNumber-1].getViewPositionOfModelPosition(0,f.forWrappedLinesBeforeOrAtColumn).lineNumberd.modelLineWrappedLineIdx)return}let m=this.convertModelPositionToViewPosition(d.modelLineNumber,f.horizontalLine.endColumn),C=this.modelLineProjections[d.modelLineNumber-1].getViewPositionOfModelPosition(0,f.horizontalLine.endColumn);return C.lineNumber===d.modelLineWrappedLineIdx?new ia(f.visibleColumn,g,f.className,new Hc(f.horizontalLine.top,m.column),-1,-1):C.lineNumber!!f))}}return r}getViewLinesIndentGuides(e,t){e=this._toValidViewLineNumber(e),t=this._toValidViewLineNumber(t);let i=this.convertViewPositionToModelPosition(e,this.getViewLineMinColumn(e)),o=this.convertViewPositionToModelPosition(t,this.getViewLineMaxColumn(t)),s=[],r=[],a=[],l=i.lineNumber-1,c=o.lineNumber-1,d=null;for(let g=l;g<=c;g++){let m=this.modelLineProjections[g];if(m.isVisible()){let C=m.getViewLineNumberOfModelPosition(0,g===l?i.column:1),S=m.getViewLineNumberOfModelPosition(0,this.model.getLineMaxColumn(g+1)),w=S-C+1,y=0;w>1&&m.getViewLineMinColumn(this.model,g+1,S)===1&&(y=C===0?1:2),r.push(w),a.push(y),d===null&&(d=new U(g+1,0))}else d!==null&&(s=s.concat(this.model.guides.getLinesIndentGuides(d.lineNumber,g)),d=null)}d!==null&&(s=s.concat(this.model.guides.getLinesIndentGuides(d.lineNumber,o.lineNumber)),d=null);let h=t-e+1,u=new Array(h),f=0;for(let g=0,m=s.length;gt&&(g=!0,f=t-s+1),h.getViewLinesData(this.model,c+1,u,f,s-e,i,l),s+=f,g)break}return l}validateViewPosition(e,t,i){e=this._toValidViewLineNumber(e);let o=this.projectedModelLineLineCounts.getIndexOf(e-1),s=o.index,r=o.remainder,a=this.modelLineProjections[s],l=a.getViewLineMinColumn(this.model,s+1,r),c=a.getViewLineMaxColumn(this.model,s+1,r);tc&&(t=c);let d=a.getModelColumnOfViewPosition(r,t);return this.model.validatePosition(new U(s+1,d)).equals(i)?new U(e,t):this.convertModelPositionToViewPosition(i.lineNumber,i.column)}validateViewRange(e,t){let i=this.validateViewPosition(e.startLineNumber,e.startColumn,t.getStartPosition()),o=this.validateViewPosition(e.endLineNumber,e.endColumn,t.getEndPosition());return new P(i.lineNumber,i.column,o.lineNumber,o.column)}convertViewPositionToModelPosition(e,t){let i=this.getViewLineInfo(e),o=this.modelLineProjections[i.modelLineNumber-1].getModelColumnOfViewPosition(i.modelLineWrappedLineIdx,t);return this.model.validatePosition(new U(i.modelLineNumber,o))}convertViewRangeToModelRange(e){let t=this.convertViewPositionToModelPosition(e.startLineNumber,e.startColumn),i=this.convertViewPositionToModelPosition(e.endLineNumber,e.endColumn);return new P(t.lineNumber,t.column,i.lineNumber,i.column)}convertModelPositionToViewPosition(e,t,i=2,o=!1,s=!1){let r=this.model.validatePosition(new U(e,t)),a=r.lineNumber,l=r.column,c=a-1,d=!1;if(s)for(;c0&&!this.modelLineProjections[c].isVisible();)c--,d=!0;if(c===0&&!this.modelLineProjections[c].isVisible())return new U(o?0:1,1);let h=1+this.projectedModelLineLineCounts.getPrefixSum(c),u;return d?s?u=this.modelLineProjections[c].getViewPositionOfModelPosition(h,1,i):u=this.modelLineProjections[c].getViewPositionOfModelPosition(h,this.model.getLineMaxColumn(c+1),i):u=this.modelLineProjections[a-1].getViewPositionOfModelPosition(h,l,i),u}convertModelRangeToViewRange(e,t=0){if(e.isEmpty()){let i=this.convertModelPositionToViewPosition(e.startLineNumber,e.startColumn,t);return P.fromPositions(i)}else{let i=this.convertModelPositionToViewPosition(e.startLineNumber,e.startColumn,1),o=this.convertModelPositionToViewPosition(e.endLineNumber,e.endColumn,0);return new P(i.lineNumber,i.column,o.lineNumber,o.column)}}getViewLineNumberOfModelPosition(e,t){let i=e-1;if(this.modelLineProjections[i].isVisible()){let s=1+this.projectedModelLineLineCounts.getPrefixSum(i);return this.modelLineProjections[i].getViewLineNumberOfModelPosition(s,t)}for(;i>0&&!this.modelLineProjections[i].isVisible();)i--;if(i===0&&!this.modelLineProjections[i].isVisible())return 1;let o=1+this.projectedModelLineLineCounts.getPrefixSum(i);return this.modelLineProjections[i].getViewLineNumberOfModelPosition(o,this.model.getLineMaxColumn(i+1))}getDecorationsInRange(e,t,i,o,s){let r=this.convertViewPositionToModelPosition(e.startLineNumber,e.startColumn),a=this.convertViewPositionToModelPosition(e.endLineNumber,e.endColumn);if(a.lineNumber-r.lineNumber<=e.endLineNumber-e.startLineNumber)return this.model.getDecorationsInRange(new P(r.lineNumber,1,a.lineNumber,a.column),t,i,o,s);let l=[],c=r.lineNumber-1,d=a.lineNumber-1,h=null;for(let m=c;m<=d;m++)if(this.modelLineProjections[m].isVisible())h===null&&(h=new U(m+1,m===c?r.column:1));else if(h!==null){let S=this.model.getLineMaxColumn(m);l=l.concat(this.model.getDecorationsInRange(new P(h.lineNumber,h.column,m,S),t,i,o)),h=null}h!==null&&(l=l.concat(this.model.getDecorationsInRange(new P(h.lineNumber,h.column,a.lineNumber,a.column),t,i,o)),h=null),l.sort((m,C)=>{let S=P.compareRangesUsingStarts(m.range,C.range);return S===0?m.idC.id?1:0:S});let u=[],f=0,g=null;for(let m of l){let C=m.id;g!==C&&(g=C,u[f++]=m)}return u}getInjectedTextAt(e){let t=this.getViewLineInfo(e.lineNumber);return this.modelLineProjections[t.modelLineNumber-1].getInjectedTextAt(t.modelLineWrappedLineIdx,e.column)}normalizePosition(e,t){let i=this.getViewLineInfo(e.lineNumber);return this.modelLineProjections[i.modelLineNumber-1].normalizePosition(i.modelLineWrappedLineIdx,e,t)}getLineIndentColumn(e){let t=this.getViewLineInfo(e);return t.modelLineWrappedLineIdx===0?this.model.getLineIndentColumn(t.modelLineNumber):0}};function MZ(n){if(n.length===0)return[];let e=n.slice();e.sort(P.compareRangesUsingStarts);let t=[],i=e[0].startLineNumber,o=e[0].endLineNumber;for(let s=1,r=e.length;so+1?(t.push(new P(i,1,o,1)),i=a.startLineNumber,o=a.endLineNumber):a.endLineNumber>o&&(o=a.endLineNumber)}return t.push(new P(i,1,o,1)),t}var Mk=class{constructor(e,t){this.modelLineNumber=e,this.modelLineWrappedLineIdx=t}},Rk=class{constructor(e,t){this.modelRange=e,this.viewLines=t}},p4=class{constructor(e){this._lines=e}convertViewPositionToModelPosition(e){return this._lines.convertViewPositionToModelPosition(e.lineNumber,e.column)}convertViewRangeToModelRange(e){return this._lines.convertViewRangeToModelRange(e)}validateViewPosition(e,t){return this._lines.validateViewPosition(e.lineNumber,e.column,t)}validateViewRange(e,t){return this._lines.validateViewRange(e,t)}convertModelPositionToViewPosition(e,t,i,o){return this._lines.convertModelPositionToViewPosition(e.lineNumber,e.column,t,i,o)}convertModelRangeToViewRange(e,t){return this._lines.convertModelRangeToViewRange(e,t)}modelPositionIsVisible(e){return this._lines.modelPositionIsVisible(e.lineNumber,e.column)}getModelLineViewLineCount(e){return this._lines.getModelLineViewLineCount(e)}getViewLineNumberOfModelPosition(e,t){return this._lines.getViewLineNumberOfModelPosition(e,t)}},Pk=class{constructor(e){this.model=e}dispose(){}createCoordinatesConverter(){return new _4(this)}getHiddenAreas(){return[]}setHiddenAreas(e){return!1}setTabSize(e){return!1}setWrappingSettings(e,t,i,o){return!1}createLineBreaksComputer(){let e=[];return{addRequest:(t,i,o)=>{e.push(null)},finalize:()=>e}}onModelFlushed(){}onModelLinesDeleted(e,t,i){return new fp(t,i)}onModelLinesInserted(e,t,i,o){return new gp(t,i)}onModelLineChanged(e,t,i){return[!1,new dv(t,1),null,null]}acceptVersionId(e){}getViewLineCount(){return this.model.getLineCount()}getActiveIndentGuide(e,t,i){return{startLineNumber:e,endLineNumber:e,indent:0}}getViewLinesBracketGuides(e,t,i){return new Array(t-e+1).fill([])}getViewLinesIndentGuides(e,t){let i=t-e+1,o=new Array(i);for(let s=0;st)}getModelLineViewLineCount(e){return 1}getViewLineNumberOfModelPosition(e,t){return e}};_();v();b();hr();var Lf=dr.Right,Ok=class{constructor(e){this.persist=0,this._requiredLanes=1,this.lanes=new Uint8Array(Math.ceil((e+1)*Lf/8))}reset(e){let t=Math.ceil((e+1)*Lf/8);this.lanes.length>>3]|=1<>>3]&1<>>3]&1<this._updateConfigurationViewLineCountNow(),0)),this._hasFocus=!1,this._viewportStart=b4.create(this.model),this.glyphLanes=new Ok(0),RZ&&this.model.isTooLargeForTokenization())this._lines=new Pk(this.model);else{let d=this._configuration.options,h=d.get(50),u=d.get(139),f=d.get(146),g=d.get(138),m=d.get(129);this._lines=new Ak(this._editorId,this.model,o,s,h,this.model.getOptions().tabSize,u,f.wrappingColumn,g,m)}this.coordinatesConverter=this._lines.createCoordinatesConverter(),this._cursor=this._register(new Dk(i,this,this.coordinatesConverter,this.cursorConfig)),this.viewLayout=this._register(new Ik(this._configuration,this.getLineCount(),r)),this._register(this.viewLayout.onDidScroll(d=>{d.scrollTopChanged&&this._handleVisibleLinesChanged(),d.scrollTopChanged&&this._viewportStart.invalidate(),this._eventDispatcher.emitSingleViewEvent(new lk(d)),this._eventDispatcher.emitOutgoingEvent(new pk(d.oldScrollWidth,d.oldScrollLeft,d.oldScrollHeight,d.oldScrollTop,d.scrollWidth,d.scrollLeft,d.scrollHeight,d.scrollTop))})),this._register(this.viewLayout.onDidContentSizeChange(d=>{this._eventDispatcher.emitOutgoingEvent(d)})),this._decorations=new Tk(this._editorId,this.model,this._configuration,this._lines,this.coordinatesConverter),this._registerModelEvents(),this._register(this._configuration.onDidChangeFast(d=>{try{let h=this._eventDispatcher.beginEmitViewEvents();this._onConfigurationChanged(h,d)}finally{this._eventDispatcher.endEmitViewEvents()}})),this._register(mf.getInstance().onDidChange(()=>{this._eventDispatcher.emitSingleViewEvent(new hk)})),this._register(this._themeService.onDidColorThemeChange(d=>{this._invalidateDecorationsColorCache(),this._eventDispatcher.emitSingleViewEvent(new ck(d))})),this._updateConfigurationViewLineCountNow()}dispose(){super.dispose(),this._decorations.dispose(),this._lines.dispose(),this._viewportStart.dispose(),this._eventDispatcher.dispose()}createLineBreaksComputer(){return this._lines.createLineBreaksComputer()}addViewEventHandler(e){this._eventDispatcher.addViewEventHandler(e)}removeViewEventHandler(e){this._eventDispatcher.removeViewEventHandler(e)}_updateConfigurationViewLineCountNow(){this._configuration.setViewLineCount(this._lines.getViewLineCount())}getModelVisibleRanges(){let e=this.viewLayout.getLinesViewportData(),t=new P(e.startLineNumber,this.getLineMinColumn(e.startLineNumber),e.endLineNumber,this.getLineMaxColumn(e.endLineNumber));return this._toModelVisibleRanges(t)}visibleLinesStabilized(){let e=this.getModelVisibleRanges();this._attachedView.setVisibleLines(e,!0)}_handleVisibleLinesChanged(){let e=this.getModelVisibleRanges();this._attachedView.setVisibleLines(e,!1)}setHasFocus(e){this._hasFocus=e,this._cursor.setHasFocus(e),this._eventDispatcher.emitSingleViewEvent(new rk(e)),this._eventDispatcher.emitOutgoingEvent(new mk(!e,e))}onCompositionStart(){this._eventDispatcher.emitSingleViewEvent(new ik)}onCompositionEnd(){this._eventDispatcher.emitSingleViewEvent(new nk)}_captureStableViewport(){if(this._viewportStart.isValid&&this.viewLayout.getCurrentScrollTop()>0){let e=new U(this._viewportStart.viewLineNumber,this.getLineMinColumn(this._viewportStart.viewLineNumber)),t=this.coordinatesConverter.convertViewPositionToModelPosition(e);return new Bk(t,this._viewportStart.startLineDelta)}return new Bk(null,0)}_onConfigurationChanged(e,t){let i=this._captureStableViewport(),o=this._configuration.options,s=o.get(50),r=o.get(139),a=o.get(146),l=o.get(138),c=o.get(129);this._lines.setWrappingSettings(s,r,a.wrappingColumn,l,c)&&(e.emitViewEvent(new yf),e.emitViewEvent(new Sf),e.emitViewEvent(new Xl(null)),this._cursor.onLineMappingChanged(e),this._decorations.onLineMappingChanged(),this.viewLayout.onFlushed(this.getLineCount()),this._updateConfigurationViewLineCount.schedule()),t.hasChanged(91)&&(this._decorations.reset(),e.emitViewEvent(new Xl(null))),t.hasChanged(98)&&(this._decorations.reset(),e.emitViewEvent(new Xl(null))),e.emitViewEvent(new ok(t)),this.viewLayout.onConfigurationChanged(t),i.recoverViewportStart(this.coordinatesConverter,this.viewLayout),Wc.shouldRecreate(t)&&(this.cursorConfig=new Wc(this.model.getLanguageId(),this.model.getOptions(),this._configuration,this.languageConfigurationService),this._cursor.updateConfiguration(this.cursorConfig))}_registerModelEvents(){this._register(this.model.onDidChangeContentOrInjectedText(e=>{try{let i=this._eventDispatcher.beginEmitViewEvents(),o=!1,s=!1,r=e instanceof _h?e.rawContentChangedEvent.changes:e.changes,a=e instanceof _h?e.rawContentChangedEvent.versionId:null,l=this._lines.createLineBreaksComputer();for(let h of r)switch(h.changeType){case 4:{for(let u=0;u!m.ownerId||m.ownerId===this._editorId)),l.addRequest(f,g,null)}break}case 2:{let u=null;h.injectedText&&(u=h.injectedText.filter(f=>!f.ownerId||f.ownerId===this._editorId)),l.addRequest(h.detail,u,null);break}}let c=l.finalize(),d=new mo(c);for(let h of r)switch(h.changeType){case 1:{this._lines.onModelFlushed(),i.emitViewEvent(new yf),this._decorations.reset(),this.viewLayout.onFlushed(this.getLineCount()),o=!0;break}case 3:{let u=this._lines.onModelLinesDeleted(a,h.fromLineNumber,h.toLineNumber);u!==null&&(i.emitViewEvent(u),this.viewLayout.onLinesDeleted(u.fromLineNumber,u.toLineNumber)),o=!0;break}case 4:{let u=d.takeCount(h.detail.length),f=this._lines.onModelLinesInserted(a,h.fromLineNumber,h.toLineNumber,u);f!==null&&(i.emitViewEvent(f),this.viewLayout.onLinesInserted(f.fromLineNumber,f.toLineNumber)),o=!0;break}case 2:{let u=d.dequeue(),[f,g,m,C]=this._lines.onModelLineChanged(a,h.lineNumber,u);s=f,g&&i.emitViewEvent(g),m&&(i.emitViewEvent(m),this.viewLayout.onLinesInserted(m.fromLineNumber,m.toLineNumber)),C&&(i.emitViewEvent(C),this.viewLayout.onLinesDeleted(C.fromLineNumber,C.toLineNumber));break}case 5:break}a!==null&&this._lines.acceptVersionId(a),this.viewLayout.onHeightMaybeChanged(),!o&&s&&(i.emitViewEvent(new Sf),i.emitViewEvent(new Xl(null)),this._cursor.onLineMappingChanged(i),this._decorations.onLineMappingChanged())}finally{this._eventDispatcher.endEmitViewEvents()}let t=this._viewportStart.isValid;if(this._viewportStart.invalidate(),this._configuration.setModelLineCount(this.model.getLineCount()),this._updateConfigurationViewLineCountNow(),!this._hasFocus&&this.model.getAttachedEditorCount()>=2&&t){let i=this.model._getTrackedRange(this._viewportStart.modelTrackedRange);if(i){let o=this.coordinatesConverter.convertModelPositionToViewPosition(i.getStartPosition()),s=this.viewLayout.getVerticalOffsetForLineNumber(o.lineNumber);this.viewLayout.setScrollPosition({scrollTop:s+this._viewportStart.startLineDelta},1)}}try{let i=this._eventDispatcher.beginEmitViewEvents();e instanceof _h&&i.emitOutgoingEvent(new xk(e.contentChangedEvent)),this._cursor.onModelContentChanged(i,e)}finally{this._eventDispatcher.endEmitViewEvents()}this._handleVisibleLinesChanged()})),this._register(this.model.onDidChangeTokens(e=>{let t=[];for(let i=0,o=e.ranges.length;i{this._eventDispatcher.emitSingleViewEvent(new ak),this.cursorConfig=new Wc(this.model.getLanguageId(),this.model.getOptions(),this._configuration,this.languageConfigurationService),this._cursor.updateConfiguration(this.cursorConfig),this._eventDispatcher.emitOutgoingEvent(new Sk(e))})),this._register(this.model.onDidChangeLanguage(e=>{this.cursorConfig=new Wc(this.model.getLanguageId(),this.model.getOptions(),this._configuration,this.languageConfigurationService),this._cursor.updateConfiguration(this.cursorConfig),this._eventDispatcher.emitOutgoingEvent(new yk(e))})),this._register(this.model.onDidChangeOptions(e=>{if(this._lines.setTabSize(this.model.getOptions().tabSize)){try{let t=this._eventDispatcher.beginEmitViewEvents();t.emitViewEvent(new yf),t.emitViewEvent(new Sf),t.emitViewEvent(new Xl(null)),this._cursor.onLineMappingChanged(t),this._decorations.onLineMappingChanged(),this.viewLayout.onFlushed(this.getLineCount())}finally{this._eventDispatcher.endEmitViewEvents()}this._updateConfigurationViewLineCount.schedule()}this.cursorConfig=new Wc(this.model.getLanguageId(),this.model.getOptions(),this._configuration,this.languageConfigurationService),this._cursor.updateConfiguration(this.cursorConfig),this._eventDispatcher.emitOutgoingEvent(new Lk(e))})),this._register(this.model.onDidChangeDecorations(e=>{this._decorations.onModelDecorationsChanged(),this._eventDispatcher.emitSingleViewEvent(new Xl(e)),this._eventDispatcher.emitOutgoingEvent(new wk(e))}))}setHiddenAreas(e,t){var i;this.hiddenAreasModel.setHiddenAreas(t,e);let o=this.hiddenAreasModel.getMergedRanges();if(o===this.previousHiddenAreas)return;this.previousHiddenAreas=o;let s=this._captureStableViewport(),r=!1;try{let a=this._eventDispatcher.beginEmitViewEvents();r=this._lines.setHiddenAreas(o),r&&(a.emitViewEvent(new yf),a.emitViewEvent(new Sf),a.emitViewEvent(new Xl(null)),this._cursor.onLineMappingChanged(a),this._decorations.onLineMappingChanged(),this.viewLayout.onFlushed(this.getLineCount()),this.viewLayout.onHeightMaybeChanged());let l=(i=s.viewportStartModelPosition)===null||i===void 0?void 0:i.lineNumber;l&&o.some(d=>d.startLineNumber<=l&&l<=d.endLineNumber)||s.recoverViewportStart(this.coordinatesConverter,this.viewLayout)}finally{this._eventDispatcher.endEmitViewEvents()}this._updateConfigurationViewLineCount.schedule(),r&&this._eventDispatcher.emitOutgoingEvent(new bk)}getVisibleRangesPlusViewportAboveBelow(){let e=this._configuration.options.get(145),t=this._configuration.options.get(67),i=Math.max(20,Math.round(e.height/t)),o=this.viewLayout.getLinesViewportData(),s=Math.max(1,o.completelyVisibleStartLineNumber-i),r=Math.min(this.getLineCount(),o.completelyVisibleEndLineNumber+i);return this._toModelVisibleRanges(new P(s,this.getLineMinColumn(s),r,this.getLineMaxColumn(r)))}getVisibleRanges(){let e=this.getCompletelyVisibleViewRange();return this._toModelVisibleRanges(e)}getHiddenAreas(){return this._lines.getHiddenAreas()}_toModelVisibleRanges(e){let t=this.coordinatesConverter.convertViewRangeToModelRange(e),i=this._lines.getHiddenAreas();if(i.length===0)return[t];let o=[],s=0,r=t.startLineNumber,a=t.startColumn,l=t.endLineNumber,c=t.endColumn;for(let d=0,h=i.length;dl||(r"u")return this._reduceRestoreStateCompatibility(e);let t=this.model.validatePosition(e.firstPosition),i=this.coordinatesConverter.convertModelPositionToViewPosition(t),o=this.viewLayout.getVerticalOffsetForLineNumber(i.lineNumber)-e.firstPositionDeltaTop;return{scrollLeft:e.scrollLeft,scrollTop:o}}_reduceRestoreStateCompatibility(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTopWithoutViewZones}}getTabSize(){return this.model.getOptions().tabSize}getLineCount(){return this._lines.getViewLineCount()}setViewport(e,t,i){this._viewportStart.update(this,e)}getActiveIndentGuide(e,t,i){return this._lines.getActiveIndentGuide(e,t,i)}getLinesIndentGuides(e,t){return this._lines.getViewLinesIndentGuides(e,t)}getBracketGuidesInRangeByLine(e,t,i,o){return this._lines.getViewLinesBracketGuides(e,t,i,o)}getLineContent(e){return this._lines.getViewLineContent(e)}getLineLength(e){return this._lines.getViewLineLength(e)}getLineMinColumn(e){return this._lines.getViewLineMinColumn(e)}getLineMaxColumn(e){return this._lines.getViewLineMaxColumn(e)}getLineFirstNonWhitespaceColumn(e){let t=Ri(this.getLineContent(e));return t===-1?0:t+1}getLineLastNonWhitespaceColumn(e){let t=Os(this.getLineContent(e));return t===-1?0:t+2}getMinimapDecorationsInRange(e){return this._decorations.getMinimapDecorationsInRange(e)}getDecorationsInViewport(e){return this._decorations.getDecorationsViewportData(e).decorations}getInjectedTextAt(e){return this._lines.getInjectedTextAt(e)}getViewportViewLineRenderingData(e,t){let o=this._decorations.getDecorationsViewportData(e).inlineDecorations[t-e.startLineNumber];return this._getViewLineRenderingData(t,o)}getViewLineRenderingData(e){let t=this._decorations.getInlineDecorationsOnLine(e);return this._getViewLineRenderingData(e,t)}_getViewLineRenderingData(e,t){let i=this.model.mightContainRTL(),o=this.model.mightContainNonBasicASCII(),s=this.getTabSize(),r=this._lines.getViewLineData(e);return r.inlineDecorations&&(t=[...t,...r.inlineDecorations.map(a=>a.toInlineDecoration(e))]),new Wo(r.minColumn,r.maxColumn,r.content,r.continuesWithWrappedLine,i,o,r.tokens,t,s,r.startVisibleColumn)}getViewLineData(e){return this._lines.getViewLineData(e)}getMinimapLinesRenderingData(e,t,i){let o=this._lines.getViewLinesData(e,t,i);return new CS(this.getTabSize(),o)}getAllOverviewRulerDecorations(e){let t=this.model.getOverviewRulerDecorations(this._editorId,nu(this._configuration.options)),i=new v4;for(let o of t){let s=o.options,r=s.overviewRuler;if(!r)continue;let a=r.position;if(a===0)continue;let l=r.getColor(e.value),c=this.coordinatesConverter.getViewLineNumberOfModelPosition(o.range.startLineNumber,o.range.startColumn),d=this.coordinatesConverter.getViewLineNumberOfModelPosition(o.range.endLineNumber,o.range.endColumn);i.accept(l,s.zIndex,c,d,a)}return i.asArray}_invalidateDecorationsColorCache(){let e=this.model.getOverviewRulerDecorations();for(let t of e){let i=t.options.overviewRuler;i?.invalidateCachedColor();let o=t.options.minimap;o?.invalidateCachedColor()}}getValueInRange(e,t){let i=this.coordinatesConverter.convertViewRangeToModelRange(e);return this.model.getValueInRange(i,t)}getValueLengthInRange(e,t){let i=this.coordinatesConverter.convertViewRangeToModelRange(e);return this.model.getValueLengthInRange(i,t)}modifyPosition(e,t){let i=this.coordinatesConverter.convertViewPositionToModelPosition(e),o=this.model.modifyPosition(i,t);return this.coordinatesConverter.convertModelPositionToViewPosition(o)}deduceModelPositionRelativeToViewPosition(e,t,i){let o=this.coordinatesConverter.convertViewPositionToModelPosition(e);this.model.getEOL().length===2&&(t<0?t-=i:t+=i);let r=this.model.getOffsetAt(o)+t;return this.model.getPositionAt(r)}getPlainTextToCopy(e,t,i){let o=i?`\r +`:this.model.getEOL();e=e.slice(0),e.sort(P.compareRangesUsingStarts);let s=!1,r=!1;for(let l of e)l.isEmpty()?s=!0:r=!0;if(!r){if(!t)return"";let l=e.map(d=>d.startLineNumber),c="";for(let d=0;d0&&l[d-1]===l[d]||(c+=this.model.getLineContent(l[d])+o);return c}if(s&&t){let l=[],c=0;for(let d of e){let h=d.startLineNumber;d.isEmpty()?h!==c&&l.push(this.model.getLineContent(h)):l.push(this.model.getValueInRange(d,i?2:0)),c=h}return l.length===1?l[0]:l}let a=[];for(let l of e)l.isEmpty()||a.push(this.model.getValueInRange(l,i?2:0));return a.length===1?a[0]:a}getRichTextToCopy(e,t){let i=this.model.getLanguageId();if(i===In||e.length!==1)return null;let o=e[0];if(o.isEmpty()){if(!t)return null;let d=o.startLineNumber;o=new P(d,this.model.getLineMinColumn(d),d,this.model.getLineMaxColumn(d))}let s=this._configuration.options.get(50),r=this._getColorMap(),l=/[:;\\\/<>]/.test(s.fontFamily)||s.fontFamily===Ao.fontFamily,c;return l?c=Ao.fontFamily:(c=s.fontFamily,c=c.replace(/"/g,"'"),/[,']/.test(c)||/[+ ]/.test(c)&&(c=`'${c}'`),c=`${c}, ${Ao.fontFamily}`),{mode:i,html:`
`+this._getHTMLToCopy(o,r)+"
"}}_getHTMLToCopy(e,t){let i=e.startLineNumber,o=e.startColumn,s=e.endLineNumber,r=e.endColumn,a=this.getTabSize(),l="";for(let c=i;c<=s;c++){let d=this.model.tokenization.getLineTokens(c),h=d.getLineContent(),u=c===i?o-1:0,f=c===s?r-1:h.length;h===""?l+="
":l+=Az(h,d.inflate(),t,u,f,a,Li)}return l}_getColorMap(){let e=Bt.getColorMap(),t=["#000000"];if(e)for(let i=1,o=e.length;ithis._cursor.setStates(o,e,t,i))}getCursorColumnSelectData(){return this._cursor.getCursorColumnSelectData()}getCursorAutoClosedCharacters(){return this._cursor.getAutoClosedCharacters()}setCursorColumnSelectData(e){this._cursor.setCursorColumnSelectData(e)}getPrevEditOperationType(){return this._cursor.getPrevEditOperationType()}setPrevEditOperationType(e){this._cursor.setPrevEditOperationType(e)}getSelection(){return this._cursor.getSelection()}getSelections(){return this._cursor.getSelections()}getPosition(){return this._cursor.getPrimaryCursorState().modelState.position}setSelections(e,t,i=0){this._withViewEventsCollector(o=>this._cursor.setSelections(o,e,t,i))}saveCursorState(){return this._cursor.saveState()}restoreCursorState(e){this._withViewEventsCollector(t=>this._cursor.restoreState(t,e))}_executeCursorEdit(e){if(this._cursor.context.cursorConfig.readOnly){this._eventDispatcher.emitOutgoingEvent(new Ck);return}this._withViewEventsCollector(e)}executeEdits(e,t,i){this._executeCursorEdit(o=>this._cursor.executeEdits(o,e,t,i))}startComposition(){this._executeCursorEdit(e=>this._cursor.startComposition(e))}endComposition(e){this._executeCursorEdit(t=>this._cursor.endComposition(t,e))}type(e,t){this._executeCursorEdit(i=>this._cursor.type(i,e,t))}compositionType(e,t,i,o,s){this._executeCursorEdit(r=>this._cursor.compositionType(r,e,t,i,o,s))}paste(e,t,i,o){this._executeCursorEdit(s=>this._cursor.paste(s,e,t,i,o))}cut(e){this._executeCursorEdit(t=>this._cursor.cut(t,e))}executeCommand(e,t){this._executeCursorEdit(i=>this._cursor.executeCommand(i,e,t))}executeCommands(e,t){this._executeCursorEdit(i=>this._cursor.executeCommands(i,e,t))}revealAllCursors(e,t,i=!1){this._withViewEventsCollector(o=>this._cursor.revealAll(o,e,i,0,t,0))}revealPrimaryCursor(e,t,i=!1){this._withViewEventsCollector(o=>this._cursor.revealPrimary(o,e,i,0,t,0))}revealTopMostCursor(e){let t=this._cursor.getTopMostViewPosition(),i=new P(t.lineNumber,t.column,t.lineNumber,t.column);this._withViewEventsCollector(o=>o.emitViewEvent(new Yc(e,!1,i,null,0,!0,0)))}revealBottomMostCursor(e){let t=this._cursor.getBottomMostViewPosition(),i=new P(t.lineNumber,t.column,t.lineNumber,t.column);this._withViewEventsCollector(o=>o.emitViewEvent(new Yc(e,!1,i,null,0,!0,0)))}revealRange(e,t,i,o,s){this._withViewEventsCollector(r=>r.emitViewEvent(new Yc(e,!1,i,null,o,t,s)))}changeWhitespace(e){this.viewLayout.changeWhitespace(e)&&(this._eventDispatcher.emitSingleViewEvent(new uk),this._eventDispatcher.emitOutgoingEvent(new _k))}_withViewEventsCollector(e){try{let t=this._eventDispatcher.beginEmitViewEvents();return e(t)}finally{this._eventDispatcher.endEmitViewEvents()}}batchEvents(e){this._withViewEventsCollector(()=>{e()})}normalizePosition(e,t){return this._lines.normalizePosition(e,t)}getLineIndentColumn(e){return this._lines.getLineIndentColumn(e)}},b4=class n{static create(e){let t=e._setTrackedRange(null,new P(1,1,1,1),1);return new n(e,1,!1,t,0)}get viewLineNumber(){return this._viewLineNumber}get isValid(){return this._isValid}get modelTrackedRange(){return this._modelTrackedRange}get startLineDelta(){return this._startLineDelta}constructor(e,t,i,o,s){this._model=e,this._viewLineNumber=t,this._isValid=i,this._modelTrackedRange=o,this._startLineDelta=s}dispose(){this._model._setTrackedRange(this._modelTrackedRange,null,1)}update(e,t){let i=e.coordinatesConverter.convertViewPositionToModelPosition(new U(t,e.getLineMinColumn(t))),o=e.model._setTrackedRange(this._modelTrackedRange,new P(i.lineNumber,i.column,i.lineNumber,i.column),1),s=e.viewLayout.getVerticalOffsetForLineNumber(t),r=e.viewLayout.getCurrentScrollTop();this._viewLineNumber=t,this._isValid=!0,this._modelTrackedRange=o,this._startLineDelta=r-s}invalidate(){this._isValid=!1}},v4=class{constructor(){this._asMap=Object.create(null),this.asArray=[]}accept(e,t,i,o,s){let r=this._asMap[e];if(r){let a=r.data,l=a[a.length-3],c=a[a.length-1];if(l===s&&c+1>=i){o>c&&(a[a.length-1]=o);return}a.push(s,i,o)}else{let a=new Wu(e,t,[s,i,o]);this._asMap[e]=a,this.asArray.push(a)}}},C4=class{constructor(){this.hiddenAreas=new Map,this.shouldRecompute=!1,this.ranges=[]}setHiddenAreas(e,t){let i=this.hiddenAreas.get(e);i&&Pz(i,t)||(this.hiddenAreas.set(e,t),this.shouldRecompute=!0)}getMergedRanges(){if(!this.shouldRecompute)return this.ranges;this.shouldRecompute=!1;let e=Array.from(this.hiddenAreas.values()).reduce((t,i)=>PZ(t,i),[]);return Pz(this.ranges,e)?this.ranges:(this.ranges=e,this.ranges)}};function PZ(n,e){let t=[],i=0,o=0;for(;i=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},Xc=function(n,e){return function(t,i){e(t,i,n)}},kf,Df=kf=class extends H{get isSimpleWidget(){return this._configuration.isSimpleWidget}get contextMenuId(){return this._configuration.contextMenuId}constructor(e,t,i,o,s,r,a,l,c,d,h,u){var f,g;super(),this.languageConfigurationService=h,this._deliveryQueue=I9(),this._contributions=this._register(new yL),this._onDidDispose=this._register(new B),this.onDidDispose=this._onDidDispose.event,this._onDidChangeModelContent=this._register(new B({deliveryQueue:this._deliveryQueue})),this.onDidChangeModelContent=this._onDidChangeModelContent.event,this._onDidChangeModelLanguage=this._register(new B({deliveryQueue:this._deliveryQueue})),this.onDidChangeModelLanguage=this._onDidChangeModelLanguage.event,this._onDidChangeModelLanguageConfiguration=this._register(new B({deliveryQueue:this._deliveryQueue})),this.onDidChangeModelLanguageConfiguration=this._onDidChangeModelLanguageConfiguration.event,this._onDidChangeModelOptions=this._register(new B({deliveryQueue:this._deliveryQueue})),this.onDidChangeModelOptions=this._onDidChangeModelOptions.event,this._onDidChangeModelDecorations=this._register(new B({deliveryQueue:this._deliveryQueue})),this.onDidChangeModelDecorations=this._onDidChangeModelDecorations.event,this._onDidChangeModelTokens=this._register(new B({deliveryQueue:this._deliveryQueue})),this.onDidChangeModelTokens=this._onDidChangeModelTokens.event,this._onDidChangeConfiguration=this._register(new B({deliveryQueue:this._deliveryQueue})),this.onDidChangeConfiguration=this._onDidChangeConfiguration.event,this._onWillChangeModel=this._register(new B({deliveryQueue:this._deliveryQueue})),this.onWillChangeModel=this._onWillChangeModel.event,this._onDidChangeModel=this._register(new B({deliveryQueue:this._deliveryQueue})),this.onDidChangeModel=this._onDidChangeModel.event,this._onDidChangeCursorPosition=this._register(new B({deliveryQueue:this._deliveryQueue})),this.onDidChangeCursorPosition=this._onDidChangeCursorPosition.event,this._onDidChangeCursorSelection=this._register(new B({deliveryQueue:this._deliveryQueue})),this.onDidChangeCursorSelection=this._onDidChangeCursorSelection.event,this._onDidAttemptReadOnlyEdit=this._register(new Xn(this._contributions,this._deliveryQueue)),this.onDidAttemptReadOnlyEdit=this._onDidAttemptReadOnlyEdit.event,this._onDidLayoutChange=this._register(new B({deliveryQueue:this._deliveryQueue})),this.onDidLayoutChange=this._onDidLayoutChange.event,this._editorTextFocus=this._register(new zk({deliveryQueue:this._deliveryQueue})),this.onDidFocusEditorText=this._editorTextFocus.onDidChangeToTrue,this.onDidBlurEditorText=this._editorTextFocus.onDidChangeToFalse,this._editorWidgetFocus=this._register(new zk({deliveryQueue:this._deliveryQueue})),this.onDidFocusEditorWidget=this._editorWidgetFocus.onDidChangeToTrue,this.onDidBlurEditorWidget=this._editorWidgetFocus.onDidChangeToFalse,this._onWillType=this._register(new Xn(this._contributions,this._deliveryQueue)),this.onWillType=this._onWillType.event,this._onDidType=this._register(new Xn(this._contributions,this._deliveryQueue)),this.onDidType=this._onDidType.event,this._onDidCompositionStart=this._register(new Xn(this._contributions,this._deliveryQueue)),this.onDidCompositionStart=this._onDidCompositionStart.event,this._onDidCompositionEnd=this._register(new Xn(this._contributions,this._deliveryQueue)),this.onDidCompositionEnd=this._onDidCompositionEnd.event,this._onDidPaste=this._register(new Xn(this._contributions,this._deliveryQueue)),this.onDidPaste=this._onDidPaste.event,this._onMouseUp=this._register(new Xn(this._contributions,this._deliveryQueue)),this.onMouseUp=this._onMouseUp.event,this._onMouseDown=this._register(new Xn(this._contributions,this._deliveryQueue)),this.onMouseDown=this._onMouseDown.event,this._onMouseDrag=this._register(new Xn(this._contributions,this._deliveryQueue)),this.onMouseDrag=this._onMouseDrag.event,this._onMouseDrop=this._register(new Xn(this._contributions,this._deliveryQueue)),this.onMouseDrop=this._onMouseDrop.event,this._onMouseDropCanceled=this._register(new Xn(this._contributions,this._deliveryQueue)),this.onMouseDropCanceled=this._onMouseDropCanceled.event,this._onDropIntoEditor=this._register(new Xn(this._contributions,this._deliveryQueue)),this.onDropIntoEditor=this._onDropIntoEditor.event,this._onContextMenu=this._register(new Xn(this._contributions,this._deliveryQueue)),this.onContextMenu=this._onContextMenu.event,this._onMouseMove=this._register(new Xn(this._contributions,this._deliveryQueue)),this.onMouseMove=this._onMouseMove.event,this._onMouseLeave=this._register(new Xn(this._contributions,this._deliveryQueue)),this.onMouseLeave=this._onMouseLeave.event,this._onMouseWheel=this._register(new Xn(this._contributions,this._deliveryQueue)),this.onMouseWheel=this._onMouseWheel.event,this._onKeyUp=this._register(new Xn(this._contributions,this._deliveryQueue)),this.onKeyUp=this._onKeyUp.event,this._onKeyDown=this._register(new Xn(this._contributions,this._deliveryQueue)),this.onKeyDown=this._onKeyDown.event,this._onDidContentSizeChange=this._register(new B({deliveryQueue:this._deliveryQueue})),this.onDidContentSizeChange=this._onDidContentSizeChange.event,this._onDidScrollChange=this._register(new B({deliveryQueue:this._deliveryQueue})),this.onDidScrollChange=this._onDidScrollChange.event,this._onDidChangeViewZones=this._register(new B({deliveryQueue:this._deliveryQueue})),this.onDidChangeViewZones=this._onDidChangeViewZones.event,this._onDidChangeHiddenAreas=this._register(new B({deliveryQueue:this._deliveryQueue})),this.onDidChangeHiddenAreas=this._onDidChangeHiddenAreas.event,this._actions=new Map,this._bannerDomNode=null,this._dropIntoEditorDecorations=this.createDecorationsCollection(),s.willCreateCodeEditor();let m={...t};this._domElement=e,this._overflowWidgetsDomNode=m.overflowWidgetsDomNode,delete m.overflowWidgetsDomNode,this._id=++FZ,this._decorationTypeKeysToIds={},this._decorationTypeSubtypes={},this._telemetryData=i.telemetryData,this._configuration=this._register(this._createConfiguration(i.isSimpleWidget||!1,(f=i.contextMenuId)!==null&&f!==void 0?f:i.isSimpleWidget?A.SimpleEditorContext:A.EditorContext,m,d)),this._register(this._configuration.onDidChange(w=>{this._onDidChangeConfiguration.fire(w);let y=this._configuration.options;if(w.hasChanged(145)){let x=y.get(145);this._onDidLayoutChange.fire(x)}})),this._contextKeyService=this._register(a.createScoped(this._domElement)),this._notificationService=c,this._codeEditorService=s,this._commandService=r,this._themeService=l,this._register(new S4(this,this._contextKeyService)),this._register(new x4(this,this._contextKeyService,u)),this._instantiationService=o.createChild(new sa([rt,this._contextKeyService])),this._modelData=null,this._focusTracker=new L4(e,this._overflowWidgetsDomNode),this._register(this._focusTracker.onChange(()=>{this._editorWidgetFocus.setValue(this._focusTracker.hasFocus())})),this._contentWidgets={},this._overlayWidgets={},this._glyphMarginWidgets={};let C;Array.isArray(i.contributions)?C=i.contributions:C=Hd.getEditorContributions(),this._contributions.initialize(this,C,this._instantiationService);for(let w of Hd.getEditorActions()){if(this._actions.has(w.id)){ut(new Error(`Cannot have two actions with the same id ${w.id}`));continue}let y=new ep(w.id,w.label,w.alias,w.metadata,(g=w.precondition)!==null&&g!==void 0?g:void 0,x=>this._instantiationService.invokeFunction(k=>Promise.resolve(w.runEditorCommand(k,this,x))),this._contextKeyService);this._actions.set(y.id,y)}let S=()=>!this._configuration.options.get(91)&&this._configuration.options.get(36).enabled;this._register(new Hw(this._domElement,{onDragOver:w=>{if(!S())return;let y=this.getTargetAtClientPoint(w.clientX,w.clientY);y?.position&&this.showDropIndicatorAt(y.position)},onDrop:async w=>{if(!S()||(this.removeDropIndicator(),!w.dataTransfer))return;let y=this.getTargetAtClientPoint(w.clientX,w.clientY);y?.position&&this._onDropIntoEditor.fire({position:y.position,event:w})},onDragLeave:()=>{this.removeDropIndicator()},onDragEnd:()=>{this.removeDropIndicator()}})),this._codeEditorService.addCodeEditor(this)}writeScreenReaderContent(e){var t;(t=this._modelData)===null||t===void 0||t.view.writeScreenReaderContent(e)}_createConfiguration(e,t,i,o){return new kS(e,t,i,this._domElement,o)}getId(){return this.getEditorType()+":"+this._id}getEditorType(){return Rc.ICodeEditor}dispose(){this._codeEditorService.removeCodeEditor(this),this._focusTracker.dispose(),this._actions.clear(),this._contentWidgets={},this._overlayWidgets={},this._removeDecorationTypes(),this._postDetachModelCleanup(this._detachModel()),this._onDidDispose.fire(),super.dispose()}invokeWithinContext(e){return this._instantiationService.invokeFunction(e)}updateOptions(e){this._configuration.updateOptions(e||{})}getOptions(){return this._configuration.options}getOption(e){return this._configuration.options.get(e)}getRawOptions(){return this._configuration.getRawOptions()}getOverflowWidgetsDomNode(){return this._overflowWidgetsDomNode}getConfiguredWordAtPosition(e){return this._modelData?uo.getWordAtPosition(this._modelData.model,this._configuration.options.get(131),this._configuration.options.get(130),e):null}getValue(e=null){if(!this._modelData)return"";let t=!!(e&&e.preserveBOM),i=0;return e&&e.lineEnding&&e.lineEnding===` +`?i=1:e&&e.lineEnding&&e.lineEnding===`\r +`&&(i=2),this._modelData.model.getValue(i,t)}setValue(e){this._modelData&&this._modelData.model.setValue(e)}getModel(){return this._modelData?this._modelData.model:null}setModel(e=null){var t;let i=e;if(this._modelData===null&&i===null||this._modelData&&this._modelData.model===i)return;let o={oldModelUrl:((t=this._modelData)===null||t===void 0?void 0:t.model.uri)||null,newModelUrl:i?.uri||null};this._onWillChangeModel.fire(o);let s=this.hasTextFocus(),r=this._detachModel();this._attachModel(i),s&&this.hasModel()&&this.focus(),this._removeDecorationTypes(),this._onDidChangeModel.fire(o),this._postDetachModelCleanup(r),this._contributionsDisposable=this._contributions.onAfterModelAttached()}_removeDecorationTypes(){if(this._decorationTypeKeysToIds={},this._decorationTypeSubtypes){for(let e in this._decorationTypeSubtypes){let t=this._decorationTypeSubtypes[e];for(let i in t)this._removeDecorationType(e+"-"+i)}this._decorationTypeSubtypes={}}}getVisibleRanges(){return this._modelData?this._modelData.viewModel.getVisibleRanges():[]}getVisibleRangesPlusViewportAboveBelow(){return this._modelData?this._modelData.viewModel.getVisibleRangesPlusViewportAboveBelow():[]}getWhitespaces(){return this._modelData?this._modelData.viewModel.viewLayout.getWhitespaces():[]}static _getVerticalOffsetAfterPosition(e,t,i,o){let s=e.model.validatePosition({lineNumber:t,column:i}),r=e.viewModel.coordinatesConverter.convertModelPositionToViewPosition(s);return e.viewModel.viewLayout.getVerticalOffsetAfterLineNumber(r.lineNumber,o)}getTopForLineNumber(e,t=!1){return this._modelData?kf._getVerticalOffsetForPosition(this._modelData,e,1,t):-1}getTopForPosition(e,t){return this._modelData?kf._getVerticalOffsetForPosition(this._modelData,e,t,!1):-1}static _getVerticalOffsetForPosition(e,t,i,o=!1){let s=e.model.validatePosition({lineNumber:t,column:i}),r=e.viewModel.coordinatesConverter.convertModelPositionToViewPosition(s);return e.viewModel.viewLayout.getVerticalOffsetForLineNumber(r.lineNumber,o)}getBottomForLineNumber(e,t=!1){return this._modelData?kf._getVerticalOffsetAfterPosition(this._modelData,e,1,t):-1}setHiddenAreas(e,t){var i;(i=this._modelData)===null||i===void 0||i.viewModel.setHiddenAreas(e.map(o=>P.lift(o)),t)}getVisibleColumnFromPosition(e){if(!this._modelData)return e.column;let t=this._modelData.model.validatePosition(e),i=this._modelData.model.getOptions().tabSize;return oi.visibleColumnFromColumn(this._modelData.model.getLineContent(t.lineNumber),t.column,i)+1}getPosition(){return this._modelData?this._modelData.viewModel.getPosition():null}setPosition(e,t="api"){if(this._modelData){if(!U.isIPosition(e))throw new Error("Invalid arguments");this._modelData.viewModel.setSelections(t,[{selectionStartLineNumber:e.lineNumber,selectionStartColumn:e.column,positionLineNumber:e.lineNumber,positionColumn:e.column}])}}_sendRevealRange(e,t,i,o){if(!this._modelData)return;if(!P.isIRange(e))throw new Error("Invalid arguments");let s=this._modelData.model.validateRange(e),r=this._modelData.viewModel.coordinatesConverter.convertModelRangeToViewRange(s);this._modelData.viewModel.revealRange("api",i,r,t,o)}revealLine(e,t=0){this._revealLine(e,0,t)}revealLineInCenter(e,t=0){this._revealLine(e,1,t)}revealLineInCenterIfOutsideViewport(e,t=0){this._revealLine(e,2,t)}revealLineNearTop(e,t=0){this._revealLine(e,5,t)}_revealLine(e,t,i){if(typeof e!="number")throw new Error("Invalid arguments");this._sendRevealRange(new P(e,1,e,1),t,!1,i)}revealPosition(e,t=0){this._revealPosition(e,0,!0,t)}revealPositionInCenter(e,t=0){this._revealPosition(e,1,!0,t)}revealPositionInCenterIfOutsideViewport(e,t=0){this._revealPosition(e,2,!0,t)}revealPositionNearTop(e,t=0){this._revealPosition(e,5,!0,t)}_revealPosition(e,t,i,o){if(!U.isIPosition(e))throw new Error("Invalid arguments");this._sendRevealRange(new P(e.lineNumber,e.column,e.lineNumber,e.column),t,i,o)}getSelection(){return this._modelData?this._modelData.viewModel.getSelection():null}getSelections(){return this._modelData?this._modelData.viewModel.getSelections():null}setSelection(e,t="api"){let i=nt.isISelection(e),o=P.isIRange(e);if(!i&&!o)throw new Error("Invalid arguments");if(i)this._setSelectionImpl(e,t);else if(o){let s={selectionStartLineNumber:e.startLineNumber,selectionStartColumn:e.startColumn,positionLineNumber:e.endLineNumber,positionColumn:e.endColumn};this._setSelectionImpl(s,t)}}_setSelectionImpl(e,t){if(!this._modelData)return;let i=new nt(e.selectionStartLineNumber,e.selectionStartColumn,e.positionLineNumber,e.positionColumn);this._modelData.viewModel.setSelections(t,[i])}revealLines(e,t,i=0){this._revealLines(e,t,0,i)}revealLinesInCenter(e,t,i=0){this._revealLines(e,t,1,i)}revealLinesInCenterIfOutsideViewport(e,t,i=0){this._revealLines(e,t,2,i)}revealLinesNearTop(e,t,i=0){this._revealLines(e,t,5,i)}_revealLines(e,t,i,o){if(typeof e!="number"||typeof t!="number")throw new Error("Invalid arguments");this._sendRevealRange(new P(e,1,t,1),i,!1,o)}revealRange(e,t=0,i=!1,o=!0){this._revealRange(e,i?1:0,o,t)}revealRangeInCenter(e,t=0){this._revealRange(e,1,!0,t)}revealRangeInCenterIfOutsideViewport(e,t=0){this._revealRange(e,2,!0,t)}revealRangeNearTop(e,t=0){this._revealRange(e,5,!0,t)}revealRangeNearTopIfOutsideViewport(e,t=0){this._revealRange(e,6,!0,t)}revealRangeAtTop(e,t=0){this._revealRange(e,3,!0,t)}_revealRange(e,t,i,o){if(!P.isIRange(e))throw new Error("Invalid arguments");this._sendRevealRange(P.lift(e),t,i,o)}setSelections(e,t="api",i=0){if(this._modelData){if(!e||e.length===0)throw new Error("Invalid arguments");for(let o=0,s=e.length;o0&&this._modelData.viewModel.restoreCursorState(i):this._modelData.viewModel.restoreCursorState([i]),this._contributions.restoreViewState(t.contributionsState||{});let o=this._modelData.viewModel.reduceRestoreState(t.viewState);this._modelData.view.restoreState(o)}}handleInitialized(){var e;(e=this._getViewModel())===null||e===void 0||e.visibleLinesStabilized()}getContribution(e){return this._contributions.get(e)}getActions(){return Array.from(this._actions.values())}getSupportedActions(){let e=this.getActions();return e=e.filter(t=>t.isSupported()),e}getAction(e){return this._actions.get(e)||null}trigger(e,t,i){switch(i=i||{},t){case"compositionStart":this._startComposition();return;case"compositionEnd":this._endComposition(e);return;case"type":{let s=i;this._type(e,s.text||"");return}case"replacePreviousChar":{let s=i;this._compositionType(e,s.text||"",s.replaceCharCnt||0,0,0);return}case"compositionType":{let s=i;this._compositionType(e,s.text||"",s.replacePrevCharCnt||0,s.replaceNextCharCnt||0,s.positionDelta||0);return}case"paste":{let s=i;this._paste(e,s.text||"",s.pasteOnNewLine||!1,s.multicursorText||null,s.mode||null,s.clipboardEvent);return}case"cut":this._cut(e);return}let o=this.getAction(t);if(o){Promise.resolve(o.run(i)).then(void 0,ut);return}this._modelData&&(this._triggerEditorCommand(e,t,i)||this._triggerCommand(t,i))}_triggerCommand(e,t){this._commandService.executeCommand(e,t)}_startComposition(){this._modelData&&(this._modelData.viewModel.startComposition(),this._onDidCompositionStart.fire())}_endComposition(e){this._modelData&&(this._modelData.viewModel.endComposition(e),this._onDidCompositionEnd.fire())}_type(e,t){!this._modelData||t.length===0||(e==="keyboard"&&this._onWillType.fire(t),this._modelData.viewModel.type(t,e),e==="keyboard"&&this._onDidType.fire(t))}_compositionType(e,t,i,o,s){this._modelData&&this._modelData.viewModel.compositionType(t,i,o,s,e)}_paste(e,t,i,o,s,r){if(!this._modelData)return;let a=this._modelData.viewModel,l=a.getSelection().getStartPosition();a.paste(t,i,o,e);let c=a.getSelection().getStartPosition();e==="keyboard"&&this._onDidPaste.fire({clipboardEvent:r,range:new P(l.lineNumber,l.column,c.lineNumber,c.column),languageId:s})}_cut(e){this._modelData&&this._modelData.viewModel.cut(e)}_triggerEditorCommand(e,t,i){let o=Hd.getEditorCommand(t);return o?(i=i||{},i.source=e,this._instantiationService.invokeFunction(s=>{Promise.resolve(o.runEditorCommand(s,this,i)).then(void 0,ut)}),!0):!1}_getViewModel(){return this._modelData?this._modelData.viewModel:null}pushUndoStop(){return!this._modelData||this._configuration.options.get(91)?!1:(this._modelData.model.pushStackElement(),!0)}popUndoStop(){return!this._modelData||this._configuration.options.get(91)?!1:(this._modelData.model.popStackElement(),!0)}executeEdits(e,t,i){if(!this._modelData||this._configuration.options.get(91))return!1;let o;return i?Array.isArray(i)?o=()=>i:o=i:o=()=>null,this._modelData.viewModel.executeEdits(e,t,o),!0}executeCommand(e,t){this._modelData&&this._modelData.viewModel.executeCommand(t,e)}executeCommands(e,t){this._modelData&&this._modelData.viewModel.executeCommands(t,e)}createDecorationsCollection(e){return new k4(this,e)}changeDecorations(e){return this._modelData?this._modelData.model.changeDecorations(e,this._id):null}getLineDecorations(e){return this._modelData?this._modelData.model.getLineDecorations(e,this._id,nu(this._configuration.options)):null}getDecorationsInRange(e){return this._modelData?this._modelData.model.getDecorationsInRange(e,this._id,nu(this._configuration.options)):null}deltaDecorations(e,t){return this._modelData?e.length===0&&t.length===0?e:this._modelData.model.deltaDecorations(e,t,this._id):[]}removeDecorations(e){!this._modelData||e.length===0||this._modelData.model.changeDecorations(t=>{t.deltaDecorations(e,[])})}removeDecorationsByType(e){let t=this._decorationTypeKeysToIds[e];t&&this.changeDecorations(i=>i.deltaDecorations(t,[])),this._decorationTypeKeysToIds.hasOwnProperty(e)&&delete this._decorationTypeKeysToIds[e],this._decorationTypeSubtypes.hasOwnProperty(e)&&delete this._decorationTypeSubtypes[e]}getLayoutInfo(){return this._configuration.options.get(145)}createOverviewRuler(e){return!this._modelData||!this._modelData.hasRealView?null:this._modelData.view.createOverviewRuler(e)}getContainerDomNode(){return this._domElement}getDomNode(){return!this._modelData||!this._modelData.hasRealView?null:this._modelData.view.domNode.domNode}delegateVerticalScrollbarPointerDown(e){!this._modelData||!this._modelData.hasRealView||this._modelData.view.delegateVerticalScrollbarPointerDown(e)}delegateScrollFromMouseWheelEvent(e){!this._modelData||!this._modelData.hasRealView||this._modelData.view.delegateScrollFromMouseWheelEvent(e)}layout(e,t=!1){this._configuration.observeContainer(e),t||this.render()}focus(){!this._modelData||!this._modelData.hasRealView||this._modelData.view.focus()}hasTextFocus(){return!this._modelData||!this._modelData.hasRealView?!1:this._modelData.view.isFocused()}hasWidgetFocus(){return this._focusTracker&&this._focusTracker.hasFocus()}addContentWidget(e){let t={widget:e,position:e.getPosition()};this._contentWidgets.hasOwnProperty(e.getId())&&console.warn("Overwriting a content widget with the same id:"+e.getId()),this._contentWidgets[e.getId()]=t,this._modelData&&this._modelData.hasRealView&&this._modelData.view.addContentWidget(t)}layoutContentWidget(e){let t=e.getId();if(this._contentWidgets.hasOwnProperty(t)){let i=this._contentWidgets[t];i.position=e.getPosition(),this._modelData&&this._modelData.hasRealView&&this._modelData.view.layoutContentWidget(i)}}removeContentWidget(e){let t=e.getId();if(this._contentWidgets.hasOwnProperty(t)){let i=this._contentWidgets[t];delete this._contentWidgets[t],this._modelData&&this._modelData.hasRealView&&this._modelData.view.removeContentWidget(i)}}addOverlayWidget(e){let t={widget:e,position:e.getPosition()};this._overlayWidgets.hasOwnProperty(e.getId())&&console.warn("Overwriting an overlay widget with the same id."),this._overlayWidgets[e.getId()]=t,this._modelData&&this._modelData.hasRealView&&this._modelData.view.addOverlayWidget(t)}layoutOverlayWidget(e){let t=e.getId();if(this._overlayWidgets.hasOwnProperty(t)){let i=this._overlayWidgets[t];i.position=e.getPosition(),this._modelData&&this._modelData.hasRealView&&this._modelData.view.layoutOverlayWidget(i)}}removeOverlayWidget(e){let t=e.getId();if(this._overlayWidgets.hasOwnProperty(t)){let i=this._overlayWidgets[t];delete this._overlayWidgets[t],this._modelData&&this._modelData.hasRealView&&this._modelData.view.removeOverlayWidget(i)}}addGlyphMarginWidget(e){let t={widget:e,position:e.getPosition()};this._glyphMarginWidgets.hasOwnProperty(e.getId())&&console.warn("Overwriting a glyph margin widget with the same id."),this._glyphMarginWidgets[e.getId()]=t,this._modelData&&this._modelData.hasRealView&&this._modelData.view.addGlyphMarginWidget(t)}layoutGlyphMarginWidget(e){let t=e.getId();if(this._glyphMarginWidgets.hasOwnProperty(t)){let i=this._glyphMarginWidgets[t];i.position=e.getPosition(),this._modelData&&this._modelData.hasRealView&&this._modelData.view.layoutGlyphMarginWidget(i)}}removeGlyphMarginWidget(e){let t=e.getId();if(this._glyphMarginWidgets.hasOwnProperty(t)){let i=this._glyphMarginWidgets[t];delete this._glyphMarginWidgets[t],this._modelData&&this._modelData.hasRealView&&this._modelData.view.removeGlyphMarginWidget(i)}}changeViewZones(e){!this._modelData||!this._modelData.hasRealView||this._modelData.view.change(e)}getTargetAtClientPoint(e,t){return!this._modelData||!this._modelData.hasRealView?null:this._modelData.view.getTargetAtClientPoint(e,t)}getScrolledVisiblePosition(e){if(!this._modelData||!this._modelData.hasRealView)return null;let t=this._modelData.model.validatePosition(e),i=this._configuration.options,o=i.get(145),s=kf._getVerticalOffsetForPosition(this._modelData,t.lineNumber,t.column)-this.getScrollTop(),r=this._modelData.view.getOffsetForColumn(t.lineNumber,t.column)+o.glyphMarginWidth+o.lineNumbersWidth+o.decorationsWidth-this.getScrollLeft();return{top:s,left:r,height:i.get(67)}}getOffsetForColumn(e,t){return!this._modelData||!this._modelData.hasRealView?-1:this._modelData.view.getOffsetForColumn(e,t)}render(e=!1){!this._modelData||!this._modelData.hasRealView||this._modelData.viewModel.batchEvents(()=>{this._modelData.view.render(!0,e)})}setAriaOptions(e){!this._modelData||!this._modelData.hasRealView||this._modelData.view.setAriaOptions(e)}applyFontInfo(e){Si(e,this._configuration.options.get(50))}setBanner(e,t){this._bannerDomNode&&this._domElement.contains(this._bannerDomNode)&&this._domElement.removeChild(this._bannerDomNode),this._bannerDomNode=e,this._configuration.setReservedHeight(e?t:0),this._bannerDomNode&&this._domElement.prepend(this._bannerDomNode)}_attachModel(e){if(!e){this._modelData=null;return}let t=[];this._domElement.setAttribute("data-mode-id",e.getLanguageId()),this._configuration.setIsDominatedByLongLines(e.isDominatedByLongLines()),this._configuration.setModelLineCount(e.getLineCount());let i=e.onBeforeAttached(),o=new Fk(this._id,this._configuration,e,wL.create(ge(this._domElement)),tk.create(this._configuration.options),a=>rn(ge(this._domElement),a),this.languageConfigurationService,this._themeService,i);t.push(e.onWillDispose(()=>this.setModel(null))),t.push(o.onEvent(a=>{switch(a.kind){case 0:this._onDidContentSizeChange.fire(a);break;case 1:this._editorTextFocus.setValue(a.hasFocus);break;case 2:this._onDidScrollChange.fire(a);break;case 3:this._onDidChangeViewZones.fire();break;case 4:this._onDidChangeHiddenAreas.fire();break;case 5:this._onDidAttemptReadOnlyEdit.fire();break;case 6:{if(a.reachedMaxCursorCount){let h=this.getOption(80),u=p("cursors.maximum","The number of cursors has been limited to {0}. Consider using [find and replace](https://code.visualstudio.com/docs/editor/codebasics#_find-and-replace) for larger changes or increase the editor multi cursor limit setting.",h);this._notificationService.prompt(Oz.Warning,u,[{label:"Find and Replace",run:()=>{this._commandService.executeCommand("editor.action.startFindReplaceAction")}},{label:p("goToSetting","Increase Multi Cursor Limit"),run:()=>{this._commandService.executeCommand("workbench.action.openSettings2",{query:"editor.multiCursorLimit"})}}])}let l=[];for(let h=0,u=a.selections.length;h{this._paste("keyboard",s,r,a,l)},type:s=>{this._type("keyboard",s)},compositionType:(s,r,a,l)=>{this._compositionType("keyboard",s,r,a,l)},startComposition:()=>{this._startComposition()},endComposition:()=>{this._endComposition("keyboard")},cut:()=>{this._cut("keyboard")}}:t={paste:(s,r,a,l)=>{let c={text:s,pasteOnNewLine:r,multicursorText:a,mode:l};this._commandService.executeCommand("paste",c)},type:s=>{let r={text:s};this._commandService.executeCommand("type",r)},compositionType:(s,r,a,l)=>{if(a||l){let c={text:s,replacePrevCharCnt:r,replaceNextCharCnt:a,positionDelta:l};this._commandService.executeCommand("compositionType",c)}else{let c={text:s,replaceCharCnt:r};this._commandService.executeCommand("replacePreviousChar",c)}},startComposition:()=>{this._commandService.executeCommand("compositionStart",{})},endComposition:()=>{this._commandService.executeCommand("compositionEnd",{})},cut:()=>{this._commandService.executeCommand("cut",{})}};let i=new qm(e.coordinatesConverter);return i.onKeyDown=s=>this._onKeyDown.fire(s),i.onKeyUp=s=>this._onKeyUp.fire(s),i.onContextMenu=s=>this._onContextMenu.fire(s),i.onMouseMove=s=>this._onMouseMove.fire(s),i.onMouseLeave=s=>this._onMouseLeave.fire(s),i.onMouseDown=s=>this._onMouseDown.fire(s),i.onMouseUp=s=>this._onMouseUp.fire(s),i.onMouseDrag=s=>this._onMouseDrag.fire(s),i.onMouseDrop=s=>this._onMouseDrop.fire(s),i.onMouseDropCanceled=s=>this._onMouseDropCanceled.fire(s),i.onMouseWheel=s=>this._onMouseWheel.fire(s),[new pL(t,this._configuration,this._themeService.getColorTheme(),e,i,this._overflowWidgetsDomNode,this._instantiationService),!0]}_postDetachModelCleanup(e){e?.removeAllDecorationsWithOwnerId(this._id)}_detachModel(){var e;if((e=this._contributionsDisposable)===null||e===void 0||e.dispose(),this._contributionsDisposable=void 0,!this._modelData)return null;let t=this._modelData.model,i=this._modelData.hasRealView?this._modelData.view.domNode.domNode:null;return this._modelData.dispose(),this._modelData=null,this._domElement.removeAttribute("data-mode-id"),i&&this._domElement.contains(i)&&this._domElement.removeChild(i),this._bannerDomNode&&this._domElement.contains(this._bannerDomNode)&&this._domElement.removeChild(this._bannerDomNode),t}_removeDecorationType(e){this._codeEditorService.removeDecorationType(e)}hasModel(){return this._modelData!==null}showDropIndicatorAt(e){let t=[{range:new P(e.lineNumber,e.column,e.lineNumber,e.column),options:kf.dropIntoEditorDecorationOptions}];this._dropIntoEditorDecorations.set(t),this.revealPosition(e,1)}removeDropIndicator(){this._dropIntoEditorDecorations.clear()}setContextValue(e,t){this._contextKeyService.createKey(e,t)}};Df.dropIntoEditorDecorationOptions=qi.register({description:"workbench-dnd-target",className:"dnd-target"});Df=kf=OZ([Xc(3,Ye),Xc(4,Zt),Xc(5,kn),Xc(6,rt),Xc(7,an),Xc(8,Ko),Xc(9,ao),Xc(10,yo),Xc(11,Tt)],Df);var FZ=0,y4=class{constructor(e,t,i,o,s,r){this.model=e,this.viewModel=t,this.view=i,this.hasRealView=o,this.listenersToRemove=s,this.attachedView=r}dispose(){li(this.listenersToRemove),this.model.onBeforeDetached(this.attachedView),this.hasRealView&&this.view.dispose(),this.viewModel.dispose()}},zk=class extends H{constructor(e){super(),this._emitterOptions=e,this._onDidChangeToTrue=this._register(new B(this._emitterOptions)),this.onDidChangeToTrue=this._onDidChangeToTrue.event,this._onDidChangeToFalse=this._register(new B(this._emitterOptions)),this.onDidChangeToFalse=this._onDidChangeToFalse.event,this._value=0}setValue(e){let t=e?2:1;this._value!==t&&(this._value=t,this._value===2?this._onDidChangeToTrue.fire():this._value===1&&this._onDidChangeToFalse.fire())}},Xn=class extends B{constructor(e,t){super({deliveryQueue:t}),this._contributions=e}fire(e){this._contributions.onBeforeInteractionEvent(),super.fire(e)}},S4=class extends H{constructor(e,t){super(),this._editor=e,t.createKey("editorId",e.getId()),this._editorSimpleInput=_e.editorSimpleInput.bindTo(t),this._editorFocus=_e.focus.bindTo(t),this._textInputFocus=_e.textInputFocus.bindTo(t),this._editorTextFocus=_e.editorTextFocus.bindTo(t),this._tabMovesFocus=_e.tabMovesFocus.bindTo(t),this._editorReadonly=_e.readOnly.bindTo(t),this._inDiffEditor=_e.inDiffEditor.bindTo(t),this._editorColumnSelection=_e.columnSelection.bindTo(t),this._hasMultipleSelections=_e.hasMultipleSelections.bindTo(t),this._hasNonEmptySelection=_e.hasNonEmptySelection.bindTo(t),this._canUndo=_e.canUndo.bindTo(t),this._canRedo=_e.canRedo.bindTo(t),this._register(this._editor.onDidChangeConfiguration(()=>this._updateFromConfig())),this._register(this._editor.onDidChangeCursorSelection(()=>this._updateFromSelection())),this._register(this._editor.onDidFocusEditorWidget(()=>this._updateFromFocus())),this._register(this._editor.onDidBlurEditorWidget(()=>this._updateFromFocus())),this._register(this._editor.onDidFocusEditorText(()=>this._updateFromFocus())),this._register(this._editor.onDidBlurEditorText(()=>this._updateFromFocus())),this._register(this._editor.onDidChangeModel(()=>this._updateFromModel())),this._register(this._editor.onDidChangeConfiguration(()=>this._updateFromModel())),this._register(wm.onDidChangeTabFocus(i=>this._tabMovesFocus.set(i))),this._updateFromConfig(),this._updateFromSelection(),this._updateFromFocus(),this._updateFromModel(),this._editorSimpleInput.set(this._editor.isSimpleWidget)}_updateFromConfig(){let e=this._editor.getOptions();this._tabMovesFocus.set(wm.getTabFocusMode()),this._editorReadonly.set(e.get(91)),this._inDiffEditor.set(e.get(61)),this._editorColumnSelection.set(e.get(22))}_updateFromSelection(){let e=this._editor.getSelections();e?(this._hasMultipleSelections.set(e.length>1),this._hasNonEmptySelection.set(e.some(t=>!t.isEmpty()))):(this._hasMultipleSelections.reset(),this._hasNonEmptySelection.reset())}_updateFromFocus(){this._editorFocus.set(this._editor.hasWidgetFocus()&&!this._editor.isSimpleWidget),this._editorTextFocus.set(this._editor.hasTextFocus()&&!this._editor.isSimpleWidget),this._textInputFocus.set(this._editor.hasTextFocus())}_updateFromModel(){let e=this._editor.getModel();this._canUndo.set(!!(e&&e.canUndo())),this._canRedo.set(!!(e&&e.canRedo()))}},x4=class extends H{constructor(e,t,i){super(),this._editor=e,this._contextKeyService=t,this._languageFeaturesService=i,this._langId=_e.languageId.bindTo(t),this._hasCompletionItemProvider=_e.hasCompletionItemProvider.bindTo(t),this._hasCodeActionsProvider=_e.hasCodeActionsProvider.bindTo(t),this._hasCodeLensProvider=_e.hasCodeLensProvider.bindTo(t),this._hasDefinitionProvider=_e.hasDefinitionProvider.bindTo(t),this._hasDeclarationProvider=_e.hasDeclarationProvider.bindTo(t),this._hasImplementationProvider=_e.hasImplementationProvider.bindTo(t),this._hasTypeDefinitionProvider=_e.hasTypeDefinitionProvider.bindTo(t),this._hasHoverProvider=_e.hasHoverProvider.bindTo(t),this._hasDocumentHighlightProvider=_e.hasDocumentHighlightProvider.bindTo(t),this._hasDocumentSymbolProvider=_e.hasDocumentSymbolProvider.bindTo(t),this._hasReferenceProvider=_e.hasReferenceProvider.bindTo(t),this._hasRenameProvider=_e.hasRenameProvider.bindTo(t),this._hasSignatureHelpProvider=_e.hasSignatureHelpProvider.bindTo(t),this._hasInlayHintsProvider=_e.hasInlayHintsProvider.bindTo(t),this._hasDocumentFormattingProvider=_e.hasDocumentFormattingProvider.bindTo(t),this._hasDocumentSelectionFormattingProvider=_e.hasDocumentSelectionFormattingProvider.bindTo(t),this._hasMultipleDocumentFormattingProvider=_e.hasMultipleDocumentFormattingProvider.bindTo(t),this._hasMultipleDocumentSelectionFormattingProvider=_e.hasMultipleDocumentSelectionFormattingProvider.bindTo(t),this._isInEmbeddedEditor=_e.isInEmbeddedEditor.bindTo(t);let o=()=>this._update();this._register(e.onDidChangeModel(o)),this._register(e.onDidChangeModelLanguage(o)),this._register(i.completionProvider.onDidChange(o)),this._register(i.codeActionProvider.onDidChange(o)),this._register(i.codeLensProvider.onDidChange(o)),this._register(i.definitionProvider.onDidChange(o)),this._register(i.declarationProvider.onDidChange(o)),this._register(i.implementationProvider.onDidChange(o)),this._register(i.typeDefinitionProvider.onDidChange(o)),this._register(i.hoverProvider.onDidChange(o)),this._register(i.documentHighlightProvider.onDidChange(o)),this._register(i.documentSymbolProvider.onDidChange(o)),this._register(i.referenceProvider.onDidChange(o)),this._register(i.renameProvider.onDidChange(o)),this._register(i.documentFormattingEditProvider.onDidChange(o)),this._register(i.documentRangeFormattingEditProvider.onDidChange(o)),this._register(i.signatureHelpProvider.onDidChange(o)),this._register(i.inlayHintsProvider.onDidChange(o)),o()}dispose(){super.dispose()}reset(){this._contextKeyService.bufferChangeEvents(()=>{this._langId.reset(),this._hasCompletionItemProvider.reset(),this._hasCodeActionsProvider.reset(),this._hasCodeLensProvider.reset(),this._hasDefinitionProvider.reset(),this._hasDeclarationProvider.reset(),this._hasImplementationProvider.reset(),this._hasTypeDefinitionProvider.reset(),this._hasHoverProvider.reset(),this._hasDocumentHighlightProvider.reset(),this._hasDocumentSymbolProvider.reset(),this._hasReferenceProvider.reset(),this._hasRenameProvider.reset(),this._hasDocumentFormattingProvider.reset(),this._hasDocumentSelectionFormattingProvider.reset(),this._hasSignatureHelpProvider.reset(),this._isInEmbeddedEditor.reset()})}_update(){let e=this._editor.getModel();if(!e){this.reset();return}this._contextKeyService.bufferChangeEvents(()=>{this._langId.set(e.getLanguageId()),this._hasCompletionItemProvider.set(this._languageFeaturesService.completionProvider.has(e)),this._hasCodeActionsProvider.set(this._languageFeaturesService.codeActionProvider.has(e)),this._hasCodeLensProvider.set(this._languageFeaturesService.codeLensProvider.has(e)),this._hasDefinitionProvider.set(this._languageFeaturesService.definitionProvider.has(e)),this._hasDeclarationProvider.set(this._languageFeaturesService.declarationProvider.has(e)),this._hasImplementationProvider.set(this._languageFeaturesService.implementationProvider.has(e)),this._hasTypeDefinitionProvider.set(this._languageFeaturesService.typeDefinitionProvider.has(e)),this._hasHoverProvider.set(this._languageFeaturesService.hoverProvider.has(e)),this._hasDocumentHighlightProvider.set(this._languageFeaturesService.documentHighlightProvider.has(e)),this._hasDocumentSymbolProvider.set(this._languageFeaturesService.documentSymbolProvider.has(e)),this._hasReferenceProvider.set(this._languageFeaturesService.referenceProvider.has(e)),this._hasRenameProvider.set(this._languageFeaturesService.renameProvider.has(e)),this._hasSignatureHelpProvider.set(this._languageFeaturesService.signatureHelpProvider.has(e)),this._hasInlayHintsProvider.set(this._languageFeaturesService.inlayHintsProvider.has(e)),this._hasDocumentFormattingProvider.set(this._languageFeaturesService.documentFormattingEditProvider.has(e)||this._languageFeaturesService.documentRangeFormattingEditProvider.has(e)),this._hasDocumentSelectionFormattingProvider.set(this._languageFeaturesService.documentRangeFormattingEditProvider.has(e)),this._hasMultipleDocumentFormattingProvider.set(this._languageFeaturesService.documentFormattingEditProvider.all(e).length+this._languageFeaturesService.documentRangeFormattingEditProvider.all(e).length>1),this._hasMultipleDocumentSelectionFormattingProvider.set(this._languageFeaturesService.documentRangeFormattingEditProvider.all(e).length>1),this._isInEmbeddedEditor.set(e.uri.scheme===Ze.walkThroughSnippet||e.uri.scheme===Ze.vscodeChatCodeBlock)})}},L4=class extends H{constructor(e,t){super(),this._onChange=this._register(new B),this.onChange=this._onChange.event,this._hadFocus=void 0,this._hasDomElementFocus=!1,this._domFocusTracker=this._register(Ic(e)),this._overflowWidgetsDomNodeHasFocus=!1,this._register(this._domFocusTracker.onDidFocus(()=>{this._hasDomElementFocus=!0,this._update()})),this._register(this._domFocusTracker.onDidBlur(()=>{this._hasDomElementFocus=!1,this._update()})),t&&(this._overflowWidgetsDomNode=this._register(Ic(t)),this._register(this._overflowWidgetsDomNode.onDidFocus(()=>{this._overflowWidgetsDomNodeHasFocus=!0,this._update()})),this._register(this._overflowWidgetsDomNode.onDidBlur(()=>{this._overflowWidgetsDomNodeHasFocus=!1,this._update()})))}_update(){let e=this._hasDomElementFocus||this._overflowWidgetsDomNodeHasFocus;this._hadFocus!==e&&(this._hadFocus=e,this._onChange.fire(void 0))}hasFocus(){var e;return(e=this._hadFocus)!==null&&e!==void 0?e:!1}},k4=class{get length(){return this._decorationIds.length}constructor(e,t){this._editor=e,this._decorationIds=[],this._isChangingDecorations=!1,Array.isArray(t)&&t.length>0&&this.set(t)}onDidChange(e,t,i){return this._editor.onDidChangeModelDecorations(o=>{this._isChangingDecorations||e.call(t,o)},i)}getRange(e){return!this._editor.hasModel()||e>=this._decorationIds.length?null:this._editor.getModel().getDecorationRange(this._decorationIds[e])}getRanges(){if(!this._editor.hasModel())return[];let e=this._editor.getModel(),t=[];for(let i of this._decorationIds){let o=e.getDecorationRange(i);o&&t.push(o)}return t}has(e){return this._decorationIds.includes(e.id)}clear(){this._decorationIds.length!==0&&this.set([])}set(e){try{this._isChangingDecorations=!0,this._editor.changeDecorations(t=>{this._decorationIds=t.deltaDecorations(this._decorationIds,e)})}finally{this._isChangingDecorations=!1}return this._decorationIds}append(e){let t=[];try{this._isChangingDecorations=!0,this._editor.changeDecorations(i=>{t=i.deltaDecorations([],e),this._decorationIds=this._decorationIds.concat(t)})}finally{this._isChangingDecorations=!1}return t}},BZ=encodeURIComponent("");function w4(n){return BZ+encodeURIComponent(n.toString())+WZ}var zZ=encodeURIComponent('');function HZ(n){return zZ+encodeURIComponent(n.toString())+VZ}Lo((n,e)=>{let t=n.getColor(Wa);t&&e.addRule(`.monaco-editor .squiggly-error { background: url("data:image/svg+xml,${w4(t)}") repeat-x bottom left; }`);let i=n.getColor(An);i&&e.addRule(`.monaco-editor .squiggly-warning { background: url("data:image/svg+xml,${w4(i)}") repeat-x bottom left; }`);let o=n.getColor(Vo);o&&e.addRule(`.monaco-editor .squiggly-info { background: url("data:image/svg+xml,${w4(o)}") repeat-x bottom left; }`);let s=n.getColor(Y8);s&&e.addRule(`.monaco-editor .squiggly-hint { background: url("data:image/svg+xml,${HZ(s)}") no-repeat bottom left; }`);let r=n.getColor(G6);r&&e.addRule(`.monaco-editor.showUnused .squiggly-inline-unnecessary { opacity: ${r.rgba.a}; }`)});_();v();b();lr();_();v();b();ke();er();_();v();b();ye();le();kr();Qi();var UZ=function(n,e,t,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},KZ=function(n,e){return function(t,i){e(t,i,n)}},Vk=class extends H{constructor(e){super(),this._themeService=e,this._onWillCreateCodeEditor=this._register(new B),this._onCodeEditorAdd=this._register(new B),this.onCodeEditorAdd=this._onCodeEditorAdd.event,this._onCodeEditorRemove=this._register(new B),this.onCodeEditorRemove=this._onCodeEditorRemove.event,this._onWillCreateDiffEditor=this._register(new B),this._onDiffEditorAdd=this._register(new B),this.onDiffEditorAdd=this._onDiffEditorAdd.event,this._onDiffEditorRemove=this._register(new B),this.onDiffEditorRemove=this._onDiffEditorRemove.event,this._decorationOptionProviders=new Map,this._codeEditorOpenHandlers=new Ii,this._modelProperties=new Map,this._codeEditors=Object.create(null),this._diffEditors=Object.create(null),this._globalStyleSheet=null}willCreateCodeEditor(){this._onWillCreateCodeEditor.fire()}addCodeEditor(e){this._codeEditors[e.getId()]=e,this._onCodeEditorAdd.fire(e)}removeCodeEditor(e){delete this._codeEditors[e.getId()]&&this._onCodeEditorRemove.fire(e)}listCodeEditors(){return Object.keys(this._codeEditors).map(e=>this._codeEditors[e])}willCreateDiffEditor(){this._onWillCreateDiffEditor.fire()}addDiffEditor(e){this._diffEditors[e.getId()]=e,this._onDiffEditorAdd.fire(e)}listDiffEditors(){return Object.keys(this._diffEditors).map(e=>this._diffEditors[e])}getFocusedCodeEditor(){let e=null,t=this.listCodeEditors();for(let i of t){if(i.hasTextFocus())return i;i.hasWidgetFocus()&&(e=i)}return e}removeDecorationType(e){let t=this._decorationOptionProviders.get(e);t&&(t.refCount--,t.refCount<=0&&(this._decorationOptionProviders.delete(e),t.dispose(),this.listCodeEditors().forEach(i=>i.removeDecorationsByType(e))))}setModelProperty(e,t,i){let o=e.toString(),s;this._modelProperties.has(o)?s=this._modelProperties.get(o):(s=new Map,this._modelProperties.set(o,s)),s.set(t,i)}getModelProperty(e,t){let i=e.toString();if(this._modelProperties.has(i))return this._modelProperties.get(i).get(t)}async openCodeEditor(e,t,i){for(let o of this._codeEditorOpenHandlers){let s=await o(e,t,i);if(s!==null)return s}return null}registerCodeEditorOpenHandler(e){let t=this._codeEditorOpenHandlers.unshift(e);return be(t)}};Vk=UZ([KZ(0,an)],Vk);Or();Oi();Ur();Qi();var $Z=function(n,e,t,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},Fz=function(n,e){return function(t,i){e(t,i,n)}},gv=class extends Vk{constructor(e,t){super(t),this._register(this.onCodeEditorAdd(()=>this._checkContextKey())),this._register(this.onCodeEditorRemove(()=>this._checkContextKey())),this._editorIsOpen=e.createKey("editorIsOpen",!1),this._activeCodeEditor=null,this._register(this.registerCodeEditorOpenHandler(async(i,o,s)=>o?this.doOpenEditor(o,i):null))}_checkContextKey(){let e=!1;for(let t of this.listCodeEditors())if(!t.isSimpleWidget){e=!0;break}this._editorIsOpen.set(e)}setActiveCodeEditor(e){this._activeCodeEditor=e}getActiveCodeEditor(){return this._activeCodeEditor}doOpenEditor(e,t){if(!this.findModel(e,t.resource)){if(t.resource){let s=t.resource.scheme;if(s===Ze.http||s===Ze.https)return Yw(t.resource.toString()),e}return null}let o=t.options?t.options.selection:null;if(o)if(typeof o.endLineNumber=="number"&&typeof o.endColumn=="number")e.setSelection(o),e.revealRangeInCenter(o,1);else{let s={lineNumber:o.startLineNumber,column:o.startColumn};e.setPosition(s),e.revealPositionInCenter(s,1)}return e}findModel(e,t){let i=e.getModel();return i&&i.uri.toString()!==t.toString()?null:i}};gv=$Z([Fz(0,rt),Fz(1,an)],gv);_t(Zt,gv,0);_();v();b();ke();vo();wt();ye();Or();Ur();_();v();b();qe();var ss=De("layoutService");var Bz=function(n,e,t,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},Wz=function(n,e){return function(t,i){e(t,i,n)}},Hk=class{get mainContainer(){var e,t;return(t=(e=lg(this._codeEditorService.listCodeEditors()))===null||e===void 0?void 0:e.getContainerDomNode())!==null&&t!==void 0?t:gt.document.body}get activeContainer(){var e,t;let i=(e=this._codeEditorService.getFocusedCodeEditor())!==null&&e!==void 0?e:this._codeEditorService.getActiveCodeEditor();return(t=i?.getContainerDomNode())!==null&&t!==void 0?t:this.mainContainer}get mainContainerDimension(){return zg(this.mainContainer)}get activeContainerDimension(){return zg(this.activeContainer)}get containers(){return $1(this._codeEditorService.listCodeEditors().map(e=>e.getContainerDomNode()))}getContainer(){return this.activeContainer}whenContainerStylesLoaded(){}focus(){var e;(e=this._codeEditorService.getFocusedCodeEditor())===null||e===void 0||e.focus()}constructor(e){this._codeEditorService=e,this.onDidLayoutMainContainer=ie.None,this.onDidLayoutActiveContainer=ie.None,this.onDidLayoutContainer=ie.None,this.onDidChangeActiveContainer=ie.None,this.onDidAddContainer=ie.None,this.mainContainerOffset={top:0,quickPickTop:0},this.activeContainerOffset={top:0,quickPickTop:0}}};Hk=Bz([Wz(0,Zt)],Hk);var Uk=class extends Hk{get mainContainer(){return this._container}constructor(e,t){super(t),this._container=e}};Uk=Bz([Wz(1,Zt)],Uk);_t(ss,Hk,1);_();v();b();xt();le();er();Ge();_();v();b();qe();var Kk=De("dialogService");Ur();ZL();var qZ=function(n,e,t,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},zz=function(n,e){return function(t,i){e(t,i,n)}},_p=!1;function $k(n){return n.scheme===Ze.file?n.fsPath:n.path}var Vz=0,bp=class{constructor(e,t,i,o,s,r,a){this.id=++Vz,this.type=0,this.actual=e,this.label=e.label,this.confirmBeforeUndo=e.confirmBeforeUndo||!1,this.resourceLabel=t,this.strResource=i,this.resourceLabels=[this.resourceLabel],this.strResources=[this.strResource],this.groupId=o,this.groupOrder=s,this.sourceId=r,this.sourceOrder=a,this.isValid=!0}setValid(e){this.isValid=e}toString(){return`[id:${this.id}] [group:${this.groupId}] [${this.isValid?" VALID":"INVALID"}] ${this.actual.constructor.name} - ${this.actual}`}},qk=class{constructor(e,t){this.resourceLabel=e,this.reason=t}},jk=class{constructor(){this.elements=new Map}createMessage(){let e=[],t=[];for(let[,o]of this.elements)(o.reason===0?e:t).push(o.resourceLabel);let i=[];return e.length>0&&i.push(p({key:"externalRemoval",comment:["{0} is a list of filenames"]},"The following files have been closed and modified on disk: {0}.",e.join(", "))),t.length>0&&i.push(p({key:"noParallelUniverses",comment:["{0} is a list of filenames"]},"The following files have been modified in an incompatible way: {0}.",t.join(", "))),i.join(` +`)}get size(){return this.elements.size}has(e){return this.elements.has(e)}set(e,t){this.elements.set(e,t)}delete(e){return this.elements.delete(e)}},D4=class{constructor(e,t,i,o,s,r,a){this.id=++Vz,this.type=1,this.actual=e,this.label=e.label,this.confirmBeforeUndo=e.confirmBeforeUndo||!1,this.resourceLabels=t,this.strResources=i,this.groupId=o,this.groupOrder=s,this.sourceId=r,this.sourceOrder=a,this.removedResources=null,this.invalidatedResources=null}canSplit(){return typeof this.actual.split=="function"}removeResource(e,t,i){this.removedResources||(this.removedResources=new jk),this.removedResources.has(t)||this.removedResources.set(t,new qk(e,i))}setValid(e,t,i){i?this.invalidatedResources&&(this.invalidatedResources.delete(t),this.invalidatedResources.size===0&&(this.invalidatedResources=null)):(this.invalidatedResources||(this.invalidatedResources=new jk),this.invalidatedResources.has(t)||this.invalidatedResources.set(t,new qk(e,0)))}toString(){return`[id:${this.id}] [group:${this.groupId}] [${this.invalidatedResources?"INVALID":" VALID"}] ${this.actual.constructor.name} - ${this.actual}`}},Gk=class{constructor(e,t){this.resourceLabel=e,this.strResource=t,this._past=[],this._future=[],this.locked=!1,this.versionId=1}dispose(){for(let e of this._past)e.type===1&&e.removeResource(this.resourceLabel,this.strResource,0);for(let e of this._future)e.type===1&&e.removeResource(this.resourceLabel,this.strResource,0);this.versionId++}toString(){let e=[];e.push(`* ${this.strResource}:`);for(let t=0;t=0;t--)e.push(` * [REDO] ${this._future[t]}`);return e.join(` +`)}flushAllElements(){this._past=[],this._future=[],this.versionId++}_setElementValidFlag(e,t){e.type===1?e.setValid(this.resourceLabel,this.strResource,t):e.setValid(t)}setElementsValidFlag(e,t){for(let i of this._past)t(i.actual)&&this._setElementValidFlag(i,e);for(let i of this._future)t(i.actual)&&this._setElementValidFlag(i,e)}pushElement(e){for(let t of this._future)t.type===1&&t.removeResource(this.resourceLabel,this.strResource,1);this._future=[],this._past.push(e),this.versionId++}createSnapshot(e){let t=[];for(let i=0,o=this._past.length;i=0;i--)t.push(this._future[i].id);return new nv(e,t)}restoreSnapshot(e){let t=e.elements.length,i=!0,o=0,s=-1;for(let a=0,l=this._past.length;a=t||c.id!==e.elements[o])&&(i=!1,s=0),!i&&c.type===1&&c.removeResource(this.resourceLabel,this.strResource,0)}let r=-1;for(let a=this._future.length-1;a>=0;a--,o++){let l=this._future[a];i&&(o>=t||l.id!==e.elements[o])&&(i=!1,r=a),!i&&l.type===1&&l.removeResource(this.resourceLabel,this.strResource,0)}s!==-1&&(this._past=this._past.slice(0,s)),r!==-1&&(this._future=this._future.slice(r+1)),this.versionId++}getElements(){let e=[],t=[];for(let i of this._past)e.push(i.actual);for(let i of this._future)t.push(i.actual);return{past:e,future:t}}getClosestPastElement(){return this._past.length===0?null:this._past[this._past.length-1]}getSecondClosestPastElement(){return this._past.length<2?null:this._past[this._past.length-2]}getClosestFutureElement(){return this._future.length===0?null:this._future[this._future.length-1]}hasPastElements(){return this._past.length>0}hasFutureElements(){return this._future.length>0}splitPastWorkspaceElement(e,t){for(let i=this._past.length-1;i>=0;i--)if(this._past[i]===e){t.has(this.strResource)?this._past[i]=t.get(this.strResource):this._past.splice(i,1);break}this.versionId++}splitFutureWorkspaceElement(e,t){for(let i=this._future.length-1;i>=0;i--)if(this._future[i]===e){t.has(this.strResource)?this._future[i]=t.get(this.strResource):this._future.splice(i,1);break}this.versionId++}moveBackward(e){this._past.pop(),this._future.push(e),this.versionId++}moveForward(e){this._future.pop(),this._past.push(e),this.versionId++}},mv=class{constructor(e){this.editStacks=e,this._versionIds=[];for(let t=0,i=this.editStacks.length;tt.sourceOrder)&&(t=r,i=o)}return[t,i]}canUndo(e){if(e instanceof Ya){let[,i]=this._findClosestUndoElementWithSource(e.id);return!!i}let t=this.getUriComparisonKey(e);return this._editStacks.has(t)?this._editStacks.get(t).hasPastElements():!1}_onError(e,t){ut(e);for(let i of t.strResources)this.removeElements(i);this._notificationService.error(e)}_acquireLocks(e){for(let t of e.editStacks)if(t.locked)throw new Error("Cannot acquire edit stack lock");for(let t of e.editStacks)t.locked=!0;return()=>{for(let t of e.editStacks)t.locked=!1}}_safeInvokeWithLocks(e,t,i,o,s){let r=this._acquireLocks(i),a;try{a=t()}catch(l){return r(),o.dispose(),this._onError(l,e)}return a?a.then(()=>(r(),o.dispose(),s()),l=>(r(),o.dispose(),this._onError(l,e))):(r(),o.dispose(),s())}async _invokeWorkspacePrepare(e){if(typeof e.actual.prepareUndoRedo>"u")return H.None;let t=e.actual.prepareUndoRedo();return typeof t>"u"?H.None:t}_invokeResourcePrepare(e,t){if(e.actual.type!==1||typeof e.actual.prepareUndoRedo>"u")return t(H.None);let i=e.actual.prepareUndoRedo();return i?aC(i)?t(i):i.then(o=>t(o)):t(H.None)}_getAffectedEditStacks(e){let t=[];for(let i of e.strResources)t.push(this._editStacks.get(i)||Hz);return new mv(t)}_tryToSplitAndUndo(e,t,i,o){if(t.canSplit())return this._splitPastWorkspaceElement(t,i),this._notificationService.warn(o),new vp(this._undo(e,0,!0));for(let s of t.strResources)this.removeElements(s);return this._notificationService.warn(o),new vp}_checkWorkspaceUndo(e,t,i,o){if(t.removedResources)return this._tryToSplitAndUndo(e,t,t.removedResources,p({key:"cannotWorkspaceUndo",comment:["{0} is a label for an operation. {1} is another message."]},"Could not undo '{0}' across all files. {1}",t.label,t.removedResources.createMessage()));if(o&&t.invalidatedResources)return this._tryToSplitAndUndo(e,t,t.invalidatedResources,p({key:"cannotWorkspaceUndo",comment:["{0} is a label for an operation. {1} is another message."]},"Could not undo '{0}' across all files. {1}",t.label,t.invalidatedResources.createMessage()));let s=[];for(let a of i.editStacks)a.getClosestPastElement()!==t&&s.push(a.resourceLabel);if(s.length>0)return this._tryToSplitAndUndo(e,t,null,p({key:"cannotWorkspaceUndoDueToChanges",comment:["{0} is a label for an operation. {1} is a list of filenames."]},"Could not undo '{0}' across all files because changes were made to {1}",t.label,s.join(", ")));let r=[];for(let a of i.editStacks)a.locked&&r.push(a.resourceLabel);return r.length>0?this._tryToSplitAndUndo(e,t,null,p({key:"cannotWorkspaceUndoDueToInProgressUndoRedo",comment:["{0} is a label for an operation. {1} is a list of filenames."]},"Could not undo '{0}' across all files because there is already an undo or redo operation running on {1}",t.label,r.join(", "))):i.isValid()?null:this._tryToSplitAndUndo(e,t,null,p({key:"cannotWorkspaceUndoDueToInMeantimeUndoRedo",comment:["{0} is a label for an operation. {1} is a list of filenames."]},"Could not undo '{0}' across all files because an undo or redo operation occurred in the meantime",t.label))}_workspaceUndo(e,t,i){let o=this._getAffectedEditStacks(t),s=this._checkWorkspaceUndo(e,t,o,!1);return s?s.returnValue:this._confirmAndExecuteWorkspaceUndo(e,t,o,i)}_isPartOfUndoGroup(e){if(!e.groupId)return!1;for(let[,t]of this._editStacks){let i=t.getClosestPastElement();if(i){if(i===e){let o=t.getSecondClosestPastElement();if(o&&o.groupId===e.groupId)return!0}if(i.groupId===e.groupId)return!0}}return!1}async _confirmAndExecuteWorkspaceUndo(e,t,i,o){if(t.canSplit()&&!this._isPartOfUndoGroup(t)){let a;(function(d){d[d.All=0]="All",d[d.This=1]="This",d[d.Cancel=2]="Cancel"})(a||(a={}));let{result:l}=await this._dialogService.prompt({type:Ci.Info,message:p("confirmWorkspace","Would you like to undo '{0}' across all files?",t.label),buttons:[{label:p({key:"ok",comment:["{0} denotes a number that is > 1, && denotes a mnemonic"]},"&&Undo in {0} Files",i.editStacks.length),run:()=>a.All},{label:p({key:"nok",comment:["&& denotes a mnemonic"]},"Undo this &&File"),run:()=>a.This}],cancelButton:{run:()=>a.Cancel}});if(l===a.Cancel)return;if(l===a.This)return this._splitPastWorkspaceElement(t,null),this._undo(e,0,!0);let c=this._checkWorkspaceUndo(e,t,i,!1);if(c)return c.returnValue;o=!0}let s;try{s=await this._invokeWorkspacePrepare(t)}catch(a){return this._onError(a,t)}let r=this._checkWorkspaceUndo(e,t,i,!0);if(r)return s.dispose(),r.returnValue;for(let a of i.editStacks)a.moveBackward(t);return this._safeInvokeWithLocks(t,()=>t.actual.undo(),i,s,()=>this._continueUndoInGroup(t.groupId,o))}_resourceUndo(e,t,i){if(!t.isValid){e.flushAllElements();return}if(e.locked){let o=p({key:"cannotResourceUndoDueToInProgressUndoRedo",comment:["{0} is a label for an operation."]},"Could not undo '{0}' because there is already an undo or redo operation running.",t.label);this._notificationService.warn(o);return}return this._invokeResourcePrepare(t,o=>(e.moveBackward(t),this._safeInvokeWithLocks(t,()=>t.actual.undo(),new mv([e]),o,()=>this._continueUndoInGroup(t.groupId,i))))}_findClosestUndoElementInGroup(e){if(!e)return[null,null];let t=null,i=null;for(let[o,s]of this._editStacks){let r=s.getClosestPastElement();r&&r.groupId===e&&(!t||r.groupOrder>t.groupOrder)&&(t=r,i=o)}return[t,i]}_continueUndoInGroup(e,t){if(!e)return;let[,i]=this._findClosestUndoElementInGroup(e);if(i)return this._undo(i,0,t)}undo(e){if(e instanceof Ya){let[,t]=this._findClosestUndoElementWithSource(e.id);return t?this._undo(t,e.id,!1):void 0}return typeof e=="string"?this._undo(e,0,!1):this._undo(this.getUriComparisonKey(e),0,!1)}_undo(e,t=0,i){if(!this._editStacks.has(e))return;let o=this._editStacks.get(e),s=o.getClosestPastElement();if(!s)return;if(s.groupId){let[a,l]=this._findClosestUndoElementInGroup(s.groupId);if(s!==a&&l)return this._undo(l,t,i)}if((s.sourceId!==t||s.confirmBeforeUndo)&&!i)return this._confirmAndContinueUndo(e,t,s);try{return s.type===1?this._workspaceUndo(e,s,i):this._resourceUndo(o,s,i)}finally{_p&&this._print("undo")}}async _confirmAndContinueUndo(e,t,i){if((await this._dialogService.confirm({message:p("confirmDifferentSource","Would you like to undo '{0}'?",i.label),primaryButton:p({key:"confirmDifferentSource.yes",comment:["&& denotes a mnemonic"]},"&&Yes"),cancelButton:p("confirmDifferentSource.no","No")})).confirmed)return this._undo(e,t,!0)}_findClosestRedoElementWithSource(e){if(!e)return[null,null];let t=null,i=null;for(let[o,s]of this._editStacks){let r=s.getClosestFutureElement();r&&r.sourceId===e&&(!t||r.sourceOrder0)return this._tryToSplitAndRedo(e,t,null,p({key:"cannotWorkspaceRedoDueToChanges",comment:["{0} is a label for an operation. {1} is a list of filenames."]},"Could not redo '{0}' across all files because changes were made to {1}",t.label,s.join(", ")));let r=[];for(let a of i.editStacks)a.locked&&r.push(a.resourceLabel);return r.length>0?this._tryToSplitAndRedo(e,t,null,p({key:"cannotWorkspaceRedoDueToInProgressUndoRedo",comment:["{0} is a label for an operation. {1} is a list of filenames."]},"Could not redo '{0}' across all files because there is already an undo or redo operation running on {1}",t.label,r.join(", "))):i.isValid()?null:this._tryToSplitAndRedo(e,t,null,p({key:"cannotWorkspaceRedoDueToInMeantimeUndoRedo",comment:["{0} is a label for an operation. {1} is a list of filenames."]},"Could not redo '{0}' across all files because an undo or redo operation occurred in the meantime",t.label))}_workspaceRedo(e,t){let i=this._getAffectedEditStacks(t),o=this._checkWorkspaceRedo(e,t,i,!1);return o?o.returnValue:this._executeWorkspaceRedo(e,t,i)}async _executeWorkspaceRedo(e,t,i){let o;try{o=await this._invokeWorkspacePrepare(t)}catch(r){return this._onError(r,t)}let s=this._checkWorkspaceRedo(e,t,i,!0);if(s)return o.dispose(),s.returnValue;for(let r of i.editStacks)r.moveForward(t);return this._safeInvokeWithLocks(t,()=>t.actual.redo(),i,o,()=>this._continueRedoInGroup(t.groupId))}_resourceRedo(e,t){if(!t.isValid){e.flushAllElements();return}if(e.locked){let i=p({key:"cannotResourceRedoDueToInProgressUndoRedo",comment:["{0} is a label for an operation."]},"Could not redo '{0}' because there is already an undo or redo operation running.",t.label);this._notificationService.warn(i);return}return this._invokeResourcePrepare(t,i=>(e.moveForward(t),this._safeInvokeWithLocks(t,()=>t.actual.redo(),new mv([e]),i,()=>this._continueRedoInGroup(t.groupId))))}_findClosestRedoElementInGroup(e){if(!e)return[null,null];let t=null,i=null;for(let[o,s]of this._editStacks){let r=s.getClosestFutureElement();r&&r.groupId===e&&(!t||r.groupOrder0?t.charCodeAt(0):0)}acceptEdit(e,t,i,o,s){this._acceptDeleteRange(e),this._acceptInsertText(new U(e.startLineNumber,e.startColumn),t,i,o,s),this._updateEndLineNumber()}_acceptDeleteRange(e){if(e.startLineNumber===e.endLineNumber&&e.startColumn===e.endColumn)return;let t=e.startLineNumber-this._startLineNumber,i=e.endLineNumber-this._startLineNumber;if(i<0){let s=i-t;this._startLineNumber-=s;return}let o=this._tokens.getMaxDeltaLine();if(!(t>=o+1)){if(t<0&&i>=o+1){this._startLineNumber=0,this._tokens.clear();return}if(t<0){let s=-t;this._startLineNumber-=s,this._tokens.acceptDeleteRange(e.startColumn-1,0,0,i,e.endColumn-1)}else this._tokens.acceptDeleteRange(0,t,e.startColumn-1,i,e.endColumn-1)}}_acceptInsertText(e,t,i,o,s){if(t===0&&i===0)return;let r=e.lineNumber-this._startLineNumber;if(r<0){this._startLineNumber+=t;return}let a=this._tokens.getMaxDeltaLine();r>=a+1||this._tokens.acceptInsertText(r,e.column-1,t,i,o,s)}},M4=class n{constructor(e){this._tokens=e,this._tokenCount=e.length/4}toString(e){let t=[];for(let i=0;ie)i=o-1;else{let r=o;for(;r>t&&this._getDeltaLine(r-1)===e;)r--;let a=o;for(;ae||u===e&&g>=t)&&(ue||g===e&&C>=t){if(gs?m-=s-i:m=i;else if(f===t&&g===i)if(f===o&&m>s)m-=s-i;else{d=!0;continue}else if(fs)f=t,g=i,m=g+(m-s);else{d=!0;continue}else if(f>o){if(l===0&&!d){c=a;break}f-=l}else if(f===o&&g>=s)e&&f===0&&(g+=e,m+=e),f-=l,g-=s-i,m-=s-i;else throw new Error("Not possible!");let S=4*c;r[S]=f,r[S+1]=g,r[S+2]=m,r[S+3]=C,c++}this._tokenCount=c}acceptInsertText(e,t,i,o,s,r){let a=i===0&&o===1&&(r>=48&&r<=57||r>=65&&r<=90||r>=97&&r<=122),l=this._tokens,c=this._tokenCount;for(let d=0;d=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},R4=function(n,e){return function(t,i){e(t,i,n)}},eD=class{constructor(e,t,i,o){this._legend=e,this._themeService=t,this._languageService=i,this._logService=o,this._hasWarnedOverlappingTokens=!1,this._hasWarnedInvalidLengthTokens=!1,this._hasWarnedInvalidEditStart=!1,this._hashTable=new tD}getMetadata(e,t,i){let o=this._languageService.languageIdCodec.encodeLanguageId(i),s=this._hashTable.get(e,t,o),r;if(s)r=s.metadata,this._logService.getLevel()===Dn.Trace&&this._logService.trace(`SemanticTokensProviderStyling [CACHED] ${e} / ${t}: foreground ${mn.getForeground(r)}, fontStyle ${mn.getFontStyle(r).toString(2)}`);else{let a=this._legend.tokenTypes[e],l=[];if(a){let c=t;for(let h=0;c>0&&h>1;c>0&&this._logService.getLevel()===Dn.Trace&&(this._logService.trace(`SemanticTokensProviderStyling: unknown token modifier index: ${t.toString(2)} for legend: ${JSON.stringify(this._legend.tokenModifiers)}`),l.push("not-in-legend"));let d=this._themeService.getColorTheme().getTokenStyleMetadata(a,l,i);if(typeof d>"u")r=2147483647;else{if(r=0,typeof d.italic<"u"){let h=(d.italic?1:0)<<11;r|=h|1}if(typeof d.bold<"u"){let h=(d.bold?2:0)<<11;r|=h|2}if(typeof d.underline<"u"){let h=(d.underline?4:0)<<11;r|=h|4}if(typeof d.strikethrough<"u"){let h=(d.strikethrough?8:0)<<11;r|=h|8}if(d.foreground){let h=d.foreground<<15;r|=h|16}r===0&&(r=2147483647)}}else this._logService.getLevel()===Dn.Trace&&this._logService.trace(`SemanticTokensProviderStyling: unknown token type index: ${e} for legend: ${JSON.stringify(this._legend.tokenTypes)}`),r=2147483647,a="not-in-legend";this._hashTable.add(e,t,o,r),this._logService.getLevel()===Dn.Trace&&this._logService.trace(`SemanticTokensProviderStyling ${e} (${a}) / ${t} (${l.join(" ")}): foreground ${mn.getForeground(r)}, fontStyle ${mn.getFontStyle(r).toString(2)}`)}return r}warnOverlappingSemanticTokens(e,t){this._hasWarnedOverlappingTokens||(this._hasWarnedOverlappingTokens=!0,this._logService.warn(`Overlapping semantic tokens detected at lineNumber ${e}, column ${t}`))}warnInvalidLengthSemanticTokens(e,t){this._hasWarnedInvalidLengthTokens||(this._hasWarnedInvalidLengthTokens=!0,this._logService.warn(`Semantic token with invalid length detected at lineNumber ${e}, column ${t}`))}warnInvalidEditStart(e,t,i,o,s){this._hasWarnedInvalidEditStart||(this._hasWarnedInvalidEditStart=!0,this._logService.warn(`Invalid semantic tokens edit detected (previousResultId: ${e}, resultId: ${t}) at edit #${i}: The provided start offset ${o} is outside the previous data (length ${s}).`))}};eD=ZZ([R4(1,an),R4(2,ii),R4(3,En)],eD);function Rze(n,e,t){let i=n.data,o=n.data.length/5|0,s=Math.max(Math.ceil(o/1024),400),r=[],a=0,l=1,c=0;for(;ad&&i[5*w]===0;)w--;if(w-1===d){let y=h;for(;y+1T)e.warnOverlappingSemanticTokens(k,T+1);else{let G=e.getMetadata(W,j,t);G!==2147483647&&(g===0&&(g=k),u[f]=k-g,u[f+1]=T,u[f+2]=M,u[f+3]=G,f+=4,m=k,C=M)}l=k,c=T,a++}f!==u.length&&(u=u.subarray(0,f));let S=Qk.create(g,u);r.push(S)}return r}var P4=class{constructor(e,t,i,o){this.tokenTypeIndex=e,this.tokenModifierSet=t,this.languageId=i,this.metadata=o,this.next=null}},tD=class n{constructor(){this._elementsCount=0,this._currentLengthIndex=0,this._currentLength=n._SIZES[this._currentLengthIndex],this._growCount=Math.round(this._currentLengthIndex+1=this._growCount){let s=this._elements;this._currentLengthIndex++,this._currentLength=n._SIZES[this._currentLengthIndex],this._growCount=Math.round(this._currentLengthIndex+1=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},O4=function(n,e){return function(t,i){e(t,i,n)}},F4=class extends H{constructor(e,t,i){super(),this._themeService=e,this._logService=t,this._languageService=i,this._caches=new WeakMap,this._register(this._themeService.onDidColorThemeChange(()=>{this._caches=new WeakMap}))}getStyling(e){return this._caches.has(e)||this._caches.set(e,new eD(e.getLegend(),this._themeService,this._languageService,this._logService)),this._caches.get(e)}};F4=YZ([O4(0,an),O4(1,En),O4(2,ii)],F4);_t($z,F4,1);_();v();b();_();v();b();ye();le();hr();_();v();b();_();v();b();Gt();yR();cr();wc();Lt();ot();var iD="**",qz="/",nD="[/\\\\]",oD="[^/\\\\]",XZ=/\//g;function jz(n,e){switch(n){case 0:return"";case 1:return`${oD}*?`;default:return`(?:${nD}|${oD}+${nD}${e?`|${nD}${oD}+`:""})*?`}}function Gz(n,e){if(!n)return[];let t=[],i=!1,o=!1,s="";for(let r of n){switch(r){case e:if(!i&&!o){t.push(s),s="";continue}break;case"{":i=!0;break;case"}":i=!1;break;case"[":o=!0;break;case"]":o=!1;break}s+=r}return s&&t.push(s),t}function Jz(n){if(!n)return"";let e="",t=Gz(n,qz);if(t.every(i=>i===iD))e=".*";else{let i=!1;t.forEach((o,s)=>{if(o===iD){if(i)return;e+=jz(2,s===t.length-1)}else{let r=!1,a="",l=!1,c="";for(let d of o){if(d!=="}"&&r){a+=d;continue}if(l&&(d!=="]"||!c)){let h;d==="-"?h=d:(d==="^"||d==="!")&&!c?h="^":d===qz?h="":h=gs(d),c+=h;continue}switch(d){case"{":r=!0;continue;case"[":l=!0;continue;case"}":{let u=`(?:${Gz(a,",").map(f=>Jz(f)).join("|")})`;e+=u,r=!1,a="";break}case"]":{e+="["+c+"]",l=!1,c="";break}case"?":e+=oD;continue;case"*":e+=jz(1);continue;default:e+=gs(d)}}sW4(a,e)).filter(a=>a!==Ql),n),i=t.length;if(!i)return Ql;if(i===1)return t[0];let o=function(a,l){for(let c=0,d=t.length;c!!a.allBasenames);s&&(o.allBasenames=s.allBasenames);let r=t.reduce((a,l)=>l.allPaths?a.concat(l.allPaths):a,[]);return r.length&&(o.allPaths=r),o}function Qz(n,e,t){let i=ya===ci.sep,o=i?n:n.replace(XZ,ya),s=ya+o,r=ci.sep+n,a;return t?a=function(l,c){return typeof l=="string"&&(l===o||l.endsWith(s)||!i&&(l===n||l.endsWith(r)))?e:null}:a=function(l,c){return typeof l=="string"&&(l===o||!i&&l===n)?e:null},a.allPaths=[(t?"*/":"./")+n],a}function aY(n){try{let e=new RegExp(`^${Jz(n)}$`);return function(t){return e.lastIndex=0,typeof t=="string"&&e.test(t)?n:null}}catch{return Ql}}function eV(n,e,t){return!n||typeof e!="string"?!1:z4(n)(e,void 0,t)}function z4(n,e={}){if(!n)return Yz;if(typeof n=="string"||lY(n)){let t=W4(n,e);if(t===Ql)return Yz;let i=function(o,s){return!!t(o,s)};return t.allBasenames&&(i.allBasenames=t.allBasenames),t.allPaths&&(i.allPaths=t.allPaths),i}return cY(n,e)}function lY(n){let e=n;return e?typeof e.base=="string"&&typeof e.pattern=="string":!1}function cY(n,e){let t=tV(Object.getOwnPropertyNames(n).map(a=>dY(a,n[a],e)).filter(a=>a!==Ql)),i=t.length;if(!i)return Ql;if(!t.some(a=>!!a.requiresSiblings)){if(i===1)return t[0];let a=function(d,h){let u;for(let f=0,g=t.length;f{for(let f of u){let g=await f;if(typeof g=="string")return g}return null})():null},l=t.find(d=>!!d.allBasenames);l&&(a.allBasenames=l.allBasenames);let c=t.reduce((d,h)=>h.allPaths?d.concat(h.allPaths):d,[]);return c.length&&(a.allPaths=c),a}let o=function(a,l,c){let d,h;for(let u=0,f=t.length;u{for(let u of h){let f=await u;if(typeof f=="string")return f}return null})():null},s=t.find(a=>!!a.allBasenames);s&&(o.allBasenames=s.allBasenames);let r=t.reduce((a,l)=>l.allPaths?a.concat(l.allPaths):a,[]);return r.length&&(o.allPaths=r),o}function dY(n,e,t){if(e===!1)return Ql;let i=W4(n,t);if(i===Ql)return Ql;if(typeof e=="boolean")return i;if(e){let o=e.when;if(typeof o=="string"){let s=(r,a,l,c)=>{if(!c||!i(r,a))return null;let d=o.replace("$(basename)",()=>l),h=c(d);return Nw(h)?h.then(u=>u?n:null):h?n:null};return s.requiresSiblings=!0,s}}return i}function tV(n,e){let t=n.filter(a=>!!a.basenames);if(t.length<2)return n;let i=t.reduce((a,l)=>{let c=l.basenames;return c?a.concat(c):a},[]),o;if(e){o=[];for(let a=0,l=i.length;a{let c=l.patterns;return c?a.concat(c):a},[]);let s=function(a,l){if(typeof a!="string")return null;if(!l){let d;for(d=a.length;d>0;d--){let h=a.charCodeAt(d-1);if(h===47||h===92)break}l=a.substr(d)}let c=i.indexOf(l);return c!==-1?o[c]:null};s.basenames=i,s.patterns=o,s.allBasenames=i;let r=n.filter(a=>!a.basenames);return r.push(s),r}wc();function V4(n,e,t,i,o,s){if(Array.isArray(n)){let r=0;for(let a of n){let l=V4(a,e,t,i,o,s);if(l===10)return l;l>r&&(r=l)}return r}else{if(typeof n=="string")return i?n==="*"?5:n===t?10:0:0;if(n){let{language:r,pattern:a,scheme:l,hasAccessToAllModels:c,notebookType:d}=n;if(!i&&!c)return 0;d&&o&&(e=o);let h=0;if(l)if(l===e.scheme)h=10;else if(l==="*")h=5;else return 0;if(r)if(r===t)h=10;else if(r==="*")h=Math.max(h,5);else return 0;if(d)if(d===s)h=10;else if(d==="*"&&s!==void 0)h=Math.max(h,5);else return 0;if(a){let u;if(typeof a=="string"?u=a:u={...a,base:mC(a.base)},u===e.fsPath||eV(u,e.fsPath))h=10;else return 0}return h}else return 0}}function iV(n){return typeof n=="string"?!1:Array.isArray(n)?n.every(iV):!!n.exclusive}var sD=class{constructor(e,t,i,o){this.uri=e,this.languageId=t,this.notebookUri=i,this.notebookType=o}equals(e){var t,i;return this.notebookType===e.notebookType&&this.languageId===e.languageId&&this.uri.toString()===e.uri.toString()&&((t=this.notebookUri)===null||t===void 0?void 0:t.toString())===((i=e.notebookUri)===null||i===void 0?void 0:i.toString())}},si=class n{constructor(e){this._notebookInfoResolver=e,this._clock=0,this._entries=[],this._onDidChange=new B,this.onDidChange=this._onDidChange.event}register(e,t){let i={selector:e,provider:t,_score:-1,_time:this._clock++};return this._entries.push(i),this._lastCandidate=void 0,this._onDidChange.fire(this._entries.length),be(()=>{if(i){let o=this._entries.indexOf(i);o>=0&&(this._entries.splice(o,1),this._lastCandidate=void 0,this._onDidChange.fire(this._entries.length),i=void 0)}})}has(e){return this.all(e).length>0}all(e){if(!e)return[];this._updateScores(e);let t=[];for(let i of this._entries)i._score>0&&t.push(i.provider);return t}ordered(e){let t=[];return this._orderedForEach(e,i=>t.push(i.provider)),t}orderedGroups(e){let t=[],i,o;return this._orderedForEach(e,s=>{i&&o===s._score?i.push(s.provider):(o=s._score,i=[s.provider],t.push(i))}),t}_orderedForEach(e,t){this._updateScores(e);for(let i of this._entries)i._score>0&&t(i)}_updateScores(e){var t,i;let o=(t=this._notebookInfoResolver)===null||t===void 0?void 0:t.call(this,e.uri),s=o?new sD(e.uri,e.getLanguageId(),o.uri,o.type):new sD(e.uri,e.getLanguageId(),void 0,void 0);if(!(!((i=this._lastCandidate)===null||i===void 0)&&i.equals(s))){this._lastCandidate=s;for(let r of this._entries)if(r._score=V4(r.selector,s.uri,s.languageId,$3(e),s.notebookUri,s.notebookType),iV(r.selector)&&r._score>0){for(let a of this._entries)a._score=0;r._score=1e3;break}this._entries.sort(n._compareByScoreAndTime)}}static _compareByScoreAndTime(e,t){return e._scoret._score?-1:_v(e.selector)&&!_v(t.selector)?1:!_v(e.selector)&&_v(t.selector)?-1:e._timet._time?-1:0}};function _v(n){return typeof n=="string"?!1:Array.isArray(n)?n.some(_v):!!n.isBuiltin}Ou();Ur();var H4=class{constructor(){this.referenceProvider=new si(this._score.bind(this)),this.renameProvider=new si(this._score.bind(this)),this.newSymbolNamesProvider=new si(this._score.bind(this)),this.codeActionProvider=new si(this._score.bind(this)),this.definitionProvider=new si(this._score.bind(this)),this.typeDefinitionProvider=new si(this._score.bind(this)),this.declarationProvider=new si(this._score.bind(this)),this.implementationProvider=new si(this._score.bind(this)),this.documentSymbolProvider=new si(this._score.bind(this)),this.inlayHintsProvider=new si(this._score.bind(this)),this.colorProvider=new si(this._score.bind(this)),this.codeLensProvider=new si(this._score.bind(this)),this.documentFormattingEditProvider=new si(this._score.bind(this)),this.documentRangeFormattingEditProvider=new si(this._score.bind(this)),this.onTypeFormattingEditProvider=new si(this._score.bind(this)),this.signatureHelpProvider=new si(this._score.bind(this)),this.hoverProvider=new si(this._score.bind(this)),this.documentHighlightProvider=new si(this._score.bind(this)),this.multiDocumentHighlightProvider=new si(this._score.bind(this)),this.selectionRangeProvider=new si(this._score.bind(this)),this.foldingRangeProvider=new si(this._score.bind(this)),this.linkProvider=new si(this._score.bind(this)),this.inlineCompletionsProvider=new si(this._score.bind(this)),this.inlineEditProvider=new si(this._score.bind(this)),this.completionProvider=new si(this._score.bind(this)),this.linkedEditingRangeProvider=new si(this._score.bind(this)),this.documentRangeSemanticTokensProvider=new si(this._score.bind(this)),this.documentSemanticTokensProvider=new si(this._score.bind(this)),this.documentDropEditProvider=new si(this._score.bind(this)),this.documentPasteEditProvider=new si(this._score.bind(this))}_score(e){var t;return(t=this._notebookTypeResolver)===null||t===void 0?void 0:t.call(this,e)}};_t(Tt,H4,1);_();v();b();Ur();Qi();is();_();v();b();qe();le();Fo();ke();var hY=function(n,e,t,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},nV=function(n,e){return function(t,i){e(t,i,n)}},Lh=De("hoverService"),xh=class extends H{get delay(){return this.isInstantlyHovering()?0:this._delay}constructor(e,t,i={},o,s){super(),this.placement=e,this.instantHover=t,this.overrideOptions=i,this.configurationService=o,this.hoverService=s,this.lastHoverHideTime=0,this.timeLimit=200,this.hoverDisposables=this._register(new ae),this._delay=this.configurationService.getValue("workbench.hover.delay"),this._register(this.configurationService.onDidChangeConfiguration(r=>{r.affectsConfiguration("workbench.hover.delay")&&(this._delay=this.configurationService.getValue("workbench.hover.delay"))}))}showHover(e,t){let i=typeof this.overrideOptions=="function"?this.overrideOptions(e,t):this.overrideOptions;this.hoverDisposables.clear();let o=e.target instanceof HTMLElement?[e.target]:e.target.targetElements;for(let r of o)this.hoverDisposables.add(Ut(r,"keydown",a=>{a.equals(9)&&this.hoverService.hideHover()}));let s=e.content instanceof HTMLElement?void 0:e.content.toString();return this.hoverService.showHover({...e,...i,persistence:{hideOnKeyDown:!0,...i.persistence},id:s,appearance:{...e.appearance,compact:!0,skipFadeInAnimation:this.isInstantlyHovering(),...i.appearance}},t)}isInstantlyHovering(){return this.instantHover&&Date.now()-this.lastHoverHideTime{i.stopPropagation(),i.preventDefault(),t(e)}))}},K4=class extends H{constructor(e,t,i){super(),this._register($(e,se.KEY_DOWN,o=>{let s=new bt(o);i.some(r=>s.equals(r))&&(o.stopPropagation(),o.preventDefault(),t(e))}))}};_();v();b();qe();var Jl=De("openerService");function sV(n){let e,t=/^L?(\d+)(?:,(\d+))?(-L?(\d+)(?:,(\d+))?)?/.exec(n.fragment);return t&&(e={startLineNumber:parseInt(t[1]),startColumn:t[2]?parseInt(t[2]):1,endLineNumber:t[4]?parseInt(t[4]):void 0,endColumn:t[4]?t[5]?parseInt(t[5]):1:void 0},n=n.with({fragment:""})),{selection:e,uri:n}}qe();_();v();b();_();v();b();ke();Fw();_();v();b();ke();function rV(n,e={}){let t=cD(e);return t.textContent=n,t}function aV(n,e={}){let t=cD(e);return lV(t,uY(n,!!e.renderCodeSegments),e.actionHandler,e.renderCodeSegments),t}function cD(n){let e=n.inline?"span":"div",t=document.createElement(e);return n.className&&(t.className=n.className),t}var $4=class{constructor(e){this.source=e,this.index=0}eos(){return this.index>=this.source.length}next(){let e=this.peek();return this.advance(),e}peek(){return this.source[this.index]}advance(){this.index++}};function lV(n,e,t,i){let o;if(e.type===2)o=document.createTextNode(e.content||"");else if(e.type===3)o=document.createElement("b");else if(e.type===4)o=document.createElement("i");else if(e.type===7&&i)o=document.createElement("code");else if(e.type===5&&t){let s=document.createElement("a");t.disposables.add(Ut(s,"click",r=>{t.callback(String(e.index),r)})),o=s}else e.type===8?o=document.createElement("br"):e.type===1&&(o=n);o&&n!==o&&n.appendChild(o),o&&Array.isArray(e.children)&&e.children.forEach(s=>{lV(o,s,t,i)})}function uY(n,e){let t={type:1,children:[]},i=0,o=t,s=[],r=new $4(n);for(;!r.eos();){let a=r.next(),l=a==="\\"&&q4(r.peek(),e)!==0;if(l&&(a=r.next()),!l&&fY(a,e)&&a===r.peek()){r.advance(),o.type===2&&(o=s.pop());let c=q4(a,e);if(o.type===c||o.type===5&&c===6)o=s.pop();else{let d={type:c,children:[]};c===5&&(d.index=i,i++),o.children.push(d),s.push(o),o=d}}else if(a===` +`)o.type===2&&(o=s.pop()),o.children.push({type:8});else if(o.type!==2){let c={type:2,content:a};o.children.push(c),s.push(o),o=c}else o.content+=a}return o.type===2&&(o=s.pop()),s.length,t}function fY(n,e){return q4(n,e)!==0}function q4(n,e){switch(n){case"*":return 3;case"_":return 4;case"[":return 5;case"]":return 6;case"`":return e?7:0;default:return 0}}oo();Qs();Ef();xt();ye();Lp();xp();_();v();b();var yv=class{constructor(e){this._prefix=e,this._lastId=0}nextId(){return this._prefix+ ++this._lastId}},c5=new yv("id#");Md();le();_();v();b();var $o={};(function(){function n(e,t){t($o)}n.amd=!0,function(e,t){typeof n=="function"&&n.amd?n(["exports"],t):typeof exports=="object"&&typeof module<"u"?t(exports):(e=typeof globalThis<"u"?globalThis:e||self,t(e.marked={}))}(this,function(e){"use strict";function t(ne,X){for(var Y=0;Yne.length)&&(X=ne.length);for(var Y=0,R=new Array(X);Y=ne.length?{done:!0}:{done:!1,value:ne[R++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function a(){return{async:!1,baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}e.defaults=a();function l(ne){e.defaults=ne}var c=/[&<>"']/,d=/[&<>"']/g,h=/[<>"']|&(?!#?\w+;)/,u=/[<>"']|&(?!#?\w+;)/g,f={"&":"&","<":"<",">":">",'"':""","'":"'"},g=function(X){return f[X]};function m(ne,X){if(X){if(c.test(ne))return ne.replace(d,g)}else if(h.test(ne))return ne.replace(u,g);return ne}var C=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function S(ne){return ne.replace(C,function(X,Y){return Y=Y.toLowerCase(),Y==="colon"?":":Y.charAt(0)==="#"?Y.charAt(1)==="x"?String.fromCharCode(parseInt(Y.substring(2),16)):String.fromCharCode(+Y.substring(1)):""})}var w=/(^|[^\[])\^/g;function y(ne,X){ne=typeof ne=="string"?ne:ne.source,X=X||"";var Y={replace:function(O,q){return q=q.source||q,q=q.replace(w,"$1"),ne=ne.replace(O,q),Y},getRegex:function(){return new RegExp(ne,X)}};return Y}var x=/[^\w:]/g,k=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function T(ne,X,Y){if(ne){var R;try{R=decodeURIComponent(S(Y)).replace(x,"").toLowerCase()}catch{return null}if(R.indexOf("javascript:")===0||R.indexOf("vbscript:")===0||R.indexOf("data:")===0)return null}X&&!k.test(Y)&&(Y=G(X,Y));try{Y=encodeURI(Y).replace(/%25/g,"%")}catch{return null}return Y}var N={},M=/^[^:]+:\/*[^/]*$/,W=/^([^:]+:)[\s\S]*$/,j=/^([^:]+:\/*[^/]*)[\s\S]*$/;function G(ne,X){N[" "+ne]||(M.test(ne)?N[" "+ne]=ne+"/":N[" "+ne]=ee(ne,"/",!0)),ne=N[" "+ne];var Y=ne.indexOf(":")===-1;return X.substring(0,2)==="//"?Y?X:ne.replace(W,"$1")+X:X.charAt(0)==="/"?Y?X:ne.replace(j,"$1")+X:ne+X}var V={exec:function(){}};function z(ne){for(var X=1,Y,R;X=0&&re[Ie]==="\\";)fe=!fe;return fe?"|":" |"}),R=Y.split(/ \|/),O=0;if(R[0].trim()||R.shift(),R.length>0&&!R[R.length-1].trim()&&R.pop(),R.length>X)R.splice(X);else for(;R.length1;)X&1&&(Y+=ne),X>>=1,ne+=ne;return Y+ne}function pe(ne,X,Y,R){var O=X.href,q=X.title?m(X.title):null,K=ne[1].replace(/\\([\[\]])/g,"$1");if(ne[0].charAt(0)!=="!"){R.state.inLink=!0;var re={type:"link",raw:Y,href:O,title:q,text:K,tokens:R.inlineTokens(K)};return R.state.inLink=!1,re}return{type:"image",raw:Y,href:O,title:q,text:m(K)}}function Pe(ne,X){var Y=ne.match(/^(\s+)(?:```)/);if(Y===null)return X;var R=Y[1];return X.split(` +`).map(function(O){var q=O.match(/^\s+/);if(q===null)return O;var K=q[0];return K.length>=R.length?O.slice(R.length):O}).join(` +`)}var Qe=function(){function ne(Y){this.options=Y||e.defaults}var X=ne.prototype;return X.space=function(R){var O=this.rules.block.newline.exec(R);if(O&&O[0].length>0)return{type:"space",raw:O[0]}},X.code=function(R){var O=this.rules.block.code.exec(R);if(O){var q=O[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:O[0],codeBlockStyle:"indented",text:this.options.pedantic?q:ee(q,` +`)}}},X.fences=function(R){var O=this.rules.block.fences.exec(R);if(O){var q=O[0],K=Pe(q,O[3]||"");return{type:"code",raw:q,lang:O[2]?O[2].trim():O[2],text:K}}},X.heading=function(R){var O=this.rules.block.heading.exec(R);if(O){var q=O[2].trim();if(/#$/.test(q)){var K=ee(q,"#");(this.options.pedantic||!K||/ $/.test(K))&&(q=K.trim())}return{type:"heading",raw:O[0],depth:O[1].length,text:q,tokens:this.lexer.inline(q)}}},X.hr=function(R){var O=this.rules.block.hr.exec(R);if(O)return{type:"hr",raw:O[0]}},X.blockquote=function(R){var O=this.rules.block.blockquote.exec(R);if(O){var q=O[0].replace(/^ *>[ \t]?/gm,"");return{type:"blockquote",raw:O[0],tokens:this.lexer.blockTokens(q,[]),text:q}}},X.list=function(R){var O=this.rules.block.list.exec(R);if(O){var q,K,re,fe,Ie,Me,st,it,qt,Wt,Ue,ki,Di=O[1].trim(),yr=Di.length>1,Nt={type:"list",raw:"",ordered:yr,start:yr?+Di.slice(0,-1):"",loose:!1,items:[]};Di=yr?"\\d{1,9}\\"+Di.slice(-1):"\\"+Di,this.options.pedantic&&(Di=yr?Di:"[*+-]");for(var Zi=new RegExp("^( {0,3}"+Di+")((?:[ ][^\\n]*)?(?:\\n|$))");R&&(ki=!1,!(!(O=Zi.exec(R))||this.rules.block.hr.test(R)));){if(q=O[0],R=R.substring(q.length),it=O[2].split(` +`,1)[0],qt=R.split(` +`,1)[0],this.options.pedantic?(fe=2,Ue=it.trimLeft()):(fe=O[2].search(/[^ ]/),fe=fe>4?1:fe,Ue=it.slice(fe),fe+=O[1].length),Me=!1,!it&&/^ *$/.test(qt)&&(q+=qt+` +`,R=R.substring(qt.length+1),ki=!0),!ki)for(var Zh=new RegExp("^ {0,"+Math.min(3,fe-1)+"}(?:[*+-]|\\d{1,9}[.)])((?: [^\\n]*)?(?:\\n|$))"),Yh=new RegExp("^ {0,"+Math.min(3,fe-1)+"}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)"),fa=new RegExp("^ {0,"+Math.min(3,fe-1)+"}(?:```|~~~)"),ud=new RegExp("^ {0,"+Math.min(3,fe-1)+"}#");R&&(Wt=R.split(` +`,1)[0],it=Wt,this.options.pedantic&&(it=it.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),!(fa.test(it)||ud.test(it)||Zh.test(it)||Yh.test(R)));){if(it.search(/[^ ]/)>=fe||!it.trim())Ue+=` +`+it.slice(fe);else if(!Me)Ue+=` +`+it;else break;!Me&&!it.trim()&&(Me=!0),q+=Wt+` +`,R=R.substring(Wt.length+1)}Nt.loose||(st?Nt.loose=!0:/\n *\n *$/.test(q)&&(st=!0)),this.options.gfm&&(K=/^\[[ xX]\] /.exec(Ue),K&&(re=K[0]!=="[ ] ",Ue=Ue.replace(/^\[[ xX]\] +/,""))),Nt.items.push({type:"list_item",raw:q,task:!!K,checked:re,loose:!1,text:Ue}),Nt.raw+=q}Nt.items[Nt.items.length-1].raw=q.trimRight(),Nt.items[Nt.items.length-1].text=Ue.trimRight(),Nt.raw=Nt.raw.trimRight();var Xh=Nt.items.length;for(Ie=0;Ie1)return!0}return!1});!Nt.loose&&Qh.length&&rg&&(Nt.loose=!0,Nt.items[Ie].loose=!0)}return Nt}},X.html=function(R){var O=this.rules.block.html.exec(R);if(O){var q={type:"html",raw:O[0],pre:!this.options.sanitizer&&(O[1]==="pre"||O[1]==="script"||O[1]==="style"),text:O[0]};if(this.options.sanitize){var K=this.options.sanitizer?this.options.sanitizer(O[0]):m(O[0]);q.type="paragraph",q.text=K,q.tokens=this.lexer.inline(K)}return q}},X.def=function(R){var O=this.rules.block.def.exec(R);if(O){O[3]&&(O[3]=O[3].substring(1,O[3].length-1));var q=O[1].toLowerCase().replace(/\s+/g," ");return{type:"def",tag:q,raw:O[0],href:O[2],title:O[3]}}},X.table=function(R){var O=this.rules.block.table.exec(R);if(O){var q={type:"table",header:te(O[1]).map(function(st){return{text:st}}),align:O[2].replace(/^ *|\| *$/g,"").split(/ *\| */),rows:O[3]&&O[3].trim()?O[3].replace(/\n[ \t]*$/,"").split(` +`):[]};if(q.header.length===q.align.length){q.raw=O[0];var K=q.align.length,re,fe,Ie,Me;for(re=0;re/i.test(O[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(O[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(O[0])&&(this.lexer.state.inRawBlock=!1),{type:this.options.sanitize?"text":"html",raw:O[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(O[0]):m(O[0]):O[0]}},X.link=function(R){var O=this.rules.inline.link.exec(R);if(O){var q=O[2].trim();if(!this.options.pedantic&&/^$/.test(q))return;var K=ee(q.slice(0,-1),"\\");if((q.length-K.length)%2===0)return}else{var re=ce(O[2],"()");if(re>-1){var fe=O[0].indexOf("!")===0?5:4,Ie=fe+O[1].length+re;O[2]=O[2].substring(0,re),O[0]=O[0].substring(0,Ie).trim(),O[3]=""}}var Me=O[2],st="";if(this.options.pedantic){var it=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Me);it&&(Me=it[1],st=it[3])}else st=O[3]?O[3].slice(1,-1):"";return Me=Me.trim(),/^$/.test(q)?Me=Me.slice(1):Me=Me.slice(1,-1)),pe(O,{href:Me&&Me.replace(this.rules.inline._escapes,"$1"),title:st&&st.replace(this.rules.inline._escapes,"$1")},O[0],this.lexer)}},X.reflink=function(R,O){var q;if((q=this.rules.inline.reflink.exec(R))||(q=this.rules.inline.nolink.exec(R))){var K=(q[2]||q[1]).replace(/\s+/g," ");if(K=O[K.toLowerCase()],!K||!K.href){var re=q[0].charAt(0);return{type:"text",raw:re,text:re}}return pe(q,K,q[0],this.lexer)}},X.emStrong=function(R,O,q){q===void 0&&(q="");var K=this.rules.inline.emStrong.lDelim.exec(R);if(K&&!(K[3]&&q.match(/(?:[0-9A-Za-z\xAA\xB2\xB3\xB5\xB9\xBA\xBC-\xBE\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u0660-\u0669\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07C0-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0966-\u096F\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09E6-\u09F1\u09F4-\u09F9\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A66-\u0A6F\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AE6-\u0AEF\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B66-\u0B6F\u0B71-\u0B77\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0BE6-\u0BF2\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C66-\u0C6F\u0C78-\u0C7E\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CE6-\u0CEF\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D58-\u0D61\u0D66-\u0D78\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DE6-\u0DEF\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F20-\u0F33\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F-\u1049\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u1090-\u1099\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1369-\u137C\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A16\u1A20-\u1A54\u1A80-\u1A89\u1A90-\u1A99\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B50-\u1B59\u1B83-\u1BA0\u1BAE-\u1BE5\u1C00-\u1C23\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2070\u2071\u2074-\u2079\u207F-\u2089\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2150-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2CFD\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u3192-\u3195\u31A0-\u31BF\u31F0-\u31FF\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA830-\uA835\uA840-\uA873\uA882-\uA8B3\uA8D0-\uA8D9\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA900-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF-\uA9D9\uA9E0-\uA9E4\uA9E6-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA50-\uAA59\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD07-\uDD33\uDD40-\uDD78\uDD8A\uDD8B\uDE80-\uDE9C\uDEA0-\uDED0\uDEE1-\uDEFB\uDF00-\uDF23\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC58-\uDC76\uDC79-\uDC9E\uDCA7-\uDCAF\uDCE0-\uDCF2\uDCF4\uDCF5\uDCFB-\uDD1B\uDD20-\uDD39\uDD80-\uDDB7\uDDBC-\uDDCF\uDDD2-\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE40-\uDE48\uDE60-\uDE7E\uDE80-\uDE9F\uDEC0-\uDEC7\uDEC9-\uDEE4\uDEEB-\uDEEF\uDF00-\uDF35\uDF40-\uDF55\uDF58-\uDF72\uDF78-\uDF91\uDFA9-\uDFAF]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDCFA-\uDD23\uDD30-\uDD39\uDE60-\uDE7E\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF27\uDF30-\uDF45\uDF51-\uDF54\uDF70-\uDF81\uDFB0-\uDFCB\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC52-\uDC6F\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD03-\uDD26\uDD36-\uDD3F\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDD0-\uDDDA\uDDDC\uDDE1-\uDDF4\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDEF0-\uDEF9\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC50-\uDC59\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE50-\uDE59\uDE80-\uDEAA\uDEB8\uDEC0-\uDEC9\uDF00-\uDF1A\uDF30-\uDF3B\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCF2\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDD50-\uDD59\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC50-\uDC6C\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD50-\uDD59\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDDA0-\uDDA9\uDEE0-\uDEF2\uDFB0\uDFC0-\uDFD4]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDE70-\uDEBE\uDEC0-\uDEC9\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF50-\uDF59\uDF5B-\uDF61\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE96\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD834[\uDEE0-\uDEF3\uDF60-\uDF78]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD837[\uDF00-\uDF1E]|\uD838[\uDD00-\uDD2C\uDD37-\uDD3D\uDD40-\uDD49\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB\uDEF0-\uDEF9]|\uD839[\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDCC7-\uDCCF\uDD00-\uDD43\uDD4B\uDD50-\uDD59]|\uD83B[\uDC71-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDCB4\uDD01-\uDD2D\uDD2F-\uDD3D\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD83C[\uDD00-\uDD0C]|\uD83E[\uDFF0-\uDFF9]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF38\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A])/))){var re=K[1]||K[2]||"";if(!re||re&&(q===""||this.rules.inline.punctuation.exec(q))){var fe=K[0].length-1,Ie,Me,st=fe,it=0,qt=K[0][0]==="*"?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(qt.lastIndex=0,O=O.slice(-1*R.length+fe);(K=qt.exec(O))!=null;)if(Ie=K[1]||K[2]||K[3]||K[4]||K[5]||K[6],!!Ie){if(Me=Ie.length,K[3]||K[4]){st+=Me;continue}else if((K[5]||K[6])&&fe%3&&!((fe+Me)%3)){it+=Me;continue}if(st-=Me,!(st>0)){if(Me=Math.min(Me,Me+st+it),Math.min(fe,Me)%2){var Wt=R.slice(1,fe+K.index+Me);return{type:"em",raw:R.slice(0,fe+K.index+Me+1),text:Wt,tokens:this.lexer.inlineTokens(Wt)}}var Ue=R.slice(2,fe+K.index+Me-1);return{type:"strong",raw:R.slice(0,fe+K.index+Me+1),text:Ue,tokens:this.lexer.inlineTokens(Ue)}}}}}},X.codespan=function(R){var O=this.rules.inline.code.exec(R);if(O){var q=O[2].replace(/\n/g," "),K=/[^ ]/.test(q),re=/^ /.test(q)&&/ $/.test(q);return K&&re&&(q=q.substring(1,q.length-1)),q=m(q,!0),{type:"codespan",raw:O[0],text:q}}},X.br=function(R){var O=this.rules.inline.br.exec(R);if(O)return{type:"br",raw:O[0]}},X.del=function(R){var O=this.rules.inline.del.exec(R);if(O)return{type:"del",raw:O[0],text:O[2],tokens:this.lexer.inlineTokens(O[2])}},X.autolink=function(R,O){var q=this.rules.inline.autolink.exec(R);if(q){var K,re;return q[2]==="@"?(K=m(this.options.mangle?O(q[1]):q[1]),re="mailto:"+K):(K=m(q[1]),re=K),{type:"link",raw:q[0],text:K,href:re,tokens:[{type:"text",raw:K,text:K}]}}},X.url=function(R,O){var q;if(q=this.rules.inline.url.exec(R)){var K,re;if(q[2]==="@")K=m(this.options.mangle?O(q[0]):q[0]),re="mailto:"+K;else{var fe;do fe=q[0],q[0]=this.rules.inline._backpedal.exec(q[0])[0];while(fe!==q[0]);K=m(q[0]),q[1]==="www."?re="http://"+K:re=K}return{type:"link",raw:q[0],text:K,href:re,tokens:[{type:"text",raw:K,text:K}]}}},X.inlineText=function(R,O){var q=this.rules.inline.text.exec(R);if(q){var K;return this.lexer.state.inRawBlock?K=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(q[0]):m(q[0]):q[0]:K=m(this.options.smartypants?O(q[0]):q[0]),{type:"text",raw:q[0],text:K}}},ne}(),Te={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hr:/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,html:"^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",def:/^ {0,3}\[(label)\]: *(?:\n *)?]+)>?(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,table:V,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,text:/^[^\n]+/};Te._label=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Te._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,Te.def=y(Te.def).replace("label",Te._label).replace("title",Te._title).getRegex(),Te.bullet=/(?:[*+-]|\d{1,9}[.)])/,Te.listItemStart=y(/^( *)(bull) */).replace("bull",Te.bullet).getRegex(),Te.list=y(Te.list).replace(/bull/g,Te.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+Te.def.source+")").getRegex(),Te._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Te._comment=/|$)/,Te.html=y(Te.html,"i").replace("comment",Te._comment).replace("tag",Te._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Te.paragraph=y(Te._paragraph).replace("hr",Te.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",Te._tag).getRegex(),Te.blockquote=y(Te.blockquote).replace("paragraph",Te.paragraph).getRegex(),Te.normal=z({},Te),Te.gfm=z({},Te.normal,{table:"^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),Te.gfm.table=y(Te.gfm.table).replace("hr",Te.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",Te._tag).getRegex(),Te.gfm.paragraph=y(Te._paragraph).replace("hr",Te.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("table",Te.gfm.table).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",Te._tag).getRegex(),Te.pedantic=z({},Te.normal,{html:y(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Te._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:V,paragraph:y(Te.normal._paragraph).replace("hr",Te.hr).replace("heading",` *#{1,6} *[^ +]`).replace("lheading",Te.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var de={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:V,tag:"^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(ref)\]/,nolink:/^!?\[(ref)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",emStrong:{lDelim:/^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,rDelimAst:/^[^_*]*?\_\_[^_*]*?\*[^_*]*?(?=\_\_)|[^*]+(?=[^*])|[punct_](\*+)(?=[\s]|$)|[^punct*_\s](\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|[^punct*_\s](\*+)(?=[^punct*_\s])/,rDelimUnd:/^[^_*]*?\*\*[^_*]*?\_[^_*]*?(?=\*\*)|[^_]+(?=[^_])|[punct*](\_+)(?=[\s]|$)|[^punct*_\s](\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:V,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\?@\\[\\]`^{|}~",de.punctuation=y(de.punctuation).replace(/punctuation/g,de._punctuation).getRegex(),de.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g,de.escapedEmSt=/\\\*|\\_/g,de._comment=y(Te._comment).replace("(?:-->|$)","-->").getRegex(),de.emStrong.lDelim=y(de.emStrong.lDelim).replace(/punct/g,de._punctuation).getRegex(),de.emStrong.rDelimAst=y(de.emStrong.rDelimAst,"g").replace(/punct/g,de._punctuation).getRegex(),de.emStrong.rDelimUnd=y(de.emStrong.rDelimUnd,"g").replace(/punct/g,de._punctuation).getRegex(),de._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,de._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,de._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])?)+(?![-_])/,de.autolink=y(de.autolink).replace("scheme",de._scheme).replace("email",de._email).getRegex(),de._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,de.tag=y(de.tag).replace("comment",de._comment).replace("attribute",de._attribute).getRegex(),de._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,de._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/,de._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,de.link=y(de.link).replace("label",de._label).replace("href",de._href).replace("title",de._title).getRegex(),de.reflink=y(de.reflink).replace("label",de._label).replace("ref",Te._label).getRegex(),de.nolink=y(de.nolink).replace("ref",Te._label).getRegex(),de.reflinkSearch=y(de.reflinkSearch,"g").replace("reflink",de.reflink).replace("nolink",de.nolink).getRegex(),de.normal=z({},de),de.pedantic=z({},de.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:y(/^!?\[(label)\]\((.*?)\)/).replace("label",de._label).getRegex(),reflink:y(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",de._label).getRegex()}),de.gfm=z({},de.normal,{escape:y(de.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\.5&&(R="x"+R.toString(16)),X+="&#"+R+";";return X}var Gi=function(){function ne(Y){this.tokens=[],this.tokens.links=Object.create(null),this.options=Y||e.defaults,this.options.tokenizer=this.options.tokenizer||new Qe,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};var R={block:Te.normal,inline:de.normal};this.options.pedantic?(R.block=Te.pedantic,R.inline=de.pedantic):this.options.gfm&&(R.block=Te.gfm,this.options.breaks?R.inline=de.breaks:R.inline=de.gfm),this.tokenizer.rules=R}ne.lex=function(R,O){var q=new ne(O);return q.lex(R)},ne.lexInline=function(R,O){var q=new ne(O);return q.inlineTokens(R)};var X=ne.prototype;return X.lex=function(R){R=R.replace(/\r\n|\r/g,` +`),this.blockTokens(R,this.tokens);for(var O;O=this.inlineQueue.shift();)this.inlineTokens(O.src,O.tokens);return this.tokens},X.blockTokens=function(R,O){var q=this;O===void 0&&(O=[]),this.options.pedantic?R=R.replace(/\t/g," ").replace(/^ +$/gm,""):R=R.replace(/^( *)(\t+)/gm,function(st,it,qt){return it+" ".repeat(qt.length)});for(var K,re,fe,Ie;R;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(function(st){return(K=st.call({lexer:q},R,O))?(R=R.substring(K.raw.length),O.push(K),!0):!1}))){if(K=this.tokenizer.space(R)){R=R.substring(K.raw.length),K.raw.length===1&&O.length>0?O[O.length-1].raw+=` +`:O.push(K);continue}if(K=this.tokenizer.code(R)){R=R.substring(K.raw.length),re=O[O.length-1],re&&(re.type==="paragraph"||re.type==="text")?(re.raw+=` +`+K.raw,re.text+=` +`+K.text,this.inlineQueue[this.inlineQueue.length-1].src=re.text):O.push(K);continue}if(K=this.tokenizer.fences(R)){R=R.substring(K.raw.length),O.push(K);continue}if(K=this.tokenizer.heading(R)){R=R.substring(K.raw.length),O.push(K);continue}if(K=this.tokenizer.hr(R)){R=R.substring(K.raw.length),O.push(K);continue}if(K=this.tokenizer.blockquote(R)){R=R.substring(K.raw.length),O.push(K);continue}if(K=this.tokenizer.list(R)){R=R.substring(K.raw.length),O.push(K);continue}if(K=this.tokenizer.html(R)){R=R.substring(K.raw.length),O.push(K);continue}if(K=this.tokenizer.def(R)){R=R.substring(K.raw.length),re=O[O.length-1],re&&(re.type==="paragraph"||re.type==="text")?(re.raw+=` +`+K.raw,re.text+=` +`+K.raw,this.inlineQueue[this.inlineQueue.length-1].src=re.text):this.tokens.links[K.tag]||(this.tokens.links[K.tag]={href:K.href,title:K.title});continue}if(K=this.tokenizer.table(R)){R=R.substring(K.raw.length),O.push(K);continue}if(K=this.tokenizer.lheading(R)){R=R.substring(K.raw.length),O.push(K);continue}if(fe=R,this.options.extensions&&this.options.extensions.startBlock&&function(){var st=1/0,it=R.slice(1),qt=void 0;q.options.extensions.startBlock.forEach(function(Wt){qt=Wt.call({lexer:this},it),typeof qt=="number"&&qt>=0&&(st=Math.min(st,qt))}),st<1/0&&st>=0&&(fe=R.substring(0,st+1))}(),this.state.top&&(K=this.tokenizer.paragraph(fe))){re=O[O.length-1],Ie&&re.type==="paragraph"?(re.raw+=` +`+K.raw,re.text+=` +`+K.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=re.text):O.push(K),Ie=fe.length!==R.length,R=R.substring(K.raw.length);continue}if(K=this.tokenizer.text(R)){R=R.substring(K.raw.length),re=O[O.length-1],re&&re.type==="text"?(re.raw+=` +`+K.raw,re.text+=` +`+K.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=re.text):O.push(K);continue}if(R){var Me="Infinite loop on byte: "+R.charCodeAt(0);if(this.options.silent){console.error(Me);break}else throw new Error(Me)}}return this.state.top=!0,O},X.inline=function(R,O){return O===void 0&&(O=[]),this.inlineQueue.push({src:R,tokens:O}),O},X.inlineTokens=function(R,O){var q=this;O===void 0&&(O=[]);var K,re,fe,Ie=R,Me,st,it;if(this.tokens.links){var qt=Object.keys(this.tokens.links);if(qt.length>0)for(;(Me=this.tokenizer.rules.inline.reflinkSearch.exec(Ie))!=null;)qt.includes(Me[0].slice(Me[0].lastIndexOf("[")+1,-1))&&(Ie=Ie.slice(0,Me.index)+"["+Se("a",Me[0].length-2)+"]"+Ie.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(Me=this.tokenizer.rules.inline.blockSkip.exec(Ie))!=null;)Ie=Ie.slice(0,Me.index)+"["+Se("a",Me[0].length-2)+"]"+Ie.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(Me=this.tokenizer.rules.inline.escapedEmSt.exec(Ie))!=null;)Ie=Ie.slice(0,Me.index)+"++"+Ie.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex);for(;R;)if(st||(it=""),st=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(function(Ue){return(K=Ue.call({lexer:q},R,O))?(R=R.substring(K.raw.length),O.push(K),!0):!1}))){if(K=this.tokenizer.escape(R)){R=R.substring(K.raw.length),O.push(K);continue}if(K=this.tokenizer.tag(R)){R=R.substring(K.raw.length),re=O[O.length-1],re&&K.type==="text"&&re.type==="text"?(re.raw+=K.raw,re.text+=K.text):O.push(K);continue}if(K=this.tokenizer.link(R)){R=R.substring(K.raw.length),O.push(K);continue}if(K=this.tokenizer.reflink(R,this.tokens.links)){R=R.substring(K.raw.length),re=O[O.length-1],re&&K.type==="text"&&re.type==="text"?(re.raw+=K.raw,re.text+=K.text):O.push(K);continue}if(K=this.tokenizer.emStrong(R,Ie,it)){R=R.substring(K.raw.length),O.push(K);continue}if(K=this.tokenizer.codespan(R)){R=R.substring(K.raw.length),O.push(K);continue}if(K=this.tokenizer.br(R)){R=R.substring(K.raw.length),O.push(K);continue}if(K=this.tokenizer.del(R)){R=R.substring(K.raw.length),O.push(K);continue}if(K=this.tokenizer.autolink(R,Vn)){R=R.substring(K.raw.length),O.push(K);continue}if(!this.state.inLink&&(K=this.tokenizer.url(R,Vn))){R=R.substring(K.raw.length),O.push(K);continue}if(fe=R,this.options.extensions&&this.options.extensions.startInline&&function(){var Ue=1/0,ki=R.slice(1),Di=void 0;q.options.extensions.startInline.forEach(function(yr){Di=yr.call({lexer:this},ki),typeof Di=="number"&&Di>=0&&(Ue=Math.min(Ue,Di))}),Ue<1/0&&Ue>=0&&(fe=R.substring(0,Ue+1))}(),K=this.tokenizer.inlineText(fe,Ki)){R=R.substring(K.raw.length),K.raw.slice(-1)!=="_"&&(it=K.raw.slice(-1)),st=!0,re=O[O.length-1],re&&re.type==="text"?(re.raw+=K.raw,re.text+=K.text):O.push(K);continue}if(R){var Wt="Infinite loop on byte: "+R.charCodeAt(0);if(this.options.silent){console.error(Wt);break}else throw new Error(Wt)}}return O},i(ne,null,[{key:"rules",get:function(){return{block:Te,inline:de}}}]),ne}(),Ns=function(){function ne(Y){this.options=Y||e.defaults}var X=ne.prototype;return X.code=function(R,O,q){var K=(O||"").match(/\S*/)[0];if(this.options.highlight){var re=this.options.highlight(R,K);re!=null&&re!==R&&(q=!0,R=re)}return R=R.replace(/\n$/,"")+` +`,K?'
'+(q?R:m(R,!0))+`
+`:"
"+(q?R:m(R,!0))+`
+`},X.blockquote=function(R){return`
+`+R+`
+`},X.html=function(R){return R},X.heading=function(R,O,q,K){if(this.options.headerIds){var re=this.options.headerPrefix+K.slug(q);return"'+R+" +`}return""+R+" +`},X.hr=function(){return this.options.xhtml?`
+`:`
+`},X.list=function(R,O,q){var K=O?"ol":"ul",re=O&&q!==1?' start="'+q+'"':"";return"<"+K+re+`> +`+R+" +`},X.listitem=function(R){return"
  • "+R+`
  • +`},X.checkbox=function(R){return" "},X.paragraph=function(R){return"

    "+R+`

    +`},X.table=function(R,O){return O&&(O=""+O+""),` + +`+R+` +`+O+`
    +`},X.tablerow=function(R){return` +`+R+` +`},X.tablecell=function(R,O){var q=O.header?"th":"td",K=O.align?"<"+q+' align="'+O.align+'">':"<"+q+">";return K+R+(" +`)},X.strong=function(R){return""+R+""},X.em=function(R){return""+R+""},X.codespan=function(R){return""+R+""},X.br=function(){return this.options.xhtml?"
    ":"
    "},X.del=function(R){return""+R+""},X.link=function(R,O,q){if(R=T(this.options.sanitize,this.options.baseUrl,R),R===null)return q;var K='",K},X.image=function(R,O,q){if(R=T(this.options.sanitize,this.options.baseUrl,R),R===null)return q;var K=''+q+'":">",K},X.text=function(R){return R},ne}(),Ot=function(){function ne(){}var X=ne.prototype;return X.strong=function(R){return R},X.em=function(R){return R},X.codespan=function(R){return R},X.del=function(R){return R},X.html=function(R){return R},X.text=function(R){return R},X.link=function(R,O,q){return""+q},X.image=function(R,O,q){return""+q},X.br=function(){return""},ne}(),Cn=function(){function ne(){this.seen={}}var X=ne.prototype;return X.serialize=function(R){return R.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")},X.getNextSafeSlug=function(R,O){var q=R,K=0;if(this.seen.hasOwnProperty(q)){K=this.seen[R];do K++,q=R+"-"+K;while(this.seen.hasOwnProperty(q))}return O||(this.seen[R]=K,this.seen[q]=0),q},X.slug=function(R,O){O===void 0&&(O={});var q=this.serialize(R);return this.getNextSafeSlug(q,O.dryrun)},ne}(),Ni=function(){function ne(Y){this.options=Y||e.defaults,this.options.renderer=this.options.renderer||new Ns,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Ot,this.slugger=new Cn}ne.parse=function(R,O){var q=new ne(O);return q.parse(R)},ne.parseInline=function(R,O){var q=new ne(O);return q.parseInline(R)};var X=ne.prototype;return X.parse=function(R,O){O===void 0&&(O=!0);var q="",K,re,fe,Ie,Me,st,it,qt,Wt,Ue,ki,Di,yr,Nt,Zi,Zh,Yh,fa,ud,Xh=R.length;for(K=0;K0&&Zi.tokens[0].type==="paragraph"?(Zi.tokens[0].text=fa+" "+Zi.tokens[0].text,Zi.tokens[0].tokens&&Zi.tokens[0].tokens.length>0&&Zi.tokens[0].tokens[0].type==="text"&&(Zi.tokens[0].tokens[0].text=fa+" "+Zi.tokens[0].tokens[0].text)):Zi.tokens.unshift({type:"text",text:fa}):Nt+=fa),Nt+=this.parse(Zi.tokens,yr),Wt+=this.renderer.listitem(Nt,Yh,Zh);q+=this.renderer.list(Wt,ki,Di);continue}case"html":{q+=this.renderer.html(Ue.text);continue}case"paragraph":{q+=this.renderer.paragraph(this.parseInline(Ue.tokens));continue}case"text":{for(Wt=Ue.tokens?this.parseInline(Ue.tokens):Ue.text;K+1"u"||ne===null)throw new Error("marked(): input parameter is undefined or null");if(typeof ne!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(ne)+", string expected");if(typeof X=="function"&&(Y=X,X=null),X=z({},tt.defaults,X||{}),Ce(X),Y){var R=X.highlight,O;try{O=Gi.lex(ne,X)}catch(Ie){return Y(Ie)}var q=function(Me){var st;if(!Me)try{X.walkTokens&&tt.walkTokens(O,X.walkTokens),st=Ni.parse(O,X)}catch(it){Me=it}return X.highlight=R,Me?Y(Me):Y(null,st)};if(!R||R.length<3||(delete X.highlight,!O.length))return q();var K=0;tt.walkTokens(O,function(Ie){Ie.type==="code"&&(K++,setTimeout(function(){R(Ie.text,Ie.lang,function(Me,st){if(Me)return q(Me);st!=null&&st!==Ie.text&&(Ie.text=st,Ie.escaped=!0),K--,K===0&&q()})},0))}),K===0&&q();return}function re(Ie){if(Ie.message+=` +Please report this to https://github.com/markedjs/marked.`,X.silent)return"

    An error occurred:

    "+m(Ie.message+"",!0)+"
    ";throw Ie}try{var fe=Gi.lex(ne,X);if(X.walkTokens){if(X.async)return Promise.all(tt.walkTokens(fe,X.walkTokens)).then(function(){return Ni.parse(fe,X)}).catch(re);tt.walkTokens(fe,X.walkTokens)}return Ni.parse(fe,X)}catch(Ie){re(Ie)}}tt.options=tt.setOptions=function(ne){return z(tt.defaults,ne),l(tt.defaults),tt},tt.getDefaults=a,tt.defaults=e.defaults,tt.use=function(){for(var ne=arguments.length,X=new Array(ne),Y=0;Y"u"||ne===null)throw new Error("marked.parseInline(): input parameter is undefined or null");if(typeof ne!="string")throw new Error("marked.parseInline(): input parameter is of type "+Object.prototype.toString.call(ne)+", string expected");X=z({},tt.defaults,X||{}),Ce(X);try{var Y=Gi.lexInline(ne,X);return X.walkTokens&&tt.walkTokens(Y,X.walkTokens),Ni.parseInline(Y,X)}catch(R){if(R.message+=` +Please report this to https://github.com/markedjs/marked.`,X.silent)return"

    An error occurred:

    "+m(R.message+"",!0)+"
    ";throw R}},tt.Parser=Ni,tt.parser=Ni.parse,tt.Renderer=Ns,tt.TextRenderer=Ot,tt.Lexer=Gi,tt.lexer=Gi.lex,tt.Tokenizer=Qe,tt.Slugger=Cn,tt.parse=tt;var vr=tt.options,Cr=tt.setOptions,cs=tt.use,wr=tt.walkTokens,pc=tt.parseInline,Hn=tt,ua=Ni.parse,uI=Gi.lex;e.Lexer=Gi,e.Parser=Ni,e.Renderer=Ns,e.Slugger=Cn,e.TextRenderer=Ot,e.Tokenizer=Qe,e.getDefaults=a,e.lexer=uI,e.marked=tt,e.options=vr,e.parse=Hn,e.parseInline=pc,e.parser=ua,e.setOptions=Cr,e.use=cs,e.walkTokens=wr,Object.defineProperty(e,"__esModule",{value:!0})})})();var eUe=$o.Lexer||exports.Lexer,tUe=$o.Parser||exports.Parser,iUe=$o.Renderer||exports.Renderer,nUe=$o.Slugger||exports.Slugger,oUe=$o.TextRenderer||exports.TextRenderer,sUe=$o.Tokenizer||exports.Tokenizer,rUe=$o.getDefaults||exports.getDefaults,aUe=$o.lexer||exports.lexer,Xa=$o.marked||exports.marked,lUe=$o.options||exports.options,cUe=$o.parse||exports.parse,dUe=$o.parseInline||exports.parseInline,hUe=$o.parser||exports.parser,uUe=$o.setOptions||exports.setOptions,fUe=$o.use||exports.use,gUe=$o.walkTokens||exports.walkTokens;_();v();b();A0();sn();function NV(n){return JSON.stringify(n,zY)}function Sv(n){let e=JSON.parse(n);return e=d5(e),e}function zY(n,e){return e instanceof RegExp?{$mid:2,source:e.source,flags:e.flags}:e}function d5(n,e=0){if(!n||e>200)return n;if(typeof n=="object"){switch(n.$mid){case 1:return Oe.revive(n);case 2:return new RegExp(n.source,n.flags);case 17:return new Date(n.source)}if(n instanceof Sy||n instanceof Uint8Array)return n;if(Array.isArray(n))for(let t=0;t{let i=[],o=[];return n&&({href:n,dimensions:i}=TV(n),o.push(`src="${wv(n)}"`)),t&&o.push(`alt="${wv(t)}"`),e&&o.push(`title="${wv(e)}"`),i.length&&(o=o.concat(i)),""},paragraph:n=>`

    ${n}

    `,link:(n,e,t)=>typeof n!="string"?"":(n===t&&(t=bD(t)),e=typeof e=="string"?wv(bD(e)):"",n=bD(n),n=n.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"),`
    ${t}`)});function kp(n,e={},t={}){var i,o;let s=new ae,r=!1,a=cD(e),l=function(S){let w;try{w=Sv(decodeURIComponent(S))}catch{}return w?(w=Z1(w,y=>{if(n.uris&&n.uris[y])return Oe.revive(n.uris[y])}),encodeURIComponent(JSON.stringify(w))):S},c=function(S,w){let y=n.uris&&n.uris[S],x=Oe.revive(y);return w?S.startsWith(Ze.data+":")?S:(x||(x=Oe.parse(S)),Ww.uriToBrowserUri(x).toString(!0)):!x||Oe.parse(S).toString()===x.toString()?S:(x.query&&(x=x.with({query:l(x.query)})),x.toString())},d=new Xa.Renderer;d.image=h5.image,d.link=h5.link,d.paragraph=h5.paragraph;let h=[],u=[];if(e.codeBlockRendererSync?d.code=(S,w)=>{let y=c5.nextId(),x=e.codeBlockRendererSync(AV(w),S);return u.push([y,x]),`
    ${hu(S)}
    `}:e.codeBlockRenderer&&(d.code=(S,w)=>{let y=c5.nextId(),x=e.codeBlockRenderer(AV(w),S);return h.push(x.then(k=>[y,k])),`
    ${hu(S)}
    `}),e.actionHandler){let S=function(x){let k=x.target;if(!(k.tagName!=="A"&&(k=k.parentElement,!k||k.tagName!=="A")))try{let T=k.dataset.href;T&&(n.baseUri&&(T=u5(Oe.from(n.baseUri),T)),e.actionHandler.callback(T,x))}catch(T){ut(T)}finally{x.preventDefault()}},w=e.actionHandler.disposables.add(new et(a,"click")),y=e.actionHandler.disposables.add(new et(a,"auxclick"));e.actionHandler.disposables.add(ie.any(w.event,y.event)(x=>{let k=new yn(ge(a),x);!k.leftButton&&!k.middleButton||S(k)})),e.actionHandler.disposables.add($(a,"keydown",x=>{let k=new bt(x);!k.equals(10)&&!k.equals(3)||S(k)}))}n.supportHtml||(t.sanitizer=S=>(n.isTrusted?S.match(/^(]+>)|(<\/\s*span>)$/):void 0)?S:"",t.sanitize=!0,t.silent=!0),t.renderer=d;let f=(i=n.value)!==null&&i!==void 0?i:"";f.length>1e5&&(f=`${f.substr(0,1e5)}\u2026`),n.supportThemeIcons&&(f=DV(f));let g;if(e.fillInIncompleteTokens){let S={...Xa.defaults,...t},w=Xa.lexer(f,S),y=jY(w);g=Xa.parser(y,S)}else g=Xa.parse(f,t);n.supportThemeIcons&&(g=ra(g).map(w=>typeof w=="string"?w:w.outerHTML).join(""));let C=new DOMParser().parseFromString(f5(n,g),"text/html");if(C.body.querySelectorAll("img, audio, video, source").forEach(S=>{let w=S.getAttribute("src");if(w){let y=w;try{n.baseUri&&(y=u5(Oe.from(n.baseUri),y))}catch{}if(S.setAttribute("src",c(y,!0)),e.disallowRemoteImages){let x=Oe.parse(y).scheme;x!==Ze.file&&x!==Ze.data&&S.replaceWith(ve("",void 0,S.outerHTML))}}}),C.body.querySelectorAll("a").forEach(S=>{let w=S.getAttribute("href");if(S.setAttribute("href",""),!w||/^data:|javascript:/i.test(w)||/^command:/i.test(w)&&!n.isTrusted||/^command:(\/\/\/)?_workbench\.downloadResource/i.test(w))S.replaceWith(...S.childNodes);else{let y=c(w,!1);n.baseUri&&(y=u5(Oe.from(n.baseUri),w)),S.dataset.href=y}}),a.innerHTML=f5(n,C.body.innerHTML),h.length>0)Promise.all(h).then(S=>{var w,y;if(r)return;let x=new Map(S),k=a.querySelectorAll("div[data-code]");for(let T of k){let N=x.get((w=T.dataset.code)!==null&&w!==void 0?w:"");N&&Wi(T,N)}(y=e.asyncRenderCallback)===null||y===void 0||y.call(e)});else if(u.length>0){let S=new Map(u),w=a.querySelectorAll("div[data-code]");for(let y of w){let x=S.get((o=y.dataset.code)!==null&&o!==void 0?o:"");x&&Wi(y,x)}}if(e.asyncRenderCallback)for(let S of a.getElementsByTagName("img")){let w=s.add($(S,"load",()=>{w.dispose(),e.asyncRenderCallback()}))}return{element:a,dispose:()=>{r=!0,s.dispose()}}}function AV(n){if(!n)return"";let e=n.split(/[\s+|:|,|\{|\?]/,1);return e.length?e[0]:n}function u5(n,e){return/^\w[\w\d+.-]*:/.test(e)?e:n.path.endsWith("/")?SR(n,e).toString():SR(QW(n),e).toString()}function f5(n,e){let{config:t,allowedSchemes:i}=HY(n);l0("uponSanitizeAttribute",(s,r)=>{var a;if(r.attrName==="style"||r.attrName==="class"){if(s.tagName==="SPAN"){if(r.attrName==="style"){r.keepAttr=/^(color\:(#[0-9a-fA-F]+|var\(--vscode(-[a-zA-Z]+)+\));)?(background-color\:(#[0-9a-fA-F]+|var\(--vscode(-[a-zA-Z]+)+\));)?$/.test(r.attrValue);return}else if(r.attrName==="class"){r.keepAttr=/^codicon codicon-[a-z\-]+( codicon-modifier-[a-z\-]+)?$/.test(r.attrValue);return}}r.keepAttr=!1;return}else if(s.tagName==="INPUT"&&((a=s.attributes.getNamedItem("type"))===null||a===void 0?void 0:a.value)==="checkbox"){if(r.attrName==="type"&&r.attrValue==="checkbox"||r.attrName==="disabled"||r.attrName==="checked"){r.keepAttr=!0;return}r.keepAttr=!1}}),l0("uponSanitizeElement",(s,r)=>{var a,l;r.tagName==="input"&&(((a=s.attributes.getNamedItem("type"))===null||a===void 0?void 0:a.value)==="checkbox"?s.setAttribute("disabled",""):(l=s.parentElement)===null||l===void 0||l.removeChild(s))});let o=Z7(i);try{return Pw(e,{...t,RETURN_TRUSTED_TYPE:!0})}finally{Ow("uponSanitizeAttribute"),o.dispose()}}var VY=["align","autoplay","alt","checked","class","controls","data-code","data-href","disabled","draggable","height","href","loop","muted","playsinline","poster","src","style","target","title","type","width","start"];function HY(n){let e=[Ze.http,Ze.https,Ze.mailto,Ze.data,Ze.file,Ze.vscodeFileResource,Ze.vscodeRemote,Ze.vscodeRemoteResource];return n.isTrusted&&e.push(Ze.command),{config:{ALLOWED_TAGS:[...Y7],ALLOWED_ATTR:VY,ALLOW_UNKNOWN_PROTOCOLS:!0},allowedSchemes:e}}function PV(n){return typeof n=="string"?n:UY(n)}function UY(n){var e;let t=(e=n.value)!==null&&e!==void 0?e:"";t.length>1e5&&(t=`${t.substr(0,1e5)}\u2026`);let i=Xa.parse(t,{renderer:$Y.value}).replace(/&(#\d+|[a-zA-Z]+);/g,o=>{var s;return(s=KY.get(o))!==null&&s!==void 0?s:o});return f5({isTrusted:!1},i).toString()}var KY=new Map([[""",'"'],[" "," "],["&","&"],["'","'"],["<","<"],[">",">"]]),$Y=new qn(()=>{let n=new Xa.Renderer;return n.code=e=>e,n.blockquote=e=>e,n.html=e=>"",n.heading=(e,t,i)=>e+` +`,n.hr=()=>"",n.list=(e,t)=>e,n.listitem=e=>e+` +`,n.paragraph=e=>e+` +`,n.table=(e,t)=>e+t+` +`,n.tablerow=e=>e,n.tablecell=(e,t)=>e+" ",n.strong=e=>e,n.em=e=>e,n.codespan=e=>e,n.br=()=>` +`,n.del=e=>e,n.image=(e,t,i)=>"",n.text=e=>e,n.link=(e,t,i)=>i,n});function g5(n){let e="";return n.forEach(t=>{e+=t.raw}),e}function qY(n){var e,t;for(let i=0;iMV(a.raw)))return JY(n)}}}}function MV(n){return!!n.match(/^[^\[]*\]\([^\)]*$/)}function jY(n){let e,t;for(e=0;e"u"&&r.match(/^\s*\|/)){let a=r.match(/(\|[^\|]+)(?=\||$)/g);a&&(i=a.length)}else if(typeof i=="number")if(r.match(/^\s*\|/)){if(s!==t.length-1)return;o=!0}else return}if(typeof i=="number"&&i>0){let s=o?t.slice(0,-1).join(` +`):e,r=!!s.match(/\|\s*$/),a=s+(r?"":"|")+` +|${" --- |".repeat(i)}`;return Xa.lexer(a)}}xt();ye();le();Hr();Ma();var nX=function(n,e,t,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},OV=function(n,e){return function(t,i){e(t,i,n)}},m5,xv=m5=class{constructor(e,t,i){this._options=e,this._languageService=t,this._openerService=i,this._onDidRenderAsync=new B,this.onDidRenderAsync=this._onDidRenderAsync.event}dispose(){this._onDidRenderAsync.dispose()}render(e,t,i){if(!e)return{element:document.createElement("span"),dispose:()=>{}};let o=new ae,s=o.add(kp(e,{...this._getRenderOptions(e,o),...t},i));return s.element.classList.add("rendered-markdown"),{element:s.element,dispose:()=>o.dispose()}}_getRenderOptions(e,t){return{codeBlockRenderer:async(i,o)=>{var s,r,a;let l;i?l=this._languageService.getLanguageIdByLanguageName(i):this._options.editor&&(l=(s=this._options.editor.getModel())===null||s===void 0?void 0:s.getLanguageId()),l||(l=In);let c=await Nz(this._languageService,o,l),d=document.createElement("span");if(d.innerHTML=(a=(r=m5._ttpTokenizer)===null||r===void 0?void 0:r.createHTML(c))!==null&&a!==void 0?a:c,this._options.editor){let h=this._options.editor.getOption(50);Si(d,h)}else this._options.codeBlockFontFamily&&(d.style.fontFamily=this._options.codeBlockFontFamily);return this._options.codeBlockFontSize!==void 0&&(d.style.fontSize=this._options.codeBlockFontSize),d},asyncRenderCallback:()=>this._onDidRenderAsync.fire(),actionHandler:{callback:i=>p5(this._openerService,i,e.isTrusted),disposables:t}}}};xv._ttpTokenizer=Bs("tokenizeToString",{createHTML(n){return n}});xv=m5=nX([OV(1,ii),OV(2,Jl)],xv);async function p5(n,e,t){try{return await n.open(e,{fromUserGesture:!0,allowContributedOpeners:!0,allowCommands:oX(t)})}catch(i){return ut(i),!1}}function oX(n){return n===!0?!0:n&&Array.isArray(n.enabledCommands)?n.enabledCommands:!1}Lp();Ge();Lt();var sX=function(n,e,t,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},Lv=function(n,e){return function(t,i){e(t,i,n)}},nc=ve,vD=class extends co{get _targetWindow(){return ge(this._target.targetElements[0])}get _targetDocumentElement(){return ge(this._target.targetElements[0]).document.documentElement}get isDisposed(){return this._isDisposed}get isMouseIn(){return this._lockMouseTracker.isMouseIn}get domNode(){return this._hover.containerDomNode}get onDispose(){return this._onDispose.event}get onRequestLayout(){return this._onRequestLayout.event}get anchor(){return this._hoverPosition===2?0:1}get x(){return this._x}get y(){return this._y}get isLocked(){return this._isLocked}set isLocked(e){this._isLocked!==e&&(this._isLocked=e,this._hoverContainer.classList.toggle("locked",this._isLocked))}constructor(e,t,i,o,s,r){var a,l,c,d,h,u,f,g;super(),this._keybindingService=t,this._configurationService=i,this._openerService=o,this._instantiationService=s,this._accessibilityService=r,this._messageListeners=new ae,this._isDisposed=!1,this._forcePosition=!1,this._x=0,this._y=0,this._isLocked=!1,this._enableFocusTraps=!1,this._addedFocusTrap=!1,this._onDispose=this._register(new B),this._onRequestLayout=this._register(new B),this._linkHandler=e.linkHandler||(x=>p5(this._openerService,x,ic(e.content)?e.content.isTrusted:void 0)),this._target="targetElements"in e.target?e.target:new _5(e.target),this._hoverPointer=!((a=e.appearance)===null||a===void 0)&&a.showPointer?nc("div.workbench-hover-pointer"):void 0,this._hover=this._register(new aD),this._hover.containerDomNode.classList.add("workbench-hover","fadeIn"),!((l=e.appearance)===null||l===void 0)&&l.compact&&this._hover.containerDomNode.classList.add("workbench-hover","compact"),!((c=e.appearance)===null||c===void 0)&&c.skipFadeInAnimation&&this._hover.containerDomNode.classList.add("skip-fade-in"),e.additionalClasses&&this._hover.containerDomNode.classList.add(...e.additionalClasses),!((d=e.position)===null||d===void 0)&&d.forcePosition&&(this._forcePosition=!0),e.trapFocus&&(this._enableFocusTraps=!0),this._hoverPosition=(u=(h=e.position)===null||h===void 0?void 0:h.hoverPosition)!==null&&u!==void 0?u:3,this.onmousedown(this._hover.containerDomNode,x=>x.stopPropagation()),this.onkeydown(this._hover.containerDomNode,x=>{x.equals(9)&&this.dispose()}),this._register($(this._targetWindow,"blur",()=>this.dispose()));let m=nc("div.hover-row.markdown-hover"),C=nc("div.hover-contents");if(typeof e.content=="string")C.textContent=e.content,C.style.whiteSpace="pre-wrap";else if(e.content instanceof HTMLElement)C.appendChild(e.content),C.classList.add("html-hover-contents");else{let x=e.content,k=this._instantiationService.createInstance(xv,{codeBlockFontFamily:this._configurationService.getValue("editor").fontFamily||Ao.fontFamily}),{element:T}=k.render(x,{actionHandler:{callback:N=>this._linkHandler(N),disposables:this._messageListeners},asyncRenderCallback:()=>{C.classList.add("code-hover-contents"),this.layout(),this._onRequestLayout.fire()}});C.appendChild(T)}if(m.appendChild(C),this._hover.contentsDomNode.appendChild(m),e.actions&&e.actions.length>0){let x=nc("div.hover-row.status-bar"),k=nc("div.actions");e.actions.forEach(T=>{let N=this._keybindingService.lookupKeybinding(T.commandId),M=N?N.getLabel():null;lD.render(k,{label:T.label,commandId:T.commandId,run:W=>{T.run(W),this.dispose()},iconClass:T.iconClass},M)}),x.appendChild(k),this._hover.containerDomNode.appendChild(x)}this._hoverContainer=nc("div.workbench-hover-container"),this._hoverPointer&&this._hoverContainer.appendChild(this._hoverPointer),this._hoverContainer.appendChild(this._hover.containerDomNode);let S;if(e.actions&&e.actions.length>0?S=!1:((f=e.persistence)===null||f===void 0?void 0:f.hideOnHover)===void 0?S=typeof e.content=="string"||ic(e.content)&&!e.content.value.includes("](")&&!e.content.value.includes(""):S=e.persistence.hideOnHover,S&&(!((g=e.appearance)===null||g===void 0)&&g.showHoverHint)){let x=nc("div.hover-row.status-bar"),k=nc("div.info");k.textContent=p("hoverhint","Hold {0} key to mouse over",Be?"Option":"Alt"),x.appendChild(k),this._hover.containerDomNode.appendChild(x)}let w=[...this._target.targetElements];S||w.push(this._hoverContainer);let y=this._register(new CD(w));if(this._register(y.onMouseOut(()=>{this._isLocked||this.dispose()})),S){let x=[...this._target.targetElements,this._hoverContainer];this._lockMouseTracker=this._register(new CD(x)),this._register(this._lockMouseTracker.onMouseOut(()=>{this._isLocked||this.dispose()}))}else this._lockMouseTracker=y}addFocusTrap(){if(!this._enableFocusTraps||this._addedFocusTrap)return;this._addedFocusTrap=!0;let e=this._hover.containerDomNode,t=this.findLastFocusableChild(this._hover.containerDomNode);if(t){let i=Ug(this._hoverContainer,nc("div")),o=me(this._hoverContainer,nc("div"));i.tabIndex=0,o.tabIndex=0,this._register($(o,"focus",s=>{e.focus(),s.preventDefault()})),this._register($(i,"focus",s=>{t.focus(),s.preventDefault()}))}}findLastFocusableChild(e){if(e.hasChildNodes())for(let t=0;t=0)return s}let o=this.findLastFocusableChild(i);if(o)return o}}render(e){var t;e.appendChild(this._hoverContainer);let o=this._hoverContainer.contains(this._hoverContainer.ownerDocument.activeElement)&&oV(this._configurationService.getValue("accessibility.verbosity.hover")===!0&&this._accessibilityService.isScreenReaderOptimized(),(t=this._keybindingService.lookupKeybinding("editor.action.accessibleView"))===null||t===void 0?void 0:t.getAriaLabel());o&&Uu(o),this.layout(),this.addFocusTrap()}layout(){this._hover.containerDomNode.classList.remove("right-aligned"),this._hover.contentsDomNode.style.maxHeight="";let e=d=>{let h=Uw(d),u=d.getBoundingClientRect();return{top:u.top*h,bottom:u.bottom*h,right:u.right*h,left:u.left*h}},t=this._target.targetElements.map(d=>e(d)),{top:i,right:o,bottom:s,left:r}=t[0],a=o-r,l=s-i,c={top:i,right:o,bottom:s,left:r,width:a,height:l,center:{x:r+a/2,y:i+l/2}};if(this.adjustHorizontalHoverPosition(c),this.adjustVerticalHoverPosition(c),this.adjustHoverMaxHeight(c),this._hoverContainer.style.padding="",this._hoverContainer.style.margin="",this._hoverPointer){switch(this._hoverPosition){case 1:c.left+=3,c.right+=3,this._hoverContainer.style.paddingLeft="3px",this._hoverContainer.style.marginLeft="-3px";break;case 0:c.left-=3,c.right-=3,this._hoverContainer.style.paddingRight="3px",this._hoverContainer.style.marginRight="-3px";break;case 2:c.top+=3,c.bottom+=3,this._hoverContainer.style.paddingTop="3px",this._hoverContainer.style.marginTop="-3px";break;case 3:c.top-=3,c.bottom-=3,this._hoverContainer.style.paddingBottom="3px",this._hoverContainer.style.marginBottom="-3px";break}c.center.x=c.left+a/2,c.center.y=c.top+l/2}this.computeXCordinate(c),this.computeYCordinate(c),this._hoverPointer&&(this._hoverPointer.classList.remove("top"),this._hoverPointer.classList.remove("left"),this._hoverPointer.classList.remove("right"),this._hoverPointer.classList.remove("bottom"),this.setHoverPointerPosition(c)),this._hover.onContentsChanged()}computeXCordinate(e){let t=this._hover.containerDomNode.clientWidth+2;this._target.x!==void 0?this._x=this._target.x:this._hoverPosition===1?this._x=e.right:this._hoverPosition===0?this._x=e.left-t:(this._hoverPointer?this._x=e.center.x-this._hover.containerDomNode.clientWidth/2:this._x=e.left,this._x+t>=this._targetDocumentElement.clientWidth&&(this._hover.containerDomNode.classList.add("right-aligned"),this._x=Math.max(this._targetDocumentElement.clientWidth-t-2,this._targetDocumentElement.clientLeft))),this._xthis._targetWindow.innerHeight&&(this._y=e.bottom)}adjustHorizontalHoverPosition(e){if(this._target.x!==void 0)return;let t=this._hoverPointer?3:0;if(this._forcePosition){let i=t+2;this._hoverPosition===1?this._hover.containerDomNode.style.maxWidth=`${this._targetDocumentElement.clientWidth-e.right-i}px`:this._hoverPosition===0&&(this._hover.containerDomNode.style.maxWidth=`${e.left-i}px`);return}this._hoverPosition===1?this._targetDocumentElement.clientWidth-e.right=this._hover.containerDomNode.clientWidth+t?this._hoverPosition=0:this._hoverPosition=2):this._hoverPosition===0&&(e.left=this._hover.containerDomNode.clientWidth+t?this._hoverPosition=1:this._hoverPosition=2),e.left-this._hover.containerDomNode.clientWidth-t<=this._targetDocumentElement.clientLeft&&(this._hoverPosition=1))}adjustVerticalHoverPosition(e){if(this._target.y!==void 0||this._forcePosition)return;let t=this._hoverPointer?3:0;this._hoverPosition===3?e.top-this._hover.containerDomNode.clientHeight-t<0&&(this._hoverPosition=2):this._hoverPosition===2&&e.bottom+this._hover.containerDomNode.clientHeight+t>this._targetWindow.innerHeight&&(this._hoverPosition=3)}adjustHoverMaxHeight(e){let t=this._targetWindow.innerHeight/2;if(this._forcePosition){let i=(this._hoverPointer?3:0)+2;this._hoverPosition===3?t=Math.min(t,e.top-i):this._hoverPosition===2&&(t=Math.min(t,this._targetWindow.innerHeight-e.bottom-i))}if(this._hover.containerDomNode.style.maxHeight=`${t}px`,this._hover.contentsDomNode.clientHeighte.height?this._hoverPointer.style.top=`${e.center.y-(this._y-t)-3}px`:this._hoverPointer.style.top=`${Math.round(t/2)-3}px`;break}case 3:case 2:{this._hoverPointer.classList.add(this._hoverPosition===3?"bottom":"top");let t=this._hover.containerDomNode.clientWidth,i=Math.round(t/2)-3,o=this._x+i;(oe.right)&&(i=e.center.x-this._x-3),this._hoverPointer.style.left=`${i}px`;break}}}focus(){this._hover.containerDomNode.focus()}dispose(){this._isDisposed||(this._onDispose.fire(),this._hoverContainer.remove(),this._messageListeners.dispose(),this._target.dispose(),super.dispose()),this._isDisposed=!0}};vD=sX([Lv(1,fi),Lv(2,Rt),Lv(3,Jl),Lv(4,Ye),Lv(5,ao)],vD);var CD=class extends co{get onMouseOut(){return this._onMouseOut.event}get isMouseIn(){return this._isMouseIn}constructor(e){super(),this._elements=e,this._isMouseIn=!0,this._onMouseOut=this._register(new B),this._elements.forEach(t=>this.onmouseover(t,()=>this._onTargetMouseOver(t))),this._elements.forEach(t=>this.onmouseleave(t,()=>this._onTargetMouseLeave(t)))}_onTargetMouseOver(e){this._isMouseIn=!0,this._clearEvaluateMouseStateTimeout(e)}_onTargetMouseLeave(e){this._isMouseIn=!1,this._evaluateMouseState(e)}_evaluateMouseState(e){this._clearEvaluateMouseStateTimeout(e),this._mouseTimeout=ge(e).setTimeout(()=>this._fireIfMouseOutside(),0)}_clearEvaluateMouseStateTimeout(e){this._mouseTimeout&&(ge(e).clearTimeout(this._mouseTimeout),this._mouseTimeout=void 0)}_fireIfMouseOutside(){this._isMouseIn||this._onMouseOut.fire()}},_5=class{constructor(e){this._element=e,this.targetElements=[this._element]}dispose(){}};le();ke();oo();vo();_();v();b();_();v();b();Sw();ke();le();Lt();_();v();b();var cn;(function(n){function e(s,r){if(s.start>=r.end||r.start>=s.end)return{start:0,end:0};let a=Math.max(s.start,r.start),l=Math.min(s.end,r.end);return l-a<=0?{start:0,end:0}:{start:a,end:l}}n.intersect=e;function t(s){return s.end-s.start<=0}n.isEmpty=t;function i(s,r){return!t(e(s,r))}n.intersects=i;function o(s,r){let a=[],l={start:s.start,end:Math.min(r.start,s.end)},c={start:Math.max(r.end,s.start),end:s.end};return t(l)||a.push(l),t(c)||a.push(c),a}n.relativeComplement=o})(cn||(cn={}));function rX(n){let e=n;return!!e&&typeof e.x=="number"&&typeof e.y=="number"}var Th;(function(n){n[n.AVOID=0]="AVOID",n[n.ALIGN=1]="ALIGN"})(Th||(Th={}));function Nf(n,e,t){let i=t.mode===Th.ALIGN?t.offset:t.offset+t.size,o=t.mode===Th.ALIGN?t.offset+t.size:t.offset;return t.position===0?e<=n-i?i:e<=o?o-e:Math.max(n-e,0):e<=o?o-e:e<=n-i?i:0}var Dp=class n extends H{constructor(e,t){super(),this.container=null,this.useFixedPosition=!1,this.useShadowDOM=!1,this.delegate=null,this.toDisposeOnClean=H.None,this.toDisposeOnSetContainer=H.None,this.shadowRoot=null,this.shadowRootHostElement=null,this.view=ve(".context-view"),Zw(this.view),this.setContainer(e,t),this._register(be(()=>this.setContainer(null,1)))}setContainer(e,t){var i;this.useFixedPosition=t!==1;let o=this.useShadowDOM;if(this.useShadowDOM=t===3,!(e===this.container&&o===this.useShadowDOM)&&(this.container&&(this.toDisposeOnSetContainer.dispose(),this.shadowRoot?(this.shadowRoot.removeChild(this.view),this.shadowRoot=null,(i=this.shadowRootHostElement)===null||i===void 0||i.remove(),this.shadowRootHostElement=null):this.container.removeChild(this.view),this.container=null),e)){if(this.container=e,this.useShadowDOM){this.shadowRootHostElement=ve(".shadow-root-host"),this.container.appendChild(this.shadowRootHostElement),this.shadowRoot=this.shadowRootHostElement.attachShadow({mode:"open"});let r=document.createElement("style");r.textContent=aX,this.shadowRoot.appendChild(r),this.shadowRoot.appendChild(this.view),this.shadowRoot.appendChild(ve("slot"))}else this.container.appendChild(this.view);let s=new ae;n.BUBBLE_UP_EVENTS.forEach(r=>{s.add(Ut(this.container,r,a=>{this.onDOMEvent(a,!1)}))}),n.BUBBLE_DOWN_EVENTS.forEach(r=>{s.add(Ut(this.container,r,a=>{this.onDOMEvent(a,!0)},!0))}),this.toDisposeOnSetContainer=s}}show(e){var t,i,o;this.isVisible()&&this.hide(),Co(this.view),this.view.className="context-view monaco-component",this.view.style.top="0px",this.view.style.left="0px",this.view.style.zIndex=`${2575+((t=e.layer)!==null&&t!==void 0?t:0)}`,this.view.style.position=this.useFixedPosition?"fixed":"absolute",b0(this.view),this.toDisposeOnClean=e.render(this.view)||H.None,this.delegate=e,this.doLayout(),(o=(i=this.delegate).focus)===null||o===void 0||o.call(i)}getViewElement(){return this.view}layout(){var e,t;if(this.isVisible()){if(this.delegate.canRelayout===!1&&!(Rs&&Ag.pointerEvents)){this.hide();return}(t=(e=this.delegate)===null||e===void 0?void 0:e.layout)===null||t===void 0||t.call(e),this.doLayout()}}doLayout(){if(!this.isVisible())return;let e=this.delegate.getAnchor(),t;if(e instanceof HTMLElement){let u=Sn(e),f=Uw(e);t={top:u.top*f,left:u.left*f,width:u.width*f,height:u.height*f}}else rX(e)?t={top:e.y,left:e.x,width:e.width||1,height:e.height||2}:t={top:e.posy,left:e.posx,width:2,height:2};let i=Vg(this.view),o=p0(this.view),s=this.delegate.anchorPosition||0,r=this.delegate.anchorAlignment||0,a=this.delegate.anchorAxisAlignment||0,l,c,d=z7();if(a===0){let u={offset:t.top-d.pageYOffset,size:t.height,position:s===0?0:1},f={offset:t.left,size:t.width,position:r===0?0:1,mode:Th.ALIGN};l=Nf(d.innerHeight,o,u)+d.pageYOffset,cn.intersects({start:l,end:l+o},{start:u.offset,end:u.offset+u.size})&&(f.mode=Th.AVOID),c=Nf(d.innerWidth,i,f)}else{let u={offset:t.left,size:t.width,position:r===0?0:1},f={offset:t.top,size:t.height,position:s===0?0:1,mode:Th.ALIGN};c=Nf(d.innerWidth,i,u),cn.intersects({start:c,end:c+i},{start:u.offset,end:u.offset+u.size})&&(f.mode=Th.AVOID),l=Nf(d.innerHeight,o,f)+d.pageYOffset}this.view.classList.remove("top","bottom","left","right"),this.view.classList.add(s===0?"bottom":"top"),this.view.classList.add(r===0?"left":"right"),this.view.classList.toggle("fixed",this.useFixedPosition);let h=Sn(this.container);this.view.style.top=`${l-(this.useFixedPosition?Sn(this.view).top:h.top)}px`,this.view.style.left=`${c-(this.useFixedPosition?Sn(this.view).left:h.left)}px`,this.view.style.width="initial"}hide(e){let t=this.delegate;this.delegate=null,t?.onHide&&t.onHide(e),this.toDisposeOnClean.dispose(),Zw(this.view)}isVisible(){return!!this.delegate}onDOMEvent(e,t){this.delegate&&(this.delegate.onDOMEvent?this.delegate.onDOMEvent(e,ge(e).document.activeElement):t&&!yi(e.target,this.container)&&this.hide())}dispose(){this.hide(),super.dispose()}};Dp.BUBBLE_UP_EVENTS=["click","keydown","focus","blur"];Dp.BUBBLE_DOWN_EVENTS=["click"];var aX=` + :host { + all: initial; /* 1st rule so subsequent properties are reset. */ + } + + .codicon[class*='codicon-'] { + font: normal normal normal 16px/1 codicon; + display: inline-block; + text-decoration: none; + text-rendering: auto; + text-align: center; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + user-select: none; + -webkit-user-select: none; + -ms-user-select: none; + } + + :host { + font-family: -apple-system, BlinkMacSystemFont, "Segoe WPC", "Segoe UI", "HelveticaNeue-Light", system-ui, "Ubuntu", "Droid Sans", sans-serif; + } + + :host-context(.mac) { font-family: -apple-system, BlinkMacSystemFont, sans-serif; } + :host-context(.mac:lang(zh-Hans)) { font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", sans-serif; } + :host-context(.mac:lang(zh-Hant)) { font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", sans-serif; } + :host-context(.mac:lang(ja)) { font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic Pro", sans-serif; } + :host-context(.mac:lang(ko)) { font-family: -apple-system, BlinkMacSystemFont, "Nanum Gothic", "Apple SD Gothic Neo", "AppleGothic", sans-serif; } + + :host-context(.windows) { font-family: "Segoe WPC", "Segoe UI", sans-serif; } + :host-context(.windows:lang(zh-Hans)) { font-family: "Segoe WPC", "Segoe UI", "Microsoft YaHei", sans-serif; } + :host-context(.windows:lang(zh-Hant)) { font-family: "Segoe WPC", "Segoe UI", "Microsoft Jhenghei", sans-serif; } + :host-context(.windows:lang(ja)) { font-family: "Segoe WPC", "Segoe UI", "Yu Gothic UI", "Meiryo UI", sans-serif; } + :host-context(.windows:lang(ko)) { font-family: "Segoe WPC", "Segoe UI", "Malgun Gothic", "Dotom", sans-serif; } + + :host-context(.linux) { font-family: system-ui, "Ubuntu", "Droid Sans", sans-serif; } + :host-context(.linux:lang(zh-Hans)) { font-family: system-ui, "Ubuntu", "Droid Sans", "Source Han Sans SC", "Source Han Sans CN", "Source Han Sans", sans-serif; } + :host-context(.linux:lang(zh-Hant)) { font-family: system-ui, "Ubuntu", "Droid Sans", "Source Han Sans TC", "Source Han Sans TW", "Source Han Sans", sans-serif; } + :host-context(.linux:lang(ja)) { font-family: system-ui, "Ubuntu", "Droid Sans", "Source Han Sans J", "Source Han Sans JP", "Source Han Sans", sans-serif; } + :host-context(.linux:lang(ko)) { font-family: system-ui, "Ubuntu", "Droid Sans", "Source Han Sans K", "Source Han Sans JR", "Source Han Sans", "UnDotum", "FBaekmuk Gulim", sans-serif; } +`;le();ke();var lX=function(n,e,t,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},cX=function(n,e){return function(t,i){e(t,i,n)}},kv=class extends H{constructor(e){super(),this.layoutService=e,this.contextView=this._register(new Dp(this.layoutService.mainContainer,1)),this.layout(),this._register(e.onDidLayoutContainer(()=>this.layout()))}showContextView(e,t,i){let o;t?t===this.layoutService.getContainer(ge(t))?o=1:i?o=3:o=2:o=1,this.contextView.setContainer(t??this.layoutService.activeContainer,o),this.contextView.show(e);let s={close:()=>{this.openContextView===s&&this.hideContextView()}};return this.openContextView=s,s}layout(){this.contextView.layout()}hideContextView(e){this.contextView.hide(e),this.openContextView=void 0}};kv=lX([cX(0,ss)],kv);var wD=class extends kv{getContextViewElement(){return this.contextView.getViewElement()}};_();v();b();fs();Lp();xi();Ge();var yD=class{constructor(e,t,i){this.hoverDelegate=e,this.target=t,this.fadeInAnimation=i}async update(e,t,i){var o;if(this._cancellationTokenSource&&(this._cancellationTokenSource.dispose(!0),this._cancellationTokenSource=void 0),this.isDisposed)return;let s;if(e===void 0||tn(e)||e instanceof HTMLElement)s=e;else if(!cg(e.markdown))s=(o=e.markdown)!==null&&o!==void 0?o:e.markdownNotSupportedFallback;else{this._hoverWidget||this.show(p("iconLabel.loading","Loading..."),t),this._cancellationTokenSource=new un;let r=this._cancellationTokenSource.token;if(s=await e.markdown(r),s===void 0&&(s=e.markdownNotSupportedFallback),this.isDisposed||r.isCancellationRequested)return}this.show(s,t,i)}show(e,t,i){let o=this._hoverWidget;if(this.hasContent(e)){let s={content:e,target:this.target,appearance:{showPointer:this.hoverDelegate.placement==="element",skipFadeInAnimation:!this.fadeInAnimation||!!o},position:{hoverPosition:2},...i};this._hoverWidget=this.hoverDelegate.showHover(s,t)}o?.dispose()}hasContent(e){return e?ic(e)?!!e.value:!0:!1}get isDisposed(){var e;return(e=this._hoverWidget)===null||e===void 0?void 0:e.isDisposed}dispose(){var e,t;(e=this._hoverWidget)===null||e===void 0||e.dispose(),(t=this._cancellationTokenSource)===null||t===void 0||t.dispose(!0),this._cancellationTokenSource=void 0}};Gt();var dX=function(n,e,t,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},Dv=function(n,e){return function(t,i){e(t,i,n)}},b5=class extends H{constructor(e,t,i,o,s){super(),this._instantiationService=e,this._keybindingService=i,this._layoutService=o,this._accessibilityService=s,t.onDidShowContextMenu(()=>this.hideHover()),this._contextViewHandler=this._register(new kv(this._layoutService))}showHover(e,t,i){var o,s,r,a;if(FV(this._currentHoverOptions)===FV(e)||this._currentHover&&(!((s=(o=this._currentHoverOptions)===null||o===void 0?void 0:o.persistence)===null||s===void 0)&&s.sticky))return;this._currentHoverOptions=e,this._lastHoverOptions=e;let l=e.trapFocus||this._accessibilityService.isScreenReaderOptimized(),c=Bi();i||(l&&c?this._lastFocusedElementBeforeOpen=c:this._lastFocusedElementBeforeOpen=void 0);let d=new ae,h=this._instantiationService.createInstance(vD,e);if(!((r=e.persistence)===null||r===void 0)&&r.sticky&&(h.isLocked=!0),h.onDispose(()=>{var u,f;((u=this._currentHover)===null||u===void 0?void 0:u.domNode)&&qw(this._currentHover.domNode)&&((f=this._lastFocusedElementBeforeOpen)===null||f===void 0||f.focus()),this._currentHoverOptions===e&&(this._currentHoverOptions=void 0),d.dispose()},void 0,d),!e.container){let u=e.target instanceof HTMLElement?e.target:e.target.targetElements[0];e.container=this._layoutService.getContainer(ge(u))}if(this._contextViewHandler.showContextView(new v5(h,t),e.container),h.onRequestLayout(()=>this._contextViewHandler.layout(),void 0,d),!((a=e.persistence)===null||a===void 0)&&a.sticky)d.add($(ge(e.container).document,se.MOUSE_DOWN,u=>{yi(u.target,h.domNode)||this.doHideHover()}));else{if("targetElements"in e.target)for(let f of e.target.targetElements)d.add($(f,se.CLICK,()=>this.hideHover()));else d.add($(e.target,se.CLICK,()=>this.hideHover()));let u=Bi();if(u){let f=ge(u).document;d.add($(u,se.KEY_DOWN,g=>{var m;return this._keyDown(g,h,!!(!((m=e.persistence)===null||m===void 0)&&m.hideOnKeyDown))})),d.add($(f,se.KEY_DOWN,g=>{var m;return this._keyDown(g,h,!!(!((m=e.persistence)===null||m===void 0)&&m.hideOnKeyDown))})),d.add($(u,se.KEY_UP,g=>this._keyUp(g,h))),d.add($(f,se.KEY_UP,g=>this._keyUp(g,h)))}}if("IntersectionObserver"in gt){let u=new IntersectionObserver(g=>this._intersectionChange(g,h),{threshold:0}),f="targetElements"in e.target?e.target.targetElements[0]:e.target;u.observe(f),d.add(be(()=>u.disconnect()))}return this._currentHover=h,h}hideHover(){var e;!((e=this._currentHover)===null||e===void 0)&&e.isLocked||!this._currentHoverOptions||this.doHideHover()}doHideHover(){this._currentHover=void 0,this._currentHoverOptions=void 0,this._contextViewHandler.hideContextView()}_intersectionChange(e,t){e[e.length-1].isIntersecting||t.dispose()}showAndFocusLastHover(){this._lastHoverOptions&&this.showHover(this._lastHoverOptions,!0,!0)}_keyDown(e,t,i){var o,s;if(e.key==="Alt"){t.isLocked=!0;return}let r=new bt(e);this._keybindingService.resolveKeyboardEvent(r).getSingleModifierDispatchChords().some(l=>!!l)||this._keybindingService.softDispatch(r,r.target).kind!==0||i&&(!(!((o=this._currentHoverOptions)===null||o===void 0)&&o.trapFocus)||e.key!=="Tab")&&(this.hideHover(),(s=this._lastFocusedElementBeforeOpen)===null||s===void 0||s.focus())}_keyUp(e,t){var i;e.key==="Alt"&&(t.isLocked=!1,t.isMouseIn||(this.hideHover(),(i=this._lastFocusedElementBeforeOpen)===null||i===void 0||i.focus()))}setupUpdatableHover(e,t,i,o){t.setAttribute("custom-hover","true"),t.title!==""&&(console.warn("HTML element already has a title attribute, which will conflict with the custom hover. Please remove the title attribute."),console.trace("Stack trace:",t.title),t.title="");let s,r,a=(y,x)=>{var k;let T=r!==void 0;y&&(r?.dispose(),r=void 0),x&&(s?.dispose(),s=void 0),T&&((k=e.onDidHideHover)===null||k===void 0||k.call(e),r=void 0)},l=(y,x,k)=>new Xo(async()=>{(!r||r.isDisposed)&&(r=new yD(e,k||t,y>0),await r.update(typeof i=="function"?i():i,x,o))},y),c=!1,d=$(t,se.MOUSE_DOWN,()=>{c=!0,a(!0,!0)},!0),h=$(t,se.MOUSE_UP,()=>{c=!1},!0),u=$(t,se.MOUSE_LEAVE,y=>{c=!1,a(!1,y.fromElement===t)},!0),f=y=>{if(s)return;let x=new ae,k={targetElements:[t],dispose:()=>{}};if(e.placement===void 0||e.placement==="mouse"){let T=N=>{k.x=N.x+10,N.target instanceof HTMLElement&&BV(N.target,t)!==t&&a(!0,!0)};x.add($(t,se.MOUSE_MOVE,T,!0))}s=x,!(y.target instanceof HTMLElement&&BV(y.target,t)!==t)&&x.add(l(e.delay,!1,k))},g=$(t,se.MOUSE_OVER,f,!0),m=()=>{if(c||s)return;let y={targetElements:[t],dispose:()=>{}},x=new ae,k=()=>a(!0,!0);x.add($(t,se.BLUR,k,!0)),x.add(l(e.delay,!1,y)),s=x},C,S=t.tagName.toLowerCase();return S!=="input"&&S!=="textarea"&&(C=$(t,se.FOCUS,m,!0)),{show:y=>{a(!1,!0),l(0,y)},hide:()=>{a(!0,!0)},update:async(y,x)=>{i=y,await r?.update(i,void 0,x)},dispose:()=>{g.dispose(),u.dispose(),d.dispose(),h.dispose(),C?.dispose(),a(!0,!0)}}}};b5=dX([Dv(0,Ye),Dv(1,Ds),Dv(2,fi),Dv(3,ss),Dv(4,ao)],b5);function FV(n){var e;if(n!==void 0)return(e=n?.id)!==null&&e!==void 0?e:n}var v5=class{get anchorPosition(){return this._hover.anchor}constructor(e,t=!1){this._hover=e,this._focus=t,this.layer=1}render(e){return this._hover.render(e),this._focus&&this._hover.focus(),this._hover}getAnchor(){return{x:this._hover.x,y:this._hover.y}}layout(){this._hover.layout()}};function BV(n,e){for(e=e??ge(n).document.body;!n.hasAttribute("custom-hover")&&n!==e;)n=n.parentElement;return n}_t(Lh,b5,1);Lo((n,e)=>{let t=n.getColor(Q8);t&&(e.addRule(`.monaco-workbench .workbench-hover .hover-row:not(:first-child):not(:empty) { border-top: 1px solid ${t.transparent(.5)}; }`),e.addRule(`.monaco-workbench .workbench-hover hr { border-top: 1px solid ${t.transparent(.5)}; }`))});ot();ke();oo();ye();Mg();le();Lt();sn();_();v();b();qe();sn();xi();var WV=De("IWorkspaceEditService"),Ep=class{constructor(e){this.metadata=e}static convert(e){return e.edits.map(t=>{if(Ip.is(t))return Ip.lift(t);if(SD.is(t))return SD.lift(t);throw new Error("Unsupported edit")})}},Ip=class n extends Ep{static is(e){return e instanceof n?!0:dn(e)&&Oe.isUri(e.resource)&&dn(e.textEdit)}static lift(e){return e instanceof n?e:new n(e.resource,e.textEdit,e.versionId,e.metadata)}constructor(e,t,i=void 0,o){super(o),this.resource=e,this.textEdit=t,this.versionId=i}},SD=class n extends Ep{static is(e){return e instanceof n?!0:dn(e)&&(!!e.newResource||!!e.oldResource)}static lift(e){return e instanceof n?e:new n(e.oldResource,e.newResource,e.options,e.metadata)}constructor(e,t,i={},o){super(o),this.oldResource=e,this.newResource=t,this.options=i}};_();v();b();_();v();b();var Wn={enableSplitViewResizing:!0,splitViewDefaultRatio:.5,renderSideBySide:!0,renderMarginRevertIcon:!0,renderGutterMenu:!0,maxComputationTime:5e3,maxFileSize:50,ignoreTrimWhitespace:!0,renderIndicators:!0,originalEditable:!1,diffCodeLens:!1,renderOverviewRuler:!0,diffWordWrap:"inherit",diffAlgorithm:"advanced",accessibilityVerbose:!1,experimental:{showMoves:!1,showEmptyDecorations:!0},hideUnchangedRegions:{enabled:!1,contextLineCount:3,minimumLineCount:3,revealLineCount:20},isInEmbeddedEditor:!1,onlyShowAccessibleDiffViewer:!1,renderSideBySideInlineBreakpoint:900,useInlineViewWhenSpaceIsLimited:!0};I_();Ge();Du();Oo();var hX=Object.freeze({id:"editor",order:5,type:"object",title:p("editorConfigurationTitle","Editor"),scope:5}),LD={...hX,properties:{"editor.tabSize":{type:"number",default:nn.tabSize,minimum:1,markdownDescription:p("tabSize","The number of spaces a tab is equal to. This setting is overridden based on the file contents when {0} is on.","`#editor.detectIndentation#`")},"editor.indentSize":{anyOf:[{type:"string",enum:["tabSize"]},{type:"number",minimum:1}],default:"tabSize",markdownDescription:p("indentSize",'The number of spaces used for indentation or `"tabSize"` to use the value from `#editor.tabSize#`. This setting is overridden based on the file contents when `#editor.detectIndentation#` is on.')},"editor.insertSpaces":{type:"boolean",default:nn.insertSpaces,markdownDescription:p("insertSpaces","Insert spaces when pressing `Tab`. This setting is overridden based on the file contents when {0} is on.","`#editor.detectIndentation#`")},"editor.detectIndentation":{type:"boolean",default:nn.detectIndentation,markdownDescription:p("detectIndentation","Controls whether {0} and {1} will be automatically detected when a file is opened based on the file contents.","`#editor.tabSize#`","`#editor.insertSpaces#`")},"editor.trimAutoWhitespace":{type:"boolean",default:nn.trimAutoWhitespace,description:p("trimAutoWhitespace","Remove trailing auto inserted whitespace.")},"editor.largeFileOptimizations":{type:"boolean",default:nn.largeFileOptimizations,description:p("largeFileOptimizations","Special handling for large files to disable certain memory intensive features.")},"editor.wordBasedSuggestions":{enum:["off","currentDocument","matchingDocuments","allDocuments"],default:"matchingDocuments",enumDescriptions:[p("wordBasedSuggestions.off","Turn off Word Based Suggestions."),p("wordBasedSuggestions.currentDocument","Only suggest words from the active document."),p("wordBasedSuggestions.matchingDocuments","Suggest words from all open documents of the same language."),p("wordBasedSuggestions.allDocuments","Suggest words from all open documents.")],description:p("wordBasedSuggestions","Controls whether completions should be computed based on words in the document and from which documents they are computed.")},"editor.semanticHighlighting.enabled":{enum:[!0,!1,"configuredByTheme"],enumDescriptions:[p("semanticHighlighting.true","Semantic highlighting enabled for all color themes."),p("semanticHighlighting.false","Semantic highlighting disabled for all color themes."),p("semanticHighlighting.configuredByTheme","Semantic highlighting is configured by the current color theme's `semanticHighlighting` setting.")],default:"configuredByTheme",description:p("semanticHighlighting.enabled","Controls whether the semanticHighlighting is shown for the languages that support it.")},"editor.stablePeek":{type:"boolean",default:!1,markdownDescription:p("stablePeek","Keep peek editors open even when double-clicking their content or when hitting `Escape`.")},"editor.maxTokenizationLineLength":{type:"integer",default:2e4,description:p("maxTokenizationLineLength","Lines above this length will not be tokenized for performance reasons")},"editor.experimental.asyncTokenization":{type:"boolean",default:!1,description:p("editor.experimental.asyncTokenization","Controls whether the tokenization should happen asynchronously on a web worker."),tags:["experimental"]},"editor.experimental.asyncTokenizationLogging":{type:"boolean",default:!1,description:p("editor.experimental.asyncTokenizationLogging","Controls whether async tokenization should be logged. For debugging only.")},"editor.experimental.asyncTokenizationVerification":{type:"boolean",default:!1,description:p("editor.experimental.asyncTokenizationVerification","Controls whether async tokenization should be verified against legacy background tokenization. Might slow down tokenization. For debugging only."),tags:["experimental"]},"editor.language.brackets":{type:["array","null"],default:null,description:p("schema.brackets","Defines the bracket symbols that increase or decrease the indentation."),items:{type:"array",items:[{type:"string",description:p("schema.openBracket","The opening bracket character or string sequence.")},{type:"string",description:p("schema.closeBracket","The closing bracket character or string sequence.")}]}},"editor.language.colorizedBracketPairs":{type:["array","null"],default:null,description:p("schema.colorizedBracketPairs","Defines the bracket pairs that are colorized by their nesting level if bracket pair colorization is enabled."),items:{type:"array",items:[{type:"string",description:p("schema.openBracket","The opening bracket character or string sequence.")},{type:"string",description:p("schema.closeBracket","The closing bracket character or string sequence.")}]}},"diffEditor.maxComputationTime":{type:"number",default:Wn.maxComputationTime,description:p("maxComputationTime","Timeout in milliseconds after which diff computation is cancelled. Use 0 for no timeout.")},"diffEditor.maxFileSize":{type:"number",default:Wn.maxFileSize,description:p("maxFileSize","Maximum file size in MB for which to compute diffs. Use 0 for no limit.")},"diffEditor.renderSideBySide":{type:"boolean",default:Wn.renderSideBySide,description:p("sideBySide","Controls whether the diff editor shows the diff side by side or inline.")},"diffEditor.renderSideBySideInlineBreakpoint":{type:"number",default:Wn.renderSideBySideInlineBreakpoint,description:p("renderSideBySideInlineBreakpoint","If the diff editor width is smaller than this value, the inline view is used.")},"diffEditor.useInlineViewWhenSpaceIsLimited":{type:"boolean",default:Wn.useInlineViewWhenSpaceIsLimited,description:p("useInlineViewWhenSpaceIsLimited","If enabled and the editor width is too small, the inline view is used.")},"diffEditor.renderMarginRevertIcon":{type:"boolean",default:Wn.renderMarginRevertIcon,description:p("renderMarginRevertIcon","When enabled, the diff editor shows arrows in its glyph margin to revert changes.")},"diffEditor.renderGutterMenu":{type:"boolean",default:Wn.renderGutterMenu,description:p("renderGutterMenu","When enabled, the diff editor shows a special gutter for revert and stage actions.")},"diffEditor.ignoreTrimWhitespace":{type:"boolean",default:Wn.ignoreTrimWhitespace,description:p("ignoreTrimWhitespace","When enabled, the diff editor ignores changes in leading or trailing whitespace.")},"diffEditor.renderIndicators":{type:"boolean",default:Wn.renderIndicators,description:p("renderIndicators","Controls whether the diff editor shows +/- indicators for added/removed changes.")},"diffEditor.codeLens":{type:"boolean",default:Wn.diffCodeLens,description:p("codeLens","Controls whether the editor shows CodeLens.")},"diffEditor.wordWrap":{type:"string",enum:["off","on","inherit"],default:Wn.diffWordWrap,markdownEnumDescriptions:[p("wordWrap.off","Lines will never wrap."),p("wordWrap.on","Lines will wrap at the viewport width."),p("wordWrap.inherit","Lines will wrap according to the {0} setting.","`#editor.wordWrap#`")]},"diffEditor.diffAlgorithm":{type:"string",enum:["legacy","advanced"],default:Wn.diffAlgorithm,markdownEnumDescriptions:[p("diffAlgorithm.legacy","Uses the legacy diffing algorithm."),p("diffAlgorithm.advanced","Uses the advanced diffing algorithm.")],tags:["experimental"]},"diffEditor.hideUnchangedRegions.enabled":{type:"boolean",default:Wn.hideUnchangedRegions.enabled,markdownDescription:p("hideUnchangedRegions.enabled","Controls whether the diff editor shows unchanged regions.")},"diffEditor.hideUnchangedRegions.revealLineCount":{type:"integer",default:Wn.hideUnchangedRegions.revealLineCount,markdownDescription:p("hideUnchangedRegions.revealLineCount","Controls how many lines are used for unchanged regions."),minimum:1},"diffEditor.hideUnchangedRegions.minimumLineCount":{type:"integer",default:Wn.hideUnchangedRegions.minimumLineCount,markdownDescription:p("hideUnchangedRegions.minimumLineCount","Controls how many lines are used as a minimum for unchanged regions."),minimum:1},"diffEditor.hideUnchangedRegions.contextLineCount":{type:"integer",default:Wn.hideUnchangedRegions.contextLineCount,markdownDescription:p("hideUnchangedRegions.contextLineCount","Controls how many lines are used as context when comparing unchanged regions."),minimum:1},"diffEditor.experimental.showMoves":{type:"boolean",default:Wn.experimental.showMoves,markdownDescription:p("showMoves","Controls whether the diff editor should show detected code moves.")},"diffEditor.experimental.showEmptyDecorations":{type:"boolean",default:Wn.experimental.showEmptyDecorations,description:p("showEmptyDecorations","Controls whether the diff editor shows empty decorations to see where characters got inserted or deleted.")}}};function uX(n){return typeof n.type<"u"||typeof n.anyOf<"u"}for(let n of wd){let e=n.schema;if(typeof e<"u")if(uX(e))LD.properties[`editor.${n.name}`]=e;else for(let t in e)Object.hasOwnProperty.call(e,t)&&(LD.properties[t]=e[t])}var xD=null;function zV(){return xD===null&&(xD=Object.create(null),Object.keys(LD.properties).forEach(n=>{xD[n]=!0})),xD}function VV(n){return zV()[`editor.${n}`]||!1}function HV(n){return zV()[`diffEditor.${n}`]||!1}var fX=Vt.as(ar.Configuration);fX.registerConfiguration(LD);_();v();b();Ke();var Af=class{static insert(e,t){return{range:new P(e.lineNumber,e.column,e.lineNumber,e.column),text:t,forceMoveMarkers:!0}}static delete(e){return{range:e,text:null}}static replace(e,t){return{range:e,text:t}}static replaceMove(e,t){return{range:e,text:t,forceMoveMarkers:!0}}};ft();Ke();_u();Jw();ir();Fo();_();v();b();wt();cr();hs();xi();sn();Fo();Du();Oo();function kD(n){return Object.isFrozen(n)?n:s9(n)}var ko=class n{static createEmptyModel(e){return new n({},[],[],void 0,e)}constructor(e,t,i,o,s){this._contents=e,this._keys=t,this._overrides=i,this.raw=o,this.logService=s,this.overrideConfigurations=new Map}get rawConfiguration(){var e;if(!this._rawConfiguration)if(!((e=this.raw)===null||e===void 0)&&e.length){let t=this.raw.map(i=>{if(i instanceof n)return i;let o=new C5("",this.logService);return o.parseRaw(i),o.configurationModel});this._rawConfiguration=t.reduce((i,o)=>o===i?o:i.merge(o),t[0])}else this._rawConfiguration=this;return this._rawConfiguration}get contents(){return this._contents}get overrides(){return this._overrides}get keys(){return this._keys}isEmpty(){return this._keys.length===0&&Object.keys(this._contents).length===0&&this._overrides.length===0}getValue(e){return e?FN(this.contents,e):this.contents}inspect(e,t){let i=this;return{get value(){return kD(i.rawConfiguration.getValue(e))},get override(){return t?kD(i.rawConfiguration.getOverrideValue(e,t)):void 0},get merged(){return kD(t?i.rawConfiguration.override(t).getValue(e):i.rawConfiguration.getValue(e))},get overrides(){let o=[];for(let{contents:s,identifiers:r,keys:a}of i.rawConfiguration.overrides){let l=new n(s,a,[],void 0,i.logService).getValue(e);l!==void 0&&o.push({identifiers:r,value:l})}return o.length?kD(o):void 0}}}getOverrideValue(e,t){let i=this.getContentsForOverrideIdentifer(t);return i?e?FN(i,e):i:void 0}override(e){let t=this.overrideConfigurations.get(e);return t||(t=this.createOverrideConfigurationModel(e),this.overrideConfigurations.set(e,t)),t}merge(...e){var t,i;let o=cl(this.contents),s=cl(this.overrides),r=[...this.keys],a=!((t=this.raw)===null||t===void 0)&&t.length?[...this.raw]:[this];for(let l of e)if(a.push(...!((i=l.raw)===null||i===void 0)&&i.length?l.raw:[l]),!l.isEmpty()){this.mergeContents(o,l.contents);for(let c of l.overrides){let[d]=s.filter(h=>Ht(h.identifiers,c.identifiers));d?(this.mergeContents(d.contents,c.contents),d.keys.push(...c.keys),d.keys=xr(d.keys)):s.push(cl(c))}for(let c of l.keys)r.indexOf(c)===-1&&r.push(c)}return new n(o,r,s,a.every(l=>l instanceof n)?void 0:a,this.logService)}createOverrideConfigurationModel(e){let t=this.getContentsForOverrideIdentifer(e);if(!t||typeof t!="object"||!Object.keys(t).length)return this;let i={};for(let o of xr([...Object.keys(this.contents),...Object.keys(t)])){let s=this.contents[o],r=t[o];r&&(typeof s=="object"&&typeof r=="object"?(s=cl(s),this.mergeContents(s,r)):s=r),i[o]=s}return new n(i,this.keys,this.overrides,void 0,this.logService)}mergeContents(e,t){for(let i of Object.keys(t)){if(i in e&&dn(e[i])&&dn(t[i])){this.mergeContents(e[i],t[i]);continue}e[i]=cl(t[i])}}getContentsForOverrideIdentifer(e){let t=null,i=null,o=s=>{s&&(i?this.mergeContents(i,s):i=cl(s))};for(let s of this.overrides)s.identifiers.length===1&&s.identifiers[0]===e?t=s.contents:s.identifiers.includes(e)&&o(s.contents);return o(t),i}toJSON(){return{contents:this.contents,overrides:this.overrides,keys:this.keys}}addValue(e,t){this.updateValue(e,t,!0)}setValue(e,t){this.updateValue(e,t,!1)}removeValue(e){let t=this.keys.indexOf(e);t!==-1&&(this.keys.splice(t,1),k3(this.contents,e),Tc.test(e)&&this.overrides.splice(this.overrides.findIndex(i=>Ht(i.identifiers,P0(e))),1))}updateValue(e,t,i){ON(this.contents,e,t,o=>this.logService.error(o)),i=i||this.keys.indexOf(e)===-1,i&&this.keys.push(e),Tc.test(e)&&this.overrides.push({identifiers:P0(e),keys:Object.keys(this.contents[e]),contents:Ay(this.contents[e],o=>this.logService.error(o))})}},C5=class{constructor(e,t){this._name=e,this.logService=t,this._raw=null,this._configurationModel=null,this._restrictedConfigurations=[]}get configurationModel(){return this._configurationModel||ko.createEmptyModel(this.logService)}parseRaw(e,t){this._raw=e;let{contents:i,keys:o,overrides:s,restricted:r,hasExcludedProperties:a}=this.doParseRaw(e,t);this._configurationModel=new ko(i,o,s,a?[e]:void 0,this.logService),this._restrictedConfigurations=r||[]}doParseRaw(e,t){let i=Vt.as(ar.Configuration).getConfigurationProperties(),o=this.filter(e,i,!0,t);e=o.raw;let s=Ay(e,l=>this.logService.error(`Conflict in settings file ${this._name}: ${l}`)),r=Object.keys(e),a=this.toOverrides(e,l=>this.logService.error(`Conflict in settings file ${this._name}: ${l}`));return{contents:s,keys:r,overrides:a,restricted:o.restricted,hasExcludedProperties:o.hasExcludedProperties}}filter(e,t,i,o){var s,r,a;let l=!1;if(!o?.scopes&&!o?.skipRestricted&&!(!((s=o?.exclude)===null||s===void 0)&&s.length))return{raw:e,restricted:[],hasExcludedProperties:l};let c={},d=[];for(let h in e)if(Tc.test(h)&&i){let u=this.filter(e[h],t,!1,o);c[h]=u.raw,l=l||u.hasExcludedProperties,d.push(...u.restricted)}else{let u=t[h],f=u?typeof u.scope<"u"?u.scope:3:void 0;u?.restricted&&d.push(h),!(!((r=o.exclude)===null||r===void 0)&&r.includes(h))&&(!((a=o.include)===null||a===void 0)&&a.includes(h)||(f===void 0||o.scopes===void 0||o.scopes.includes(f))&&!(o.skipRestricted&&u?.restricted))?c[h]=e[h]:l=!0}return{raw:c,restricted:d,hasExcludedProperties:l}}toOverrides(e,t){let i=[];for(let o of Object.keys(e))if(Tc.test(o)){let s={};for(let r in e[o])s[r]=e[o][r];i.push({identifiers:P0(o),keys:Object.keys(s),contents:Ay(s,t)})}return i}},w5=class{constructor(e,t,i,o,s,r,a,l,c,d,h,u,f){this.key=e,this.overrides=t,this._value=i,this.overrideIdentifiers=o,this.defaultConfiguration=s,this.policyConfiguration=r,this.applicationConfiguration=a,this.userConfiguration=l,this.localUserConfiguration=c,this.remoteUserConfiguration=d,this.workspaceConfiguration=h,this.folderConfigurationModel=u,this.memoryConfigurationModel=f}toInspectValue(e){return e?.value!==void 0||e?.override!==void 0||e?.overrides!==void 0?e:void 0}get userInspectValue(){return this._userInspectValue||(this._userInspectValue=this.userConfiguration.inspect(this.key,this.overrides.overrideIdentifier)),this._userInspectValue}get user(){return this.toInspectValue(this.userInspectValue)}},Ev=class n{constructor(e,t,i,o,s,r,a,l,c,d){this._defaultConfiguration=e,this._policyConfiguration=t,this._applicationConfiguration=i,this._localUserConfiguration=o,this._remoteUserConfiguration=s,this._workspaceConfiguration=r,this._folderConfigurations=a,this._memoryConfiguration=l,this._memoryConfigurationByResource=c,this.logService=d,this._workspaceConsolidatedConfiguration=null,this._foldersConsolidatedConfigurations=new Gn,this._userConfiguration=null}getValue(e,t,i){return this.getConsolidatedConfigurationModel(e,t,i).getValue(e)}updateValue(e,t,i={}){let o;i.resource?(o=this._memoryConfigurationByResource.get(i.resource),o||(o=ko.createEmptyModel(this.logService),this._memoryConfigurationByResource.set(i.resource,o))):o=this._memoryConfiguration,t===void 0?o.removeValue(e):o.setValue(e,t),i.resource||(this._workspaceConsolidatedConfiguration=null)}inspect(e,t,i){let o=this.getConsolidatedConfigurationModel(e,t,i),s=this.getFolderConfigurationModelForResource(t.resource,i),r=t.resource?this._memoryConfigurationByResource.get(t.resource)||this._memoryConfiguration:this._memoryConfiguration,a=new Set;for(let l of o.overrides)for(let c of l.identifiers)o.getOverrideValue(e,c)!==void 0&&a.add(c);return new w5(e,t,o.getValue(e),a.size?[...a]:void 0,this._defaultConfiguration,this._policyConfiguration.isEmpty()?void 0:this._policyConfiguration,this.applicationConfiguration.isEmpty()?void 0:this.applicationConfiguration,this.userConfiguration,this.localUserConfiguration,this.remoteUserConfiguration,i?this._workspaceConfiguration:void 0,s||void 0,r)}get applicationConfiguration(){return this._applicationConfiguration}get userConfiguration(){return this._userConfiguration||(this._userConfiguration=this._remoteUserConfiguration.isEmpty()?this._localUserConfiguration:this._localUserConfiguration.merge(this._remoteUserConfiguration)),this._userConfiguration}get localUserConfiguration(){return this._localUserConfiguration}get remoteUserConfiguration(){return this._remoteUserConfiguration}getConsolidatedConfigurationModel(e,t,i){let o=this.getConsolidatedConfigurationModelForResource(t,i);return t.overrideIdentifier&&(o=o.override(t.overrideIdentifier)),!this._policyConfiguration.isEmpty()&&this._policyConfiguration.getValue(e)!==void 0&&(o=o.merge(this._policyConfiguration)),o}getConsolidatedConfigurationModelForResource({resource:e},t){let i=this.getWorkspaceConsolidatedConfiguration();if(t&&e){let o=t.getFolder(e);o&&(i=this.getFolderConsolidatedConfiguration(o.uri)||i);let s=this._memoryConfigurationByResource.get(e);s&&(i=i.merge(s))}return i}getWorkspaceConsolidatedConfiguration(){return this._workspaceConsolidatedConfiguration||(this._workspaceConsolidatedConfiguration=this._defaultConfiguration.merge(this.applicationConfiguration,this.userConfiguration,this._workspaceConfiguration,this._memoryConfiguration)),this._workspaceConsolidatedConfiguration}getFolderConsolidatedConfiguration(e){let t=this._foldersConsolidatedConfigurations.get(e);if(!t){let i=this.getWorkspaceConsolidatedConfiguration(),o=this._folderConfigurations.get(e);o?(t=i.merge(o),this._foldersConsolidatedConfigurations.set(e,t)):t=i}return t}getFolderConfigurationModelForResource(e,t){if(t&&e){let i=t.getFolder(e);if(i)return this._folderConfigurations.get(i.uri)}}toData(){return{defaults:{contents:this._defaultConfiguration.contents,overrides:this._defaultConfiguration.overrides,keys:this._defaultConfiguration.keys},policy:{contents:this._policyConfiguration.contents,overrides:this._policyConfiguration.overrides,keys:this._policyConfiguration.keys},application:{contents:this.applicationConfiguration.contents,overrides:this.applicationConfiguration.overrides,keys:this.applicationConfiguration.keys},user:{contents:this.userConfiguration.contents,overrides:this.userConfiguration.overrides,keys:this.userConfiguration.keys},workspace:{contents:this._workspaceConfiguration.contents,overrides:this._workspaceConfiguration.overrides,keys:this._workspaceConfiguration.keys},folders:[...this._folderConfigurations.keys()].reduce((e,t)=>{let{contents:i,overrides:o,keys:s}=this._folderConfigurations.get(t);return e.push([t,{contents:i,overrides:o,keys:s}]),e},[])}}static parse(e,t){let i=this.parseConfigurationModel(e.defaults,t),o=this.parseConfigurationModel(e.policy,t),s=this.parseConfigurationModel(e.application,t),r=this.parseConfigurationModel(e.user,t),a=this.parseConfigurationModel(e.workspace,t),l=e.folders.reduce((c,d)=>(c.set(Oe.revive(d[0]),this.parseConfigurationModel(d[1],t)),c),new Gn);return new n(i,o,s,r,ko.createEmptyModel(t),a,l,ko.createEmptyModel(t),new Gn,t)}static parseConfigurationModel(e,t){return new ko(e.contents,e.keys,e.overrides,void 0,t)}},DD=class{constructor(e,t,i,o,s){this.change=e,this.previous=t,this.currentConfiguraiton=i,this.currentWorkspace=o,this.logService=s,this._marker=` +`,this._markerCode1=this._marker.charCodeAt(0),this._markerCode2=46,this.affectedKeys=new Set,this._previousConfiguration=void 0;for(let r of e.keys)this.affectedKeys.add(r);for(let[,r]of e.overrides)for(let a of r)this.affectedKeys.add(a);this._affectsConfigStr=this._marker;for(let r of this.affectedKeys)this._affectsConfigStr+=r+this._marker}get previousConfiguration(){return!this._previousConfiguration&&this.previous&&(this._previousConfiguration=Ev.parse(this.previous.data,this.logService)),this._previousConfiguration}affectsConfiguration(e,t){var i;let o=this._marker+e,s=this._affectsConfigStr.indexOf(o);if(s<0)return!1;let r=s+o.length;if(r>=this._affectsConfigStr.length)return!1;let a=this._affectsConfigStr.charCodeAt(r);if(a!==this._markerCode1&&a!==this._markerCode2)return!1;if(t){let l=this.previousConfiguration?this.previousConfiguration.getValue(e,t,(i=this.previous)===null||i===void 0?void 0:i.workspace):void 0,c=this.currentConfiguraiton.getValue(e,t,this.currentWorkspace);return!hn(l,c)}return!0}};Oi();qe();_();v();b();Gt();xt();ye();le();Ge();_();v();b();Oi();var Iv={kind:0},gX={kind:1};function mX(n,e,t){return{kind:2,commandId:n,commandArgs:e,isBubble:t}}var ED=class n{constructor(e,t,i){var o;this._log=i,this._defaultKeybindings=e,this._defaultBoundCommands=new Map;for(let s of e){let r=s.command;r&&r.charAt(0)!=="-"&&this._defaultBoundCommands.set(r,!0)}this._map=new Map,this._lookupMap=new Map,this._keybindings=n.handleRemovals([].concat(e).concat(t));for(let s=0,r=this._keybindings.length;s"u"){this._map.set(e,[t]),this._addToLookupMap(t);return}for(let o=i.length-1;o>=0;o--){let s=i[o];if(s.command===t.command)continue;let r=!0;for(let a=1;a"u"?(t=[e],this._lookupMap.set(e.command,t)):t.push(e)}_removeFromLookupMap(e){if(!e.command)return;let t=this._lookupMap.get(e.command);if(!(typeof t>"u")){for(let i=0,o=t.length;i"u"||i.length===0)return null;if(i.length===1)return i[0];for(let o=i.length-1;o>=0;o--){let s=i[o];if(t.contextMatchesRules(s.when))return s}return i[i.length-1]}resolve(e,t,i){let o=[...t,i];this._log(`| Resolving ${o}`);let s=this._map.get(o[0]);if(s===void 0)return this._log("\\ No keybinding entries."),Iv;let r=null;if(o.length<2)r=s;else{r=[];for(let l=0,c=s.length;ld.chords.length)continue;let h=!0;for(let u=1;u=0;i--){let o=t[i];if(n._contextMatchesRules(e,o.when))return o}return null}static _contextMatchesRules(e,t){return t?t.evaluate(e):!0}};function UV(n){return n?`${n.serialize()}`:"no when condition"}function KV(n){return n.extensionId?n.isBuiltinExtension?`built-in extension ${n.extensionId}`:`user extension ${n.extensionId}`:n.isDefault?"built-in":"user"}var pX=/^(cursor|delete|undo|redo|tab|editor\.action\.clipboard)/,ID=class extends H{get onDidUpdateKeybindings(){return this._onDidUpdateKeybindings?this._onDidUpdateKeybindings.event:ie.None}get inChordMode(){return this._currentChords.length>0}constructor(e,t,i,o,s){super(),this._contextKeyService=e,this._commandService=t,this._telemetryService=i,this._notificationService=o,this._logService=s,this._onDidUpdateKeybindings=this._register(new B),this._currentChords=[],this._currentChordChecker=new Fd,this._currentChordStatusMessage=null,this._ignoreSingleModifiers=Nh.EMPTY,this._currentSingleModifier=null,this._currentSingleModifierClearTimeout=new Xo,this._currentlyDispatchingCommandId=null,this._logging=!1}dispose(){super.dispose()}_log(e){this._logging&&this._logService.info(`[KeybindingService]: ${e}`)}getKeybindings(){return this._getResolver().getKeybindings()}lookupKeybinding(e,t){let i=this._getResolver().lookupPrimaryKeybinding(e,t||this._contextKeyService);if(i)return i.resolvedKeybinding}dispatchEvent(e,t){return this._dispatch(e,t)}softDispatch(e,t){this._log("/ Soft dispatching keyboard event");let i=this.resolveKeyboardEvent(e);if(i.hasMultipleChords())return console.warn("keyboard event should not be mapped to multiple chords"),Iv;let[o]=i.getDispatchChords();if(o===null)return this._log("\\ Keyboard event cannot be dispatched"),Iv;let s=this._contextKeyService.getContext(t),r=this._currentChords.map(({keypress:a})=>a);return this._getResolver().resolve(s,r,o)}_scheduleLeaveChordMode(){let e=Date.now();this._currentChordChecker.cancelAndSet(()=>{if(!this._documentHasFocus()){this._leaveChordMode();return}Date.now()-e>5e3&&this._leaveChordMode()},500)}_expectAnotherChord(e,t){switch(this._currentChords.push({keypress:e,label:t}),this._currentChords.length){case 0:throw _g("impossible");case 1:this._currentChordStatusMessage=this._notificationService.status(p("first.chord","({0}) was pressed. Waiting for second key of chord...",t));break;default:{let i=this._currentChords.map(({label:o})=>o).join(", ");this._currentChordStatusMessage=this._notificationService.status(p("next.chord","({0}) was pressed. Waiting for next key of chord...",i))}}this._scheduleLeaveChordMode(),af.enabled&&af.disable()}_leaveChordMode(){this._currentChordStatusMessage&&(this._currentChordStatusMessage.dispose(),this._currentChordStatusMessage=null),this._currentChordChecker.cancel(),this._currentChords=[],af.enable()}_dispatch(e,t){return this._doDispatch(this.resolveKeyboardEvent(e),t,!1)}_singleModifierDispatch(e,t){let i=this.resolveKeyboardEvent(e),[o]=i.getSingleModifierDispatchChords();if(o)return this._ignoreSingleModifiers.has(o)?(this._log(`+ Ignoring single modifier ${o} due to it being pressed together with other keys.`),this._ignoreSingleModifiers=Nh.EMPTY,this._currentSingleModifierClearTimeout.cancel(),this._currentSingleModifier=null,!1):(this._ignoreSingleModifiers=Nh.EMPTY,this._currentSingleModifier===null?(this._log(`+ Storing single modifier for possible chord ${o}.`),this._currentSingleModifier=o,this._currentSingleModifierClearTimeout.cancelAndSet(()=>{this._log("+ Clearing single modifier due to 300ms elapsed."),this._currentSingleModifier=null},300),!1):o===this._currentSingleModifier?(this._log(`/ Dispatching single modifier chord ${o} ${o}`),this._currentSingleModifierClearTimeout.cancel(),this._currentSingleModifier=null,this._doDispatch(i,t,!0)):(this._log(`+ Clearing single modifier due to modifier mismatch: ${this._currentSingleModifier} ${o}`),this._currentSingleModifierClearTimeout.cancel(),this._currentSingleModifier=null,!1));let[s]=i.getChords();return this._ignoreSingleModifiers=new Nh(s),this._currentSingleModifier!==null&&this._log("+ Clearing single modifier due to other key up."),this._currentSingleModifierClearTimeout.cancel(),this._currentSingleModifier=null,!1}_doDispatch(e,t,i=!1){var o;let s=!1;if(e.hasMultipleChords())return console.warn("Unexpected keyboard event mapped to multiple chords"),!1;let r=null,a=null;if(i){let[h]=e.getSingleModifierDispatchChords();r=h,a=h?[h]:[]}else[r]=e.getDispatchChords(),a=this._currentChords.map(({keypress:h})=>h);if(r===null)return this._log("\\ Keyboard event cannot be dispatched in keydown phase."),s;let l=this._contextKeyService.getContext(t),c=e.getLabel(),d=this._getResolver().resolve(l,a,r);switch(d.kind){case 0:{if(this._logService.trace("KeybindingService#dispatch",c,"[ No matching keybinding ]"),this.inChordMode){let h=this._currentChords.map(({label:u})=>u).join(", ");this._log(`+ Leaving multi-chord mode: Nothing bound to "${h}, ${c}".`),this._notificationService.status(p("missing.chord","The key combination ({0}, {1}) is not a command.",h,c),{hideAfter:10*1e3}),this._leaveChordMode(),s=!0}return s}case 1:return this._logService.trace("KeybindingService#dispatch",c,"[ Several keybindings match - more chords needed ]"),s=!0,this._expectAnotherChord(r,c),this._log(this._currentChords.length===1?"+ Entering multi-chord mode...":"+ Continuing multi-chord mode..."),s;case 2:{if(this._logService.trace("KeybindingService#dispatch",c,`[ Will dispatch command ${d.commandId} ]`),d.commandId===null||d.commandId===""){if(this.inChordMode){let h=this._currentChords.map(({label:u})=>u).join(", ");this._log(`+ Leaving chord mode: Nothing bound to "${h}, ${c}".`),this._notificationService.status(p("missing.chord","The key combination ({0}, {1}) is not a command.",h,c),{hideAfter:10*1e3}),this._leaveChordMode(),s=!0}}else{this.inChordMode&&this._leaveChordMode(),d.isBubble||(s=!0),this._log(`+ Invoking command ${d.commandId}.`),this._currentlyDispatchingCommandId=d.commandId;try{typeof d.commandArgs>"u"?this._commandService.executeCommand(d.commandId).then(void 0,h=>this._notificationService.warn(h)):this._commandService.executeCommand(d.commandId,d.commandArgs).then(void 0,h=>this._notificationService.warn(h))}finally{this._currentlyDispatchingCommandId=null}pX.test(d.commandId)||this._telemetryService.publicLog2("workbenchActionExecuted",{id:d.commandId,from:"keybinding",detail:(o=e.getUserSettingsLabel())!==null&&o!==void 0?o:void 0})}return s}}}mightProducePrintableCharacter(e){return e.ctrlKey||e.metaKey?!1:e.keyCode>=31&&e.keyCode<=56||e.keyCode>=21&&e.keyCode<=30}},Nh=class{constructor(e){this._ctrlKey=e?e.ctrlKey:!1,this._shiftKey=e?e.shiftKey:!1,this._altKey=e?e.altKey:!1,this._metaKey=e?e.metaKey:!1}has(e){switch(e){case"ctrl":return this._ctrlKey;case"shift":return this._shiftKey;case"alt":return this._altKey;case"meta":return this._metaKey}}};Nh.EMPTY=new Nh(null);k0();_();v();b();var Tv=class{constructor(e,t,i,o,s,r,a){this._resolvedKeybindingItemBrand=void 0,this.resolvedKeybinding=e,this.chords=e?TD(e.getDispatchChords()):[],e&&this.chords.length===0&&(this.chords=TD(e.getSingleModifierDispatchChords())),this.bubble=t?t.charCodeAt(0)===94:!1,this.command=this.bubble?t.substr(1):t,this.commandArgs=i,this.when=o,this.isDefault=s,this.extensionId=r,this.isBuiltinExtension=a}};function TD(n){let e=[];for(let t=0,i=n.length;tthis._getLabel(e))}getAriaLabel(){return $V.toLabel(this._os,this._chords,e=>this._getAriaLabel(e))}getElectronAccelerator(){return this._chords.length>1||this._chords[0].isDuplicateModifierCase()?null:qV.toLabel(this._os,this._chords,e=>this._getElectronAccelerator(e))}getUserSettingsLabel(){return jV.toLabel(this._os,this._chords,e=>this._getUserSettingsLabel(e))}hasMultipleChords(){return this._chords.length>1}getChords(){return this._chords.map(e=>this._getChord(e))}_getChord(e){return new Lw(e.ctrlKey,e.shiftKey,e.altKey,e.metaKey,this._getLabel(e),this._getAriaLabel(e))}getDispatchChords(){return this._chords.map(e=>this._getChordDispatch(e))}getSingleModifierDispatchChords(){return this._chords.map(e=>this._getSingleModifierChordDispatch(e))}};var Nv=class n extends ND{constructor(e,t){super(t,e)}_keyCodeToUILabel(e){if(this._os===2)switch(e){case 15:return"\u2190";case 16:return"\u2191";case 17:return"\u2192";case 18:return"\u2193"}return Ir.toString(e)}_getLabel(e){return e.isDuplicateModifierCase()?"":this._keyCodeToUILabel(e.keyCode)}_getAriaLabel(e){return e.isDuplicateModifierCase()?"":Ir.toString(e.keyCode)}_getElectronAccelerator(e){return Ir.toElectronAccelerator(e.keyCode)}_getUserSettingsLabel(e){if(e.isDuplicateModifierCase())return"";let t=Ir.toUserSettingsUS(e.keyCode);return t&&t.toLowerCase()}_getChordDispatch(e){return n.getDispatchStr(e)}static getDispatchStr(e){if(e.isModifierKey())return null;let t="";return e.ctrlKey&&(t+="ctrl+"),e.shiftKey&&(t+="shift+"),e.altKey&&(t+="alt+"),e.metaKey&&(t+="meta+"),t+=Ir.toString(e.keyCode),t}_getSingleModifierChordDispatch(e){return e.keyCode===5&&!e.shiftKey&&!e.altKey&&!e.metaKey?"ctrl":e.keyCode===4&&!e.ctrlKey&&!e.altKey&&!e.metaKey?"shift":e.keyCode===6&&!e.ctrlKey&&!e.shiftKey&&!e.metaKey?"alt":e.keyCode===57&&!e.ctrlKey&&!e.shiftKey&&!e.altKey?"meta":null}static _scanCodeToKeyCode(e){let t=uC[e];if(t!==-1)return t;switch(e){case 10:return 31;case 11:return 32;case 12:return 33;case 13:return 34;case 14:return 35;case 15:return 36;case 16:return 37;case 17:return 38;case 18:return 39;case 19:return 40;case 20:return 41;case 21:return 42;case 22:return 43;case 23:return 44;case 24:return 45;case 25:return 46;case 26:return 47;case 27:return 48;case 28:return 49;case 29:return 50;case 30:return 51;case 31:return 52;case 32:return 53;case 33:return 54;case 34:return 55;case 35:return 56;case 36:return 22;case 37:return 23;case 38:return 24;case 39:return 25;case 40:return 26;case 41:return 27;case 42:return 28;case 43:return 29;case 44:return 30;case 45:return 21;case 51:return 88;case 52:return 86;case 53:return 92;case 54:return 94;case 55:return 93;case 56:return 0;case 57:return 85;case 58:return 95;case 59:return 91;case 60:return 87;case 61:return 89;case 62:return 90;case 106:return 97}return 0}static _toKeyCodeChord(e){if(!e)return null;if(e instanceof pl)return e;let t=this._scanCodeToKeyCode(e.scanCode);return t===0?null:new pl(e.ctrlKey,e.shiftKey,e.altKey,e.metaKey,t)}static resolveKeybinding(e,t){let i=TD(e.chords.map(o=>this._toKeyCodeChord(o)));return i.length>0?[new n(i,t)]:[]}};_();v();b();qe();var GV=De("labelService");_();v();b();qe();var ZV=De("progressService"),ije=Object.freeze({total(){},worked(){},done(){}}),y5=class{constructor(e){this.callback=e}report(e){this._value=e,this.callback(this._value)}};y5.None=Object.freeze({report(){}});var Ap=De("editorProgressService");Gg();_();v();b();Ge();wc();_();v();b();ot();var S5=class{constructor(){this._value="",this._pos=0}reset(e){return this._value=e,this._pos=0,this}next(){return this._pos+=1,this}hasNext(){return this._pos=0;t--,this._valueLen--){let i=this._value.charCodeAt(t);if(!(i===47||this._splitOnBackslash&&i===92))break}return this.next()}hasNext(){return this._to!1,t=()=>!1){return new n(new k5(e,t))}static forStrings(){return new n(new S5)}static forConfigKeys(){return new n(new x5)}constructor(e){this._iter=e}clear(){this._root=void 0}set(e,t){let i=this._iter.reset(e),o;this._root||(this._root=new Mp,this._root.segment=i.value());let s=[];for(o=this._root;;){let a=i.cmp(o.segment);if(a>0)o.left||(o.left=new Mp,o.left.segment=i.value()),s.push([-1,o]),o=o.left;else if(a<0)o.right||(o.right=new Mp,o.right.segment=i.value()),s.push([1,o]),o=o.right;else if(i.hasNext())i.next(),o.mid||(o.mid=new Mp,o.mid.segment=i.value()),s.push([0,o]),o=o.mid;else break}let r=o.value;o.value=t,o.key=e;for(let a=s.length-1;a>=0;a--){let l=s[a][1];l.updateHeight();let c=l.balanceFactor();if(c<-1||c>1){let d=s[a][0],h=s[a+1][0];if(d===1&&h===1)s[a][1]=l.rotateLeft();else if(d===-1&&h===-1)s[a][1]=l.rotateRight();else if(d===1&&h===-1)l.right=s[a+1][1]=s[a+1][1].rotateRight(),s[a][1]=l.rotateLeft();else if(d===-1&&h===1)l.left=s[a+1][1]=s[a+1][1].rotateLeft(),s[a][1]=l.rotateRight();else throw new Error;if(a>0)switch(s[a-1][0]){case-1:s[a-1][1].left=s[a][1];break;case 1:s[a-1][1].right=s[a][1];break;case 0:s[a-1][1].mid=s[a][1];break}else this._root=s[0][1]}}return r}get(e){var t;return(t=this._getNode(e))===null||t===void 0?void 0:t.value}_getNode(e){let t=this._iter.reset(e),i=this._root;for(;i;){let o=t.cmp(i.segment);if(o>0)i=i.left;else if(o<0)i=i.right;else if(t.hasNext())t.next(),i=i.mid;else break}return i}has(e){let t=this._getNode(e);return!(t?.value===void 0&&t?.mid===void 0)}delete(e){return this._delete(e,!1)}deleteSuperstr(e){return this._delete(e,!0)}_delete(e,t){var i;let o=this._iter.reset(e),s=[],r=this._root;for(;r;){let a=o.cmp(r.segment);if(a>0)s.push([-1,r]),r=r.left;else if(a<0)s.push([1,r]),r=r.right;else if(o.hasNext())o.next(),s.push([0,r]),r=r.mid;else break}if(r){if(t?(r.left=void 0,r.mid=void 0,r.right=void 0,r.height=1):(r.key=void 0,r.value=void 0),!r.mid&&!r.value)if(r.left&&r.right){let a=this._min(r.right);if(a.key){let{key:l,value:c,segment:d}=a;this._delete(a.key,!1),r.key=l,r.value=c,r.segment=d}}else{let a=(i=r.left)!==null&&i!==void 0?i:r.right;if(s.length>0){let[l,c]=s[s.length-1];switch(l){case-1:c.left=a;break;case 0:c.mid=a;break;case 1:c.right=a;break}}else this._root=a}for(let a=s.length-1;a>=0;a--){let l=s[a][1];l.updateHeight();let c=l.balanceFactor();if(c>1?(l.right.balanceFactor()>=0||(l.right=l.right.rotateRight()),s[a][1]=l.rotateLeft()):c<-1&&(l.left.balanceFactor()<=0||(l.left=l.left.rotateLeft()),s[a][1]=l.rotateRight()),a>0)switch(s[a-1][0]){case-1:s[a-1][1].left=s[a][1];break;case 1:s[a-1][1].right=s[a][1];break;case 0:s[a-1][1].mid=s[a][1];break}else this._root=s[0][1]}}}_min(e){for(;e.left;)e=e.left;return e}findSubstr(e){let t=this._iter.reset(e),i=this._root,o;for(;i;){let s=t.cmp(i.segment);if(s>0)i=i.left;else if(s<0)i=i.right;else if(t.hasNext())t.next(),o=i.value||o,i=i.mid;else break}return i&&i.value||o}findSuperstr(e){return this._findSuperstrOrElement(e,!1)}_findSuperstrOrElement(e,t){let i=this._iter.reset(e),o=this._root;for(;o;){let s=i.cmp(o.segment);if(s>0)o=o.left;else if(s<0)o=o.right;else if(i.hasNext())i.next(),o=o.mid;else return o.mid?this._entries(o.mid):t?o.value:void 0}}forEach(e){for(let[t,i]of this)e(i,t)}*[Symbol.iterator](){yield*this._entries(this._root)}_entries(e){let t=[];return this._dfsEntries(e,t),t[Symbol.iterator]()}_dfsEntries(e,t){e&&(e.left&&this._dfsEntries(e.left,t),e.value&&t.push([e.key,e.value]),e.mid&&this._dfsEntries(e.mid,t),e.right&&this._dfsEntries(e.right,t))}};sn();qe();var YV=De("contextService");function bX(n){let e=n;return typeof e?.id=="string"&&Oe.isUri(e.uri)}function _je(n){let e=n;return typeof e?.id=="string"&&!bX(n)&&!wX(n)}var vX={id:"ext-dev"},CX={id:"empty-window"};function bje(n,e){if(typeof n=="string"||typeof n>"u")return typeof n=="string"?{id:xg(n)}:e?vX:CX;let t=n;return t.configuration?{id:t.id,configPath:t.configuration}:t.folders.length===1?{id:t.id,uri:t.folders[0].uri}:{id:t.id}}function wX(n){let e=n;return typeof e?.id=="string"&&Oe.isUri(e.configPath)}var AD=class{constructor(e,t){this.raw=t,this.uri=e.uri,this.index=e.index,this.name=e.name}toJSON(){return{uri:this.uri,name:this.name,index:this.index}}},yX="code-workspace",vje=[{name:p("codeWorkspace","Code Workspace"),extensions:[yX]}],D5="4064f6ec-cb38-4ad0-af64-ee6467e63c82";function Cje(n){return n.id===D5}E5();bf();Or();Aa();_();v();b();qe();var nH=De("workspaceTrustManagementService");_();v();b();ye();le();_();v();b();ye();le();ot();_();v();b();M0();er();wc();bf();ot();Ma();var Rp=[],I5=[],sH=[];function Rv(n,e=!1){SX(n,!1,e)}function SX(n,e,t){let i=xX(n,e);Rp.push(i),i.userConfigured?sH.push(i):I5.push(i),t&&!i.userConfigured&&Rp.forEach(o=>{o.mime===i.mime||o.userConfigured||(i.extension&&o.extension===i.extension&&console.warn(`Overwriting extension <<${i.extension}>> to now point to mime <<${i.mime}>>`),i.filename&&o.filename===i.filename&&console.warn(`Overwriting filename <<${i.filename}>> to now point to mime <<${i.mime}>>`),i.filepattern&&o.filepattern===i.filepattern&&console.warn(`Overwriting filepattern <<${i.filepattern}>> to now point to mime <<${i.mime}>>`),i.firstline&&o.firstline===i.firstline&&console.warn(`Overwriting firstline <<${i.firstline}>> to now point to mime <<${i.mime}>>`))})}function xX(n,e){return{id:n.id,mime:n.mime,filename:n.filename,extension:n.extension,filepattern:n.filepattern,firstline:n.firstline,userConfigured:e,filenameLowercase:n.filename?n.filename.toLowerCase():void 0,extensionLowercase:n.extension?n.extension.toLowerCase():void 0,filepatternLowercase:n.filepattern?z4(n.filepattern.toLowerCase()):void 0,filepatternOnPath:n.filepattern?n.filepattern.indexOf(ci.sep)>=0:!1}}function rH(){Rp=Rp.filter(n=>n.userConfigured),I5=[]}function aH(n,e){return LX(n,e).map(t=>t.id)}function LX(n,e){let t;if(n)switch(n.scheme){case Ze.file:t=n.fsPath;break;case Ze.data:{t=$b.parseMetaData(n).get($b.META_DATA_LABEL);break}case Ze.vscodeNotebookCell:t=void 0;break;default:t=n.path}if(!t)return[{id:"unknown",mime:rr.unknown}];t=t.toLowerCase();let i=xg(t),o=oH(t,i,sH);if(o)return[o,{id:In,mime:rr.text}];let s=oH(t,i,I5);if(s)return[s,{id:In,mime:rr.text}];if(e){let r=kX(e);if(r)return[r,{id:In,mime:rr.text}]}return[{id:"unknown",mime:rr.unknown}]}function oH(n,e,t){var i;let o,s,r;for(let a=t.length-1;a>=0;a--){let l=t[a];if(e===l.filenameLowercase){o=l;break}if(l.filepattern&&(!s||l.filepattern.length>s.filepattern.length)){let c=l.filepatternOnPath?n:e;!((i=l.filepatternLowercase)===null||i===void 0)&&i.call(l,c)&&(s=l)}l.extension&&(!r||l.extension.length>r.extension.length)&&e.endsWith(l.extensionLowercase)&&(r=l)}if(o)return o;if(s)return s;if(r)return r}function kX(n){if(Tg(n)&&(n=n.substr(1)),n.length>0)for(let e=Rp.length-1;e>=0;e--){let t=Rp[e];if(!t.firstline)continue;let i=n.match(t.firstline);if(i&&i.length>0)return t}}Ma();Du();Oo();var RD=Object.prototype.hasOwnProperty,lH="vs.editor.nullLanguage",T5=class{constructor(){this._languageIdToLanguage=[],this._languageToLanguageId=new Map,this._register(lH,0),this._register(In,1),this._nextLanguageId=2}_register(e,t){this._languageIdToLanguage[t]=e,this._languageToLanguageId.set(e,t)}register(e){if(this._languageToLanguageId.has(e))return;let t=this._nextLanguageId++;this._register(e,t)}encodeLanguageId(e){return this._languageToLanguageId.get(e)||0}decodeLanguageId(e){return this._languageIdToLanguage[e]||lH}},Pv=class n extends H{constructor(e=!0,t=!1){super(),this._onDidChange=this._register(new B),this.onDidChange=this._onDidChange.event,n.instanceCount++,this._warnOnOverwrite=t,this.languageIdCodec=new T5,this._dynamicLanguages=[],this._languages={},this._mimeTypesMap={},this._nameMap={},this._lowercaseNameMap={},e&&(this._initializeFromRegistry(),this._register($d.onDidChangeLanguages(i=>{this._initializeFromRegistry()})))}dispose(){n.instanceCount--,super.dispose()}_initializeFromRegistry(){this._languages={},this._mimeTypesMap={},this._nameMap={},this._lowercaseNameMap={},rH();let e=[].concat($d.getLanguages()).concat(this._dynamicLanguages);this._registerLanguages(e)}_registerLanguages(e){for(let t of e)this._registerLanguage(t);this._mimeTypesMap={},this._nameMap={},this._lowercaseNameMap={},Object.keys(this._languages).forEach(t=>{let i=this._languages[t];i.name&&(this._nameMap[i.name]=i.identifier),i.aliases.forEach(o=>{this._lowercaseNameMap[o.toLowerCase()]=i.identifier}),i.mimetypes.forEach(o=>{this._mimeTypesMap[o]=i.identifier})}),Vt.as(ar.Configuration).registerOverrideIdentifiers(this.getRegisteredLanguageIds()),this._onDidChange.fire()}_registerLanguage(e){let t=e.id,i;RD.call(this._languages,t)?i=this._languages[t]:(this.languageIdCodec.register(t),i={identifier:t,name:null,mimetypes:[],aliases:[],extensions:[],filenames:[],configurationFiles:[],icons:[]},this._languages[t]=i),this._mergeLanguage(i,e)}_mergeLanguage(e,t){let i=t.id,o=null;if(Array.isArray(t.mimetypes)&&t.mimetypes.length>0&&(e.mimetypes.push(...t.mimetypes),o=t.mimetypes[0]),o||(o=`text/x-${i}`,e.mimetypes.push(o)),Array.isArray(t.extensions)){t.configuration?e.extensions=t.extensions.concat(e.extensions):e.extensions=e.extensions.concat(t.extensions);for(let a of t.extensions)Rv({id:i,mime:o,extension:a},this._warnOnOverwrite)}if(Array.isArray(t.filenames))for(let a of t.filenames)Rv({id:i,mime:o,filename:a},this._warnOnOverwrite),e.filenames.push(a);if(Array.isArray(t.filenamePatterns))for(let a of t.filenamePatterns)Rv({id:i,mime:o,filepattern:a},this._warnOnOverwrite);if(typeof t.firstLine=="string"&&t.firstLine.length>0){let a=t.firstLine;a.charAt(0)!=="^"&&(a="^"+a);try{let l=new RegExp(a);c7(l)||Rv({id:i,mime:o,firstline:l},this._warnOnOverwrite)}catch(l){console.warn(`[${t.id}]: Invalid regular expression \`${a}\`: `,l)}}e.aliases.push(i);let s=null;if(typeof t.aliases<"u"&&Array.isArray(t.aliases)&&(t.aliases.length===0?s=[null]:s=t.aliases),s!==null)for(let a of s)!a||a.length===0||e.aliases.push(a);let r=s!==null&&s.length>0;if(!(r&&s[0]===null)){let a=(r?s[0]:null)||i;(r||!e.name)&&(e.name=a)}t.configuration&&e.configurationFiles.push(t.configuration),t.icon&&e.icons.push(t.icon)}isRegisteredLanguageId(e){return e?RD.call(this._languages,e):!1}getRegisteredLanguageIds(){return Object.keys(this._languages)}getLanguageIdByLanguageName(e){let t=e.toLowerCase();return RD.call(this._lowercaseNameMap,t)?this._lowercaseNameMap[t]:null}getLanguageIdByMimeType(e){return e&&RD.call(this._mimeTypesMap,e)?this._mimeTypesMap[e]:null}guessLanguageIdByFilepathOrFirstLine(e,t){return!e&&!t?[]:aH(e,t)}};Pv.instanceCount=0;wt();Yo();Ma();var Ov=class n extends H{constructor(e=!1){super(),this._onDidRequestBasicLanguageFeatures=this._register(new B),this.onDidRequestBasicLanguageFeatures=this._onDidRequestBasicLanguageFeatures.event,this._onDidRequestRichLanguageFeatures=this._register(new B),this.onDidRequestRichLanguageFeatures=this._onDidRequestRichLanguageFeatures.event,this._onDidChange=this._register(new B({leakWarningThreshold:200})),this.onDidChange=this._onDidChange.event,this._requestedBasicLanguages=new Set,this._requestedRichLanguages=new Set,n.instanceCount++,this._registry=this._register(new Pv(!0,e)),this.languageIdCodec=this._registry.languageIdCodec,this._register(this._registry.onDidChange(()=>this._onDidChange.fire()))}dispose(){n.instanceCount--,super.dispose()}isRegisteredLanguageId(e){return this._registry.isRegisteredLanguageId(e)}getLanguageIdByLanguageName(e){return this._registry.getLanguageIdByLanguageName(e)}getLanguageIdByMimeType(e){return this._registry.getLanguageIdByMimeType(e)}guessLanguageIdByFilepathOrFirstLine(e,t){let i=this._registry.guessLanguageIdByFilepathOrFirstLine(e,t);return lg(i,null)}createById(e){return new PD(this.onDidChange,()=>this._createAndGetLanguageIdentifier(e))}createByFilepathOrFirstLine(e,t){return new PD(this.onDidChange,()=>{let i=this.guessLanguageIdByFilepathOrFirstLine(e,t);return this._createAndGetLanguageIdentifier(i)})}_createAndGetLanguageIdentifier(e){return(!e||!this.isRegisteredLanguageId(e))&&(e=In),e}requestBasicLanguageFeatures(e){this._requestedBasicLanguages.has(e)||(this._requestedBasicLanguages.add(e),this._onDidRequestBasicLanguageFeatures.fire(e))}requestRichLanguageFeatures(e){this._requestedRichLanguages.has(e)||(this._requestedRichLanguages.add(e),this.requestBasicLanguageFeatures(e),Bt.getOrCreate(e),this._onDidRequestRichLanguageFeatures.fire(e))}};Ov.instanceCount=0;var PD=class{constructor(e,t){this._onDidChangeLanguages=e,this._selector=t,this._listener=null,this._emitter=null,this.languageId=this._selector()}_dispose(){this._listener&&(this._listener.dispose(),this._listener=null),this._emitter&&(this._emitter.dispose(),this._emitter=null)}get onDidChange(){return this._listener||(this._listener=this._onDidChangeLanguages(()=>this._evaluate())),this._emitter||(this._emitter=new B({onDidRemoveLastListener:()=>{this._dispose()}})),this._emitter.event}_evaluate(){var e;let t=this._selector();t!==this.languageId&&(this.languageId=t,(e=this._emitter)===null||e===void 0||e.fire(this.languageId))}};_();v();b();ke();Po();ye();le();_();v();b();ke();oo();_();v();b();ps();_();v();b();M0();var OD={RESOURCES:"ResourceURLs",DOWNLOAD_URL:"DownloadURL",FILES:"Files",TEXT:rr.text,INTERNAL_URI_LIST:"application/vnd.code.uri-list"};ke();_();v();b();Md();var DX=()=>({get delay(){return-1},dispose:()=>{},showHover:()=>{}}),FD=DX,EX=new qn(()=>FD("mouse",!1)),IX=new qn(()=>FD("element",!1));function cH(n){FD=n}function ji(n){return n==="element"?IX.value:EX.value}function Mf(){return FD("element",!0)}_();v();b();_();v();b();ke();oo();_();v();b();var dH={showHover:()=>{},hideHover:()=>{},showAndFocusLastHover:()=>{},setupUpdatableHover:()=>null};function hH(n){dH=n}function Qn(){return dH}_();v();b();ke();oo();_();v();b();var BD=class{constructor(e){this.spliceables=e}splice(e,t,i){this.spliceables.forEach(o=>o.splice(e,t,i))}};wt();Gt();gn();ye();mD();le();Cp();Lt();xi();_();v();b();var oc=class extends Error{constructor(e,t){super(`ListError [${e}] ${t}`)}};_();v();b();ke();wt();Gt();ye();le();_();v();b();function uH(n,e){let t=[];for(let i of e){if(n.start>=i.range.end)continue;if(n.ende.concat(t),[]))}var WD=class{get paddingTop(){return this._paddingTop}set paddingTop(e){this._size=this._size+e-this._paddingTop,this._paddingTop=e}constructor(e){this.groups=[],this._size=0,this._paddingTop=0,this._paddingTop=e??0,this._size=this._paddingTop}splice(e,t,i=[]){let o=i.length-t,s=uH({start:0,end:e},this.groups),r=uH({start:e+t,end:Number.POSITIVE_INFINITY},this.groups).map(l=>({range:zD(l.range,o),size:l.size})),a=i.map((l,c)=>({range:{start:e+c,end:e+c+1},size:l.size}));this.groups=NX(s,a,r),this._size=this._paddingTop+this.groups.reduce((l,c)=>l+c.size*(c.range.end-c.range.start),0)}get count(){let e=this.groups.length;return e?this.groups[e-1].range.end:0}get size(){return this._size}indexAt(e){if(e<0)return-1;if(e{for(let i of e)this.getRenderer(t).disposeTemplate(i.templateData),i.templateData=null}),this.cache.clear(),this.transactionNodesPendingRemoval.clear()}getRenderer(e){let t=this.renderers.get(e);if(!t)throw new Error(`No renderer found for ${e}`);return t}};xt();Cp();var ed=function(n,e,t,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},Rf={CurrentDragAndDropData:void 0},sc={useShadows:!0,verticalScrollMode:1,setRowLineHeight:!0,setRowHeight:!0,supportDynamicHeights:!1,dnd:{getDragElements(n){return[n]},getDragURI(){return null},onDragStart(){},onDragOver(){return!1},drop(){},dispose(){}},horizontalScrolling:!1,transformOptimization:!0,alwaysConsumeMouseWheel:!0},Jc=class{constructor(e){this.elements=e}update(){}getData(){return this.elements}},N5=class{constructor(e){this.elements=e}update(){}getData(){return this.elements}},A5=class{constructor(){this.types=[],this.files=[]}update(e){if(e.types&&this.types.splice(0,this.types.length,...e.types),e.files){this.files.splice(0,this.files.length);for(let t=0;to,e?.getPosInSet?this.getPosInSet=e.getPosInSet.bind(e):this.getPosInSet=(t,i)=>i+1,e?.getRole?this.getRole=e.getRole.bind(e):this.getRole=t=>"listitem",e?.isChecked?this.isChecked=e.isChecked.bind(e):this.isChecked=t=>{}}},$s=class n{get contentHeight(){return this.rangeMap.size}get onDidScroll(){return this.scrollableElement.onScroll}get scrollableElementDomNode(){return this.scrollableElement.getDomNode()}get horizontalScrolling(){return this._horizontalScrolling}set horizontalScrolling(e){if(e!==this._horizontalScrolling){if(e&&this.supportDynamicHeights)throw new Error("Horizontal scrolling and dynamic heights not supported simultaneously");if(this._horizontalScrolling=e,this.domNode.classList.toggle("horizontal-scrolling",this._horizontalScrolling),this._horizontalScrolling){for(let t of this.items)this.measureItemWidth(t);this.updateScrollWidth(),this.scrollableElement.setScrollDimensions({width:Kw(this.domNode)}),this.rowsContainer.style.width=`${Math.max(this.scrollWidth||0,this.renderWidth)}px`}else this.scrollableElementWidthDelayer.cancel(),this.scrollableElement.setScrollDimensions({width:this.renderWidth,scrollWidth:this.renderWidth}),this.rowsContainer.style.width=""}}constructor(e,t,i,o=sc){var s,r,a,l,c,d,h,u,f,g,m,C,S;if(this.virtualDelegate=t,this.domId=`list_id_${++n.InstanceCount}`,this.renderers=new Map,this.renderWidth=0,this._scrollHeight=0,this.scrollableElementUpdateDisposable=null,this.scrollableElementWidthDelayer=new ka(50),this.splicing=!1,this.dragOverAnimationStopDisposable=H.None,this.dragOverMouseY=0,this.canDrop=!1,this.currentDragFeedbackDisposable=H.None,this.onDragLeaveTimeout=H.None,this.disposables=new ae,this._onDidChangeContentHeight=new B,this._onDidChangeContentWidth=new B,this.onDidChangeContentHeight=ie.latch(this._onDidChangeContentHeight.event,void 0,this.disposables),this._horizontalScrolling=!1,o.horizontalScrolling&&o.supportDynamicHeights)throw new Error("Horizontal scrolling and dynamic heights not supported simultaneously");this.items=[],this.itemId=0,this.rangeMap=this.createRangeMap((s=o.paddingTop)!==null&&s!==void 0?s:0);for(let y of i)this.renderers.set(y.templateId,y);this.cache=this.disposables.add(new VD(this.renderers)),this.lastRenderTop=0,this.lastRenderHeight=0,this.domNode=document.createElement("div"),this.domNode.className="monaco-list",this.domNode.classList.add(this.domId),this.domNode.tabIndex=0,this.domNode.classList.toggle("mouse-support",typeof o.mouseSupport=="boolean"?o.mouseSupport:!0),this._horizontalScrolling=(r=o.horizontalScrolling)!==null&&r!==void 0?r:sc.horizontalScrolling,this.domNode.classList.toggle("horizontal-scrolling",this._horizontalScrolling),this.paddingBottom=typeof o.paddingBottom>"u"?0:o.paddingBottom,this.accessibilityProvider=new M5(o.accessibilityProvider),this.rowsContainer=document.createElement("div"),this.rowsContainer.className="monaco-list-rows",((a=o.transformOptimization)!==null&&a!==void 0?a:sc.transformOptimization)&&(this.rowsContainer.style.transform="translate3d(0px, 0px, 0px)",this.rowsContainer.style.overflow="hidden",this.rowsContainer.style.contain="strict"),this.disposables.add(ui.addTarget(this.rowsContainer)),this.scrollable=this.disposables.add(new gr({forceIntegerValues:!0,smoothScrollDuration:(l=o.smoothScrolling)!==null&&l!==void 0&&l?125:0,scheduleAtNextAnimationFrame:y=>rn(ge(this.domNode),y)})),this.scrollableElement=this.disposables.add(new Bl(this.rowsContainer,{alwaysConsumeMouseWheel:(c=o.alwaysConsumeMouseWheel)!==null&&c!==void 0?c:sc.alwaysConsumeMouseWheel,horizontal:1,vertical:(d=o.verticalScrollMode)!==null&&d!==void 0?d:sc.verticalScrollMode,useShadows:(h=o.useShadows)!==null&&h!==void 0?h:sc.useShadows,mouseWheelScrollSensitivity:o.mouseWheelScrollSensitivity,fastScrollSensitivity:o.fastScrollSensitivity,scrollByPage:o.scrollByPage},this.scrollable)),this.domNode.appendChild(this.scrollableElement.getDomNode()),e.appendChild(this.domNode),this.scrollableElement.onScroll(this.onScroll,this,this.disposables),this.disposables.add($(this.rowsContainer,It.Change,y=>this.onTouchChange(y))),this.disposables.add($(this.scrollableElement.getDomNode(),"scroll",y=>y.target.scrollTop=0)),this.disposables.add($(this.domNode,"dragover",y=>this.onDragOver(this.toDragEvent(y)))),this.disposables.add($(this.domNode,"drop",y=>this.onDrop(this.toDragEvent(y)))),this.disposables.add($(this.domNode,"dragleave",y=>this.onDragLeave(this.toDragEvent(y)))),this.disposables.add($(this.domNode,"dragend",y=>this.onDragEnd(y))),this.setRowLineHeight=(u=o.setRowLineHeight)!==null&&u!==void 0?u:sc.setRowLineHeight,this.setRowHeight=(f=o.setRowHeight)!==null&&f!==void 0?f:sc.setRowHeight,this.supportDynamicHeights=(g=o.supportDynamicHeights)!==null&&g!==void 0?g:sc.supportDynamicHeights,this.dnd=(m=o.dnd)!==null&&m!==void 0?m:this.disposables.add(sc.dnd),this.layout((C=o.initialSize)===null||C===void 0?void 0:C.height,(S=o.initialSize)===null||S===void 0?void 0:S.width)}updateOptions(e){e.paddingBottom!==void 0&&(this.paddingBottom=e.paddingBottom,this.scrollableElement.setScrollDimensions({scrollHeight:this.scrollHeight})),e.smoothScrolling!==void 0&&this.scrollable.setSmoothScrollDuration(e.smoothScrolling?125:0),e.horizontalScrolling!==void 0&&(this.horizontalScrolling=e.horizontalScrolling);let t;if(e.scrollByPage!==void 0&&(t={...t??{},scrollByPage:e.scrollByPage}),e.mouseWheelScrollSensitivity!==void 0&&(t={...t??{},mouseWheelScrollSensitivity:e.mouseWheelScrollSensitivity}),e.fastScrollSensitivity!==void 0&&(t={...t??{},fastScrollSensitivity:e.fastScrollSensitivity}),t&&this.scrollableElement.updateOptions(t),e.paddingTop!==void 0&&e.paddingTop!==this.rangeMap.paddingTop){let i=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight),o=e.paddingTop-this.rangeMap.paddingTop;this.rangeMap.paddingTop=e.paddingTop,this.render(i,Math.max(0,this.lastRenderTop+o),this.lastRenderHeight,void 0,void 0,!0),this.setScrollTop(this.lastRenderTop),this.eventuallyUpdateScrollDimensions(),this.supportDynamicHeights&&this._rerender(this.lastRenderTop,this.lastRenderHeight)}}createRangeMap(e){return new WD(e)}splice(e,t,i=[]){if(this.splicing)throw new Error("Can't run recursive splices.");this.splicing=!0;try{return this._splice(e,t,i)}finally{this.splicing=!1,this._onDidChangeContentHeight.fire(this.contentHeight)}}_splice(e,t,i=[]){let o=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight),s={start:e,end:e+t},r=cn.intersect(o,s),a=new Map;for(let k=r.end-1;k>=r.start;k--){let T=this.items[k];if(T.dragStartDisposable.dispose(),T.checkedDisposable.dispose(),T.row){let N=a.get(T.templateId);N||(N=[],a.set(T.templateId,N));let M=this.renderers.get(T.templateId);M&&M.disposeElement&&M.disposeElement(T.element,k,T.row.templateData,T.size),N.unshift(T.row)}T.row=null,T.stale=!0}let l={start:e+t,end:this.items.length},c=cn.intersect(l,o),d=cn.relativeComplement(l,o),h=i.map(k=>({id:String(this.itemId++),element:k,templateId:this.virtualDelegate.getTemplateId(k),size:this.virtualDelegate.getHeight(k),width:void 0,hasDynamicHeight:!!this.virtualDelegate.hasDynamicHeight&&this.virtualDelegate.hasDynamicHeight(k),lastDynamicHeightWidth:void 0,row:null,uri:void 0,dropTarget:!1,dragStartDisposable:H.None,checkedDisposable:H.None,stale:!1})),u;e===0&&t>=this.items.length?(this.rangeMap=this.createRangeMap(this.rangeMap.paddingTop),this.rangeMap.splice(0,0,h),u=this.items,this.items=h):(this.rangeMap.splice(e,t,h),u=this.items.splice(e,t,...h));let f=i.length-t,g=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight),m=zD(c,f),C=cn.intersect(g,m);for(let k=C.start;kzD(k,f)),x=[{start:e,end:e+i.length},...w].map(k=>cn.intersect(g,k)).reverse();for(let k of x)for(let T=k.end-1;T>=k.start;T--){let N=this.items[T],M=a.get(N.templateId),W=M?.pop();this.insertItemInDOM(T,W)}for(let k of a.values())for(let T of k)this.cache.release(T);return this.eventuallyUpdateScrollDimensions(),this.supportDynamicHeights&&this._rerender(this.scrollTop,this.renderHeight),u.map(k=>k.element)}eventuallyUpdateScrollDimensions(){this._scrollHeight=this.contentHeight,this.rowsContainer.style.height=`${this._scrollHeight}px`,this.scrollableElementUpdateDisposable||(this.scrollableElementUpdateDisposable=rn(ge(this.domNode),()=>{this.scrollableElement.setScrollDimensions({scrollHeight:this.scrollHeight}),this.updateScrollWidth(),this.scrollableElementUpdateDisposable=null}))}eventuallyUpdateScrollWidth(){if(!this.horizontalScrolling){this.scrollableElementWidthDelayer.cancel();return}this.scrollableElementWidthDelayer.trigger(()=>this.updateScrollWidth())}updateScrollWidth(){if(!this.horizontalScrolling)return;let e=0;for(let t of this.items)typeof t.width<"u"&&(e=Math.max(e,t.width));this.scrollWidth=e,this.scrollableElement.setScrollDimensions({scrollWidth:e===0?0:e+10}),this._onDidChangeContentWidth.fire(this.scrollWidth)}rerender(){if(this.supportDynamicHeights){for(let e of this.items)e.lastDynamicHeightWidth=void 0;this._rerender(this.lastRenderTop,this.lastRenderHeight)}}get length(){return this.items.length}get renderHeight(){return this.scrollableElement.getScrollDimensions().height}get firstVisibleIndex(){return this.getRenderRange(this.lastRenderTop,this.lastRenderHeight).start}element(e){return this.items[e].element}indexOf(e){return this.items.findIndex(t=>t.element===e)}domElement(e){let t=this.items[e].row;return t&&t.domNode}elementHeight(e){return this.items[e].size}elementTop(e){return this.rangeMap.positionAt(e)}indexAt(e){return this.rangeMap.indexAt(e)}indexAfter(e){return this.rangeMap.indexAfter(e)}layout(e,t){let i={height:typeof e=="number"?e:B7(this.domNode)};this.scrollableElementUpdateDisposable&&(this.scrollableElementUpdateDisposable.dispose(),this.scrollableElementUpdateDisposable=null,i.scrollHeight=this.scrollHeight),this.scrollableElement.setScrollDimensions(i),typeof t<"u"&&(this.renderWidth=t,this.supportDynamicHeights&&this._rerender(this.scrollTop,this.renderHeight)),this.horizontalScrolling&&this.scrollableElement.setScrollDimensions({width:typeof t=="number"?t:Kw(this.domNode)})}render(e,t,i,o,s,r=!1){let a=this.getRenderRange(t,i),l=cn.relativeComplement(a,e).reverse(),c=cn.relativeComplement(e,a);if(r){let d=cn.intersect(e,a);for(let h=d.start;h{for(let d of c)for(let h=d.start;h=d.start;h--)this.insertItemInDOM(h)}),o!==void 0&&(this.rowsContainer.style.left=`-${o}px`),this.rowsContainer.style.top=`-${t}px`,this.horizontalScrolling&&s!==void 0&&(this.rowsContainer.style.width=`${Math.max(s,this.renderWidth)}px`),this.lastRenderTop=t,this.lastRenderHeight=i}insertItemInDOM(e,t){var i,o,s;let r=this.items[e];if(!r.row)if(t)r.row=t,r.stale=!0;else{let h=this.cache.alloc(r.templateId);r.row=h.row,r.stale||(r.stale=h.isReusingConnectedDomNode)}let a=this.accessibilityProvider.getRole(r.element)||"listitem";r.row.domNode.setAttribute("role",a);let l=this.accessibilityProvider.isChecked(r.element);if(typeof l=="boolean")r.row.domNode.setAttribute("aria-checked",String(!!l));else if(l){let h=u=>r.row.domNode.setAttribute("aria-checked",String(!!u));h(l.value),r.checkedDisposable=l.onDidChange(()=>h(l.value))}if(r.stale||!r.row.domNode.parentElement){let h=(s=(o=(i=this.items.at(e+1))===null||i===void 0?void 0:i.row)===null||o===void 0?void 0:o.domNode)!==null&&s!==void 0?s:null;(r.row.domNode.parentElement!==this.rowsContainer||r.row.domNode.nextElementSibling!==h)&&this.rowsContainer.insertBefore(r.row.domNode,h),r.stale=!1}this.updateItemInDOM(r,e);let c=this.renderers.get(r.templateId);if(!c)throw new Error(`No renderer found for template id ${r.templateId}`);c?.renderElement(r.element,e,r.row.templateData,r.size);let d=this.dnd.getDragURI(r.element);r.dragStartDisposable.dispose(),r.row.domNode.draggable=!!d,d&&(r.dragStartDisposable=$(r.row.domNode,"dragstart",h=>this.onDragStart(r.element,d,h))),this.horizontalScrolling&&(this.measureItemWidth(r),this.eventuallyUpdateScrollWidth())}measureItemWidth(e){if(!e.row||!e.row.domNode)return;e.row.domNode.style.width="fit-content",e.width=Kw(e.row.domNode);let t=ge(e.row.domNode).getComputedStyle(e.row.domNode);t.paddingLeft&&(e.width+=parseFloat(t.paddingLeft)),t.paddingRight&&(e.width+=parseFloat(t.paddingRight)),e.row.domNode.style.width=""}updateItemInDOM(e,t){e.row.domNode.style.top=`${this.elementTop(t)}px`,this.setRowHeight&&(e.row.domNode.style.height=`${e.size}px`),this.setRowLineHeight&&(e.row.domNode.style.lineHeight=`${e.size}px`),e.row.domNode.setAttribute("data-index",`${t}`),e.row.domNode.setAttribute("data-last-element",t===this.length-1?"true":"false"),e.row.domNode.setAttribute("data-parity",t%2===0?"even":"odd"),e.row.domNode.setAttribute("aria-setsize",String(this.accessibilityProvider.getSetSize(e.element,t,this.length))),e.row.domNode.setAttribute("aria-posinset",String(this.accessibilityProvider.getPosInSet(e.element,t))),e.row.domNode.setAttribute("id",this.getElementDomId(t)),e.row.domNode.classList.toggle("drop-target",e.dropTarget)}removeItemFromDOM(e){let t=this.items[e];if(t.dragStartDisposable.dispose(),t.checkedDisposable.dispose(),t.row){let i=this.renderers.get(t.templateId);i&&i.disposeElement&&i.disposeElement(t.element,e,t.row.templateData,t.size),this.cache.release(t.row),t.row=null}this.horizontalScrolling&&this.eventuallyUpdateScrollWidth()}getScrollTop(){return this.scrollableElement.getScrollPosition().scrollTop}setScrollTop(e,t){this.scrollableElementUpdateDisposable&&(this.scrollableElementUpdateDisposable.dispose(),this.scrollableElementUpdateDisposable=null,this.scrollableElement.setScrollDimensions({scrollHeight:this.scrollHeight})),this.scrollableElement.setScrollPosition({scrollTop:e,reuseAnimation:t})}get scrollTop(){return this.getScrollTop()}set scrollTop(e){this.setScrollTop(e)}get scrollHeight(){return this._scrollHeight+(this.horizontalScrolling?10:0)+this.paddingBottom}get onMouseClick(){return ie.map(this.disposables.add(new et(this.domNode,"click")).event,e=>this.toMouseEvent(e),this.disposables)}get onMouseDblClick(){return ie.map(this.disposables.add(new et(this.domNode,"dblclick")).event,e=>this.toMouseEvent(e),this.disposables)}get onMouseMiddleClick(){return ie.filter(ie.map(this.disposables.add(new et(this.domNode,"auxclick")).event,e=>this.toMouseEvent(e),this.disposables),e=>e.browserEvent.button===1,this.disposables)}get onMouseDown(){return ie.map(this.disposables.add(new et(this.domNode,"mousedown")).event,e=>this.toMouseEvent(e),this.disposables)}get onMouseOver(){return ie.map(this.disposables.add(new et(this.domNode,"mouseover")).event,e=>this.toMouseEvent(e),this.disposables)}get onMouseOut(){return ie.map(this.disposables.add(new et(this.domNode,"mouseout")).event,e=>this.toMouseEvent(e),this.disposables)}get onContextMenu(){return ie.any(ie.map(this.disposables.add(new et(this.domNode,"contextmenu")).event,e=>this.toMouseEvent(e),this.disposables),ie.map(this.disposables.add(new et(this.domNode,It.Contextmenu)).event,e=>this.toGestureEvent(e),this.disposables))}get onTouchStart(){return ie.map(this.disposables.add(new et(this.domNode,"touchstart")).event,e=>this.toTouchEvent(e),this.disposables)}get onTap(){return ie.map(this.disposables.add(new et(this.rowsContainer,It.Tap)).event,e=>this.toGestureEvent(e),this.disposables)}toMouseEvent(e){let t=this.getItemIndexFromEventTarget(e.target||null),i=typeof t>"u"?void 0:this.items[t],o=i&&i.element;return{browserEvent:e,index:t,element:o}}toTouchEvent(e){let t=this.getItemIndexFromEventTarget(e.target||null),i=typeof t>"u"?void 0:this.items[t],o=i&&i.element;return{browserEvent:e,index:t,element:o}}toGestureEvent(e){let t=this.getItemIndexFromEventTarget(e.initialTarget||null),i=typeof t>"u"?void 0:this.items[t],o=i&&i.element;return{browserEvent:e,index:t,element:o}}toDragEvent(e){let t=this.getItemIndexFromEventTarget(e.target||null),i=typeof t>"u"?void 0:this.items[t],o=i&&i.element,s=this.getTargetSector(e,t);return{browserEvent:e,index:t,element:o,sector:s}}onScroll(e){try{let t=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight);this.render(t,e.scrollTop,e.height,e.scrollLeft,e.scrollWidth),this.supportDynamicHeights&&this._rerender(e.scrollTop,e.height,e.inSmoothScrolling)}catch(t){throw console.error("Got bad scroll event:",e),t}}onTouchChange(e){e.preventDefault(),e.stopPropagation(),this.scrollTop-=e.translationY}onDragStart(e,t,i){var o,s;if(!i.dataTransfer)return;let r=this.dnd.getDragElements(e);if(i.dataTransfer.effectAllowed="copyMove",i.dataTransfer.setData(OD.TEXT,t),i.dataTransfer.setDragImage){let a;this.dnd.getDragLabel&&(a=this.dnd.getDragLabel(r,i)),typeof a>"u"&&(a=String(r.length));let l=ve(".monaco-drag-image");l.textContent=a;let d=(h=>{for(;h&&!h.classList.contains("monaco-workbench");)h=h.parentElement;return h||this.domNode.ownerDocument})(this.domNode);d.appendChild(l),i.dataTransfer.setDragImage(l,-10,-10),setTimeout(()=>d.removeChild(l),0)}this.domNode.classList.add("dragging"),this.currentDragData=new Jc(r),Rf.CurrentDragAndDropData=new N5(r),(s=(o=this.dnd).onDragStart)===null||s===void 0||s.call(o,this.currentDragData,i)}onDragOver(e){var t,i;if(e.browserEvent.preventDefault(),this.onDragLeaveTimeout.dispose(),Rf.CurrentDragAndDropData&&Rf.CurrentDragAndDropData.getData()==="vscode-ui"||(this.setupDragAndDropScrollTopAnimation(e.browserEvent),!e.browserEvent.dataTransfer))return!1;if(!this.currentDragData)if(Rf.CurrentDragAndDropData)this.currentDragData=Rf.CurrentDragAndDropData;else{if(!e.browserEvent.dataTransfer.types)return!1;this.currentDragData=new A5}let o=this.dnd.onDragOver(this.currentDragData,e.element,e.index,e.sector,e.browserEvent);if(this.canDrop=typeof o=="boolean"?o:o.accept,!this.canDrop)return this.currentDragFeedback=void 0,this.currentDragFeedbackDisposable.dispose(),!1;e.browserEvent.dataTransfer.dropEffect=typeof o!="boolean"&&((t=o.effect)===null||t===void 0?void 0:t.type)===0?"copy":"move";let s;typeof o!="boolean"&&o.feedback?s=o.feedback:typeof e.index>"u"?s=[-1]:s=[e.index],s=xr(s).filter(a=>a>=-1&&aa-l),s=s[0]===-1?[-1]:s;let r=typeof o!="boolean"&&o.effect&&o.effect.position?o.effect.position:"drop-target";if(MX(this.currentDragFeedback,s)&&this.currentDragFeedbackPosition===r)return!0;if(this.currentDragFeedback=s,this.currentDragFeedbackPosition=r,this.currentDragFeedbackDisposable.dispose(),s[0]===-1)this.domNode.classList.add(r),this.rowsContainer.classList.add(r),this.currentDragFeedbackDisposable=be(()=>{this.domNode.classList.remove(r),this.rowsContainer.classList.remove(r)});else{if(s.length>1&&r!=="drop-target")throw new Error("Can't use multiple feedbacks with position different than 'over'");r==="drop-target-after"&&s[0]{var a;for(let l of s){let c=this.items[l];c.dropTarget=!1,(a=c.row)===null||a===void 0||a.domNode.classList.remove(r)}})}return!0}onDragLeave(e){var t,i;this.onDragLeaveTimeout.dispose(),this.onDragLeaveTimeout=s0(()=>this.clearDragOverFeedback(),100,this.disposables),this.currentDragData&&((i=(t=this.dnd).onDragLeave)===null||i===void 0||i.call(t,this.currentDragData,e.element,e.index,e.browserEvent))}onDrop(e){if(!this.canDrop)return;let t=this.currentDragData;this.teardownDragAndDropScrollTopAnimation(),this.clearDragOverFeedback(),this.domNode.classList.remove("dragging"),this.currentDragData=void 0,Rf.CurrentDragAndDropData=void 0,!(!t||!e.browserEvent.dataTransfer)&&(e.browserEvent.preventDefault(),t.update(e.browserEvent.dataTransfer),this.dnd.drop(t,e.element,e.index,e.sector,e.browserEvent))}onDragEnd(e){var t,i;this.canDrop=!1,this.teardownDragAndDropScrollTopAnimation(),this.clearDragOverFeedback(),this.domNode.classList.remove("dragging"),this.currentDragData=void 0,Rf.CurrentDragAndDropData=void 0,(i=(t=this.dnd).onDragEnd)===null||i===void 0||i.call(t,e)}clearDragOverFeedback(){this.currentDragFeedback=void 0,this.currentDragFeedbackPosition=void 0,this.currentDragFeedbackDisposable.dispose(),this.currentDragFeedbackDisposable=H.None}setupDragAndDropScrollTopAnimation(e){if(!this.dragOverAnimationDisposable){let t=F7(this.domNode).top;this.dragOverAnimationDisposable=G7(ge(this.domNode),this.animateDragAndDropScrollTop.bind(this,t))}this.dragOverAnimationStopDisposable.dispose(),this.dragOverAnimationStopDisposable=s0(()=>{this.dragOverAnimationDisposable&&(this.dragOverAnimationDisposable.dispose(),this.dragOverAnimationDisposable=void 0)},1e3,this.disposables),this.dragOverMouseY=e.pageY}animateDragAndDropScrollTop(e){if(this.dragOverMouseY===void 0)return;let t=this.dragOverMouseY-e,i=this.renderHeight-35;t<35?this.scrollTop+=Math.max(-14,Math.floor(.3*(t-35))):t>i&&(this.scrollTop+=Math.min(14,Math.floor(.3*(t-i))))}teardownDragAndDropScrollTopAnimation(){this.dragOverAnimationStopDisposable.dispose(),this.dragOverAnimationDisposable&&(this.dragOverAnimationDisposable.dispose(),this.dragOverAnimationDisposable=void 0)}getTargetSector(e,t){if(t===void 0)return;let i=e.offsetY/this.items[t].size,o=Math.floor(i/.25);return Bn(o,0,3)}getItemIndexFromEventTarget(e){let t=this.scrollableElement.getDomNode(),i=e;for(;i instanceof HTMLElement&&i!==this.rowsContainer&&t.contains(i);){let o=i.getAttribute("data-index");if(o){let s=Number(o);if(!isNaN(s))return s}i=i.parentElement}}getRenderRange(e,t){return{start:this.rangeMap.indexAt(e),end:this.rangeMap.indexAfter(e+t-1)}}_rerender(e,t,i){let o=this.getRenderRange(e,t),s,r;e===this.elementTop(o.start)?(s=o.start,r=0):o.end-o.start>1&&(s=o.start+1,r=this.elementTop(s)-e);let a=0;for(;;){let l=this.getRenderRange(e,t),c=!1;for(let d=l.start;d=u.start;f--)this.insertItemInDOM(f);for(let u=l.start;u=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},H5=class{constructor(e){this.trait=e,this.renderedElements=[]}get templateId(){return`template:${this.trait.name}`}renderTemplate(e){return e}renderElement(e,t,i){let o=this.renderedElements.findIndex(s=>s.templateData===i);if(o>=0){let s=this.renderedElements[o];this.trait.unrender(i),s.index=t}else{let s={index:t,templateData:i};this.renderedElements.push(s)}this.trait.renderIndex(t,i)}splice(e,t,i){let o=[];for(let s of this.renderedElements)s.index=e+t&&o.push({index:s.index+i-t,templateData:s.templateData});this.renderedElements=o}renderIndexes(e){for(let{index:t,templateData:i}of this.renderedElements)e.indexOf(t)>-1&&this.trait.renderIndex(t,i)}disposeTemplate(e){let t=this.renderedElements.findIndex(i=>i.templateData===e);t<0||this.renderedElements.splice(t,1)}},$p=class{get name(){return this._trait}get renderer(){return new H5(this)}constructor(e){this._trait=e,this.indexes=[],this.sortedIndexes=[],this._onChange=new B,this.onChange=this._onChange.event}splice(e,t,i){let o=i.length-t,s=e+t,r=[],a=0;for(;a=s;)r.push(this.sortedIndexes[a++]+o);this.renderer.splice(e,t,i.length),this._set(r,r)}renderIndex(e,t){t.classList.toggle(this._trait,this.contains(e))}unrender(e){e.classList.remove(this._trait)}set(e,t){return this._set(e,[...e].sort(DH),t)}_set(e,t,i){let o=this.indexes,s=this.sortedIndexes;this.indexes=e,this.sortedIndexes=t;let r=q5(s,e);return this.renderer.renderIndexes(r),this._onChange.fire({indexes:e,browserEvent:i}),o}get(){return this.indexes}contains(e){return ZF(this.sortedIndexes,e,DH)>=0}dispose(){li(this._onChange)}};Oh([Yt],$p.prototype,"renderer",null);var U5=class extends $p{constructor(e){super("selected"),this.setAriaSelected=e}renderIndex(e,t){super.renderIndex(e,t),this.setAriaSelected&&(this.contains(e)?t.setAttribute("aria-selected","true"):t.setAttribute("aria-selected","false"))}},$v=class{constructor(e,t,i){this.trait=e,this.view=t,this.identityProvider=i}splice(e,t,i){if(!this.identityProvider)return this.trait.splice(e,t,new Array(i.length).fill(!1));let o=this.trait.get().map(a=>this.identityProvider.getId(this.view.element(a)).toString());if(o.length===0)return this.trait.splice(e,t,new Array(i.length).fill(!1));let s=new Set(o),r=i.map(a=>s.has(this.identityProvider.getId(a).toString()));this.trait.splice(e,t,r)}};function id(n){return n.tagName==="INPUT"||n.tagName==="TEXTAREA"}function Gv(n,e){return n.classList.contains(e)?!0:n.classList.contains("monaco-list")||!n.parentElement?!1:Gv(n.parentElement,e)}function Up(n){return Gv(n,"monaco-editor")}function EH(n){return Gv(n,"monaco-custom-toggle")}function IH(n){return Gv(n,"action-item")}function qp(n){return Gv(n,"monaco-tree-sticky-row")}function jp(n){return n.classList.contains("monaco-tree-sticky-container")}function Y5(n){return n.tagName==="A"&&n.classList.contains("monaco-button")||n.tagName==="DIV"&&n.classList.contains("monaco-button-dropdown")?!0:n.classList.contains("monaco-list")||!n.parentElement?!1:Y5(n.parentElement)}var jD=class{get onKeyDown(){return ie.chain(this.disposables.add(new et(this.view.domNode,"keydown")).event,e=>e.filter(t=>!id(t.target)).map(t=>new bt(t)))}constructor(e,t,i){this.list=e,this.view=t,this.disposables=new ae,this.multipleSelectionDisposables=new ae,this.multipleSelectionSupport=i.multipleSelectionSupport,this.disposables.add(this.onKeyDown(o=>{switch(o.keyCode){case 3:return this.onEnter(o);case 16:return this.onUpArrow(o);case 18:return this.onDownArrow(o);case 11:return this.onPageUpArrow(o);case 12:return this.onPageDownArrow(o);case 9:return this.onEscape(o);case 31:this.multipleSelectionSupport&&(Be?o.metaKey:o.ctrlKey)&&this.onCtrlA(o)}}))}updateOptions(e){e.multipleSelectionSupport!==void 0&&(this.multipleSelectionSupport=e.multipleSelectionSupport)}onEnter(e){e.preventDefault(),e.stopPropagation(),this.list.setSelection(this.list.getFocus(),e.browserEvent)}onUpArrow(e){e.preventDefault(),e.stopPropagation(),this.list.focusPrevious(1,!1,e.browserEvent);let t=this.list.getFocus()[0];this.list.setAnchor(t),this.list.reveal(t),this.view.domNode.focus()}onDownArrow(e){e.preventDefault(),e.stopPropagation(),this.list.focusNext(1,!1,e.browserEvent);let t=this.list.getFocus()[0];this.list.setAnchor(t),this.list.reveal(t),this.view.domNode.focus()}onPageUpArrow(e){e.preventDefault(),e.stopPropagation(),this.list.focusPreviousPage(e.browserEvent);let t=this.list.getFocus()[0];this.list.setAnchor(t),this.list.reveal(t),this.view.domNode.focus()}onPageDownArrow(e){e.preventDefault(),e.stopPropagation(),this.list.focusNextPage(e.browserEvent);let t=this.list.getFocus()[0];this.list.setAnchor(t),this.list.reveal(t),this.view.domNode.focus()}onCtrlA(e){e.preventDefault(),e.stopPropagation(),this.list.setSelection(Un(this.list.length),e.browserEvent),this.list.setAnchor(void 0),this.view.domNode.focus()}onEscape(e){this.list.getSelection().length&&(e.preventDefault(),e.stopPropagation(),this.list.setSelection([],e.browserEvent),this.list.setAnchor(void 0),this.view.domNode.focus())}dispose(){this.disposables.dispose(),this.multipleSelectionDisposables.dispose()}};Oh([Yt],jD.prototype,"onKeyDown",null);var el;(function(n){n[n.Automatic=0]="Automatic",n[n.Trigger=1]="Trigger"})(el||(el={}));var Kp;(function(n){n[n.Idle=0]="Idle",n[n.Typing=1]="Typing"})(Kp||(Kp={}));var jX=new class{mightProducePrintableCharacter(n){return n.ctrlKey||n.metaKey||n.altKey?!1:n.keyCode>=31&&n.keyCode<=56||n.keyCode>=21&&n.keyCode<=30||n.keyCode>=98&&n.keyCode<=107||n.keyCode>=85&&n.keyCode<=95}},K5=class{constructor(e,t,i,o,s){this.list=e,this.view=t,this.keyboardNavigationLabelProvider=i,this.keyboardNavigationEventFilter=o,this.delegate=s,this.enabled=!1,this.state=Kp.Idle,this.mode=el.Automatic,this.triggered=!1,this.previouslyFocused=-1,this.enabledDisposables=new ae,this.disposables=new ae,this.updateOptions(e.options)}updateOptions(e){var t,i;!((t=e.typeNavigationEnabled)!==null&&t!==void 0)||t?this.enable():this.disable(),this.mode=(i=e.typeNavigationMode)!==null&&i!==void 0?i:el.Automatic}enable(){if(this.enabled)return;let e=!1,t=ie.chain(this.enabledDisposables.add(new et(this.view.domNode,"keydown")).event,s=>s.filter(r=>!id(r.target)).filter(()=>this.mode===el.Automatic||this.triggered).map(r=>new bt(r)).filter(r=>e||this.keyboardNavigationEventFilter(r)).filter(r=>this.delegate.mightProducePrintableCharacter(r)).forEach(r=>He.stop(r,!0)).map(r=>r.browserEvent.key)),i=ie.debounce(t,()=>null,800,void 0,void 0,void 0,this.enabledDisposables);ie.reduce(ie.any(t,i),(s,r)=>r===null?null:(s||"")+r,void 0,this.enabledDisposables)(this.onInput,this,this.enabledDisposables),i(this.onClear,this,this.enabledDisposables),t(()=>e=!0,void 0,this.enabledDisposables),i(()=>e=!1,void 0,this.enabledDisposables),this.enabled=!0,this.triggered=!1}disable(){this.enabled&&(this.enabledDisposables.clear(),this.enabled=!1,this.triggered=!1)}onClear(){var e;let t=this.list.getFocus();if(t.length>0&&t[0]===this.previouslyFocused){let i=(e=this.list.options.accessibilityProvider)===null||e===void 0?void 0:e.getAriaLabel(this.list.element(t[0]));typeof i=="string"?ob(i):i&&ob(i.get())}this.previouslyFocused=-1}onInput(e){if(!e){this.state=Kp.Idle,this.triggered=!1;return}let t=this.list.getFocus(),i=t.length>0?t[0]:0,o=this.state===Kp.Idle?1:0;this.state=Kp.Typing;for(let s=0;s1&&c.length===1){this.previouslyFocused=i,this.list.setFocus([r]),this.list.reveal(r);return}}}else if(typeof l>"u"||vv(e,l)){this.previouslyFocused=i,this.list.setFocus([r]),this.list.reveal(r);return}}}dispose(){this.disable(),this.enabledDisposables.dispose(),this.disposables.dispose()}},$5=class{constructor(e,t){this.list=e,this.view=t,this.disposables=new ae;let i=ie.chain(this.disposables.add(new et(t.domNode,"keydown")).event,s=>s.filter(r=>!id(r.target)).map(r=>new bt(r)));ie.chain(i,s=>s.filter(r=>r.keyCode===2&&!r.ctrlKey&&!r.metaKey&&!r.shiftKey&&!r.altKey))(this.onTab,this,this.disposables)}onTab(e){if(e.target!==this.view.domNode)return;let t=this.list.getFocus();if(t.length===0)return;let i=this.view.domElement(t[0]);if(!i)return;let o=i.querySelector("[tabIndex]");if(!o||!(o instanceof HTMLElement)||o.tabIndex===-1)return;let s=ge(o).getComputedStyle(o);s.visibility==="hidden"||s.display==="none"||(e.preventDefault(),e.stopPropagation(),o.focus())}dispose(){this.disposables.dispose()}};function X5(n){return Be?n.browserEvent.metaKey:n.browserEvent.ctrlKey}function Q5(n){return n.browserEvent.shiftKey}function GX(n){return Hg(n)&&n.button===2}var kH={isSelectionSingleChangeEvent:X5,isSelectionRangeChangeEvent:Q5},qv=class{constructor(e){this.list=e,this.disposables=new ae,this._onPointer=new B,this.onPointer=this._onPointer.event,e.options.multipleSelectionSupport!==!1&&(this.multipleSelectionController=this.list.options.multipleSelectionController||kH),this.mouseSupport=typeof e.options.mouseSupport>"u"||!!e.options.mouseSupport,this.mouseSupport&&(e.onMouseDown(this.onMouseDown,this,this.disposables),e.onContextMenu(this.onContextMenu,this,this.disposables),e.onMouseDblClick(this.onDoubleClick,this,this.disposables),e.onTouchStart(this.onMouseDown,this,this.disposables),this.disposables.add(ui.addTarget(e.getHTMLElement()))),ie.any(e.onMouseClick,e.onMouseMiddleClick,e.onTap)(this.onViewPointer,this,this.disposables)}updateOptions(e){e.multipleSelectionSupport!==void 0&&(this.multipleSelectionController=void 0,e.multipleSelectionSupport&&(this.multipleSelectionController=this.list.options.multipleSelectionController||kH))}isSelectionSingleChangeEvent(e){return this.multipleSelectionController?this.multipleSelectionController.isSelectionSingleChangeEvent(e):!1}isSelectionRangeChangeEvent(e){return this.multipleSelectionController?this.multipleSelectionController.isSelectionRangeChangeEvent(e):!1}isSelectionChangeEvent(e){return this.isSelectionSingleChangeEvent(e)||this.isSelectionRangeChangeEvent(e)}onMouseDown(e){Up(e.browserEvent.target)||Bi()!==e.browserEvent.target&&this.list.domFocus()}onContextMenu(e){if(id(e.browserEvent.target)||Up(e.browserEvent.target))return;let t=typeof e.index>"u"?[]:[e.index];this.list.setFocus(t,e.browserEvent)}onViewPointer(e){if(!this.mouseSupport||id(e.browserEvent.target)||Up(e.browserEvent.target)||e.browserEvent.isHandledByList)return;e.browserEvent.isHandledByList=!0;let t=e.index;if(typeof t>"u"){this.list.setFocus([],e.browserEvent),this.list.setSelection([],e.browserEvent),this.list.setAnchor(void 0);return}if(this.isSelectionChangeEvent(e))return this.changeSelection(e);this.list.setFocus([t],e.browserEvent),this.list.setAnchor(t),GX(e.browserEvent)||this.list.setSelection([t],e.browserEvent),this._onPointer.fire(e)}onDoubleClick(e){if(id(e.browserEvent.target)||Up(e.browserEvent.target)||this.isSelectionChangeEvent(e)||e.browserEvent.isHandledByList)return;e.browserEvent.isHandledByList=!0;let t=this.list.getFocus();this.list.setSelection(t,e.browserEvent)}changeSelection(e){let t=e.index,i=this.list.getAnchor();if(this.isSelectionRangeChangeEvent(e)){if(typeof i>"u"){let d=this.list.getFocus()[0];i=d??t,this.list.setAnchor(i)}let o=Math.min(i,t),s=Math.max(i,t),r=Un(o,s+1),a=this.list.getSelection(),l=YX(q5(a,[i]),i);if(l.length===0)return;let c=q5(r,XX(a,l));this.list.setSelection(c,e.browserEvent),this.list.setFocus([t],e.browserEvent)}else if(this.isSelectionSingleChangeEvent(e)){let o=this.list.getSelection(),s=o.filter(r=>r!==t);this.list.setFocus([t]),this.list.setAnchor(t),o.length===s.length?this.list.setSelection([...s,t],e.browserEvent):this.list.setSelection(s,e.browserEvent)}}dispose(){this.disposables.dispose()}},jv=class{constructor(e,t){this.styleElement=e,this.selectorSuffix=t}style(e){var t,i;let o=this.selectorSuffix&&`.${this.selectorSuffix}`,s=[];e.listBackground&&s.push(`.monaco-list${o} .monaco-list-rows { background: ${e.listBackground}; }`),e.listFocusBackground&&(s.push(`.monaco-list${o}:focus .monaco-list-row.focused { background-color: ${e.listFocusBackground}; }`),s.push(`.monaco-list${o}:focus .monaco-list-row.focused:hover { background-color: ${e.listFocusBackground}; }`)),e.listFocusForeground&&s.push(`.monaco-list${o}:focus .monaco-list-row.focused { color: ${e.listFocusForeground}; }`),e.listActiveSelectionBackground&&(s.push(`.monaco-list${o}:focus .monaco-list-row.selected { background-color: ${e.listActiveSelectionBackground}; }`),s.push(`.monaco-list${o}:focus .monaco-list-row.selected:hover { background-color: ${e.listActiveSelectionBackground}; }`)),e.listActiveSelectionForeground&&s.push(`.monaco-list${o}:focus .monaco-list-row.selected { color: ${e.listActiveSelectionForeground}; }`),e.listActiveSelectionIconForeground&&s.push(`.monaco-list${o}:focus .monaco-list-row.selected .codicon { color: ${e.listActiveSelectionIconForeground}; }`),e.listFocusAndSelectionBackground&&s.push(` + .monaco-drag-image, + .monaco-list${o}:focus .monaco-list-row.selected.focused { background-color: ${e.listFocusAndSelectionBackground}; } + `),e.listFocusAndSelectionForeground&&s.push(` + .monaco-drag-image, + .monaco-list${o}:focus .monaco-list-row.selected.focused { color: ${e.listFocusAndSelectionForeground}; } + `),e.listInactiveFocusForeground&&(s.push(`.monaco-list${o} .monaco-list-row.focused { color: ${e.listInactiveFocusForeground}; }`),s.push(`.monaco-list${o} .monaco-list-row.focused:hover { color: ${e.listInactiveFocusForeground}; }`)),e.listInactiveSelectionIconForeground&&s.push(`.monaco-list${o} .monaco-list-row.focused .codicon { color: ${e.listInactiveSelectionIconForeground}; }`),e.listInactiveFocusBackground&&(s.push(`.monaco-list${o} .monaco-list-row.focused { background-color: ${e.listInactiveFocusBackground}; }`),s.push(`.monaco-list${o} .monaco-list-row.focused:hover { background-color: ${e.listInactiveFocusBackground}; }`)),e.listInactiveSelectionBackground&&(s.push(`.monaco-list${o} .monaco-list-row.selected { background-color: ${e.listInactiveSelectionBackground}; }`),s.push(`.monaco-list${o} .monaco-list-row.selected:hover { background-color: ${e.listInactiveSelectionBackground}; }`)),e.listInactiveSelectionForeground&&s.push(`.monaco-list${o} .monaco-list-row.selected { color: ${e.listInactiveSelectionForeground}; }`),e.listHoverBackground&&s.push(`.monaco-list${o}:not(.drop-target):not(.dragging) .monaco-list-row:hover:not(.selected):not(.focused) { background-color: ${e.listHoverBackground}; }`),e.listHoverForeground&&s.push(`.monaco-list${o}:not(.drop-target):not(.dragging) .monaco-list-row:hover:not(.selected):not(.focused) { color: ${e.listHoverForeground}; }`);let r=tr(e.listFocusAndSelectionOutline,tr(e.listSelectionOutline,(t=e.listFocusOutline)!==null&&t!==void 0?t:""));r&&s.push(`.monaco-list${o}:focus .monaco-list-row.focused.selected { outline: 1px solid ${r}; outline-offset: -1px;}`),e.listFocusOutline&&s.push(` + .monaco-drag-image, + .monaco-list${o}:focus .monaco-list-row.focused { outline: 1px solid ${e.listFocusOutline}; outline-offset: -1px; } + .monaco-workbench.context-menu-visible .monaco-list${o}.last-focused .monaco-list-row.focused { outline: 1px solid ${e.listFocusOutline}; outline-offset: -1px; } + `);let a=tr(e.listSelectionOutline,(i=e.listInactiveFocusOutline)!==null&&i!==void 0?i:"");a&&s.push(`.monaco-list${o} .monaco-list-row.focused.selected { outline: 1px dotted ${a}; outline-offset: -1px; }`),e.listSelectionOutline&&s.push(`.monaco-list${o} .monaco-list-row.selected { outline: 1px dotted ${e.listSelectionOutline}; outline-offset: -1px; }`),e.listInactiveFocusOutline&&s.push(`.monaco-list${o} .monaco-list-row.focused { outline: 1px dotted ${e.listInactiveFocusOutline}; outline-offset: -1px; }`),e.listHoverOutline&&s.push(`.monaco-list${o} .monaco-list-row:hover { outline: 1px dashed ${e.listHoverOutline}; outline-offset: -1px; }`),e.listDropOverBackground&&s.push(` + .monaco-list${o}.drop-target, + .monaco-list${o} .monaco-list-rows.drop-target, + .monaco-list${o} .monaco-list-row.drop-target { background-color: ${e.listDropOverBackground} !important; color: inherit !important; } + `),e.listDropBetweenBackground&&(s.push(` + .monaco-list${o} .monaco-list-rows.drop-target-before .monaco-list-row:first-child::before, + .monaco-list${o} .monaco-list-row.drop-target-before::before { + content: ""; position: absolute; top: 0px; left: 0px; width: 100%; height: 1px; + background-color: ${e.listDropBetweenBackground}; + }`),s.push(` + .monaco-list${o} .monaco-list-rows.drop-target-after .monaco-list-row:last-child::after, + .monaco-list${o} .monaco-list-row.drop-target-after::after { + content: ""; position: absolute; bottom: 0px; left: 0px; width: 100%; height: 1px; + background-color: ${e.listDropBetweenBackground}; + }`)),e.tableColumnsBorder&&s.push(` + .monaco-table > .monaco-split-view2, + .monaco-table > .monaco-split-view2 .monaco-sash.vertical::before, + .monaco-workbench:not(.reduce-motion) .monaco-table:hover > .monaco-split-view2, + .monaco-workbench:not(.reduce-motion) .monaco-table:hover > .monaco-split-view2 .monaco-sash.vertical::before { + border-color: ${e.tableColumnsBorder}; + } + + .monaco-workbench:not(.reduce-motion) .monaco-table > .monaco-split-view2, + .monaco-workbench:not(.reduce-motion) .monaco-table > .monaco-split-view2 .monaco-sash.vertical::before { + border-color: transparent; + } + `),e.tableOddRowsBackgroundColor&&s.push(` + .monaco-table .monaco-list-row[data-parity=odd]:not(.focused):not(.selected):not(:hover) .monaco-table-tr, + .monaco-table .monaco-list:not(:focus) .monaco-list-row[data-parity=odd].focused:not(.selected):not(:hover) .monaco-table-tr, + .monaco-table .monaco-list:not(.focused) .monaco-list-row[data-parity=odd].focused:not(.selected):not(:hover) .monaco-table-tr { + background-color: ${e.tableOddRowsBackgroundColor}; + } + `),this.styleElement.textContent=s.join(` +`)}},TH={listFocusBackground:"#7FB0D0",listActiveSelectionBackground:"#0E639C",listActiveSelectionForeground:"#FFFFFF",listActiveSelectionIconForeground:"#FFFFFF",listFocusAndSelectionOutline:"#90C2F9",listFocusAndSelectionBackground:"#094771",listFocusAndSelectionForeground:"#FFFFFF",listInactiveSelectionBackground:"#3F3F46",listInactiveSelectionIconForeground:"#FFFFFF",listHoverBackground:"#2A2D2E",listDropOverBackground:"#383B3D",listDropBetweenBackground:"#EEEEEE",treeIndentGuidesStroke:"#a9a9a9",treeInactiveIndentGuidesStroke:Z.fromHex("#a9a9a9").transparent(.4).toString(),tableColumnsBorder:Z.fromHex("#cccccc").transparent(.2).toString(),tableOddRowsBackgroundColor:Z.fromHex("#cccccc").transparent(.04).toString(),listBackground:void 0,listFocusForeground:void 0,listInactiveSelectionForeground:void 0,listInactiveFocusForeground:void 0,listInactiveFocusBackground:void 0,listHoverForeground:void 0,listFocusOutline:void 0,listInactiveFocusOutline:void 0,listSelectionOutline:void 0,listHoverOutline:void 0,treeStickyScrollBackground:void 0,treeStickyScrollBorder:void 0,treeStickyScrollShadow:void 0},ZX={keyboardSupport:!0,mouseSupport:!0,multipleSelectionSupport:!0,dnd:{getDragURI(){return null},onDragStart(){},onDragOver(){return!1},drop(){},dispose(){}}};function YX(n,e){let t=n.indexOf(e);if(t===-1)return[];let i=[],o=t-1;for(;o>=0&&n[o]===e-(t-o);)i.push(n[o--]);for(i.reverse(),o=t;o=n.length)t.push(e[o++]);else if(o>=e.length)t.push(n[i++]);else if(n[i]===e[o]){t.push(n[i]),i++,o++;continue}else n[i]=n.length)t.push(e[o++]);else if(o>=e.length)t.push(n[i++]);else if(n[i]===e[o]){i++,o++;continue}else n[i]n-e,j5=class{constructor(e,t){this._templateId=e,this.renderers=t}get templateId(){return this._templateId}renderTemplate(e){return this.renderers.map(t=>t.renderTemplate(e))}renderElement(e,t,i,o){let s=0;for(let r of this.renderers)r.renderElement(e,t,i[s++],o)}disposeElement(e,t,i,o){var s;let r=0;for(let a of this.renderers)(s=a.disposeElement)===null||s===void 0||s.call(a,e,t,i[r],o),r+=1}disposeTemplate(e){let t=0;for(let i of this.renderers)i.disposeTemplate(e[t++])}},G5=class{constructor(e){this.accessibilityProvider=e,this.templateId="a18n"}renderTemplate(e){return{container:e,disposables:new ae}}renderElement(e,t,i){let o=this.accessibilityProvider.getAriaLabel(e),s=o&&typeof o!="string"?o:Rh(o);i.disposables.add(pt(a=>{this.setAriaLabel(a.readObservable(s),i.container)}));let r=this.accessibilityProvider.getAriaLevel&&this.accessibilityProvider.getAriaLevel(e);typeof r=="number"?i.container.setAttribute("aria-level",`${r}`):i.container.removeAttribute("aria-level")}setAriaLabel(e,t){e?t.setAttribute("aria-label",e):t.removeAttribute("aria-label")}disposeElement(e,t,i,o){i.disposables.clear()}disposeTemplate(e){e.disposables.dispose()}},Z5=class{constructor(e,t){this.list=e,this.dnd=t}getDragElements(e){let t=this.list.getSelectedElements();return t.indexOf(e)>-1?t:[e]}getDragURI(e){return this.dnd.getDragURI(e)}getDragLabel(e,t){if(this.dnd.getDragLabel)return this.dnd.getDragLabel(e,t)}onDragStart(e,t){var i,o;(o=(i=this.dnd).onDragStart)===null||o===void 0||o.call(i,e,t)}onDragOver(e,t,i,o,s){return this.dnd.onDragOver(e,t,i,o,s)}onDragLeave(e,t,i,o){var s,r;(r=(s=this.dnd).onDragLeave)===null||r===void 0||r.call(s,e,t,i,o)}onDragEnd(e){var t,i;(i=(t=this.dnd).onDragEnd)===null||i===void 0||i.call(t,e)}drop(e,t,i,o,s){this.dnd.drop(e,t,i,o,s)}dispose(){this.dnd.dispose()}},Do=class{get onDidChangeFocus(){return ie.map(this.eventBufferer.wrapEvent(this.focus.onChange),e=>this.toListEvent(e),this.disposables)}get onDidChangeSelection(){return ie.map(this.eventBufferer.wrapEvent(this.selection.onChange),e=>this.toListEvent(e),this.disposables)}get domId(){return this.view.domId}get onDidScroll(){return this.view.onDidScroll}get onMouseClick(){return this.view.onMouseClick}get onMouseDblClick(){return this.view.onMouseDblClick}get onMouseMiddleClick(){return this.view.onMouseMiddleClick}get onPointer(){return this.mouseController.onPointer}get onMouseDown(){return this.view.onMouseDown}get onMouseOver(){return this.view.onMouseOver}get onMouseOut(){return this.view.onMouseOut}get onTouchStart(){return this.view.onTouchStart}get onTap(){return this.view.onTap}get onContextMenu(){let e=!1,t=ie.chain(this.disposables.add(new et(this.view.domNode,"keydown")).event,s=>s.map(r=>new bt(r)).filter(r=>e=r.keyCode===58||r.shiftKey&&r.keyCode===68).map(r=>He.stop(r,!0)).filter(()=>!1)),i=ie.chain(this.disposables.add(new et(this.view.domNode,"keyup")).event,s=>s.forEach(()=>e=!1).map(r=>new bt(r)).filter(r=>r.keyCode===58||r.shiftKey&&r.keyCode===68).map(r=>He.stop(r,!0)).map(({browserEvent:r})=>{let a=this.getFocus(),l=a.length?a[0]:void 0,c=typeof l<"u"?this.view.element(l):void 0,d=typeof l<"u"?this.view.domElement(l):this.view.domNode;return{index:l,element:c,anchor:d,browserEvent:r}})),o=ie.chain(this.view.onContextMenu,s=>s.filter(r=>!e).map(({element:r,index:a,browserEvent:l})=>({element:r,index:a,anchor:new yn(ge(this.view.domNode),l),browserEvent:l})));return ie.any(t,i,o)}get onKeyDown(){return this.disposables.add(new et(this.view.domNode,"keydown")).event}get onDidFocus(){return ie.signal(this.disposables.add(new et(this.view.domNode,"focus",!0)).event)}get onDidBlur(){return ie.signal(this.disposables.add(new et(this.view.domNode,"blur",!0)).event)}constructor(e,t,i,o,s=ZX){var r,a,l,c;this.user=e,this._options=s,this.focus=new $p("focused"),this.anchor=new $p("anchor"),this.eventBufferer=new kd,this._ariaLabel="",this.disposables=new ae,this._onDidDispose=new B,this.onDidDispose=this._onDidDispose.event;let d=this._options.accessibilityProvider&&this._options.accessibilityProvider.getWidgetRole?(r=this._options.accessibilityProvider)===null||r===void 0?void 0:r.getWidgetRole():"list";this.selection=new U5(d!=="listbox");let h=[this.focus.renderer,this.selection.renderer];this.accessibilityProvider=s.accessibilityProvider,this.accessibilityProvider&&(h.push(new G5(this.accessibilityProvider)),(l=(a=this.accessibilityProvider).onDidChangeActiveDescendant)===null||l===void 0||l.call(a,this.onDidChangeActiveDescendant,this,this.disposables)),o=o.map(f=>new j5(f.templateId,[...h,f]));let u={...s,dnd:s.dnd&&new Z5(this,s.dnd)};if(this.view=this.createListView(t,i,o,u),this.view.domNode.setAttribute("role",d),s.styleController)this.styleController=s.styleController(this.view.domId);else{let f=Xi(this.view.domNode);this.styleController=new jv(f,this.view.domId)}if(this.spliceable=new BD([new $v(this.focus,this.view,s.identityProvider),new $v(this.selection,this.view,s.identityProvider),new $v(this.anchor,this.view,s.identityProvider),this.view]),this.disposables.add(this.focus),this.disposables.add(this.selection),this.disposables.add(this.anchor),this.disposables.add(this.view),this.disposables.add(this._onDidDispose),this.disposables.add(new $5(this,this.view)),(typeof s.keyboardSupport!="boolean"||s.keyboardSupport)&&(this.keyboardController=new jD(this,this.view,s),this.disposables.add(this.keyboardController)),s.keyboardNavigationLabelProvider){let f=s.keyboardNavigationDelegate||jX;this.typeNavigationController=new K5(this,this.view,s.keyboardNavigationLabelProvider,(c=s.keyboardNavigationEventFilter)!==null&&c!==void 0?c:()=>!0,f),this.disposables.add(this.typeNavigationController)}this.mouseController=this.createMouseController(s),this.disposables.add(this.mouseController),this.onDidChangeFocus(this._onFocusChange,this,this.disposables),this.onDidChangeSelection(this._onSelectionChange,this,this.disposables),this.accessibilityProvider&&(this.ariaLabel=this.accessibilityProvider.getWidgetAriaLabel()),this._options.multipleSelectionSupport!==!1&&this.view.domNode.setAttribute("aria-multiselectable","true")}createListView(e,t,i,o){return new $s(e,t,i,o)}createMouseController(e){return new qv(this)}updateOptions(e={}){var t,i;this._options={...this._options,...e},(t=this.typeNavigationController)===null||t===void 0||t.updateOptions(this._options),this._options.multipleSelectionController!==void 0&&(this._options.multipleSelectionSupport?this.view.domNode.setAttribute("aria-multiselectable","true"):this.view.domNode.removeAttribute("aria-multiselectable")),this.mouseController.updateOptions(e),(i=this.keyboardController)===null||i===void 0||i.updateOptions(e),this.view.updateOptions(e)}get options(){return this._options}splice(e,t,i=[]){if(e<0||e>this.view.length)throw new oc(this.user,`Invalid start index: ${e}`);if(t<0)throw new oc(this.user,`Invalid delete count: ${t}`);t===0&&i.length===0||this.eventBufferer.bufferEvents(()=>this.spliceable.splice(e,t,i))}rerender(){this.view.rerender()}element(e){return this.view.element(e)}indexOf(e){return this.view.indexOf(e)}indexAt(e){return this.view.indexAt(e)}get length(){return this.view.length}get contentHeight(){return this.view.contentHeight}get onDidChangeContentHeight(){return this.view.onDidChangeContentHeight}get scrollTop(){return this.view.getScrollTop()}set scrollTop(e){this.view.setScrollTop(e)}get scrollHeight(){return this.view.scrollHeight}get renderHeight(){return this.view.renderHeight}get firstVisibleIndex(){return this.view.firstVisibleIndex}get ariaLabel(){return this._ariaLabel}set ariaLabel(e){this._ariaLabel=e,this.view.domNode.setAttribute("aria-label",e)}domFocus(){this.view.domNode.focus({preventScroll:!0})}layout(e,t){this.view.layout(e,t)}setSelection(e,t){for(let i of e)if(i<0||i>=this.length)throw new oc(this.user,`Invalid index ${i}`);this.selection.set(e,t)}getSelection(){return this.selection.get()}getSelectedElements(){return this.getSelection().map(e=>this.view.element(e))}setAnchor(e){if(typeof e>"u"){this.anchor.set([]);return}if(e<0||e>=this.length)throw new oc(this.user,`Invalid index ${e}`);this.anchor.set([e])}getAnchor(){return lg(this.anchor.get(),void 0)}getAnchorElement(){let e=this.getAnchor();return typeof e>"u"?void 0:this.element(e)}setFocus(e,t){for(let i of e)if(i<0||i>=this.length)throw new oc(this.user,`Invalid index ${i}`);this.focus.set(e,t)}focusNext(e=1,t=!1,i,o){if(this.length===0)return;let s=this.focus.get(),r=this.findNextIndex(s.length>0?s[0]+e:0,t,o);r>-1&&this.setFocus([r],i)}focusPrevious(e=1,t=!1,i,o){if(this.length===0)return;let s=this.focus.get(),r=this.findPreviousIndex(s.length>0?s[0]-e:0,t,o);r>-1&&this.setFocus([r],i)}async focusNextPage(e,t){let i=this.view.indexAt(this.view.getScrollTop()+this.view.renderHeight);i=i===0?0:i-1;let o=this.getFocus()[0];if(o!==i&&(o===void 0||i>o)){let s=this.findPreviousIndex(i,!1,t);s>-1&&o!==s?this.setFocus([s],e):this.setFocus([i],e)}else{let s=this.view.getScrollTop(),r=s+this.view.renderHeight;i>o&&(r-=this.view.elementHeight(i)),this.view.setScrollTop(r),this.view.getScrollTop()!==s&&(this.setFocus([]),await kc(0),await this.focusNextPage(e,t))}}async focusPreviousPage(e,t,i=()=>0){let o,s=i(),r=this.view.getScrollTop()+s;r===0?o=this.view.indexAt(r):o=this.view.indexAfter(r-1);let a=this.getFocus()[0];if(a!==o&&(a===void 0||a>=o)){let l=this.findNextIndex(o,!1,t);l>-1&&a!==l?this.setFocus([l],e):this.setFocus([o],e)}else{let l=r;this.view.setScrollTop(r-this.view.renderHeight-s),this.view.getScrollTop()+i()!==l&&(this.setFocus([]),await kc(0),await this.focusPreviousPage(e,t,i))}}focusLast(e,t){if(this.length===0)return;let i=this.findPreviousIndex(this.length-1,!1,t);i>-1&&this.setFocus([i],e)}focusFirst(e,t){this.focusNth(0,e,t)}focusNth(e,t,i){if(this.length===0)return;let o=this.findNextIndex(e,!1,i);o>-1&&this.setFocus([o],t)}findNextIndex(e,t=!1,i){for(let o=0;o=this.length&&!t)return-1;if(e=e%this.length,!i||i(this.element(e)))return e;e++}return-1}findPreviousIndex(e,t=!1,i){for(let o=0;othis.view.element(e))}reveal(e,t,i=0){if(e<0||e>=this.length)throw new oc(this.user,`Invalid index ${e}`);let o=this.view.getScrollTop(),s=this.view.elementTop(e),r=this.view.elementHeight(e);if(pa(t)){let a=r-this.view.renderHeight+i;this.view.setScrollTop(a*Bn(t,0,1)+s-i)}else{let a=s+r,l=o+this.view.renderHeight;s=l||(s=l&&r>=this.view.renderHeight?this.view.setScrollTop(s-i):a>=l&&this.view.setScrollTop(a-this.view.renderHeight))}}getRelativeTop(e,t=0){if(e<0||e>=this.length)throw new oc(this.user,`Invalid index ${e}`);let i=this.view.getScrollTop(),o=this.view.elementTop(e),s=this.view.elementHeight(e);if(oi+this.view.renderHeight)return null;let r=s-this.view.renderHeight+t;return Math.abs((i+t-o)/r)}getHTMLElement(){return this.view.domNode}getScrollableElement(){return this.view.scrollableElementDomNode}getElementID(e){return this.view.getElementDomId(e)}getElementTop(e){return this.view.elementTop(e)}style(e){this.styleController.style(e)}toListEvent({indexes:e,browserEvent:t}){return{indexes:e,elements:e.map(i=>this.view.element(i)),browserEvent:t}}_onFocusChange(){let e=this.focus.get();this.view.domNode.classList.toggle("element-focused",e.length>0),this.onDidChangeActiveDescendant()}onDidChangeActiveDescendant(){var e;let t=this.focus.get();if(t.length>0){let i;!((e=this.accessibilityProvider)===null||e===void 0)&&e.getActiveDescendantId&&(i=this.accessibilityProvider.getActiveDescendantId(this.view.element(t[0]))),this.view.domNode.setAttribute("aria-activedescendant",i||this.view.getElementDomId(t[0]))}else this.view.domNode.removeAttribute("aria-activedescendant")}_onSelectionChange(){let e=this.selection.get();this.view.domNode.classList.toggle("selection-none",e.length===0),this.view.domNode.classList.toggle("selection-single",e.length===1),this.view.domNode.classList.toggle("selection-multiple",e.length>1)}dispose(){this._onDidDispose.fire(),this.disposables.dispose(),this._onDidDispose.dispose()}};Oh([Yt],Do.prototype,"onDidChangeFocus",null);Oh([Yt],Do.prototype,"onDidChangeSelection",null);Oh([Yt],Do.prototype,"onContextMenu",null);Oh([Yt],Do.prototype,"onKeyDown",null);Oh([Yt],Do.prototype,"onDidFocus",null);Oh([Yt],Do.prototype,"onDidBlur",null);wt();ye();z_();le();Lt();Ge();var Ff=ve,NH="selectOption.entry.template",J5=class{get templateId(){return NH}renderTemplate(e){let t=Object.create(null);return t.root=e,t.text=me(e,Ff(".option-text")),t.detail=me(e,Ff(".option-detail")),t.decoratorRight=me(e,Ff(".option-decorator-right")),t}renderElement(e,t,i){let o=i,s=e.text,r=e.detail,a=e.decoratorRight,l=e.isDisabled;o.text.textContent=s,o.detail.textContent=r||"",o.decoratorRight.innerText=a||"",l?o.root.classList.add("option-disabled"):o.root.classList.remove("option-disabled")}disposeTemplate(e){}},Bf=class n extends H{constructor(e,t,i,o,s){super(),this.options=[],this._currentSelection=0,this._hasDetails=!1,this._skipLayout=!1,this._sticky=!1,this._isVisible=!1,this.styles=o,this.selectBoxOptions=s||Object.create(null),typeof this.selectBoxOptions.minBottomMargin!="number"?this.selectBoxOptions.minBottomMargin=n.DEFAULT_DROPDOWN_MINIMUM_BOTTOM_MARGIN:this.selectBoxOptions.minBottomMargin<0&&(this.selectBoxOptions.minBottomMargin=0),this.selectElement=document.createElement("select"),this.selectElement.className="monaco-select-box monaco-select-box-dropdown-padding",typeof this.selectBoxOptions.ariaLabel=="string"&&this.selectElement.setAttribute("aria-label",this.selectBoxOptions.ariaLabel),typeof this.selectBoxOptions.ariaDescription=="string"&&this.selectElement.setAttribute("aria-description",this.selectBoxOptions.ariaDescription),this._onDidSelect=new B,this._register(this._onDidSelect),this.registerListeners(),this.constructSelectDropDown(i),this.selected=t||0,e&&this.setOptions(e,t),this.initStyleSheet()}setTitle(e){!this._hover&&e?this._hover=this._register(Qn().setupUpdatableHover(ji("mouse"),this.selectElement,e)):this._hover&&this._hover.update(e)}getHeight(){return 22}getTemplateId(){return NH}constructSelectDropDown(e){this.contextViewProvider=e,this.selectDropDownContainer=ve(".monaco-select-box-dropdown-container"),this.selectDropDownContainer.classList.add("monaco-select-box-dropdown-padding"),this.selectionDetailsPane=me(this.selectDropDownContainer,Ff(".select-box-details-pane"));let t=me(this.selectDropDownContainer,Ff(".select-box-dropdown-container-width-control")),i=me(t,Ff(".width-control-div"));this.widthControlElement=document.createElement("span"),this.widthControlElement.className="option-text-width-control",me(i,this.widthControlElement),this._dropDownPosition=0,this.styleElement=Xi(this.selectDropDownContainer),this.selectDropDownContainer.setAttribute("draggable","true"),this._register($(this.selectDropDownContainer,se.DRAG_START,o=>{He.stop(o,!0)}))}registerListeners(){this._register(Ut(this.selectElement,"change",t=>{this.selected=t.target.selectedIndex,this._onDidSelect.fire({index:t.target.selectedIndex,selected:t.target.value}),this.options[this.selected]&&this.options[this.selected].text&&this.setTitle(this.options[this.selected].text)})),this._register($(this.selectElement,se.CLICK,t=>{He.stop(t),this._isVisible?this.hideSelectDropDown(!0):this.showSelectDropDown()})),this._register($(this.selectElement,se.MOUSE_DOWN,t=>{He.stop(t)}));let e;this._register($(this.selectElement,"touchstart",t=>{e=this._isVisible})),this._register($(this.selectElement,"touchend",t=>{He.stop(t),e?this.hideSelectDropDown(!0):this.showSelectDropDown()})),this._register($(this.selectElement,se.KEY_DOWN,t=>{let i=new bt(t),o=!1;Be?(i.keyCode===18||i.keyCode===16||i.keyCode===10||i.keyCode===3)&&(o=!0):(i.keyCode===18&&i.altKey||i.keyCode===16&&i.altKey||i.keyCode===10||i.keyCode===3)&&(o=!0),o&&(this.showSelectDropDown(),He.stop(t,!0))}))}get onDidSelect(){return this._onDidSelect.event}setOptions(e,t){Ht(this.options,e)||(this.options=e,this.selectElement.options.length=0,this._hasDetails=!1,this._cachedMaxDetailsHeight=void 0,this.options.forEach((i,o)=>{this.selectElement.add(this.createOption(i.text,o,i.isDisabled)),typeof i.description=="string"&&(this._hasDetails=!0)})),t!==void 0&&(this.select(t),this._currentSelection=this.selected)}setOptionsList(){var e;(e=this.selectList)===null||e===void 0||e.splice(0,this.selectList.length,this.options)}select(e){e>=0&&ethis.options.length-1?this.select(this.options.length-1):this.selected<0&&(this.selected=0),this.selectElement.selectedIndex=this.selected,this.options[this.selected]&&this.options[this.selected].text&&this.setTitle(this.options[this.selected].text)}focus(){this.selectElement&&(this.selectElement.tabIndex=0,this.selectElement.focus())}blur(){this.selectElement&&(this.selectElement.tabIndex=-1,this.selectElement.blur())}setFocusable(e){this.selectElement.tabIndex=e?0:-1}render(e){this.container=e,e.classList.add("select-container"),e.appendChild(this.selectElement),this.styleSelectElement()}initStyleSheet(){let e=[];this.styles.listFocusBackground&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row.focused { background-color: ${this.styles.listFocusBackground} !important; }`),this.styles.listFocusForeground&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row.focused { color: ${this.styles.listFocusForeground} !important; }`),this.styles.decoratorRightForeground&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row:not(.focused) .option-decorator-right { color: ${this.styles.decoratorRightForeground}; }`),this.styles.selectBackground&&this.styles.selectBorder&&this.styles.selectBorder!==this.styles.selectBackground?(e.push(`.monaco-select-box-dropdown-container { border: 1px solid ${this.styles.selectBorder} } `),e.push(`.monaco-select-box-dropdown-container > .select-box-details-pane.border-top { border-top: 1px solid ${this.styles.selectBorder} } `),e.push(`.monaco-select-box-dropdown-container > .select-box-details-pane.border-bottom { border-bottom: 1px solid ${this.styles.selectBorder} } `)):this.styles.selectListBorder&&(e.push(`.monaco-select-box-dropdown-container > .select-box-details-pane.border-top { border-top: 1px solid ${this.styles.selectListBorder} } `),e.push(`.monaco-select-box-dropdown-container > .select-box-details-pane.border-bottom { border-bottom: 1px solid ${this.styles.selectListBorder} } `)),this.styles.listHoverForeground&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row:not(.option-disabled):not(.focused):hover { color: ${this.styles.listHoverForeground} !important; }`),this.styles.listHoverBackground&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row:not(.option-disabled):not(.focused):hover { background-color: ${this.styles.listHoverBackground} !important; }`),this.styles.listFocusOutline&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row.focused { outline: 1.6px dotted ${this.styles.listFocusOutline} !important; outline-offset: -1.6px !important; }`),this.styles.listHoverOutline&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row:not(.option-disabled):not(.focused):hover { outline: 1.6px dashed ${this.styles.listHoverOutline} !important; outline-offset: -1.6px !important; }`),e.push(".monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row.option-disabled.focused { background-color: transparent !important; color: inherit !important; outline: none !important; }"),e.push(".monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row.option-disabled:hover { background-color: transparent !important; color: inherit !important; outline: none !important; }"),this.styleElement.textContent=e.join(` +`)}styleSelectElement(){var e,t,i;let o=(e=this.styles.selectBackground)!==null&&e!==void 0?e:"",s=(t=this.styles.selectForeground)!==null&&t!==void 0?t:"",r=(i=this.styles.selectBorder)!==null&&i!==void 0?i:"";this.selectElement.style.backgroundColor=o,this.selectElement.style.color=s,this.selectElement.style.borderColor=r}styleList(){var e,t;let i=(e=this.styles.selectBackground)!==null&&e!==void 0?e:"",o=tr(this.styles.selectListBackground,i);this.selectDropDownListContainer.style.backgroundColor=o,this.selectionDetailsPane.style.backgroundColor=o;let s=(t=this.styles.focusBorder)!==null&&t!==void 0?t:"";this.selectDropDownContainer.style.outlineColor=s,this.selectDropDownContainer.style.outlineOffset="-1px",this.selectList.style(this.styles)}createOption(e,t,i){let o=document.createElement("option");return o.value=e,o.text=e,o.disabled=!!i,o}showSelectDropDown(){this.selectionDetailsPane.innerText="",!(!this.contextViewProvider||this._isVisible)&&(this.createSelectList(this.selectDropDownContainer),this.setOptionsList(),this.contextViewProvider.showContextView({getAnchor:()=>this.selectElement,render:e=>this.renderSelectDropDown(e,!0),layout:()=>{this.layoutSelectDropDown()},onHide:()=>{this.selectDropDownContainer.classList.remove("visible"),this.selectElement.classList.remove("synthetic-focus")},anchorPosition:this._dropDownPosition},this.selectBoxOptions.optionsAsChildren?this.container:void 0),this._isVisible=!0,this.hideSelectDropDown(!1),this.contextViewProvider.showContextView({getAnchor:()=>this.selectElement,render:e=>this.renderSelectDropDown(e),layout:()=>this.layoutSelectDropDown(),onHide:()=>{this.selectDropDownContainer.classList.remove("visible"),this.selectElement.classList.remove("synthetic-focus")},anchorPosition:this._dropDownPosition},this.selectBoxOptions.optionsAsChildren?this.container:void 0),this._currentSelection=this.selected,this._isVisible=!0,this.selectElement.setAttribute("aria-expanded","true"))}hideSelectDropDown(e){!this.contextViewProvider||!this._isVisible||(this._isVisible=!1,this.selectElement.setAttribute("aria-expanded","false"),e&&this.selectElement.focus(),this.contextViewProvider.hideContextView())}renderSelectDropDown(e,t){return e.appendChild(this.selectDropDownContainer),this.layoutSelectDropDown(t),{dispose:()=>{try{e.removeChild(this.selectDropDownContainer)}catch{}}}}measureMaxDetailsHeight(){let e=0;return this.options.forEach((t,i)=>{this.updateDetail(i),this.selectionDetailsPane.offsetHeight>e&&(e=this.selectionDetailsPane.offsetHeight)}),e}layoutSelectDropDown(e){if(this._skipLayout)return!1;if(this.selectList){this.selectDropDownContainer.classList.add("visible");let t=ge(this.selectElement),i=Sn(this.selectElement),o=ge(this.selectElement).getComputedStyle(this.selectElement),s=parseFloat(o.getPropertyValue("--dropdown-padding-top"))+parseFloat(o.getPropertyValue("--dropdown-padding-bottom")),r=t.innerHeight-i.top-i.height-(this.selectBoxOptions.minBottomMargin||0),a=i.top-n.DEFAULT_DROPDOWN_MINIMUM_TOP_MARGIN,l=this.selectElement.offsetWidth,c=this.setWidthControlElement(this.widthControlElement),d=Math.max(c,Math.round(l)).toString()+"px";this.selectDropDownContainer.style.width=d,this.selectList.getHTMLElement().style.height="",this.selectList.layout();let h=this.selectList.contentHeight;this._hasDetails&&this._cachedMaxDetailsHeight===void 0&&(this._cachedMaxDetailsHeight=this.measureMaxDetailsHeight());let u=this._hasDetails?this._cachedMaxDetailsHeight:0,f=h+s+u,g=Math.floor((r-s-u)/this.getHeight()),m=Math.floor((a-s-u)/this.getHeight());if(e)return i.top+i.height>t.innerHeight-22||i.topg&&this.options.length>g?(this._dropDownPosition=1,this.selectDropDownContainer.removeChild(this.selectDropDownListContainer),this.selectDropDownContainer.removeChild(this.selectionDetailsPane),this.selectDropDownContainer.appendChild(this.selectionDetailsPane),this.selectDropDownContainer.appendChild(this.selectDropDownListContainer),this.selectionDetailsPane.classList.remove("border-top"),this.selectionDetailsPane.classList.add("border-bottom")):(this._dropDownPosition=0,this.selectDropDownContainer.removeChild(this.selectDropDownListContainer),this.selectDropDownContainer.removeChild(this.selectionDetailsPane),this.selectDropDownContainer.appendChild(this.selectDropDownListContainer),this.selectDropDownContainer.appendChild(this.selectionDetailsPane),this.selectionDetailsPane.classList.remove("border-bottom"),this.selectionDetailsPane.classList.add("border-top")),!0);if(i.top+i.height>t.innerHeight-22||i.topr&&(h=g*this.getHeight())}else f>a&&(h=m*this.getHeight());return this.selectList.layout(h),this.selectList.domFocus(),this.selectList.length>0&&(this.selectList.setFocus([this.selected||0]),this.selectList.reveal(this.selectList.getFocus()[0]||0)),this._hasDetails?(this.selectList.getHTMLElement().style.height=h+s+"px",this.selectDropDownContainer.style.height=""):this.selectDropDownContainer.style.height=h+s+"px",this.updateDetail(this.selected),this.selectDropDownContainer.style.width=d,this.selectDropDownListContainer.setAttribute("tabindex","0"),this.selectElement.classList.add("synthetic-focus"),this.selectDropDownContainer.classList.add("synthetic-focus"),!0}else return!1}setWidthControlElement(e){let t=0;if(e){let i=0,o=0;this.options.forEach((s,r)=>{let a=s.detail?s.detail.length:0,l=s.decoratorRight?s.decoratorRight.length:0,c=s.text.length+a+l;c>o&&(i=r,o=c)}),e.textContent=this.options[i].text+(this.options[i].decoratorRight?this.options[i].decoratorRight+" ":""),t=Vg(e)}return t}createSelectList(e){if(this.selectList)return;this.selectDropDownListContainer=me(e,Ff(".select-box-dropdown-list-container")),this.listRenderer=new J5,this.selectList=new Do("SelectBoxCustom",this.selectDropDownListContainer,this,[this.listRenderer],{useShadows:!1,verticalScrollMode:3,keyboardSupport:!1,mouseSupport:!1,accessibilityProvider:{getAriaLabel:o=>{let s=o.text;return o.detail&&(s+=`. ${o.detail}`),o.decoratorRight&&(s+=`. ${o.decoratorRight}`),o.description&&(s+=`. ${o.description}`),s},getWidgetAriaLabel:()=>p({key:"selectBox",comment:["Behave like native select dropdown element."]},"Select Box"),getRole:()=>Be?"":"option",getWidgetRole:()=>"listbox"}}),this.selectBoxOptions.ariaLabel&&(this.selectList.ariaLabel=this.selectBoxOptions.ariaLabel);let t=this._register(new et(this.selectDropDownListContainer,"keydown")),i=ie.chain(t.event,o=>o.filter(()=>this.selectList.length>0).map(s=>new bt(s)));this._register(ie.chain(i,o=>o.filter(s=>s.keyCode===3))(this.onEnter,this)),this._register(ie.chain(i,o=>o.filter(s=>s.keyCode===2))(this.onEnter,this)),this._register(ie.chain(i,o=>o.filter(s=>s.keyCode===9))(this.onEscape,this)),this._register(ie.chain(i,o=>o.filter(s=>s.keyCode===16))(this.onUpArrow,this)),this._register(ie.chain(i,o=>o.filter(s=>s.keyCode===18))(this.onDownArrow,this)),this._register(ie.chain(i,o=>o.filter(s=>s.keyCode===12))(this.onPageDown,this)),this._register(ie.chain(i,o=>o.filter(s=>s.keyCode===11))(this.onPageUp,this)),this._register(ie.chain(i,o=>o.filter(s=>s.keyCode===14))(this.onHome,this)),this._register(ie.chain(i,o=>o.filter(s=>s.keyCode===13))(this.onEnd,this)),this._register(ie.chain(i,o=>o.filter(s=>s.keyCode>=21&&s.keyCode<=56||s.keyCode>=85&&s.keyCode<=113))(this.onCharacter,this)),this._register($(this.selectList.getHTMLElement(),se.POINTER_UP,o=>this.onPointerUp(o))),this._register(this.selectList.onMouseOver(o=>typeof o.index<"u"&&this.selectList.setFocus([o.index]))),this._register(this.selectList.onDidChangeFocus(o=>this.onListFocus(o))),this._register($(this.selectDropDownContainer,se.FOCUS_OUT,o=>{!this._isVisible||yi(o.relatedTarget,this.selectDropDownContainer)||this.onListBlur()})),this.selectList.getHTMLElement().setAttribute("aria-label",this.selectBoxOptions.ariaLabel||""),this.selectList.getHTMLElement().setAttribute("aria-expanded","true"),this.styleList()}onPointerUp(e){if(!this.selectList.length)return;He.stop(e);let t=e.target;if(!t||t.classList.contains("slider"))return;let i=t.closest(".monaco-list-row");if(!i)return;let o=Number(i.getAttribute("data-index")),s=i.classList.contains("option-disabled");o>=0&&o{for(let r=0;rthis.selected+2)this.selected+=2;else{if(t)return;this.selected++}this.select(this.selected),this.selectList.setFocus([this.selected]),this.selectList.reveal(this.selectList.getFocus()[0])}}onUpArrow(e){this.selected>0&&(He.stop(e,!0),this.options[this.selected-1].isDisabled&&this.selected>1?this.selected-=2:this.selected--,this.select(this.selected),this.selectList.setFocus([this.selected]),this.selectList.reveal(this.selectList.getFocus()[0]))}onPageUp(e){He.stop(e),this.selectList.focusPreviousPage(),setTimeout(()=>{this.selected=this.selectList.getFocus()[0],this.options[this.selected].isDisabled&&this.selected{this.selected=this.selectList.getFocus()[0],this.options[this.selected].isDisabled&&this.selected>0&&(this.selected--,this.selectList.setFocus([this.selected])),this.selectList.reveal(this.selected),this.select(this.selected)},1)}onHome(e){He.stop(e),!(this.options.length<2)&&(this.selected=0,this.options[this.selected].isDisabled&&this.selected>1&&this.selected++,this.selectList.setFocus([this.selected]),this.selectList.reveal(this.selected),this.select(this.selected))}onEnd(e){He.stop(e),!(this.options.length<2)&&(this.selected=this.options.length-1,this.options[this.selected].isDisabled&&this.selected>1&&this.selected--,this.selectList.setFocus([this.selected]),this.selectList.reveal(this.selected),this.select(this.selected))}onCharacter(e){let t=Ir.toString(e.keyCode),i=-1;for(let o=0;o{this._register($(this.selectElement,e,t=>{this.selectElement.focus()}))}),this._register(Ut(this.selectElement,"click",e=>{He.stop(e,!0)})),this._register(Ut(this.selectElement,"change",e=>{this.selectElement.title=e.target.value,this._onDidSelect.fire({index:e.target.selectedIndex,selected:e.target.value})})),this._register(Ut(this.selectElement,"keydown",e=>{let t=!1;Be?(e.keyCode===18||e.keyCode===16||e.keyCode===10)&&(t=!0):(e.keyCode===18&&e.altKey||e.keyCode===10||e.keyCode===3)&&(t=!0),t&&e.stopPropagation()}))}get onDidSelect(){return this._onDidSelect.event}setOptions(e,t){(!this.options||!Ht(this.options,e))&&(this.options=e,this.selectElement.options.length=0,this.options.forEach((i,o)=>{this.selectElement.add(this.createOption(i.text,o,i.isDisabled))})),t!==void 0&&this.select(t)}select(e){this.options.length===0?this.selected=0:e>=0&&ethis.options.length-1?this.select(this.options.length-1):this.selected<0&&(this.selected=0),this.selectElement.selectedIndex=this.selected,this.selected{this.element&&this.handleActionChangeEvent(o)}))}handleActionChangeEvent(e){e.enabled!==void 0&&this.updateEnabled(),e.checked!==void 0&&this.updateChecked(),e.class!==void 0&&this.updateClass(),e.label!==void 0&&(this.updateLabel(),this.updateTooltip()),e.tooltip!==void 0&&this.updateTooltip()}get actionRunner(){return this._actionRunner||(this._actionRunner=this._register(new bs)),this._actionRunner}set actionRunner(e){this._actionRunner=e}isEnabled(){return this._action.enabled}setActionContext(e){this._context=e}render(e){let t=this.element=e;this._register(ui.addTarget(e));let i=this.options&&this.options.draggable;i&&(e.draggable=!0,wn&&this._register($(e,se.DRAG_START,o=>{var s;return(s=o.dataTransfer)===null||s===void 0?void 0:s.setData(OD.TEXT,this._action.label)}))),this._register($(t,It.Tap,o=>this.onClick(o,!0))),this._register($(t,se.MOUSE_DOWN,o=>{i||He.stop(o,!0),this._action.enabled&&o.button===0&&t.classList.add("active")})),Be&&this._register($(t,se.CONTEXT_MENU,o=>{o.button===0&&o.ctrlKey===!0&&this.onClick(o)})),this._register($(t,se.CLICK,o=>{He.stop(o,!0),this.options&&this.options.isMenu||this.onClick(o)})),this._register($(t,se.DBLCLICK,o=>{He.stop(o,!0)})),[se.MOUSE_UP,se.MOUSE_OUT].forEach(o=>{this._register($(t,o,s=>{He.stop(s),t.classList.remove("active")}))})}onClick(e,t=!1){var i;He.stop(e,!0);let o=io(this._context)?!((i=this.options)===null||i===void 0)&&i.useEventAsContext?e:{preserveFocus:t}:this._context;this.actionRunner.run(this._action,o)}focus(){this.element&&(this.element.tabIndex=0,this.element.focus(),this.element.classList.add("focused"))}blur(){this.element&&(this.element.blur(),this.element.tabIndex=-1,this.element.classList.remove("focused"))}setFocusable(e){this.element&&(this.element.tabIndex=e?0:-1)}get trapsArrowNavigation(){return!1}updateEnabled(){}updateLabel(){}getClass(){return this.action.class}getTooltip(){return this.action.tooltip}updateTooltip(){var e,t,i;if(!this.element)return;let o=(e=this.getTooltip())!==null&&e!==void 0?e:"";if(this.updateAriaLabel(),!((t=this.options.hoverDelegate)===null||t===void 0)&&t.showNativeHover)this.element.title=o;else if(!this.customHover&&o!==""){let s=(i=this.options.hoverDelegate)!==null&&i!==void 0?i:ji("element");this.customHover=this._store.add(Qn().setupUpdatableHover(s,this.element,o))}else this.customHover&&this.customHover.update(o)}updateAriaLabel(){var e;if(this.element){let t=(e=this.getTooltip())!==null&&e!==void 0?e:"";this.element.setAttribute("aria-label",t)}}updateClass(){}updateChecked(){}dispose(){this.element&&(this.element.remove(),this.element=void 0),this._context=void 0,super.dispose()}},Fh=class extends qo{constructor(e,t,i){super(e,t,i),this.options=i,this.options.icon=i.icon!==void 0?i.icon:!1,this.options.label=i.label!==void 0?i.label:!0,this.cssClass=""}render(e){super.render(e),Ms(this.element);let t=document.createElement("a");if(t.classList.add("action-label"),t.setAttribute("role",this.getDefaultAriaRole()),this.label=t,this.element.appendChild(t),this.options.label&&this.options.keybinding){let i=document.createElement("span");i.classList.add("keybinding"),i.textContent=this.options.keybinding,this.element.appendChild(i)}this.updateClass(),this.updateLabel(),this.updateTooltip(),this.updateEnabled(),this.updateChecked()}getDefaultAriaRole(){return this._action.id===zi.ID?"presentation":this.options.isMenu?"menuitem":"button"}focus(){this.label&&(this.label.tabIndex=0,this.label.focus())}blur(){this.label&&(this.label.tabIndex=-1)}setFocusable(e){this.label&&(this.label.tabIndex=e?0:-1)}updateLabel(){this.options.label&&this.label&&(this.label.textContent=this.action.label)}getTooltip(){let e=null;return this.action.tooltip?e=this.action.tooltip:!this.options.label&&this.action.label&&this.options.icon&&(e=this.action.label,this.options.keybinding&&(e=p({key:"titleLabel",comment:["action title","action keybinding"]},"{0} ({1})",e,this.options.keybinding))),e??void 0}updateClass(){var e;this.cssClass&&this.label&&this.label.classList.remove(...this.cssClass.split(" ")),this.options.icon?(this.cssClass=this.getClass(),this.label&&(this.label.classList.add("codicon"),this.cssClass&&this.label.classList.add(...this.cssClass.split(" "))),this.updateEnabled()):(e=this.label)===null||e===void 0||e.classList.remove("codicon")}updateEnabled(){var e,t;this.action.enabled?(this.label&&(this.label.removeAttribute("aria-disabled"),this.label.classList.remove("disabled")),(e=this.element)===null||e===void 0||e.classList.remove("disabled")):(this.label&&(this.label.setAttribute("aria-disabled","true"),this.label.classList.add("disabled")),(t=this.element)===null||t===void 0||t.classList.add("disabled"))}updateAriaLabel(){var e;if(this.label){let t=(e=this.getTooltip())!==null&&e!==void 0?e:"";this.label.setAttribute("aria-label",t)}}updateChecked(){this.label&&(this.action.checked!==void 0?(this.label.classList.toggle("checked",this.action.checked),this.label.setAttribute("aria-checked",this.action.checked?"true":"false"),this.label.setAttribute("role","checkbox")):(this.label.classList.remove("checked"),this.label.removeAttribute("aria-checked"),this.label.setAttribute("role",this.getDefaultAriaRole())))}},YD=class extends qo{constructor(e,t,i,o,s,r,a){super(e,t),this.selectBox=new ZD(i,o,s,r,a),this.selectBox.setFocusable(!1),this._register(this.selectBox),this.registerListeners()}select(e){this.selectBox.select(e)}registerListeners(){this._register(this.selectBox.onDidSelect(e=>this.runAction(e.selected,e.index)))}runAction(e,t){this.actionRunner.run(this._action,this.getActionContext(e,t))}getActionContext(e,t){return e}setFocusable(e){this.selectBox.setFocusable(e)}focus(){var e;(e=this.selectBox)===null||e===void 0||e.focus()}blur(){var e;(e=this.selectBox)===null||e===void 0||e.blur()}render(e){this.selectBox.render(e)}};_();v();b();ke();_();v();b();ke();oo();Po();ye();var eP=class extends bs{constructor(e,t){super(),this._onDidChangeVisibility=this._register(new B),this.onDidChangeVisibility=this._onDidChangeVisibility.event,this._element=me(e,ve(".monaco-dropdown")),this._label=me(this._element,ve(".dropdown-label"));let i=t.labelRenderer;i||(i=s=>(s.textContent=t.label||"",null));for(let s of[se.CLICK,se.MOUSE_DOWN,It.Tap])this._register($(this.element,s,r=>He.stop(r,!0)));for(let s of[se.MOUSE_DOWN,It.Tap])this._register($(this._label,s,r=>{Hg(r)&&(r.detail>1||r.button!==0)||(this.visible?this.hide():this.show())}));this._register($(this._label,se.KEY_UP,s=>{let r=new bt(s);(r.equals(3)||r.equals(10))&&(He.stop(s,!0),this.visible?this.hide():this.show())}));let o=i(this._label);o&&this._register(o),this._register(ui.addTarget(this._label))}get element(){return this._element}show(){this.visible||(this.visible=!0,this._onDidChangeVisibility.fire(!0))}hide(){this.visible&&(this.visible=!1,this._onDidChangeVisibility.fire(!1))}dispose(){super.dispose(),this.hide(),this.boxContainer&&(this.boxContainer.remove(),this.boxContainer=void 0),this.contents&&(this.contents.remove(),this.contents=void 0),this._label&&(this._label.remove(),this._label=void 0)}},XD=class extends eP{constructor(e,t){super(e,t),this._options=t,this._actions=[],this.actions=t.actions||[]}set menuOptions(e){this._menuOptions=e}get menuOptions(){return this._menuOptions}get actions(){return this._options.actionProvider?this._options.actionProvider.getActions():this._actions}set actions(e){this._actions=e}show(){super.show(),this.element.classList.add("active"),this._options.contextMenuProvider.showContextMenu({getAnchor:()=>this.element,getActions:()=>this.actions,getActionsContext:()=>this.menuOptions?this.menuOptions.context:null,getActionViewItem:(e,t)=>this.menuOptions&&this.menuOptions.actionViewItemProvider?this.menuOptions.actionViewItemProvider(e,t):void 0,getKeyBinding:e=>this.menuOptions&&this.menuOptions.getKeyBinding?this.menuOptions.getKeyBinding(e):void 0,getMenuClassName:()=>this._options.menuClassName||"",onHide:()=>this.onHide(),actionRunner:this.menuOptions?this.menuOptions.actionRunner:void 0,anchorAlignment:this.menuOptions?this.menuOptions.anchorAlignment:0,domForShadowRoot:this._options.menuAsChild?this.element:void 0,skipTelemetry:this._options.skipTelemetry})}hide(){super.hide()}onHide(){this.hide(),this.element.classList.remove("active")}};ye();var Bh=class extends qo{constructor(e,t,i,o=Object.create(null)){super(null,e,o),this.actionItem=null,this._onDidChangeVisibility=this._register(new B),this.onDidChangeVisibility=this._onDidChangeVisibility.event,this.menuActionsOrProvider=t,this.contextMenuProvider=i,this.options=o,this.options.actionRunner&&(this.actionRunner=this.options.actionRunner)}render(e){this.actionItem=e;let t=s=>{var r;this.element=me(s,ve("a.action-label"));let a=[];return typeof this.options.classNames=="string"?a=this.options.classNames.split(/\s+/g).filter(l=>!!l):this.options.classNames&&(a=this.options.classNames),a.find(l=>l==="icon")||a.push("codicon"),this.element.classList.add(...a),this.element.setAttribute("role","button"),this.element.setAttribute("aria-haspopup","true"),this.element.setAttribute("aria-expanded","false"),this._action.label&&this._register(Qn().setupUpdatableHover((r=this.options.hoverDelegate)!==null&&r!==void 0?r:ji("mouse"),this.element,this._action.label)),this.element.ariaLabel=this._action.label||"",null},i=Array.isArray(this.menuActionsOrProvider),o={contextMenuProvider:this.contextMenuProvider,labelRenderer:t,menuAsChild:this.options.menuAsChild,actions:i?this.menuActionsOrProvider:void 0,actionProvider:i?void 0:this.menuActionsOrProvider,skipTelemetry:this.options.skipTelemetry};if(this.dropdownMenu=this._register(new XD(e,o)),this._register(this.dropdownMenu.onDidChangeVisibility(s=>{var r;(r=this.element)===null||r===void 0||r.setAttribute("aria-expanded",`${s}`),this._onDidChangeVisibility.fire(s)})),this.dropdownMenu.menuOptions={actionViewItemProvider:this.options.actionViewItemProvider,actionRunner:this.actionRunner,getKeyBinding:this.options.keybindingProvider,context:this._context},this.options.anchorAlignmentProvider){let s=this;this.dropdownMenu.menuOptions={...this.dropdownMenu.menuOptions,get anchorAlignment(){return s.options.anchorAlignmentProvider()}}}this.updateTooltip(),this.updateEnabled()}getTooltip(){let e=null;return this.action.tooltip?e=this.action.tooltip:this.action.label&&(e=this.action.label),e??void 0}setActionContext(e){super.setActionContext(e),this.dropdownMenu&&(this.dropdownMenu.menuOptions?this.dropdownMenu.menuOptions.context=e:this.dropdownMenu.menuOptions={context:e})}show(){var e;(e=this.dropdownMenu)===null||e===void 0||e.show()}updateEnabled(){var e,t;let i=!this.action.enabled;(e=this.actionItem)===null||e===void 0||e.classList.toggle("disabled",i),(t=this.element)===null||t===void 0||t.classList.toggle("disabled",i)}};Po();le();Lt();Ge();zr();_();v();b();function SQe(n){return n&&typeof n=="object"&&typeof n.original=="string"&&typeof n.value=="string"}function AH(n){return n?n.condition!==void 0:!1}Oi();qe();_();v();b();ye();le();xi();_();v();b();Gt();ye();le();xi();var Wf;(function(n){n[n.STORAGE_DOES_NOT_EXIST=0]="STORAGE_DOES_NOT_EXIST",n[n.STORAGE_IN_MEMORY=1]="STORAGE_IN_MEMORY"})(Wf||(Wf={}));var Gp;(function(n){n[n.None=0]="None",n[n.Initialized=1]="Initialized",n[n.Closed=2]="Closed"})(Gp||(Gp={}));var zf=class n extends H{constructor(e,t=Object.create(null)){super(),this.database=e,this.options=t,this._onDidChangeStorage=this._register(new ul),this.onDidChangeStorage=this._onDidChangeStorage.event,this.state=Gp.None,this.cache=new Map,this.flushDelayer=this._register(new Pg(n.DEFAULT_FLUSH_DELAY)),this.pendingDeletes=new Set,this.pendingInserts=new Map,this.whenFlushedCallbacks=[],this.registerListeners()}registerListeners(){this._register(this.database.onDidChangeItemsExternal(e=>this.onDidChangeItemsExternal(e)))}onDidChangeItemsExternal(e){var t,i;this._onDidChangeStorage.pause();try{(t=e.changed)===null||t===void 0||t.forEach((o,s)=>this.acceptExternal(s,o)),(i=e.deleted)===null||i===void 0||i.forEach(o=>this.acceptExternal(o,void 0))}finally{this._onDidChangeStorage.resume()}}acceptExternal(e,t){if(this.state===Gp.Closed)return;let i=!1;io(t)?i=this.cache.delete(e):this.cache.get(e)!==t&&(this.cache.set(e,t),i=!0),i&&this._onDidChangeStorage.fire({key:e,external:!0})}get(e,t){let i=this.cache.get(e);return io(i)?t:i}getBoolean(e,t){let i=this.get(e);return io(i)?t:i==="true"}getNumber(e,t){let i=this.get(e);return io(i)?t:parseInt(i,10)}async set(e,t,i=!1){if(this.state===Gp.Closed)return;if(io(t))return this.delete(e,i);let o=dn(t)||Array.isArray(t)?NV(t):String(t);if(this.cache.get(e)!==o)return this.cache.set(e,o),this.pendingInserts.set(e,o),this.pendingDeletes.delete(e),this._onDidChangeStorage.fire({key:e,external:i}),this.doFlush()}async delete(e,t=!1){if(!(this.state===Gp.Closed||!this.cache.delete(e)))return this.pendingDeletes.has(e)||this.pendingDeletes.add(e),this.pendingInserts.delete(e),this._onDidChangeStorage.fire({key:e,external:t}),this.doFlush()}get hasPending(){return this.pendingInserts.size>0||this.pendingDeletes.size>0}async flushPending(){if(!this.hasPending)return;let e={insert:this.pendingInserts,delete:this.pendingDeletes};return this.pendingDeletes=new Set,this.pendingInserts=new Map,this.database.updateItems(e).finally(()=>{var t;if(!this.hasPending)for(;this.whenFlushedCallbacks.length;)(t=this.whenFlushedCallbacks.pop())===null||t===void 0||t()})}async doFlush(e){return this.options.hint===Wf.STORAGE_IN_MEMORY?this.flushPending():this.flushDelayer.trigger(()=>this.flushPending(),e)}};zf.DEFAULT_FLUSH_DELAY=100;var Zp=class{constructor(){this.onDidChangeItemsExternal=ie.None,this.items=new Map}async updateItems(e){var t,i;(t=e.insert)===null||t===void 0||t.forEach((o,s)=>this.items.set(s,o)),(i=e.delete)===null||i===void 0||i.forEach(o=>this.items.delete(o))}};qe();var QD="__$__targetStorageMarker",Vf=De("storageService"),MH;(function(n){n[n.NONE=0]="NONE",n[n.SHUTDOWN=1]="SHUTDOWN"})(MH||(MH={}));function QX(n){let e=n.get(QD);if(e)try{return JSON.parse(e)}catch{}return Object.create(null)}var JD=class n extends H{constructor(e={flushInterval:n.DEFAULT_FLUSH_INTERVAL}){super(),this.options=e,this._onDidChangeValue=this._register(new ul),this._onDidChangeTarget=this._register(new ul),this._onWillSaveState=this._register(new B),this.onWillSaveState=this._onWillSaveState.event,this._workspaceKeyTargets=void 0,this._profileKeyTargets=void 0,this._applicationKeyTargets=void 0}onDidChangeValue(e,t,i){return ie.filter(this._onDidChangeValue.event,o=>o.scope===e&&(t===void 0||o.key===t),i)}emitDidChangeValue(e,t){let{key:i,external:o}=t;if(i===QD){switch(e){case-1:this._applicationKeyTargets=void 0;break;case 0:this._profileKeyTargets=void 0;break;case 1:this._workspaceKeyTargets=void 0;break}this._onDidChangeTarget.fire({scope:e})}else this._onDidChangeValue.fire({scope:e,key:i,target:this.getKeyTargets(e)[i],external:o})}get(e,t,i){var o;return(o=this.getStorage(t))===null||o===void 0?void 0:o.get(e,i)}getBoolean(e,t,i){var o;return(o=this.getStorage(t))===null||o===void 0?void 0:o.getBoolean(e,i)}getNumber(e,t,i){var o;return(o=this.getStorage(t))===null||o===void 0?void 0:o.getNumber(e,i)}store(e,t,i,o,s=!1){if(io(t)){this.remove(e,i,s);return}this.withPausedEmitters(()=>{var r;this.updateKeyTarget(e,i,o),(r=this.getStorage(i))===null||r===void 0||r.set(e,t,s)})}remove(e,t,i=!1){this.withPausedEmitters(()=>{var o;this.updateKeyTarget(e,t,void 0),(o=this.getStorage(t))===null||o===void 0||o.delete(e,i)})}withPausedEmitters(e){this._onDidChangeValue.pause(),this._onDidChangeTarget.pause();try{e()}finally{this._onDidChangeValue.resume(),this._onDidChangeTarget.resume()}}updateKeyTarget(e,t,i,o=!1){var s,r;let a=this.getKeyTargets(t);typeof i=="number"?a[e]!==i&&(a[e]=i,(s=this.getStorage(t))===null||s===void 0||s.set(QD,JSON.stringify(a),o)):typeof a[e]=="number"&&(delete a[e],(r=this.getStorage(t))===null||r===void 0||r.set(QD,JSON.stringify(a),o))}get workspaceKeyTargets(){return this._workspaceKeyTargets||(this._workspaceKeyTargets=this.loadKeyTargets(1)),this._workspaceKeyTargets}get profileKeyTargets(){return this._profileKeyTargets||(this._profileKeyTargets=this.loadKeyTargets(0)),this._profileKeyTargets}get applicationKeyTargets(){return this._applicationKeyTargets||(this._applicationKeyTargets=this.loadKeyTargets(-1)),this._applicationKeyTargets}getKeyTargets(e){switch(e){case-1:return this.applicationKeyTargets;case 0:return this.profileKeyTargets;default:return this.workspaceKeyTargets}}loadKeyTargets(e){let t=this.getStorage(e);return t?QX(t):Object.create(null)}};JD.DEFAULT_FLUSH_INTERVAL=60*1e3;var eE=class extends JD{constructor(){super(),this.applicationStorage=this._register(new zf(new Zp,{hint:Wf.STORAGE_IN_MEMORY})),this.profileStorage=this._register(new zf(new Zp,{hint:Wf.STORAGE_IN_MEMORY})),this.workspaceStorage=this._register(new zf(new Zp,{hint:Wf.STORAGE_IN_MEMORY})),this._register(this.workspaceStorage.onDidChangeStorage(e=>this.emitDidChangeValue(1,e))),this._register(this.profileStorage.onDidChangeStorage(e=>this.emitDidChangeValue(0,e))),this._register(this.applicationStorage.onDidChangeStorage(e=>this.emitDidChangeValue(-1,e)))}getStorage(e){switch(e){case-1:return this.applicationStorage;case 0:return this.profileStorage;default:return this.workspaceStorage}}};Qi();Ln();ch();xi();is();_();v();b();is();gn();function JX(n,e){let t={...e};for(let i in n){let o=n[i];t[i]=o!==void 0?he(o):void 0}return t}var RH={keybindingLabelBackground:he(VB),keybindingLabelForeground:he(HB),keybindingLabelBorder:he(UB),keybindingLabelBottomBorder:he(KB),keybindingLabelShadow:he(Va)},PH={buttonForeground:he(Am),buttonSeparator:he(MB),buttonBackground:he(Mm),buttonHoverBackground:he(RB),buttonSecondaryForeground:he(OB),buttonSecondaryBackground:he(MS),buttonSecondaryHoverBackground:he(FB),buttonBorder:he(PB)},OH={progressBarBackground:he(K8)},tP={inputActiveOptionBorder:he(CB),inputActiveOptionForeground:he(yB),inputActiveOptionBackground:he(wB)},GQe={checkboxBackground:he(BB),checkboxBorder:he(zB),checkboxForeground:he(WB)},ZQe={dialogBackground:he(Fi),dialogForeground:he(Ba),dialogShadow:he(Va),dialogBorder:he(Ct),errorIconForeground:he(lB),warningIconForeground:he(cB),infoIconForeground:he(dB),textLinkForeground:he(H8)},iP={inputBackground:he(_B),inputForeground:he(bB),inputBorder:he(vB),inputValidationInfoBorder:he(LB),inputValidationInfoBackground:he(SB),inputValidationInfoForeground:he(xB),inputValidationWarningBorder:he(EB),inputValidationWarningBackground:he(kB),inputValidationWarningForeground:he(DB),inputValidationErrorBorder:he(NB),inputValidationErrorBackground:he(IB),inputValidationErrorForeground:he(TB)},FH={listFilterWidgetBackground:he(i6),listFilterWidgetOutline:he(n6),listFilterWidgetNoMatchesOutline:he(o6),listFilterWidgetShadow:he(s6),inputBoxStyles:iP,toggleStyles:tP},BH={badgeBackground:he(ym),badgeForeground:he(U8),badgeBorder:he(Ct)},YQe={breadcrumbsBackground:he(sB),breadcrumbsForeground:he(oB),breadcrumbsHoverForeground:he(qA),breadcrumbsFocusForeground:he(qA),breadcrumbsFocusAndSelectionForeground:he(rB)},Hf={listBackground:void 0,listInactiveFocusForeground:void 0,listFocusBackground:he($B),listFocusForeground:he(qB),listFocusOutline:he(jB),listActiveSelectionBackground:he(Yr),listActiveSelectionForeground:he(fr),listActiveSelectionIconForeground:he(Yu),listFocusAndSelectionOutline:he(GB),listFocusAndSelectionBackground:he(Yr),listFocusAndSelectionForeground:he(fr),listInactiveSelectionBackground:he(ZB),listInactiveSelectionIconForeground:he(XB),listInactiveSelectionForeground:he(YB),listInactiveFocusBackground:he(QB),listInactiveFocusOutline:he(JB),listHoverBackground:he(YA),listHoverForeground:he(XA),listDropOverBackground:he(e6),listDropBetweenBackground:he(t6),listSelectionOutline:he(ni),listHoverOutline:he(ni),treeIndentGuidesStroke:he(Rm),treeInactiveIndentGuidesStroke:he(r6),treeStickyScrollBackground:void 0,treeStickyScrollBorder:void 0,treeStickyScrollShadow:void 0,tableColumnsBorder:he(a6),tableOddRowsBackgroundColor:he(l6)};function Uf(n){return JX(n,Hf)}var WH={selectBackground:he(Zr),selectListBackground:he(AB),selectForeground:he(Ha),decoratorRightForeground:he(OS),selectBorder:he(ah),focusBorder:he(zo),listFocusBackground:he(cb),listInactiveSelectionIconForeground:he(FS),listFocusForeground:he(lb),listFocusOutline:B8(ni,Z.transparent.toString()),listHoverBackground:he(YA),listHoverForeground:he(XA),listHoverOutline:he(ni),selectListBorder:he(Sm),listBackground:void 0,listActiveSelectionBackground:void 0,listActiveSelectionForeground:void 0,listActiveSelectionIconForeground:void 0,listFocusAndSelectionBackground:void 0,listDropOverBackground:void 0,listDropBetweenBackground:void 0,listInactiveSelectionBackground:void 0,listInactiveSelectionForeground:void 0,listInactiveFocusBackground:void 0,listInactiveFocusOutline:void 0,listSelectionOutline:void 0,listFocusAndSelectionForeground:void 0,listFocusAndSelectionOutline:void 0,listInactiveFocusForeground:void 0,tableColumnsBorder:void 0,tableOddRowsBackgroundColor:void 0,treeIndentGuidesStroke:void 0,treeInactiveIndentGuidesStroke:void 0,treeStickyScrollBackground:void 0,treeStickyScrollBorder:void 0,treeStickyScrollShadow:void 0},zH={shadowColor:he(Va),borderColor:he(c6),foregroundColor:he(d6),backgroundColor:he(h6),selectionForegroundColor:he(u6),selectionBackgroundColor:he(f6),selectionBorderColor:he(g6),separatorColor:he(m6),scrollbarShadow:he($u),scrollbarSliderBackground:he(qu),scrollbarSliderHoverBackground:he(ju),scrollbarSliderActiveBackground:he(Gu)};var tE=function(n,e,t,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},rs=function(n,e){return function(t,i){e(t,i,n)}};function VH(n,e,t,i){let o=n.getActions(e),s=uu.getInstance(),r=s.keyStatus.altKey||(Li||mi)&&s.keyStatus.shiftKey;UH(o,t,r,i?a=>a===i:a=>a==="navigation")}function HH(n,e,t,i,o,s){let r=n.getActions(e);UH(r,t,!1,typeof i=="string"?l=>l===i:i,o,s)}function UH(n,e,t,i=r=>r==="navigation",o=()=>!1,s=!1){let r,a;Array.isArray(e)?(r=e,a=e):(r=e.primary,a=e.secondary);let l=new Set;for(let[c,d]of n){let h;i(c)?(h=r,h.length>0&&s&&h.push(new zi)):(h=a,h.length>0&&h.push(new zi));for(let u of d){t&&(u=u instanceof Br&&u.alt?u.alt:u);let f=h.push(u);u instanceof bl&&l.add({group:c,action:u,index:f-1})}}for(let{group:c,action:d,index:h}of l){let u=i(c)?r:a,f=d.actions;o(d,c,u.length)&&u.splice(h,1,...f)}}var Zv=class extends Fh{constructor(e,t,i,o,s,r,a,l){super(void 0,e,{icon:!!(e.class||e.item.icon),label:!e.class&&!e.item.icon,draggable:t?.draggable,keybinding:t?.keybinding,hoverDelegate:t?.hoverDelegate}),this._keybindingService=i,this._notificationService=o,this._contextKeyService=s,this._themeService=r,this._contextMenuService=a,this._accessibilityService=l,this._wantsAltCommand=!1,this._itemClassDispose=this._register(new no),this._altKey=uu.getInstance()}get _menuItemAction(){return this._action}get _commandAction(){return this._wantsAltCommand&&this._menuItemAction.alt||this._menuItemAction}async onClick(e){e.preventDefault(),e.stopPropagation();try{await this.actionRunner.run(this._commandAction,this._context)}catch(t){this._notificationService.error(t)}}render(e){if(super.render(e),e.classList.add("menu-entry"),this.options.icon&&this._updateItemClass(this._menuItemAction.item),this._menuItemAction.alt){let t=!1,i=()=>{var o;let s=!!(!((o=this._menuItemAction.alt)===null||o===void 0)&&o.enabled)&&(!this._accessibilityService.isMotionReduced()||t)&&(this._altKey.keyStatus.altKey||this._altKey.keyStatus.shiftKey&&t);s!==this._wantsAltCommand&&(this._wantsAltCommand=s,this.updateLabel(),this.updateTooltip(),this.updateClass())};this._register(this._altKey.event(i)),this._register($(e,"mouseleave",o=>{t=!1,i()})),this._register($(e,"mouseenter",o=>{t=!0,i()})),i()}}updateLabel(){this.options.label&&this.label&&(this.label.textContent=this._commandAction.label)}getTooltip(){var e;let t=this._keybindingService.lookupKeybinding(this._commandAction.id,this._contextKeyService),i=t&&t.getLabel(),o=this._commandAction.tooltip||this._commandAction.label,s=i?p("titleAndKb","{0} ({1})",o,i):o;if(!this._wantsAltCommand&&(!((e=this._menuItemAction.alt)===null||e===void 0)&&e.enabled)){let r=this._menuItemAction.alt.tooltip||this._menuItemAction.alt.label,a=this._keybindingService.lookupKeybinding(this._menuItemAction.alt.id,this._contextKeyService),l=a&&a.getLabel(),c=l?p("titleAndKb","{0} ({1})",r,l):r;s=p("titleAndKbAndAlt",`{0} +[{1}] {2}`,s,Np.modifierLabels[po].altKey,c)}return s}updateClass(){this.options.icon&&(this._commandAction!==this._menuItemAction?this._menuItemAction.alt&&this._updateItemClass(this._menuItemAction.alt.item):this._updateItemClass(this._menuItemAction.item))}_updateItemClass(e){this._itemClassDispose.value=void 0;let{element:t,label:i}=this;if(!t||!i)return;let o=this._commandAction.checked&&AH(e.toggled)&&e.toggled.icon?e.toggled.icon:e.icon;if(o)if(Xe.isThemeIcon(o)){let s=Xe.asClassNameArray(o);i.classList.add(...s),this._itemClassDispose.value=be(()=>{i.classList.remove(...s)})}else i.style.backgroundImage=Qu(this._themeService.getColorTheme().type)?Mr(o.dark):Mr(o.light),i.classList.add("icon"),this._itemClassDispose.value=_o(be(()=>{i.style.backgroundImage="",i.classList.remove("icon")}),this._themeService.onDidColorThemeChange(()=>{this.updateClass()}))}};Zv=tE([rs(2,fi),rs(3,Ko),rs(4,rt),rs(5,an),rs(6,Ds),rs(7,ao)],Zv);var nP=class extends Bh{constructor(e,t,i,o,s){var r,a,l;let c={...t,menuAsChild:(r=t?.menuAsChild)!==null&&r!==void 0?r:!1,classNames:(a=t?.classNames)!==null&&a!==void 0?a:Xe.isThemeIcon(e.item.icon)?Xe.asClassName(e.item.icon):void 0,keybindingProvider:(l=t?.keybindingProvider)!==null&&l!==void 0?l:d=>i.lookupKeybinding(d.id)};super(e,{getActions:()=>e.actions},o,c),this._keybindingService=i,this._contextMenuService=o,this._themeService=s}render(e){super.render(e),Ms(this.element),e.classList.add("menu-entry");let t=this._action,{icon:i}=t.item;if(i&&!Xe.isThemeIcon(i)){this.element.classList.add("icon");let o=()=>{this.element&&(this.element.style.backgroundImage=Qu(this._themeService.getColorTheme().type)?Mr(i.dark):Mr(i.light))};o(),this._register(this._themeService.onDidColorThemeChange(()=>{o()}))}}};nP=tE([rs(2,fi),rs(3,Ds),rs(4,an)],nP);var oP=class extends qo{constructor(e,t,i,o,s,r,a,l){var c,d,h;super(null,e),this._keybindingService=i,this._notificationService=o,this._contextMenuService=s,this._menuService=r,this._instaService=a,this._storageService=l,this._container=null,this._options=t,this._storageKey=`${e.item.submenu.id}_lastActionId`;let u,f=t?.persistLastActionId?l.get(this._storageKey,1):void 0;f&&(u=e.actions.find(m=>f===m.id)),u||(u=e.actions[0]),this._defaultAction=this._instaService.createInstance(Zv,u,{keybinding:this._getDefaultActionKeybindingLabel(u)});let g={keybindingProvider:m=>this._keybindingService.lookupKeybinding(m.id),...t,menuAsChild:(c=t?.menuAsChild)!==null&&c!==void 0?c:!0,classNames:(d=t?.classNames)!==null&&d!==void 0?d:["codicon","codicon-chevron-down"],actionRunner:(h=t?.actionRunner)!==null&&h!==void 0?h:new bs};this._dropdown=new Bh(e,e.actions,this._contextMenuService,g),this._register(this._dropdown.actionRunner.onDidRun(m=>{m.action instanceof Br&&this.update(m.action)}))}update(e){var t;!((t=this._options)===null||t===void 0)&&t.persistLastActionId&&this._storageService.store(this._storageKey,e.id,1,1),this._defaultAction.dispose(),this._defaultAction=this._instaService.createInstance(Zv,e,{keybinding:this._getDefaultActionKeybindingLabel(e)}),this._defaultAction.actionRunner=new class extends bs{async runAction(i,o){await i.run(void 0)}},this._container&&this._defaultAction.render(Ug(this._container,ve(".action-container")))}_getDefaultActionKeybindingLabel(e){var t;let i;if(!((t=this._options)===null||t===void 0)&&t.renderKeybindingWithDefaultActionLabel){let o=this._keybindingService.lookupKeybinding(e.id);o&&(i=`(${o.getLabel()})`)}return i}setActionContext(e){super.setActionContext(e),this._defaultAction.setActionContext(e),this._dropdown.setActionContext(e)}render(e){this._container=e,super.render(this._container),this._container.classList.add("monaco-dropdown-with-default");let t=ve(".action-container");this._defaultAction.render(me(this._container,t)),this._register($(t,se.KEY_DOWN,o=>{let s=new bt(o);s.equals(17)&&(this._defaultAction.element.tabIndex=-1,this._dropdown.focus(),s.stopPropagation())}));let i=ve(".dropdown-action-container");this._dropdown.render(me(this._container,i)),this._register($(i,se.KEY_DOWN,o=>{var s;let r=new bt(o);r.equals(15)&&(this._defaultAction.element.tabIndex=0,this._dropdown.setFocusable(!1),(s=this._defaultAction.element)===null||s===void 0||s.focus(),r.stopPropagation())}))}focus(e){e?this._dropdown.focus():(this._defaultAction.element.tabIndex=0,this._defaultAction.element.focus())}blur(){this._defaultAction.element.tabIndex=-1,this._dropdown.blur(),this._container.blur()}setFocusable(e){e?this._defaultAction.element.tabIndex=0:(this._defaultAction.element.tabIndex=-1,this._dropdown.setFocusable(!1))}dispose(){this._defaultAction.dispose(),this._dropdown.dispose(),super.dispose()}};oP=tE([rs(2,fi),rs(3,Ko),rs(4,Ds),rs(5,Wr),rs(6,Ye),rs(7,Vf)],oP);var sP=class extends YD{constructor(e,t){super(null,e,e.actions.map(i=>({text:i.id===zi.ID?"\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500":i.label,isDisabled:!i.enabled})),0,t,WH,{ariaLabel:e.tooltip,optionsAsChildren:!0}),this.select(Math.max(0,e.actions.findIndex(i=>i.checked)))}render(e){super.render(e),e.style.borderColor=he(ah)}runAction(e,t){let i=this.action.actions[t];i&&this.actionRunner.run(i)}};sP=tE([rs(1,Qc)],sP);function KH(n,e,t){return e instanceof Br?n.createInstance(Zv,e,t):e instanceof wl?e.item.isSelection?n.createInstance(sP,e):e.item.rememberDefaultAction?n.createInstance(oP,e,{...t,persistLastActionId:!0}):n.createInstance(nP,e,t):void 0}zr();Oi();Gg();_();v();b();ke();Qs();_();v();b();ps();ke();oo();Qs();_();v();b();ke();oo();Po();ye();le();xi();var Eo=class extends H{constructor(e,t={}){var i,o,s,r,a,l,c;super(),this._actionRunnerDisposables=this._register(new ae),this.viewItemDisposables=this._register(new xd),this.triggerKeyDown=!1,this.focusable=!0,this._onDidBlur=this._register(new B),this.onDidBlur=this._onDidBlur.event,this._onDidCancel=this._register(new B({onWillAddFirstListener:()=>this.cancelHasListener=!0})),this.onDidCancel=this._onDidCancel.event,this.cancelHasListener=!1,this._onDidRun=this._register(new B),this.onDidRun=this._onDidRun.event,this._onWillRun=this._register(new B),this.onWillRun=this._onWillRun.event,this.options=t,this._context=(i=t.context)!==null&&i!==void 0?i:null,this._orientation=(o=this.options.orientation)!==null&&o!==void 0?o:0,this._triggerKeys={keyDown:(r=(s=this.options.triggerKeys)===null||s===void 0?void 0:s.keyDown)!==null&&r!==void 0?r:!1,keys:(l=(a=this.options.triggerKeys)===null||a===void 0?void 0:a.keys)!==null&&l!==void 0?l:[3,10]},this._hoverDelegate=(c=t.hoverDelegate)!==null&&c!==void 0?c:this._register(Mf()),this.options.actionRunner?this._actionRunner=this.options.actionRunner:(this._actionRunner=new bs,this._actionRunnerDisposables.add(this._actionRunner)),this._actionRunnerDisposables.add(this._actionRunner.onDidRun(u=>this._onDidRun.fire(u))),this._actionRunnerDisposables.add(this._actionRunner.onWillRun(u=>this._onWillRun.fire(u))),this.viewItems=[],this.focusedItem=void 0,this.domNode=document.createElement("div"),this.domNode.className="monaco-action-bar";let d,h;switch(this._orientation){case 0:d=[15],h=[17];break;case 1:d=[16],h=[18],this.domNode.className+=" vertical";break}this._register($(this.domNode,se.KEY_DOWN,u=>{let f=new bt(u),g=!0,m=typeof this.focusedItem=="number"?this.viewItems[this.focusedItem]:void 0;d&&(f.equals(d[0])||f.equals(d[1]))?g=this.focusPrevious():h&&(f.equals(h[0])||f.equals(h[1]))?g=this.focusNext():f.equals(9)&&this.cancelHasListener?this._onDidCancel.fire():f.equals(14)?g=this.focusFirst():f.equals(13)?g=this.focusLast():f.equals(2)&&m instanceof qo&&m.trapsArrowNavigation?g=this.focusNext():this.isTriggerKeyEvent(f)?this._triggerKeys.keyDown?this.doTrigger(f):this.triggerKeyDown=!0:g=!1,g&&(f.preventDefault(),f.stopPropagation())})),this._register($(this.domNode,se.KEY_UP,u=>{let f=new bt(u);this.isTriggerKeyEvent(f)?(!this._triggerKeys.keyDown&&this.triggerKeyDown&&(this.triggerKeyDown=!1,this.doTrigger(f)),f.preventDefault(),f.stopPropagation()):(f.equals(2)||f.equals(1026)||f.equals(16)||f.equals(18)||f.equals(15)||f.equals(17))&&this.updateFocusedItem()})),this.focusTracker=this._register(Ic(this.domNode)),this._register(this.focusTracker.onDidBlur(()=>{(Bi()===this.domNode||!yi(Bi(),this.domNode))&&(this._onDidBlur.fire(),this.previouslyFocusedItem=this.focusedItem,this.focusedItem=void 0,this.triggerKeyDown=!1)})),this._register(this.focusTracker.onDidFocus(()=>this.updateFocusedItem())),this.actionsList=document.createElement("ul"),this.actionsList.className="actions-container",this.options.highlightToggledItems&&this.actionsList.classList.add("highlight-toggled"),this.actionsList.setAttribute("role",this.options.ariaRole||"toolbar"),this.options.ariaLabel&&this.actionsList.setAttribute("aria-label",this.options.ariaLabel),this.domNode.appendChild(this.actionsList),e.appendChild(this.domNode)}refreshRole(){this.length()>=1?this.actionsList.setAttribute("role",this.options.ariaRole||"toolbar"):this.actionsList.setAttribute("role","presentation")}setFocusable(e){if(this.focusable=e,this.focusable){let t=this.viewItems.find(i=>i instanceof qo&&i.isEnabled());t instanceof qo&&t.setFocusable(!0)}else this.viewItems.forEach(t=>{t instanceof qo&&t.setFocusable(!1)})}isTriggerKeyEvent(e){let t=!1;return this._triggerKeys.keys.forEach(i=>{t=t||e.equals(i)}),t}updateFocusedItem(){var e,t;for(let i=0;it.setActionContext(e))}get actionRunner(){return this._actionRunner}set actionRunner(e){this._actionRunner=e,this._actionRunnerDisposables.clear(),this._actionRunnerDisposables.add(this._actionRunner.onDidRun(t=>this._onDidRun.fire(t))),this._actionRunnerDisposables.add(this._actionRunner.onWillRun(t=>this._onWillRun.fire(t))),this.viewItems.forEach(t=>t.actionRunner=e)}getContainer(){return this.domNode}getAction(e){var t;if(typeof e=="number")return(t=this.viewItems[e])===null||t===void 0?void 0:t.action;if(e instanceof HTMLElement){for(;e.parentElement!==this.actionsList;){if(!e.parentElement)return;e=e.parentElement}for(let i=0;i{let r=document.createElement("li");r.className="action-item",r.setAttribute("role","presentation");let a,l={hoverDelegate:this._hoverDelegate,...t};this.options.actionViewItemProvider&&(a=this.options.actionViewItemProvider(s,l)),a||(a=new Fh(this.context,s,l)),this.options.allowContextMenu||this.viewItemDisposables.set(a,$(r,se.CONTEXT_MENU,c=>{He.stop(c,!0)})),a.actionRunner=this._actionRunner,a.setActionContext(this.context),a.render(r),this.focusable&&a instanceof qo&&this.viewItems.length===0&&a.setFocusable(!0),o===null||o<0||o>=this.actionsList.children.length?(this.actionsList.appendChild(r),this.viewItems.push(a)):(this.actionsList.insertBefore(r,this.actionsList.children[o]),this.viewItems.splice(o,0,a),o++)}),typeof this.focusedItem=="number"&&this.focus(this.focusedItem),this.refreshRole()}clear(){this.isEmpty()||(this.viewItems=li(this.viewItems),this.viewItemDisposables.clearAndDisposeAll(),Co(this.actionsList),this.refreshRole())}length(){return this.viewItems.length}isEmpty(){return this.viewItems.length===0}focus(e){let t=!1,i;if(e===void 0?t=!0:typeof e=="number"?i=e:typeof e=="boolean"&&(t=e),t&&typeof this.focusedItem>"u"){let o=this.viewItems.findIndex(s=>s.isEnabled());this.focusedItem=o===-1?void 0:o,this.updateFocus(void 0,void 0,!0)}else i!==void 0&&(this.focusedItem=i),this.updateFocus(void 0,void 0,!0)}focusFirst(){return this.focusedItem=this.length()-1,this.focusNext(!0)}focusLast(){return this.focusedItem=0,this.focusPrevious(!0)}focusNext(e){if(typeof this.focusedItem>"u")this.focusedItem=this.viewItems.length-1;else if(this.viewItems.length<=1)return!1;let t=this.focusedItem,i;do{if(!e&&this.options.preventLoopNavigation&&this.focusedItem+1>=this.viewItems.length)return this.focusedItem=t,!1;this.focusedItem=(this.focusedItem+1)%this.viewItems.length,i=this.viewItems[this.focusedItem]}while(this.focusedItem!==t&&(this.options.focusOnlyEnabledItems&&!i.isEnabled()||i.action.id===zi.ID));return this.updateFocus(),!0}focusPrevious(e){if(typeof this.focusedItem>"u")this.focusedItem=0;else if(this.viewItems.length<=1)return!1;let t=this.focusedItem,i;do{if(this.focusedItem=this.focusedItem-1,this.focusedItem<0){if(!e&&this.options.preventLoopNavigation)return this.focusedItem=t,!1;this.focusedItem=this.viewItems.length-1}i=this.viewItems[this.focusedItem]}while(this.focusedItem!==t&&(this.options.focusOnlyEnabledItems&&!i.isEnabled()||i.action.id===zi.ID));return this.updateFocus(!0),!0}updateFocus(e,t,i=!1){var o,s;typeof this.focusedItem>"u"&&this.actionsList.focus({preventScroll:t}),this.previouslyFocusedItem!==void 0&&this.previouslyFocusedItem!==this.focusedItem&&((o=this.viewItems[this.previouslyFocusedItem])===null||o===void 0||o.blur());let r=this.focusedItem!==void 0?this.viewItems[this.focusedItem]:void 0;if(r){let a=!0;cg(r.focus)||(a=!1),this.options.focusOnlyEnabledItems&&cg(r.isEnabled)&&!r.isEnabled()&&(a=!1),r.action.id===zi.ID&&(a=!1),a?(i||this.previouslyFocusedItem!==this.focusedItem)&&(r.focus(e),this.previouslyFocusedItem=this.focusedItem):(this.actionsList.focus({preventScroll:t}),this.previouslyFocusedItem=void 0),a&&((s=r.showHover)===null||s===void 0||s.call(r))}}doTrigger(e){if(typeof this.focusedItem>"u")return;let t=this.viewItems[this.focusedItem];if(t instanceof qo){let i=t._context===null||t._context===void 0?e:t._context;this.run(t._action,i)}}async run(e,t){await this._actionRunner.run(e,t)}dispose(){this._context=void 0,this.viewItems=li(this.viewItems),this.getContainer().remove(),super.dispose()}};Po();Gt();$n();K_();Ln();xp();le();Lt();ot();var aP=/\(&([^\s&])\)|(^|[^&])&([^\s&])/,rP=/(&)?(&)([^\s&])/g,iE;(function(n){n[n.Right=0]="Right",n[n.Left=1]="Left"})(iE||(iE={}));var lP;(function(n){n[n.Above=0]="Above",n[n.Below=1]="Below"})(lP||(lP={}));var Yv=class n extends Eo{constructor(e,t,i,o){e.classList.add("monaco-menu-container"),e.setAttribute("role","presentation");let s=document.createElement("div");s.classList.add("monaco-menu"),s.setAttribute("role","presentation"),super(s,{orientation:1,actionViewItemProvider:c=>this.doGetActionViewItem(c,i,r),context:i.context,actionRunner:i.actionRunner,ariaLabel:i.ariaLabel,ariaRole:"menu",focusOnlyEnabledItems:!0,triggerKeys:{keys:[3,...Be||mi?[10]:[]],keyDown:!0}}),this.menuStyles=o,this.menuElement=s,this.actionsList.tabIndex=0,this.initializeOrUpdateStyleSheet(e,o),this._register(ui.addTarget(s)),this._register($(s,se.KEY_DOWN,c=>{new bt(c).equals(2)&&c.preventDefault()})),i.enableMnemonics&&this._register($(s,se.KEY_DOWN,c=>{let d=c.key.toLocaleLowerCase();if(this.mnemonics.has(d)){He.stop(c,!0);let h=this.mnemonics.get(d);if(h.length===1&&(h[0]instanceof oE&&h[0].container&&this.focusItemByElement(h[0].container),h[0].onClick(c)),h.length>1){let u=h.shift();u&&u.container&&(this.focusItemByElement(u.container),h.push(u)),this.mnemonics.set(d,h)}}})),mi&&this._register($(s,se.KEY_DOWN,c=>{let d=new bt(c);d.equals(14)||d.equals(11)?(this.focusedItem=this.viewItems.length-1,this.focusNext(),He.stop(c,!0)):(d.equals(13)||d.equals(12))&&(this.focusedItem=0,this.focusPrevious(),He.stop(c,!0))})),this._register($(this.domNode,se.MOUSE_OUT,c=>{let d=c.relatedTarget;yi(d,this.domNode)||(this.focusedItem=void 0,this.updateFocus(),c.stopPropagation())})),this._register($(this.actionsList,se.MOUSE_OVER,c=>{let d=c.target;if(!(!d||!yi(d,this.actionsList)||d===this.actionsList)){for(;d.parentElement!==this.actionsList&&d.parentElement!==null;)d=d.parentElement;if(d.classList.contains("action-item")){let h=this.focusedItem;this.setFocusedItem(d),h!==this.focusedItem&&this.updateFocus()}}})),this._register(ui.addTarget(this.actionsList)),this._register($(this.actionsList,It.Tap,c=>{let d=c.initialTarget;if(!(!d||!yi(d,this.actionsList)||d===this.actionsList)){for(;d.parentElement!==this.actionsList&&d.parentElement!==null;)d=d.parentElement;if(d.classList.contains("action-item")){let h=this.focusedItem;this.setFocusedItem(d),h!==this.focusedItem&&this.updateFocus()}}}));let r={parent:this};this.mnemonics=new Map,this.scrollableElement=this._register(new uh(s,{alwaysConsumeMouseWheel:!0,horizontal:2,vertical:3,verticalScrollbarSize:7,handleMouseWheel:!0,useShadows:!0}));let a=this.scrollableElement.getDomNode();a.style.position="",this.styleScrollElement(a,o),this._register($(s,It.Change,c=>{He.stop(c,!0);let d=this.scrollableElement.getScrollPosition().scrollTop;this.scrollableElement.setScrollPosition({scrollTop:d-c.translationY})})),this._register($(a,se.MOUSE_UP,c=>{c.preventDefault()}));let l=ge(e);s.style.maxHeight=`${Math.max(10,l.innerHeight-e.getBoundingClientRect().top-35)}px`,t=t.filter((c,d)=>{var h;return!((h=i.submenuIds)===null||h===void 0)&&h.has(c.id)?(console.warn(`Found submenu cycle: ${c.id}`),!1):!(c instanceof zi&&(d===t.length-1||d===0||t[d-1]instanceof zi))}),this.push(t,{icon:!0,label:!0,isMenu:!0}),e.appendChild(this.scrollableElement.getDomNode()),this.scrollableElement.scanDomNode(),this.viewItems.filter(c=>!(c instanceof sE)).forEach((c,d,h)=>{c.updatePositionInSet(d+1,h.length)})}initializeOrUpdateStyleSheet(e,t){this.styleSheet||(gu(e)?this.styleSheet=Xi(e):(n.globalStyleSheet||(n.globalStyleSheet=Xi()),this.styleSheet=n.globalStyleSheet)),this.styleSheet.textContent=tQ(t,gu(e))}styleScrollElement(e,t){var i,o;let s=(i=t.foregroundColor)!==null&&i!==void 0?i:"",r=(o=t.backgroundColor)!==null&&o!==void 0?o:"",a=t.borderColor?`1px solid ${t.borderColor}`:"",l="5px",c=t.shadowColor?`0 2px 8px ${t.shadowColor}`:"";e.style.outline=a,e.style.borderRadius=l,e.style.color=s,e.style.backgroundColor=r,e.style.boxShadow=c}getContainer(){return this.scrollableElement.getDomNode()}get onScroll(){return this.scrollableElement.onScroll}focusItemByElement(e){let t=this.focusedItem;this.setFocusedItem(e),t!==this.focusedItem&&this.updateFocus()}setFocusedItem(e){for(let t=0;t{this.element&&(this._register($(this.element,se.MOUSE_UP,s=>{if(He.stop(s,!0),wn){if(new yn(ge(this.element),s).rightButton)return;this.onClick(s)}else setTimeout(()=>{this.onClick(s)},0)})),this._register($(this.element,se.CONTEXT_MENU,s=>{He.stop(s,!0)})))},100),this._register(this.runOnceToEnableMouseUp)}render(e){super.render(e),this.element&&(this.container=e,this.item=me(this.element,ve("a.action-menu-item")),this._action.id===zi.ID?this.item.setAttribute("role","presentation"):(this.item.setAttribute("role","menuitem"),this.mnemonic&&this.item.setAttribute("aria-keyshortcuts",`${this.mnemonic}`)),this.check=me(this.item,ve("span.menu-item-check"+Xe.asCSSSelector(ue.menuSelection))),this.check.setAttribute("role","none"),this.label=me(this.item,ve("span.action-label")),this.options.label&&this.options.keybinding&&(me(this.item,ve("span.keybinding")).textContent=this.options.keybinding),this.runOnceToEnableMouseUp.schedule(),this.updateClass(),this.updateLabel(),this.updateTooltip(),this.updateEnabled(),this.updateChecked(),this.applyStyle())}blur(){super.blur(),this.applyStyle()}focus(){var e;super.focus(),(e=this.item)===null||e===void 0||e.focus(),this.applyStyle()}updatePositionInSet(e,t){this.item&&(this.item.setAttribute("aria-posinset",`${e}`),this.item.setAttribute("aria-setsize",`${t}`))}updateLabel(){var e;if(this.label&&this.options.label){Co(this.label);let t=pD(this.action.label);if(t){let i=eQ(t);this.options.enableMnemonics||(t=i),this.label.setAttribute("aria-label",i.replace(/&&/g,"&"));let o=aP.exec(t);if(o){t=hu(t),rP.lastIndex=0;let s=rP.exec(t);for(;s&&s[1];)s=rP.exec(t);let r=a=>a.replace(/&&/g,"&");s?this.label.append(Sc(r(t.substr(0,s.index))," "),ve("u",{"aria-hidden":"true"},s[3]),kT(r(t.substr(s.index+s[0].length))," ")):this.label.innerText=r(t).trim(),(e=this.item)===null||e===void 0||e.setAttribute("aria-keyshortcuts",(o[1]?o[1]:o[3]).toLocaleLowerCase())}else this.label.innerText=t.replace(/&&/g,"&").trim()}}}updateTooltip(){}updateClass(){this.cssClass&&this.item&&this.item.classList.remove(...this.cssClass.split(" ")),this.options.icon&&this.label?(this.cssClass=this.action.class||"",this.label.classList.add("icon"),this.cssClass&&this.label.classList.add(...this.cssClass.split(" ")),this.updateEnabled()):this.label&&this.label.classList.remove("icon")}updateEnabled(){this.action.enabled?(this.element&&(this.element.classList.remove("disabled"),this.element.removeAttribute("aria-disabled")),this.item&&(this.item.classList.remove("disabled"),this.item.removeAttribute("aria-disabled"),this.item.tabIndex=0)):(this.element&&(this.element.classList.add("disabled"),this.element.setAttribute("aria-disabled","true")),this.item&&(this.item.classList.add("disabled"),this.item.setAttribute("aria-disabled","true")))}updateChecked(){if(!this.item)return;let e=this.action.checked;this.item.classList.toggle("checked",!!e),e!==void 0?(this.item.setAttribute("role","menuitemcheckbox"),this.item.setAttribute("aria-checked",e?"true":"false")):(this.item.setAttribute("role","menuitem"),this.item.setAttribute("aria-checked",""))}getMnemonic(){return this.mnemonic}applyStyle(){let e=this.element&&this.element.classList.contains("focused"),t=e&&this.menuStyle.selectionForegroundColor?this.menuStyle.selectionForegroundColor:this.menuStyle.foregroundColor,i=e&&this.menuStyle.selectionBackgroundColor?this.menuStyle.selectionBackgroundColor:void 0,o=e&&this.menuStyle.selectionBorderColor?`1px solid ${this.menuStyle.selectionBorderColor}`:"",s=e&&this.menuStyle.selectionBorderColor?"-1px":"";this.item&&(this.item.style.color=t??"",this.item.style.backgroundColor=i??"",this.item.style.outline=o,this.item.style.outlineOffset=s),this.check&&(this.check.style.color=t??"")}},oE=class extends nE{constructor(e,t,i,o,s){super(e,e,o,s),this.submenuActions=t,this.parentData=i,this.submenuOptions=o,this.mysubmenu=null,this.submenuDisposables=this._register(new ae),this.mouseOver=!1,this.expandDirection=o&&o.expandDirection!==void 0?o.expandDirection:{horizontal:iE.Right,vertical:lP.Below},this.showScheduler=new di(()=>{this.mouseOver&&(this.cleanupExistingSubmenu(!1),this.createSubmenu(!1))},250),this.hideScheduler=new di(()=>{this.element&&!yi(Bi(),this.element)&&this.parentData.submenu===this.mysubmenu&&(this.parentData.parent.focus(!1),this.cleanupExistingSubmenu(!0))},750)}render(e){super.render(e),this.element&&(this.item&&(this.item.classList.add("monaco-submenu-item"),this.item.tabIndex=0,this.item.setAttribute("aria-haspopup","true"),this.updateAriaExpanded("false"),this.submenuIndicator=me(this.item,ve("span.submenu-indicator"+Xe.asCSSSelector(ue.menuSubmenu))),this.submenuIndicator.setAttribute("aria-hidden","true")),this._register($(this.element,se.KEY_UP,t=>{let i=new bt(t);(i.equals(17)||i.equals(3))&&(He.stop(t,!0),this.createSubmenu(!0))})),this._register($(this.element,se.KEY_DOWN,t=>{let i=new bt(t);Bi()===this.item&&(i.equals(17)||i.equals(3))&&He.stop(t,!0)})),this._register($(this.element,se.MOUSE_OVER,t=>{this.mouseOver||(this.mouseOver=!0,this.showScheduler.schedule())})),this._register($(this.element,se.MOUSE_LEAVE,t=>{this.mouseOver=!1})),this._register($(this.element,se.FOCUS_OUT,t=>{this.element&&!yi(Bi(),this.element)&&this.hideScheduler.schedule()})),this._register(this.parentData.parent.onScroll(()=>{this.parentData.submenu===this.mysubmenu&&(this.parentData.parent.focus(!1),this.cleanupExistingSubmenu(!0))})))}updateEnabled(){}onClick(e){He.stop(e,!0),this.cleanupExistingSubmenu(!1),this.createSubmenu(!0)}cleanupExistingSubmenu(e){if(this.parentData.submenu&&(e||this.parentData.submenu!==this.mysubmenu)){try{this.parentData.submenu.dispose()}catch{}this.parentData.submenu=void 0,this.updateAriaExpanded("false"),this.submenuContainer&&(this.submenuDisposables.clear(),this.submenuContainer=void 0)}}calculateSubmenuMenuLayout(e,t,i,o){let s={top:0,left:0};return s.left=Nf(e.width,t.width,{position:o.horizontal===iE.Right?0:1,offset:i.left,size:i.width}),s.left>=i.left&&s.left{new bt(d).equals(15)&&(He.stop(d,!0),this.parentData.parent.focus(),this.cleanupExistingSubmenu(!0))})),this.submenuDisposables.add($(this.submenuContainer,se.KEY_DOWN,d=>{new bt(d).equals(15)&&He.stop(d,!0)})),this.submenuDisposables.add(this.parentData.submenu.onDidCancel(()=>{this.parentData.parent.focus(),this.cleanupExistingSubmenu(!0)})),this.parentData.submenu.focus(e),this.mysubmenu=this.parentData.submenu}}updateAriaExpanded(e){var t;this.item&&((t=this.item)===null||t===void 0||t.setAttribute("aria-expanded",e))}applyStyle(){super.applyStyle();let t=this.element&&this.element.classList.contains("focused")&&this.menuStyle.selectionForegroundColor?this.menuStyle.selectionForegroundColor:this.menuStyle.foregroundColor;this.submenuIndicator&&(this.submenuIndicator.style.color=t??"")}dispose(){super.dispose(),this.hideScheduler.dispose(),this.mysubmenu&&(this.mysubmenu.dispose(),this.mysubmenu=null),this.submenuContainer&&(this.submenuContainer=void 0)}},sE=class extends Fh{constructor(e,t,i,o){super(e,t,i),this.menuStyles=o}render(e){super.render(e),this.label&&(this.label.style.borderBottomColor=this.menuStyles.separatorColor?`${this.menuStyles.separatorColor}`:"")}};function eQ(n){let e=aP,t=e.exec(n);if(!t)return n;let i=!t[1];return n.replace(e,i?"$2$3":"").trim()}function $H(n){let e=_C()[n.id];return`.codicon-${n.id}:before { content: '\\${e.toString(16)}'; }`}function tQ(n,e){let t=` +.monaco-menu { + font-size: 13px; + border-radius: 5px; + min-width: 160px; +} + +${$H(ue.menuSelection)} +${$H(ue.menuSubmenu)} + +.monaco-menu .monaco-action-bar { + text-align: right; + overflow: hidden; + white-space: nowrap; +} + +.monaco-menu .monaco-action-bar .actions-container { + display: flex; + margin: 0 auto; + padding: 0; + width: 100%; + justify-content: flex-end; +} + +.monaco-menu .monaco-action-bar.vertical .actions-container { + display: inline-block; +} + +.monaco-menu .monaco-action-bar.reverse .actions-container { + flex-direction: row-reverse; +} + +.monaco-menu .monaco-action-bar .action-item { + cursor: pointer; + display: inline-block; + transition: transform 50ms ease; + position: relative; /* DO NOT REMOVE - this is the key to preventing the ghosting icon bug in Chrome 42 */ +} + +.monaco-menu .monaco-action-bar .action-item.disabled { + cursor: default; +} + +.monaco-menu .monaco-action-bar .action-item .icon, +.monaco-menu .monaco-action-bar .action-item .codicon { + display: inline-block; +} + +.monaco-menu .monaco-action-bar .action-item .codicon { + display: flex; + align-items: center; +} + +.monaco-menu .monaco-action-bar .action-label { + font-size: 11px; + margin-right: 4px; +} + +.monaco-menu .monaco-action-bar .action-item.disabled .action-label, +.monaco-menu .monaco-action-bar .action-item.disabled .action-label:hover { + color: var(--vscode-disabledForeground); +} + +/* Vertical actions */ + +.monaco-menu .monaco-action-bar.vertical { + text-align: left; +} + +.monaco-menu .monaco-action-bar.vertical .action-item { + display: block; +} + +.monaco-menu .monaco-action-bar.vertical .action-label.separator { + display: block; + border-bottom: 1px solid var(--vscode-menu-separatorBackground); + padding-top: 1px; + padding: 30px; +} + +.monaco-menu .secondary-actions .monaco-action-bar .action-label { + margin-left: 6px; +} + +/* Action Items */ +.monaco-menu .monaco-action-bar .action-item.select-container { + overflow: hidden; /* somehow the dropdown overflows its container, we prevent it here to not push */ + flex: 1; + max-width: 170px; + min-width: 60px; + display: flex; + align-items: center; + justify-content: center; + margin-right: 10px; +} + +.monaco-menu .monaco-action-bar.vertical { + margin-left: 0; + overflow: visible; +} + +.monaco-menu .monaco-action-bar.vertical .actions-container { + display: block; +} + +.monaco-menu .monaco-action-bar.vertical .action-item { + padding: 0; + transform: none; + display: flex; +} + +.monaco-menu .monaco-action-bar.vertical .action-item.active { + transform: none; +} + +.monaco-menu .monaco-action-bar.vertical .action-menu-item { + flex: 1 1 auto; + display: flex; + height: 2em; + align-items: center; + position: relative; + margin: 0 4px; + border-radius: 4px; +} + +.monaco-menu .monaco-action-bar.vertical .action-menu-item:hover .keybinding, +.monaco-menu .monaco-action-bar.vertical .action-menu-item:focus .keybinding { + opacity: unset; +} + +.monaco-menu .monaco-action-bar.vertical .action-label { + flex: 1 1 auto; + text-decoration: none; + padding: 0 1em; + background: none; + font-size: 12px; + line-height: 1; +} + +.monaco-menu .monaco-action-bar.vertical .keybinding, +.monaco-menu .monaco-action-bar.vertical .submenu-indicator { + display: inline-block; + flex: 2 1 auto; + padding: 0 1em; + text-align: right; + font-size: 12px; + line-height: 1; +} + +.monaco-menu .monaco-action-bar.vertical .submenu-indicator { + height: 100%; +} + +.monaco-menu .monaco-action-bar.vertical .submenu-indicator.codicon { + font-size: 16px !important; + display: flex; + align-items: center; +} + +.monaco-menu .monaco-action-bar.vertical .submenu-indicator.codicon::before { + margin-left: auto; + margin-right: -20px; +} + +.monaco-menu .monaco-action-bar.vertical .action-item.disabled .keybinding, +.monaco-menu .monaco-action-bar.vertical .action-item.disabled .submenu-indicator { + opacity: 0.4; +} + +.monaco-menu .monaco-action-bar.vertical .action-label:not(.separator) { + display: inline-block; + box-sizing: border-box; + margin: 0; +} + +.monaco-menu .monaco-action-bar.vertical .action-item { + position: static; + overflow: visible; +} + +.monaco-menu .monaco-action-bar.vertical .action-item .monaco-submenu { + position: absolute; +} + +.monaco-menu .monaco-action-bar.vertical .action-label.separator { + width: 100%; + height: 0px !important; + opacity: 1; +} + +.monaco-menu .monaco-action-bar.vertical .action-label.separator.text { + padding: 0.7em 1em 0.1em 1em; + font-weight: bold; + opacity: 1; +} + +.monaco-menu .monaco-action-bar.vertical .action-label:hover { + color: inherit; +} + +.monaco-menu .monaco-action-bar.vertical .menu-item-check { + position: absolute; + visibility: hidden; + width: 1em; + height: 100%; +} + +.monaco-menu .monaco-action-bar.vertical .action-menu-item.checked .menu-item-check { + visibility: visible; + display: flex; + align-items: center; + justify-content: center; +} + +/* Context Menu */ + +.context-view.monaco-menu-container { + outline: 0; + border: none; + animation: fadeIn 0.083s linear; + -webkit-app-region: no-drag; +} + +.context-view.monaco-menu-container :focus, +.context-view.monaco-menu-container .monaco-action-bar.vertical:focus, +.context-view.monaco-menu-container .monaco-action-bar.vertical :focus { + outline: 0; +} + +.hc-black .context-view.monaco-menu-container, +.hc-light .context-view.monaco-menu-container, +:host-context(.hc-black) .context-view.monaco-menu-container, +:host-context(.hc-light) .context-view.monaco-menu-container { + box-shadow: none; +} + +.hc-black .monaco-menu .monaco-action-bar.vertical .action-item.focused, +.hc-light .monaco-menu .monaco-action-bar.vertical .action-item.focused, +:host-context(.hc-black) .monaco-menu .monaco-action-bar.vertical .action-item.focused, +:host-context(.hc-light) .monaco-menu .monaco-action-bar.vertical .action-item.focused { + background: none; +} + +/* Vertical Action Bar Styles */ + +.monaco-menu .monaco-action-bar.vertical { + padding: 4px 0; +} + +.monaco-menu .monaco-action-bar.vertical .action-menu-item { + height: 2em; +} + +.monaco-menu .monaco-action-bar.vertical .action-label:not(.separator), +.monaco-menu .monaco-action-bar.vertical .keybinding { + font-size: inherit; + padding: 0 2em; + max-height: 100%; +} + +.monaco-menu .monaco-action-bar.vertical .menu-item-check { + font-size: inherit; + width: 2em; +} + +.monaco-menu .monaco-action-bar.vertical .action-label.separator { + font-size: inherit; + margin: 5px 0 !important; + padding: 0; + border-radius: 0; +} + +.linux .monaco-menu .monaco-action-bar.vertical .action-label.separator, +:host-context(.linux) .monaco-menu .monaco-action-bar.vertical .action-label.separator { + margin-left: 0; + margin-right: 0; +} + +.monaco-menu .monaco-action-bar.vertical .submenu-indicator { + font-size: 60%; + padding: 0 1.8em; +} + +.linux .monaco-menu .monaco-action-bar.vertical .submenu-indicator, +:host-context(.linux) .monaco-menu .monaco-action-bar.vertical .submenu-indicator { + height: 100%; + mask-size: 10px 10px; + -webkit-mask-size: 10px 10px; +} + +.monaco-menu .action-item { + cursor: default; +}`;if(e){t+=` + /* Arrows */ + .monaco-scrollable-element > .scrollbar > .scra { + cursor: pointer; + font-size: 11px !important; + } + + .monaco-scrollable-element > .visible { + opacity: 1; + + /* Background rule added for IE9 - to allow clicks on dom node */ + background:rgba(0,0,0,0); + + transition: opacity 100ms linear; + } + .monaco-scrollable-element > .invisible { + opacity: 0; + pointer-events: none; + } + .monaco-scrollable-element > .invisible.fade { + transition: opacity 800ms linear; + } + + /* Scrollable Content Inset Shadow */ + .monaco-scrollable-element > .shadow { + position: absolute; + display: none; + } + .monaco-scrollable-element > .shadow.top { + display: block; + top: 0; + left: 3px; + height: 3px; + width: 100%; + } + .monaco-scrollable-element > .shadow.left { + display: block; + top: 3px; + left: 0; + height: 100%; + width: 3px; + } + .monaco-scrollable-element > .shadow.top-left-corner { + display: block; + top: 0; + left: 0; + height: 3px; + width: 3px; + } + `;let i=n.scrollbarShadow;i&&(t+=` + .monaco-scrollable-element > .shadow.top { + box-shadow: ${i} 0 6px 6px -6px inset; + } + + .monaco-scrollable-element > .shadow.left { + box-shadow: ${i} 6px 0 6px -6px inset; + } + + .monaco-scrollable-element > .shadow.top.left { + box-shadow: ${i} 6px 6px 6px -6px inset; + } + `);let o=n.scrollbarSliderBackground;o&&(t+=` + .monaco-scrollable-element > .scrollbar > .slider { + background: ${o}; + } + `);let s=n.scrollbarSliderHoverBackground;s&&(t+=` + .monaco-scrollable-element > .scrollbar > .slider:hover { + background: ${s}; + } + `);let r=n.scrollbarSliderActiveBackground;r&&(t+=` + .monaco-scrollable-element > .scrollbar > .slider.active { + background: ${r}; + } + `)}return t}Po();xt();le();var rE=class{constructor(e,t,i,o){this.contextViewService=e,this.telemetryService=t,this.notificationService=i,this.keybindingService=o,this.focusToReturn=null,this.lastContainer=null,this.block=null,this.blockDisposable=null,this.options={blockMouse:!0}}configure(e){this.options=e}showContextMenu(e){let t=e.getActions();if(!t.length)return;this.focusToReturn=Bi();let i,o=e.domForShadowRoot instanceof HTMLElement?e.domForShadowRoot:void 0;this.contextViewService.showContextView({getAnchor:()=>e.getAnchor(),canRelayout:!1,anchorAlignment:e.anchorAlignment,anchorAxisAlignment:e.anchorAxisAlignment,render:s=>{var r;this.lastContainer=s;let a=e.getMenuClassName?e.getMenuClassName():"";a&&(s.className+=" "+a),this.options.blockMouse&&(this.block=s.appendChild(ve(".context-view-block")),this.block.style.position="fixed",this.block.style.cursor="initial",this.block.style.left="0",this.block.style.top="0",this.block.style.width="100%",this.block.style.height="100%",this.block.style.zIndex="-1",(r=this.blockDisposable)===null||r===void 0||r.dispose(),this.blockDisposable=$(this.block,se.MOUSE_DOWN,h=>h.stopPropagation()));let l=new ae,c=e.actionRunner||new bs;c.onWillRun(h=>this.onActionRun(h,!e.skipTelemetry),this,l),c.onDidRun(this.onDidActionRun,this,l),i=new Yv(s,t,{actionViewItemProvider:e.getActionViewItem,context:e.getActionsContext?e.getActionsContext():null,actionRunner:c,getKeyBinding:e.getKeyBinding?e.getKeyBinding:h=>this.keybindingService.lookupKeybinding(h.id)},zH),i.onDidCancel(()=>this.contextViewService.hideContextView(!0),null,l),i.onDidBlur(()=>this.contextViewService.hideContextView(!0),null,l);let d=ge(s);return l.add($(d,se.BLUR,()=>this.contextViewService.hideContextView(!0))),l.add($(d,se.MOUSE_DOWN,h=>{if(h.defaultPrevented)return;let u=new yn(d,h),f=u.target;if(!u.rightButton){for(;f;){if(f===s)return;f=f.parentElement}this.contextViewService.hideContextView(!0)}})),_o(l,i)},focus:()=>{i?.focus(!!e.autoSelectFirstItem)},onHide:s=>{var r,a,l;(r=e.onHide)===null||r===void 0||r.call(e,!!s),this.block&&(this.block.remove(),this.block=null),(a=this.blockDisposable)===null||a===void 0||a.dispose(),this.blockDisposable=null,this.lastContainer&&(Bi()===this.lastContainer||yi(Bi(),this.lastContainer))&&((l=this.focusToReturn)===null||l===void 0||l.focus()),this.lastContainer=null}},o,!!o)}onActionRun(e,t){t&&this.telemetryService.publicLog2("workbenchActionExecuted",{id:e.action.id,from:"contextMenu"}),this.contextViewService.hideContextView(!1)}onDidActionRun(e){e.error&&!yd(e.error)&&this.notificationService.error(e.error)}};var iQ=function(n,e,t,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},Yp=function(n,e){return function(t,i){e(t,i,n)}},aE=class extends H{get contextMenuHandler(){return this._contextMenuHandler||(this._contextMenuHandler=new rE(this.contextViewService,this.telemetryService,this.notificationService,this.keybindingService)),this._contextMenuHandler}constructor(e,t,i,o,s,r){super(),this.telemetryService=e,this.notificationService=t,this.contextViewService=i,this.keybindingService=o,this.menuService=s,this.contextKeyService=r,this._contextMenuHandler=void 0,this._onDidShowContextMenu=this._store.add(new B),this.onDidShowContextMenu=this._onDidShowContextMenu.event,this._onDidHideContextMenu=this._store.add(new B)}configure(e){this.contextMenuHandler.configure(e)}showContextMenu(e){e=cP.transform(e,this.menuService,this.contextKeyService),this.contextMenuHandler.showContextMenu({...e,onHide:t=>{var i;(i=e.onHide)===null||i===void 0||i.call(e,t),this._onDidHideContextMenu.fire()}}),uu.getInstance().resetKeyStatus(),this._onDidShowContextMenu.fire()}};aE=iQ([Yp(0,nr),Yp(1,Ko),Yp(2,Qc),Yp(3,fi),Yp(4,Wr),Yp(5,rt)],aE);var cP;(function(n){function e(i){return i&&i.menuId instanceof A}function t(i,o,s){if(!e(i))return i;let{menuId:r,menuActionOptions:a,contextKeyService:l}=i;return{...i,getActions:()=>{let c=[];if(r){let d=o.createMenu(r,l??s);VH(d,a,c),d.dispose()}return i.getActions?zi.join(i.getActions(),c):c}}}n.transform=t})(cP||(cP={}));Ur();_();v();b();ke();vo();fs();kr();cr();er();bf();sn();Or();ir();_();v();b();var Xv;(function(n){n[n.API=0]="API",n[n.USER=1]="USER"})(Xv||(Xv={}));var uP=function(n,e,t,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},lE=function(n,e){return function(t,i){e(t,i,n)}},dP=class{constructor(e){this._commandService=e}async open(e,t){if(!c0(e,Ze.command))return!1;if(!t?.allowCommands||(typeof e=="string"&&(e=Oe.parse(e)),Array.isArray(t.allowCommands)&&!t.allowCommands.includes(e.path)))return!0;let i=[];try{i=Sv(decodeURIComponent(e.query))}catch{try{i=Sv(e.query)}catch{}}return Array.isArray(i)||(i=[i]),await this._commandService.executeCommand(e.path,...i),!0}};dP=uP([lE(0,kn)],dP);var hP=class{constructor(e){this._editorService=e}async open(e,t){typeof e=="string"&&(e=Oe.parse(e));let{selection:i,uri:o}=sV(e);return e=o,e.scheme===Ze.file&&(e=JW(e)),await this._editorService.openCodeEditor({resource:e,options:{selection:i,source:t?.fromUserGesture?Xv.USER:Xv.API,...t?.editorOptions}},this._editorService.getFocusedCodeEditor(),t?.openToSide),!0}};hP=uP([lE(0,Zt)],hP);var cE=class{constructor(e,t){this._openers=new Ii,this._validators=new Ii,this._resolvers=new Ii,this._resolvedUriTargets=new Gn(i=>i.with({path:null,fragment:null,query:null}).toString()),this._externalOpeners=new Ii,this._defaultExternalOpener={openExternal:async i=>($T(i,Ze.http,Ze.https)?Yw(i):gt.location.href=i,!0)},this._openers.push({open:async(i,o)=>o?.openExternal||$T(i,Ze.mailto,Ze.http,Ze.https,Ze.vsls)?(await this._doOpenExternal(i,o),!0):!1}),this._openers.push(new dP(t)),this._openers.push(new hP(e))}registerOpener(e){return{dispose:this._openers.unshift(e)}}async open(e,t){var i;let o=typeof e=="string"?Oe.parse(e):e,s=(i=this._resolvedUriTargets.get(o))!==null&&i!==void 0?i:e;for(let r of this._validators)if(!await r.shouldOpen(s,t))return!1;for(let r of this._openers)if(await r.open(e,t))return!0;return!1}async resolveExternalUri(e,t){for(let i of this._resolvers)try{let o=await i.resolveExternalUri(e,t);if(o)return this._resolvedUriTargets.has(o.resolved)||this._resolvedUriTargets.set(o.resolved,e),o}catch{}throw new Error("Could not resolve external URI: "+e.toString())}async _doOpenExternal(e,t){let i=typeof e=="string"?Oe.parse(e):e,o;try{o=(await this.resolveExternalUri(i,t)).resolved}catch{o=i}let s;if(typeof e=="string"&&i.toString()===o.toString()?s=e:s=encodeURI(o.toString(!0)),t?.allowContributedOpeners){let r=typeof t?.allowContributedOpeners=="string"?t?.allowContributedOpeners:void 0;for(let a of this._externalOpeners)if(await a.openExternal(s,{sourceUri:i,preferredOpenerId:r},Mo.None))return!0}return this._defaultExternalOpener.openExternal(s,{sourceUri:i},Mo.None)}dispose(){this._validators.clear()}};cE=uP([lE(0,Zt),lE(1,kn)],cE);dE();Hr();_();v();b();_();v();b();Ge();qe();var Es;(function(n){n[n.Hint=1]="Hint",n[n.Info=2]="Info",n[n.Warning=4]="Warning",n[n.Error=8]="Error"})(Es||(Es={}));(function(n){function e(r,a){return a-r}n.compare=e;let t=Object.create(null);t[n.Error]=p("sev.error","Error"),t[n.Warning]=p("sev.warning","Warning"),t[n.Info]=p("sev.info","Info");function i(r){return t[r]||""}n.toString=i;function o(r){switch(r){case Ci.Error:return n.Error;case Ci.Warning:return n.Warning;case Ci.Info:return n.Info;case Ci.Ignore:return n.Hint}}n.fromSeverity=o;function s(r){switch(r){case n.Error:return Ci.Error;case n.Warning:return Ci.Warning;case n.Info:return Ci.Info;case n.Hint:return Ci.Ignore}}n.toSeverity=s})(Es||(Es={}));var qH;(function(n){let e="";function t(o){return i(o,!0)}n.makeKey=t;function i(o,s){let r=[e];return o.source?r.push(o.source.replace("\xA6","\\\xA6")):r.push(e),o.code?typeof o.code=="string"?r.push(o.code.replace("\xA6","\\\xA6")):r.push(o.code.value.replace("\xA6","\\\xA6")):r.push(e),o.severity!==void 0&&o.severity!==null?r.push(Es.toString(o.severity)):r.push(e),o.message&&s?r.push(o.message.replace("\xA6","\\\xA6")):r.push(e),o.startLineNumber!==void 0&&o.startLineNumber!==null?r.push(o.startLineNumber.toString()):r.push(e),o.startColumn!==void 0&&o.startColumn!==null?r.push(o.startColumn.toString()):r.push(e),o.endLineNumber!==void 0&&o.endLineNumber!==null?r.push(o.endLineNumber.toString()):r.push(e),o.endColumn!==void 0&&o.endColumn!==null?r.push(o.endColumn.toString()):r.push(e),r.push(e),r.join("\xA6")}n.makeKeyOptionalMessage=i})(qH||(qH={}));var tl=De("markerService");le();hr();Qi();$a();_u();Ke();er();ye();is();cr();_();v();b();function jH(n,e){let t=[],i=[];for(let o of n)e.has(o)||t.push(o);for(let o of e)n.has(o)||i.push(o);return{removed:t,added:i}}function GH(n,e){let t=new Set;for(let i of e)n.has(i)&&t.add(i);return t}var nQ=function(n,e,t,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},ZH=function(n,e){return function(t,i){e(t,i,n)}},hE=class extends H{constructor(e,t){super(),this._markerService=t,this._onDidChangeMarker=this._register(new B),this._markerDecorations=new Gn,e.getModels().forEach(i=>this._onModelAdded(i)),this._register(e.onModelAdded(this._onModelAdded,this)),this._register(e.onModelRemoved(this._onModelRemoved,this)),this._register(this._markerService.onMarkerChanged(this._handleMarkerChange,this))}dispose(){super.dispose(),this._markerDecorations.forEach(e=>e.dispose()),this._markerDecorations.clear()}getMarker(e,t){let i=this._markerDecorations.get(e);return i&&i.getMarker(t)||null}_handleMarkerChange(e){e.forEach(t=>{let i=this._markerDecorations.get(t);i&&this._updateDecorations(i)})}_onModelAdded(e){let t=new fP(e);this._markerDecorations.set(e.uri,t),this._updateDecorations(t)}_onModelRemoved(e){var t;let i=this._markerDecorations.get(e.uri);i&&(i.dispose(),this._markerDecorations.delete(e.uri)),(e.uri.scheme===Ze.inMemory||e.uri.scheme===Ze.internal||e.uri.scheme===Ze.vscode)&&((t=this._markerService)===null||t===void 0||t.read({resource:e.uri}).map(o=>o.owner).forEach(o=>this._markerService.remove(o,[e.uri])))}_updateDecorations(e){let t=this._markerService.read({resource:e.model.uri,take:500});e.update(t)&&this._onDidChangeMarker.fire(e.model)}};hE=nQ([ZH(0,xn),ZH(1,tl)],hE);var fP=class extends H{constructor(e){super(),this.model=e,this._map=new Zy,this._register(be(()=>{this.model.deltaDecorations([...this._map.values()],[]),this._map.clear()}))}update(e){let{added:t,removed:i}=jH(new Set(this._map.keys()),new Set(e));if(t.length===0&&i.length===0)return!1;let o=i.map(a=>this._map.get(a)),s=t.map(a=>({range:this._createDecorationRange(this.model,a),options:this._createDecorationOption(a)})),r=this.model.deltaDecorations(o,s);for(let a of i)this._map.delete(a);for(let a=0;a=o)return i;let s=e.getWordAtPosition(i.getStartPosition());s&&(i=new P(i.startLineNumber,s.startColumn,i.endLineNumber,s.endColumn))}else if(t.endColumn===Number.MAX_VALUE&&t.startColumn===1&&i.startLineNumber===i.endLineNumber){let o=e.getLineFirstNonWhitespaceColumn(t.startLineNumber);o=0:!1}};_();v();b();ye();le();Lt();sv();I_();Ma();Hr();Fo();ZL();Bg();kR();er();hs();lr();var oQ=function(n,e,t,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},Qv=function(n,e){return function(t,i){e(t,i,n)}},Xp;function Kf(n){return n.toString()}var gP=class{constructor(e,t,i){this.model=e,this._modelEventListeners=new ae,this.model=e,this._modelEventListeners.add(e.onWillDispose(()=>t(e))),this._modelEventListeners.add(e.onDidChangeLanguage(o=>i(e,o)))}dispose(){this._modelEventListeners.dispose()}},sQ=mi||Be?1:2,mP=class{constructor(e,t,i,o,s,r,a,l){this.uri=e,this.initialUndoRedoSnapshot=t,this.time=i,this.sharesUndoRedoStack=o,this.heapSize=s,this.sha1=r,this.versionId=a,this.alternativeVersionId=l}},Jv=Xp=class extends H{constructor(e,t,i,o,s){super(),this._configurationService=e,this._resourcePropertiesService=t,this._undoRedoService=i,this._languageService=o,this._languageConfigurationService=s,this._onModelAdded=this._register(new B),this.onModelAdded=this._onModelAdded.event,this._onModelRemoved=this._register(new B),this.onModelRemoved=this._onModelRemoved.event,this._onModelModeChanged=this._register(new B),this.onModelLanguageChanged=this._onModelModeChanged.event,this._modelCreationOptionsByLanguageAndResource=Object.create(null),this._models={},this._disposedModels=new Map,this._disposedModelsHeapSize=0,this._register(this._configurationService.onDidChangeConfiguration(r=>this._updateModelOptions(r))),this._updateModelOptions(void 0)}static _readModelOptions(e,t){var i;let o=nn.tabSize;if(e.editor&&typeof e.editor.tabSize<"u"){let f=parseInt(e.editor.tabSize,10);isNaN(f)||(o=f),o<1&&(o=1)}let s="tabSize";if(e.editor&&typeof e.editor.indentSize<"u"&&e.editor.indentSize!=="tabSize"){let f=parseInt(e.editor.indentSize,10);isNaN(f)||(s=Math.max(f,1))}let r=nn.insertSpaces;e.editor&&typeof e.editor.insertSpaces<"u"&&(r=e.editor.insertSpaces==="false"?!1:!!e.editor.insertSpaces);let a=sQ,l=e.eol;l===`\r +`?a=2:l===` +`&&(a=1);let c=nn.trimAutoWhitespace;e.editor&&typeof e.editor.trimAutoWhitespace<"u"&&(c=e.editor.trimAutoWhitespace==="false"?!1:!!e.editor.trimAutoWhitespace);let d=nn.detectIndentation;e.editor&&typeof e.editor.detectIndentation<"u"&&(d=e.editor.detectIndentation==="false"?!1:!!e.editor.detectIndentation);let h=nn.largeFileOptimizations;e.editor&&typeof e.editor.largeFileOptimizations<"u"&&(h=e.editor.largeFileOptimizations==="false"?!1:!!e.editor.largeFileOptimizations);let u=nn.bracketPairColorizationOptions;return!((i=e.editor)===null||i===void 0)&&i.bracketPairColorization&&typeof e.editor.bracketPairColorization=="object"&&(u={enabled:!!e.editor.bracketPairColorization.enabled,independentColorPoolPerBracketType:!!e.editor.bracketPairColorization.independentColorPoolPerBracketType}),{isForSimpleWidget:t,tabSize:o,indentSize:s,insertSpaces:r,detectIndentation:d,defaultEOL:a,trimAutoWhitespace:c,largeFileOptimizations:h,bracketPairColorizationOptions:u}}_getEOL(e,t){if(e)return this._resourcePropertiesService.getEOL(e,t);let i=this._configurationService.getValue("files.eol",{overrideIdentifier:t});return i&&typeof i=="string"&&i!=="auto"?i:po===3||po===2?` +`:`\r +`}_shouldRestoreUndoStack(){let e=this._configurationService.getValue("files.restoreUndoStack");return typeof e=="boolean"?e:!0}getCreationOptions(e,t,i){let o=typeof e=="string"?e:e.languageId,s=this._modelCreationOptionsByLanguageAndResource[o+t];if(!s){let r=this._configurationService.getValue("editor",{overrideIdentifier:o,resource:t}),a=this._getEOL(t,o);s=Xp._readModelOptions({editor:r,eol:a},i),this._modelCreationOptionsByLanguageAndResource[o+t]=s}return s}_updateModelOptions(e){let t=this._modelCreationOptionsByLanguageAndResource;this._modelCreationOptionsByLanguageAndResource=Object.create(null);let i=Object.keys(this._models);for(let o=0,s=i.length;oe){let t=[];for(this._disposedModels.forEach(i=>{i.sharesUndoRedoStack||t.push(i)}),t.sort((i,o)=>i.time-o.time);t.length>0&&this._disposedModelsHeapSize>e;){let i=t.shift();this._removeDisposedModel(i.uri),i.initialUndoRedoSnapshot!==null&&this._undoRedoService.restoreSnapshot(i.initialUndoRedoSnapshot)}}}_createModelData(e,t,i,o){let s=this.getCreationOptions(t,i,o),r=new Zc(e,t,s,i,this._undoRedoService,this._languageService,this._languageConfigurationService);if(i&&this._disposedModels.has(Kf(i))){let c=this._removeDisposedModel(i),d=this._undoRedoService.getElements(i),h=this._getSHA1Computer(),u=h.canComputeSHA1(r)?h.computeSHA1(r)===c.sha1:!1;if(u||c.sharesUndoRedoStack){for(let f of d.past)Ul(f)&&f.matchesResource(i)&&f.setModel(r);for(let f of d.future)Ul(f)&&f.matchesResource(i)&&f.setModel(r);this._undoRedoService.setElementsValidFlag(i,!0,f=>Ul(f)&&f.matchesResource(i)),u&&(r._overwriteVersionId(c.versionId),r._overwriteAlternativeVersionId(c.alternativeVersionId),r._overwriteInitialUndoRedoSnapshot(c.initialUndoRedoSnapshot))}else c.initialUndoRedoSnapshot!==null&&this._undoRedoService.restoreSnapshot(c.initialUndoRedoSnapshot)}let a=Kf(r.uri);if(this._models[a])throw new Error("ModelService: Cannot add model because it already exists!");let l=new gP(r,c=>this._onWillDispose(c),(c,d)=>this._onDidChangeLanguage(c,d));return this._models[a]=l,l}createModel(e,t,i,o=!1){let s;return t?s=this._createModelData(e,t,i,o):s=this._createModelData(e,In,i,o),this._onModelAdded.fire(s.model),s.model}getModels(){let e=[],t=Object.keys(this._models);for(let i=0,o=t.length;i0||c.future.length>0){for(let d of c.past)Ul(d)&&d.matchesResource(e.uri)&&(s=!0,r+=d.heapSize(e.uri),d.setModel(e.uri));for(let d of c.future)Ul(d)&&d.matchesResource(e.uri)&&(s=!0,r+=d.heapSize(e.uri),d.setModel(e.uri))}}let a=Xp.MAX_MEMORY_FOR_CLOSED_FILES_UNDO_STACK,l=this._getSHA1Computer();if(s)if(!o&&(r>a||!l.canComputeSHA1(e))){let c=i.model.getInitialUndoRedoSnapshot();c!==null&&this._undoRedoService.restoreSnapshot(c)}else this._ensureDisposedModelsHeapSize(a-r),this._undoRedoService.setElementsValidFlag(e.uri,!1,c=>Ul(c)&&c.matchesResource(e.uri)),this._insertDisposedModel(new mP(e.uri,i.model.getInitialUndoRedoSnapshot(),Date.now(),o,r,l.computeSHA1(e),e.getVersionId(),e.getAlternativeVersionId()));else if(!o){let c=i.model.getInitialUndoRedoSnapshot();c!==null&&this._undoRedoService.restoreSnapshot(c)}delete this._models[t],i.dispose(),delete this._modelCreationOptionsByLanguageAndResource[e.getLanguageId()+e.uri],this._onModelRemoved.fire(e)}_onDidChangeLanguage(e,t){let i=t.oldLanguage,o=e.getLanguageId(),s=this.getCreationOptions(i,e.uri,e.isForSimpleWidget),r=this.getCreationOptions(o,e.uri,e.isForSimpleWidget);Xp._setModelOptionsForModel(e,r,s),this._onModelModeChanged.fire({model:e,oldLanguageId:i})}_getSHA1Computer(){return new uE}};Jv.MAX_MEMORY_FOR_CLOSED_FILES_UNDO_STACK=20*1024*1024;Jv=Xp=oQ([Qv(0,Rt),Qv(1,gS),Qv(2,up),Qv(3,ii),Qv(4,yo)],Jv);var uE=class n{canComputeSHA1(e){return e.getValueLength()<=n.MAX_MODEL_SIZE}computeSHA1(e){let t=new h0,i=e.createSnapshot(),o;for(;o=i.read();)t.update(o);return t.digest()}};uE.MAX_MODEL_SIZE=10*1024*1024;_();v();b();ye();Ud();Qi();fs();qe();Oi();Or();_();v();b();fs();ye();Oi();qe();_();v();b();Gt();fs();ye();le();qe();_();v();b();wt();le();Oo();var fE;(function(n){n[n.PRESERVE=0]="PRESERVE",n[n.LAST=1]="LAST"})(fE||(fE={}));var _P={Quickaccess:"workbench.contributions.quickaccess"},pP=class{constructor(){this.providers=[],this.defaultProvider=void 0}registerQuickAccessProvider(e){return e.prefix.length===0?this.defaultProvider=e:this.providers.push(e),this.providers.sort((t,i)=>i.prefix.length-t.prefix.length),be(()=>{this.providers.splice(this.providers.indexOf(e),1),this.defaultProvider===e&&(this.defaultProvider=void 0)})}getQuickAccessProviders(){return $1([this.defaultProvider,...this.providers])}getQuickAccessProvider(e){return e&&this.providers.find(i=>e.startsWith(i.prefix))||void 0||this.defaultProvider}};Vt.add(_P.Quickaccess,new pP);_();v();b();qe();var YH={ctrlCmd:!1,alt:!1},Wh;(function(n){n[n.Blur=1]="Blur",n[n.Gesture=2]="Gesture",n[n.Other=3]="Other"})(Wh||(Wh={}));var la;(function(n){n[n.NONE=0]="NONE",n[n.FIRST=1]="FIRST",n[n.SECOND=2]="SECOND",n[n.LAST=3]="LAST"})(la||(la={}));var bP=class{constructor(e){this.options=e}},Cit=new bP,gE=De("quickInputService");Oo();var rQ=function(n,e,t,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},XH=function(n,e){return function(t,i){e(t,i,n)}},mE=class extends H{constructor(e,t){super(),this.quickInputService=e,this.instantiationService=t,this.registry=Vt.as(_P.Quickaccess),this.mapProviderToDescriptor=new Map,this.lastAcceptedPickerValues=new Map,this.visibleQuickAccess=void 0}show(e="",t){this.doShowOrPick(e,!1,t)}doShowOrPick(e,t,i){var o,s,r;let[a,l]=this.getOrInstantiateProvider(e),c=this.visibleQuickAccess,d=c?.descriptor;if(c&&l&&d===l){e!==l.prefix&&!i?.preserveValue&&(c.picker.value=e),this.adjustValueSelection(c.picker,l,i);return}if(l&&!i?.preserveValue){let S;if(c&&d&&d!==l){let w=c.value.substr(d.prefix.length);w&&(S=`${l.prefix}${w}`)}if(!S){let w=a?.defaultFilterValue;w===fE.LAST?S=this.lastAcceptedPickerValues.get(l):typeof w=="string"&&(S=`${l.prefix}${w}`)}typeof S=="string"&&(e=S)}let h=(o=c?.picker)===null||o===void 0?void 0:o.valueSelection,u=(s=c?.picker)===null||s===void 0?void 0:s.value,f=new ae,g=f.add(this.quickInputService.createQuickPick());g.value=e,this.adjustValueSelection(g,l,i),g.placeholder=l?.placeholder,g.quickNavigate=i?.quickNavigateConfiguration,g.hideInput=!!g.quickNavigate&&!c,(typeof i?.itemActivation=="number"||i?.quickNavigateConfiguration)&&(g.itemActivation=(r=i?.itemActivation)!==null&&r!==void 0?r:la.SECOND),g.contextKey=l?.contextKey,g.filterValue=S=>S.substring(l?l.prefix.length:0);let m;t&&(m=new Og,f.add(ie.once(g.onWillAccept)(S=>{S.veto(),g.hide()}))),f.add(this.registerPickerListeners(g,a,l,e,i?.providerOptions));let C=f.add(new un);if(a&&f.add(a.provide(g,C.token,i?.providerOptions)),ie.once(g.onDidHide)(()=>{g.selectedItems.length===0&&C.cancel(),f.dispose(),m?.complete(g.selectedItems.slice(0))}),g.show(),h&&u===e&&(g.valueSelection=h),t)return m?.p}adjustValueSelection(e,t,i){var o;let s;i?.preserveValue?s=[e.value.length,e.value.length]:s=[(o=t?.prefix.length)!==null&&o!==void 0?o:0,e.value.length],e.valueSelection=s}registerPickerListeners(e,t,i,o,s){let r=new ae,a=this.visibleQuickAccess={picker:e,descriptor:i,value:o};return r.add(be(()=>{a===this.visibleQuickAccess&&(this.visibleQuickAccess=void 0)})),r.add(e.onDidChangeValue(l=>{let[c]=this.getOrInstantiateProvider(l);c!==t?this.show(l,{preserveValue:!0,providerOptions:s}):a.value=l})),i&&r.add(e.onDidAccept(()=>{this.lastAcceptedPickerValues.set(i,e.value)})),r}getOrInstantiateProvider(e){let t=this.registry.getQuickAccessProvider(e);if(!t)return[void 0,void 0];let i=this.mapProviderToDescriptor.get(t);return i||(i=this.instantiationService.createInstance(t.ctor),this.mapProviderToDescriptor.set(t,i)),[i,t]}};mE=rQ([XH(0,gE),XH(1,Ye)],mE);is();Qi();_();v();b();ke();oo();_();v();b();Ln();ye();var nd=class extends co{constructor(e){var t;super(),this._onChange=this._register(new B),this.onChange=this._onChange.event,this._onKeyDown=this._register(new B),this.onKeyDown=this._onKeyDown.event,this._opts=e,this._checked=this._opts.isChecked;let i=["monaco-custom-toggle"];this._opts.icon&&(this._icon=this._opts.icon,i.push(...Xe.asClassNameArray(this._icon))),this._opts.actionClassName&&i.push(...this._opts.actionClassName.split(" ")),this._checked&&i.push("checked"),this.domNode=document.createElement("div"),this._hover=this._register(Qn().setupUpdatableHover((t=e.hoverDelegate)!==null&&t!==void 0?t:ji("mouse"),this.domNode,this._opts.title)),this.domNode.classList.add(...i),this._opts.notFocusable||(this.domNode.tabIndex=0),this.domNode.setAttribute("role","checkbox"),this.domNode.setAttribute("aria-checked",String(this._checked)),this.domNode.setAttribute("aria-label",this._opts.title),this.applyStyles(),this.onclick(this.domNode,o=>{this.enabled&&(this.checked=!this._checked,this._onChange.fire(!1),o.preventDefault())}),this._register(this.ignoreGesture(this.domNode)),this.onkeydown(this.domNode,o=>{if(o.keyCode===10||o.keyCode===3){this.checked=!this._checked,this._onChange.fire(!0),o.preventDefault(),o.stopPropagation();return}this._onKeyDown.fire(o)})}get enabled(){return this.domNode.getAttribute("aria-disabled")!=="true"}focus(){this.domNode.focus()}get checked(){return this._checked}set checked(e){this._checked=e,this.domNode.setAttribute("aria-checked",String(this._checked)),this.domNode.classList.toggle("checked",this._checked),this.applyStyles()}width(){return 22}applyStyles(){this.domNode&&(this.domNode.style.borderColor=this._checked&&this._opts.inputActiveOptionBorder||"",this.domNode.style.color=this._checked&&this._opts.inputActiveOptionForeground||"inherit",this.domNode.style.backgroundColor=this._checked&&this._opts.inputActiveOptionBackground||"")}enable(){this.domNode.setAttribute("aria-disabled",String(!1))}disable(){this.domNode.setAttribute("aria-disabled",String(!0))}};wt();Gt();$n();ye();le();Lt();Ln();Ge();_();v();b();ke();ye();oo();Ef();_();v();b();var aQ=function(n,e,t,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},pE=class{constructor(e){this.nodes=e}toString(){return this.nodes.map(e=>typeof e=="string"?e:e.label).join("")}};aQ([Yt],pE.prototype,"toString",null);var lQ=/\[([^\]]+)\]\(((?:https?:\/\/|command:|file:)[^\)\s]+)(?: (["'])(.+?)(\3))?\)/gi;function QH(n){let e=[],t=0,i;for(;i=lQ.exec(n);){i.index-t>0&&e.push(n.substring(t,i.index));let[,o,s,,r]=i;r?e.push({label:o,href:s,title:r}):e.push({label:o,href:s}),t=i.index+i[0].length}return t{U7(f)&&He.stop(f,!0),t.callback(s.href)},c=t.disposables.add(new et(a,se.CLICK)).event,d=t.disposables.add(new et(a,se.KEY_DOWN)).event,h=ie.chain(d,f=>f.filter(g=>{let m=new bt(g);return m.equals(10)||m.equals(3)}));t.disposables.add(ui.addTarget(a));let u=t.disposables.add(new et(a,It.Tap)).event;ie.any(c,u,h)(l,null,t.disposables),e.appendChild(a)}}Fo();_();v();b();ke();ye();Ge();qe();_();v();b();ke();_();v();b();wt();fs();ye();le();var CP=class{get templateId(){return this.renderer.templateId}constructor(e,t){this.renderer=e,this.modelProvider=t}renderTemplate(e){return{data:this.renderer.renderTemplate(e),disposable:H.None}}renderElement(e,t,i,o){var s;if((s=i.disposable)===null||s===void 0||s.dispose(),!i.data)return;let r=this.modelProvider();if(r.isResolved(e))return this.renderer.renderElement(r.get(e),e,i.data,o);let a=new un,l=r.resolve(e,a.token);i.disposable={dispose:()=>a.cancel()},this.renderer.renderPlaceholder(e,i.data),l.then(c=>this.renderer.renderElement(c,e,i.data,o))}disposeTemplate(e){e.disposable&&(e.disposable.dispose(),e.disposable=void 0),e.data&&(this.renderer.disposeTemplate(e.data),e.data=void 0)}},wP=class{constructor(e,t){this.modelProvider=e,this.accessibilityProvider=t}getWidgetAriaLabel(){return this.accessibilityProvider.getWidgetAriaLabel()}getAriaLabel(e){let t=this.modelProvider();return t.isResolved(e)?this.accessibilityProvider.getAriaLabel(t.get(e)):null}};function hQ(n,e){return{...e,accessibilityProvider:e.accessibilityProvider&&new wP(n,e.accessibilityProvider)}}var _E=class{constructor(e,t,i,o,s={}){let r=()=>this.model,a=o.map(l=>new CP(l,r));this.list=new Do(e,t,i,a,hQ(r,s))}updateOptions(e){this.list.updateOptions(e)}getHTMLElement(){return this.list.getHTMLElement()}get onDidFocus(){return this.list.onDidFocus}get widget(){return this.list}get onDidDispose(){return this.list.onDidDispose}get onMouseDblClick(){return ie.map(this.list.onMouseDblClick,({element:e,index:t,browserEvent:i})=>({element:e===void 0?void 0:this._model.get(e),index:t,browserEvent:i}))}get onPointer(){return ie.map(this.list.onPointer,({element:e,index:t,browserEvent:i})=>({element:e===void 0?void 0:this._model.get(e),index:t,browserEvent:i}))}get onDidChangeSelection(){return ie.map(this.list.onDidChangeSelection,({elements:e,indexes:t,browserEvent:i})=>({elements:e.map(o=>this._model.get(o)),indexes:t,browserEvent:i}))}get model(){return this._model}set model(e){this._model=e,this.list.splice(0,this.list.length,Un(e.length))}getFocus(){return this.list.getFocus()}getSelection(){return this.list.getSelection()}getSelectedElements(){return this.getSelection().map(e=>this.model.get(e))}style(e){this.list.style(e)}dispose(){this.list.dispose()}};_();v();b();ke();_();v();b();ke();_();v();b();ke();Gt();ye();le();Lt();var e_=function(n,e,t,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},uQ=!1,eU;(function(n){n.North="north",n.South="south",n.East="east",n.West="west"})(eU||(eU={}));var fQ=4,gQ=new B,mQ=300,pQ=new B,e1=class{constructor(e){this.el=e,this.disposables=new ae}get onPointerMove(){return this.disposables.add(new et(ge(this.el),"mousemove")).event}get onPointerUp(){return this.disposables.add(new et(ge(this.el),"mouseup")).event}dispose(){this.disposables.dispose()}};e_([Yt],e1.prototype,"onPointerMove",null);e_([Yt],e1.prototype,"onPointerUp",null);var t1=class{get onPointerMove(){return this.disposables.add(new et(this.el,It.Change)).event}get onPointerUp(){return this.disposables.add(new et(this.el,It.End)).event}constructor(e){this.el=e,this.disposables=new ae}dispose(){this.disposables.dispose()}};e_([Yt],t1.prototype,"onPointerMove",null);e_([Yt],t1.prototype,"onPointerUp",null);var Jp=class{get onPointerMove(){return this.factory.onPointerMove}get onPointerUp(){return this.factory.onPointerUp}constructor(e){this.factory=e}dispose(){}};e_([Yt],Jp.prototype,"onPointerMove",null);e_([Yt],Jp.prototype,"onPointerUp",null);var tU="pointer-events-disabled",$f=class n extends H{get state(){return this._state}get orthogonalStartSash(){return this._orthogonalStartSash}get orthogonalEndSash(){return this._orthogonalEndSash}set state(e){this._state!==e&&(this.el.classList.toggle("disabled",e===0),this.el.classList.toggle("minimum",e===1),this.el.classList.toggle("maximum",e===2),this._state=e,this.onDidEnablementChange.fire(e))}set orthogonalStartSash(e){if(this._orthogonalStartSash!==e){if(this.orthogonalStartDragHandleDisposables.clear(),this.orthogonalStartSashDisposables.clear(),e){let t=i=>{this.orthogonalStartDragHandleDisposables.clear(),i!==0&&(this._orthogonalStartDragHandle=me(this.el,ve(".orthogonal-drag-handle.start")),this.orthogonalStartDragHandleDisposables.add(be(()=>this._orthogonalStartDragHandle.remove())),this.orthogonalStartDragHandleDisposables.add(new et(this._orthogonalStartDragHandle,"mouseenter")).event(()=>n.onMouseEnter(e),void 0,this.orthogonalStartDragHandleDisposables),this.orthogonalStartDragHandleDisposables.add(new et(this._orthogonalStartDragHandle,"mouseleave")).event(()=>n.onMouseLeave(e),void 0,this.orthogonalStartDragHandleDisposables))};this.orthogonalStartSashDisposables.add(e.onDidEnablementChange.event(t,this)),t(e.state)}this._orthogonalStartSash=e}}set orthogonalEndSash(e){if(this._orthogonalEndSash!==e){if(this.orthogonalEndDragHandleDisposables.clear(),this.orthogonalEndSashDisposables.clear(),e){let t=i=>{this.orthogonalEndDragHandleDisposables.clear(),i!==0&&(this._orthogonalEndDragHandle=me(this.el,ve(".orthogonal-drag-handle.end")),this.orthogonalEndDragHandleDisposables.add(be(()=>this._orthogonalEndDragHandle.remove())),this.orthogonalEndDragHandleDisposables.add(new et(this._orthogonalEndDragHandle,"mouseenter")).event(()=>n.onMouseEnter(e),void 0,this.orthogonalEndDragHandleDisposables),this.orthogonalEndDragHandleDisposables.add(new et(this._orthogonalEndDragHandle,"mouseleave")).event(()=>n.onMouseLeave(e),void 0,this.orthogonalEndDragHandleDisposables))};this.orthogonalEndSashDisposables.add(e.onDidEnablementChange.event(t,this)),t(e.state)}this._orthogonalEndSash=e}}constructor(e,t,i){super(),this.hoverDelay=mQ,this.hoverDelayer=this._register(new ka(this.hoverDelay)),this._state=3,this.onDidEnablementChange=this._register(new B),this._onDidStart=this._register(new B),this._onDidChange=this._register(new B),this._onDidReset=this._register(new B),this._onDidEnd=this._register(new B),this.orthogonalStartSashDisposables=this._register(new ae),this.orthogonalStartDragHandleDisposables=this._register(new ae),this.orthogonalEndSashDisposables=this._register(new ae),this.orthogonalEndDragHandleDisposables=this._register(new ae),this.onDidStart=this._onDidStart.event,this.onDidChange=this._onDidChange.event,this.onDidReset=this._onDidReset.event,this.onDidEnd=this._onDidEnd.event,this.linkedSash=void 0,this.el=me(e,ve(".monaco-sash")),i.orthogonalEdge&&this.el.classList.add(`orthogonal-edge-${i.orthogonalEdge}`),Be&&this.el.classList.add("mac");let o=this._register(new et(this.el,"mousedown")).event;this._register(o(h=>this.onPointerStart(h,new e1(e)),this));let s=this._register(new et(this.el,"dblclick")).event;this._register(s(this.onPointerDoublePress,this));let r=this._register(new et(this.el,"mouseenter")).event;this._register(r(()=>n.onMouseEnter(this)));let a=this._register(new et(this.el,"mouseleave")).event;this._register(a(()=>n.onMouseLeave(this))),this._register(ui.addTarget(this.el));let l=this._register(new et(this.el,It.Start)).event;this._register(l(h=>this.onPointerStart(h,new t1(this.el)),this));let c=this._register(new et(this.el,It.Tap)).event,d;this._register(c(h=>{if(d){clearTimeout(d),d=void 0,this.onPointerDoublePress(h);return}clearTimeout(d),d=setTimeout(()=>d=void 0,250)},this)),typeof i.size=="number"?(this.size=i.size,i.orientation===0?this.el.style.width=`${this.size}px`:this.el.style.height=`${this.size}px`):(this.size=fQ,this._register(gQ.event(h=>{this.size=h,this.layout()}))),this._register(pQ.event(h=>this.hoverDelay=h)),this.layoutProvider=t,this.orthogonalStartSash=i.orthogonalStartSash,this.orthogonalEndSash=i.orthogonalEndSash,this.orientation=i.orientation||0,this.orientation===1?(this.el.classList.add("horizontal"),this.el.classList.remove("vertical")):(this.el.classList.remove("horizontal"),this.el.classList.add("vertical")),this.el.classList.toggle("debug",uQ),this.layout()}onPointerStart(e,t){He.stop(e);let i=!1;if(!e.__orthogonalSashEvent){let g=this.getOrthogonalSash(e);g&&(i=!0,e.__orthogonalSashEvent=!0,g.onPointerStart(e,new Jp(t)))}if(this.linkedSash&&!e.__linkedSashEvent&&(e.__linkedSashEvent=!0,this.linkedSash.onPointerStart(e,new Jp(t))),!this.state)return;let o=this.el.ownerDocument.getElementsByTagName("iframe");for(let g of o)g.classList.add(tU);let s=e.pageX,r=e.pageY,a=e.altKey,l={startX:s,currentX:s,startY:r,currentY:r,altKey:a};this.el.classList.add("active"),this._onDidStart.fire(l);let c=Xi(this.el),d=()=>{let g="";i?g="all-scroll":this.orientation===1?this.state===1?g="s-resize":this.state===2?g="n-resize":g=Be?"row-resize":"ns-resize":this.state===1?g="e-resize":this.state===2?g="w-resize":g=Be?"col-resize":"ew-resize",c.textContent=`* { cursor: ${g} !important; }`},h=new ae;d(),i||this.onDidEnablementChange.event(d,null,h);let u=g=>{He.stop(g,!1);let m={startX:s,currentX:g.pageX,startY:r,currentY:g.pageY,altKey:a};this._onDidChange.fire(m)},f=g=>{He.stop(g,!1),this.el.removeChild(c),this.el.classList.remove("active"),this._onDidEnd.fire(),h.dispose();for(let m of o)m.classList.remove(tU)};t.onPointerMove(u,null,h),t.onPointerUp(f,null,h),h.add(t)}onPointerDoublePress(e){let t=this.getOrthogonalSash(e);t&&t._onDidReset.fire(),this.linkedSash&&this.linkedSash._onDidReset.fire(),this._onDidReset.fire()}static onMouseEnter(e,t=!1){e.el.classList.contains("active")?(e.hoverDelayer.cancel(),e.el.classList.add("hover")):e.hoverDelayer.trigger(()=>e.el.classList.add("hover"),e.hoverDelay).then(void 0,()=>{}),!t&&e.linkedSash&&n.onMouseEnter(e.linkedSash,!0)}static onMouseLeave(e,t=!1){e.hoverDelayer.cancel(),e.el.classList.remove("hover"),!t&&e.linkedSash&&n.onMouseLeave(e.linkedSash,!0)}clearSashHoverState(){n.onMouseLeave(this)}layout(){if(this.orientation===0){let e=this.layoutProvider;this.el.style.left=e.getVerticalSashLeft(this)-this.size/2+"px",e.getVerticalSashTop&&(this.el.style.top=e.getVerticalSashTop(this)+"px"),e.getVerticalSashHeight&&(this.el.style.height=e.getVerticalSashHeight(this)+"px")}else{let e=this.layoutProvider;this.el.style.top=e.getHorizontalSashTop(this)-this.size/2+"px",e.getHorizontalSashLeft&&(this.el.style.left=e.getHorizontalSashLeft(this)+"px"),e.getHorizontalSashWidth&&(this.el.style.width=e.getHorizontalSashWidth(this)+"px")}}getOrthogonalSash(e){var t;let i=(t=e.initialTarget)!==null&&t!==void 0?t:e.target;if(!(!i||!(i instanceof HTMLElement))&&i.classList.contains("orthogonal-drag-handle"))return i.classList.contains("start")?this.orthogonalStartSash:this.orthogonalEndSash}dispose(){super.dispose(),this.el.remove()}};wt();gn();ye();le();Cp();xi();var _Q={separatorBorder:Z.transparent},bE=class{set size(e){this._size=e}get size(){return this._size}get visible(){return typeof this._cachedVisibleSize>"u"}setVisible(e,t){var i,o;if(e!==this.visible){e?(this.size=Bn(this._cachedVisibleSize,this.viewMinimumSize,this.viewMaximumSize),this._cachedVisibleSize=void 0):(this._cachedVisibleSize=typeof t=="number"?t:this.size,this.size=0),this.container.classList.toggle("visible",e);try{(o=(i=this.view).setVisible)===null||o===void 0||o.call(i,e)}catch(s){console.error("Splitview: Failed to set visible view"),console.error(s)}}}get minimumSize(){return this.visible?this.view.minimumSize:0}get viewMinimumSize(){return this.view.minimumSize}get maximumSize(){return this.visible?this.view.maximumSize:0}get viewMaximumSize(){return this.view.maximumSize}get priority(){return this.view.priority}get proportionalLayout(){var e;return(e=this.view.proportionalLayout)!==null&&e!==void 0?e:!0}get snap(){return!!this.view.snap}set enabled(e){this.container.style.pointerEvents=e?"":"none"}constructor(e,t,i,o){this.container=e,this.view=t,this.disposable=o,this._cachedVisibleSize=void 0,typeof i=="number"?(this._size=i,this._cachedVisibleSize=void 0,e.classList.add("visible")):(this._size=0,this._cachedVisibleSize=i.cachedVisibleSize)}layout(e,t){this.layoutContainer(e);try{this.view.layout(this.size,e,t)}catch(i){console.error("Splitview: Failed to layout view"),console.error(i)}}dispose(){this.disposable.dispose()}},yP=class extends bE{layoutContainer(e){this.container.style.top=`${e}px`,this.container.style.height=`${this.size}px`}},SP=class extends bE{layoutContainer(e){this.container.style.left=`${e}px`,this.container.style.width=`${this.size}px`}},od;(function(n){n[n.Idle=0]="Idle",n[n.Busy=1]="Busy"})(od||(od={}));var iU;(function(n){n.Distribute={type:"distribute"};function e(o){return{type:"split",index:o}}n.Split=e;function t(o){return{type:"auto",index:o}}n.Auto=t;function i(o){return{type:"invisible",cachedVisibleSize:o}}n.Invisible=i})(iU||(iU={}));var vE=class extends H{get orthogonalStartSash(){return this._orthogonalStartSash}get orthogonalEndSash(){return this._orthogonalEndSash}get startSnappingEnabled(){return this._startSnappingEnabled}get endSnappingEnabled(){return this._endSnappingEnabled}set orthogonalStartSash(e){for(let t of this.sashItems)t.sash.orthogonalStartSash=e;this._orthogonalStartSash=e}set orthogonalEndSash(e){for(let t of this.sashItems)t.sash.orthogonalEndSash=e;this._orthogonalEndSash=e}set startSnappingEnabled(e){this._startSnappingEnabled!==e&&(this._startSnappingEnabled=e,this.updateSashEnablement())}set endSnappingEnabled(e){this._endSnappingEnabled!==e&&(this._endSnappingEnabled=e,this.updateSashEnablement())}constructor(e,t={}){var i,o,s,r,a;super(),this.size=0,this._contentSize=0,this.proportions=void 0,this.viewItems=[],this.sashItems=[],this.state=od.Idle,this._onDidSashChange=this._register(new B),this._onDidSashReset=this._register(new B),this._startSnappingEnabled=!0,this._endSnappingEnabled=!0,this.onDidSashChange=this._onDidSashChange.event,this.onDidSashReset=this._onDidSashReset.event,this.orientation=(i=t.orientation)!==null&&i!==void 0?i:0,this.inverseAltBehavior=(o=t.inverseAltBehavior)!==null&&o!==void 0?o:!1,this.proportionalLayout=(s=t.proportionalLayout)!==null&&s!==void 0?s:!0,this.getSashOrthogonalSize=t.getSashOrthogonalSize,this.el=document.createElement("div"),this.el.classList.add("monaco-split-view2"),this.el.classList.add(this.orientation===0?"vertical":"horizontal"),e.appendChild(this.el),this.sashContainer=me(this.el,ve(".sash-container")),this.viewContainer=ve(".split-view-container"),this.scrollable=this._register(new gr({forceIntegerValues:!0,smoothScrollDuration:125,scheduleAtNextAnimationFrame:c=>rn(ge(this.el),c)})),this.scrollableElement=this._register(new Bl(this.viewContainer,{vertical:this.orientation===0?(r=t.scrollbarVisibility)!==null&&r!==void 0?r:1:2,horizontal:this.orientation===1?(a=t.scrollbarVisibility)!==null&&a!==void 0?a:1:2},this.scrollable));let l=this._register(new et(this.viewContainer,"scroll")).event;this._register(l(c=>{let d=this.scrollableElement.getScrollPosition(),h=Math.abs(this.viewContainer.scrollLeft-d.scrollLeft)<=1?void 0:this.viewContainer.scrollLeft,u=Math.abs(this.viewContainer.scrollTop-d.scrollTop)<=1?void 0:this.viewContainer.scrollTop;(h!==void 0||u!==void 0)&&this.scrollableElement.setScrollPosition({scrollLeft:h,scrollTop:u})})),this.onDidScroll=this.scrollableElement.onScroll,this._register(this.onDidScroll(c=>{c.scrollTopChanged&&(this.viewContainer.scrollTop=c.scrollTop),c.scrollLeftChanged&&(this.viewContainer.scrollLeft=c.scrollLeft)})),me(this.el,this.scrollableElement.getDomNode()),this.style(t.styles||_Q),t.descriptor&&(this.size=t.descriptor.size,t.descriptor.views.forEach((c,d)=>{let h=ds(c.visible)||c.visible?c.size:{type:"invisible",cachedVisibleSize:c.size},u=c.view;this.doAddView(u,h,d,!0)}),this._contentSize=this.viewItems.reduce((c,d)=>c+d.size,0),this.saveProportions())}style(e){e.separatorBorder.isTransparent()?(this.el.classList.remove("separator-border"),this.el.style.removeProperty("--separator-border")):(this.el.classList.add("separator-border"),this.el.style.setProperty("--separator-border",e.separatorBorder.toString()))}addView(e,t,i=this.viewItems.length,o){this.doAddView(e,t,i,o)}layout(e,t){let i=Math.max(this.size,this._contentSize);if(this.size=e,this.layoutContext=t,this.proportions){let o=0;for(let s=0;s0&&(r.size=Bn(Math.round(a*e/o),r.minimumSize,r.maximumSize))}}else{let o=Un(this.viewItems.length),s=o.filter(a=>this.viewItems[a].priority===1),r=o.filter(a=>this.viewItems[a].priority===2);this.resize(this.viewItems.length-1,e-i,void 0,s,r)}this.distributeEmptySpace(),this.layoutViews()}saveProportions(){this.proportionalLayout&&this._contentSize>0&&(this.proportions=this.viewItems.map(e=>e.proportionalLayout&&e.visible?e.size/this._contentSize:void 0))}onSashStart({sash:e,start:t,alt:i}){for(let a of this.viewItems)a.enabled=!1;let o=this.sashItems.findIndex(a=>a.sash===e),s=_o($(this.el.ownerDocument.body,"keydown",a=>r(this.sashDragState.current,a.altKey)),$(this.el.ownerDocument.body,"keyup",()=>r(this.sashDragState.current,!1))),r=(a,l)=>{let c=this.viewItems.map(g=>g.size),d=Number.NEGATIVE_INFINITY,h=Number.POSITIVE_INFINITY;if(this.inverseAltBehavior&&(l=!l),l)if(o===this.sashItems.length-1){let m=this.viewItems[o];d=(m.minimumSize-m.size)/2,h=(m.maximumSize-m.size)/2}else{let m=this.viewItems[o+1];d=(m.size-m.maximumSize)/2,h=(m.size-m.minimumSize)/2}let u,f;if(!l){let g=Un(o,-1),m=Un(o+1,this.viewItems.length),C=g.reduce((M,W)=>M+(this.viewItems[W].minimumSize-c[W]),0),S=g.reduce((M,W)=>M+(this.viewItems[W].viewMaximumSize-c[W]),0),w=m.length===0?Number.POSITIVE_INFINITY:m.reduce((M,W)=>M+(c[W]-this.viewItems[W].minimumSize),0),y=m.length===0?Number.NEGATIVE_INFINITY:m.reduce((M,W)=>M+(c[W]-this.viewItems[W].viewMaximumSize),0),x=Math.max(C,y),k=Math.min(w,S),T=this.findFirstSnapIndex(g),N=this.findFirstSnapIndex(m);if(typeof T=="number"){let M=this.viewItems[T],W=Math.floor(M.viewMinimumSize/2);u={index:T,limitDelta:M.visible?x-W:x+W,size:M.size}}if(typeof N=="number"){let M=this.viewItems[N],W=Math.floor(M.viewMinimumSize/2);f={index:N,limitDelta:M.visible?k+W:k-W,size:M.size}}}this.sashDragState={start:a,current:a,index:o,sizes:c,minDelta:d,maxDelta:h,alt:l,snapBefore:u,snapAfter:f,disposable:s}};r(t,i)}onSashChange({current:e}){let{index:t,start:i,sizes:o,alt:s,minDelta:r,maxDelta:a,snapBefore:l,snapAfter:c}=this.sashDragState;this.sashDragState.current=e;let d=e-i,h=this.resize(t,d,o,void 0,void 0,r,a,l,c);if(s){let u=t===this.sashItems.length-1,f=this.viewItems.map(y=>y.size),g=u?t:t+1,m=this.viewItems[g],C=m.size-m.maximumSize,S=m.size-m.minimumSize,w=u?t-1:t+1;this.resize(w,-h,f,void 0,void 0,C,S)}this.distributeEmptySpace(),this.layoutViews()}onSashEnd(e){this._onDidSashChange.fire(e),this.sashDragState.disposable.dispose(),this.saveProportions();for(let t of this.viewItems)t.enabled=!0}onViewChange(e,t){let i=this.viewItems.indexOf(e);i<0||i>=this.viewItems.length||(t=typeof t=="number"?t:e.size,t=Bn(t,e.minimumSize,e.maximumSize),this.inverseAltBehavior&&i>0?(this.resize(i-1,Math.floor((e.size-t)/2)),this.distributeEmptySpace(),this.layoutViews()):(e.size=t,this.relayout([i],void 0)))}resizeView(e,t){if(!(e<0||e>=this.viewItems.length)){if(this.state!==od.Idle)throw new Error("Cant modify splitview");this.state=od.Busy;try{let i=Un(this.viewItems.length).filter(a=>a!==e),o=[...i.filter(a=>this.viewItems[a].priority===1),e],s=i.filter(a=>this.viewItems[a].priority===2),r=this.viewItems[e];t=Math.round(t),t=Bn(t,r.minimumSize,Math.min(r.maximumSize,this.size)),r.size=t,this.relayout(o,s)}finally{this.state=od.Idle}}}distributeViewSizes(){let e=[],t=0;for(let a of this.viewItems)a.maximumSize-a.minimumSize>0&&(e.push(a),t+=a.size);let i=Math.floor(t/e.length);for(let a of e)a.size=Bn(i,a.minimumSize,a.maximumSize);let o=Un(this.viewItems.length),s=o.filter(a=>this.viewItems[a].priority===1),r=o.filter(a=>this.viewItems[a].priority===2);this.relayout(s,r)}getViewSize(e){return e<0||e>=this.viewItems.length?-1:this.viewItems[e].size}doAddView(e,t,i=this.viewItems.length,o){if(this.state!==od.Idle)throw new Error("Cant modify splitview");this.state=od.Busy;try{let s=ve(".split-view-view");i===this.viewItems.length?this.viewContainer.appendChild(s):this.viewContainer.insertBefore(s,this.viewContainer.children.item(i));let r=e.onDidChange(u=>this.onViewChange(d,u)),a=be(()=>this.viewContainer.removeChild(s)),l=_o(r,a),c;typeof t=="number"?c=t:(t.type==="auto"&&(this.areViewsDistributed()?t={type:"distribute"}:t={type:"split",index:t.index}),t.type==="split"?c=this.getViewSize(t.index)/2:t.type==="invisible"?c={cachedVisibleSize:t.cachedVisibleSize}:c=e.minimumSize);let d=this.orientation===0?new yP(s,e,c,l):new SP(s,e,c,l);if(this.viewItems.splice(i,0,d),this.viewItems.length>1){let u={orthogonalStartSash:this.orthogonalStartSash,orthogonalEndSash:this.orthogonalEndSash},f=this.orientation===0?new $f(this.sashContainer,{getHorizontalSashTop:M=>this.getSashPosition(M),getHorizontalSashWidth:this.getSashOrthogonalSize},{...u,orientation:1}):new $f(this.sashContainer,{getVerticalSashLeft:M=>this.getSashPosition(M),getVerticalSashHeight:this.getSashOrthogonalSize},{...u,orientation:0}),g=this.orientation===0?M=>({sash:f,start:M.startY,current:M.currentY,alt:M.altKey}):M=>({sash:f,start:M.startX,current:M.currentX,alt:M.altKey}),C=ie.map(f.onDidStart,g)(this.onSashStart,this),w=ie.map(f.onDidChange,g)(this.onSashChange,this),x=ie.map(f.onDidEnd,()=>this.sashItems.findIndex(M=>M.sash===f))(this.onSashEnd,this),k=f.onDidReset(()=>{let M=this.sashItems.findIndex(z=>z.sash===f),W=Un(M,-1),j=Un(M+1,this.viewItems.length),G=this.findFirstSnapIndex(W),V=this.findFirstSnapIndex(j);typeof G=="number"&&!this.viewItems[G].visible||typeof V=="number"&&!this.viewItems[V].visible||this._onDidSashReset.fire(M)}),T=_o(C,w,x,k,f),N={sash:f,disposable:T};this.sashItems.splice(i-1,0,N)}s.appendChild(e.element);let h;typeof t!="number"&&t.type==="split"&&(h=[t.index]),o||this.relayout([i],h),!o&&typeof t!="number"&&t.type==="distribute"&&this.distributeViewSizes()}finally{this.state=od.Idle}}relayout(e,t){let i=this.viewItems.reduce((o,s)=>o+s.size,0);this.resize(this.viewItems.length-1,this.size-i,void 0,e,t),this.distributeEmptySpace(),this.layoutViews(),this.saveProportions()}resize(e,t,i=this.viewItems.map(d=>d.size),o,s,r=Number.NEGATIVE_INFINITY,a=Number.POSITIVE_INFINITY,l,c){if(e<0||e>=this.viewItems.length)return 0;let d=Un(e,-1),h=Un(e+1,this.viewItems.length);if(s)for(let N of s)q1(d,N),q1(h,N);if(o)for(let N of o)x_(d,N),x_(h,N);let u=d.map(N=>this.viewItems[N]),f=d.map(N=>i[N]),g=h.map(N=>this.viewItems[N]),m=h.map(N=>i[N]),C=d.reduce((N,M)=>N+(this.viewItems[M].minimumSize-i[M]),0),S=d.reduce((N,M)=>N+(this.viewItems[M].maximumSize-i[M]),0),w=h.length===0?Number.POSITIVE_INFINITY:h.reduce((N,M)=>N+(i[M]-this.viewItems[M].minimumSize),0),y=h.length===0?Number.NEGATIVE_INFINITY:h.reduce((N,M)=>N+(i[M]-this.viewItems[M].maximumSize),0),x=Math.max(C,y,r),k=Math.min(w,S,a),T=!1;if(l){let N=this.viewItems[l.index],M=t>=l.limitDelta;T=M!==N.visible,N.setVisible(M,l.size)}if(!T&&c){let N=this.viewItems[c.index],M=ta+l.size,0),i=this.size-t,o=Un(this.viewItems.length-1,-1),s=o.filter(a=>this.viewItems[a].priority===1),r=o.filter(a=>this.viewItems[a].priority===2);for(let a of r)q1(o,a);for(let a of s)x_(o,a);typeof e=="number"&&x_(o,e);for(let a=0;i!==0&&at+i.size,0);let e=0;for(let t of this.viewItems)t.layout(e,this.layoutContext),e+=t.size;this.sashItems.forEach(t=>t.sash.layout()),this.updateSashEnablement(),this.updateScrollableElement()}updateScrollableElement(){this.orientation===0?this.scrollableElement.setScrollDimensions({height:this.size,scrollHeight:this._contentSize}):this.scrollableElement.setScrollDimensions({width:this.size,scrollWidth:this._contentSize})}updateSashEnablement(){let e=!1,t=this.viewItems.map(l=>e=l.size-l.minimumSize>0||e);e=!1;let i=this.viewItems.map(l=>e=l.maximumSize-l.size>0||e),o=[...this.viewItems].reverse();e=!1;let s=o.map(l=>e=l.size-l.minimumSize>0||e).reverse();e=!1;let r=o.map(l=>e=l.maximumSize-l.size>0||e).reverse(),a=0;for(let l=0;l0||this.startSnappingEnabled)?c.state=1:w&&t[l]&&(a0)return;if(!i.visible&&i.snap)return t}}areViewsDistributed(){let e,t;for(let i of this.viewItems)if(e=e===void 0?i.size:Math.min(e,i.size),t=t===void 0?i.size:Math.max(t,i.size),t-e>2)return!1;return!0}dispose(){var e;(e=this.sashDragState)===null||e===void 0||e.disposable.dispose(),li(this.viewItems),this.viewItems=[],this.sashItems.forEach(t=>t.disposable.dispose()),this.sashItems=[],super.dispose()}};ye();le();var i1=class n{constructor(e,t,i){this.columns=e,this.getColumnSize=i,this.templateId=n.TemplateId,this.renderedTemplates=new Set;let o=new Map(t.map(s=>[s.templateId,s]));this.renderers=[];for(let s of e){let r=o.get(s.templateId);if(!r)throw new Error(`Table cell renderer for template id ${s.templateId} not found.`);this.renderers.push(r)}}renderTemplate(e){let t=me(e,ve(".monaco-table-tr")),i=[],o=[];for(let r=0;rthis.disposables.add(new xP(d,h))),l={size:a.reduce((d,h)=>d+h.column.weight,0),views:a.map(d=>({size:d.column.weight,view:d}))};this.splitview=this.disposables.add(new vE(this.domNode,{orientation:1,scrollbarVisibility:2,getSashOrthogonalSize:()=>this.cachedHeight,descriptor:l})),this.splitview.el.style.height=`${i.headerRowHeight}px`,this.splitview.el.style.lineHeight=`${i.headerRowHeight}px`;let c=new i1(o,s,d=>this.splitview.getViewSize(d));this.list=this.disposables.add(new Do(e,this.domNode,bQ(i),[c],r)),ie.any(...a.map(d=>d.onDidLayout))(([d,h])=>c.layoutColumn(d,h),null,this.disposables),this.splitview.onDidSashReset(d=>{let h=o.reduce((f,g)=>f+g.weight,0),u=o[d].weight/h*this.cachedWidth;this.splitview.resizeView(d,u)},null,this.disposables),this.styleElement=Xi(this.domNode),this.style(TH)}updateOptions(e){this.list.updateOptions(e)}splice(e,t,i=[]){this.list.splice(e,t,i)}getHTMLElement(){return this.domNode}style(e){let t=[];t.push(`.monaco-table.${this.domId} > .monaco-split-view2 .monaco-sash.vertical::before { + top: ${this.virtualDelegate.headerRowHeight+1}px; + height: calc(100% - ${this.virtualDelegate.headerRowHeight}px); + }`),this.styleElement.textContent=t.join(` +`),this.list.style(e)}getSelectedElements(){return this.list.getSelectedElements()}getSelection(){return this.list.getSelection()}getFocus(){return this.list.getFocus()}dispose(){this.disposables.dispose()}};n1.InstanceCount=0;_();v();b();ke();oo();_();v();b();ke();_();v();b();$n();Ge();var vQ=p("caseDescription","Match Case"),CQ=p("wordsDescription","Match Whole Word"),wQ=p("regexDescription","Use Regular Expression"),CE=class extends nd{constructor(e){var t;super({icon:ue.caseSensitive,title:vQ+e.appendTitle,isChecked:e.isChecked,hoverDelegate:(t=e.hoverDelegate)!==null&&t!==void 0?t:ji("element"),inputActiveOptionBorder:e.inputActiveOptionBorder,inputActiveOptionForeground:e.inputActiveOptionForeground,inputActiveOptionBackground:e.inputActiveOptionBackground})}},wE=class extends nd{constructor(e){var t;super({icon:ue.wholeWord,title:CQ+e.appendTitle,isChecked:e.isChecked,hoverDelegate:(t=e.hoverDelegate)!==null&&t!==void 0?t:ji("element"),inputActiveOptionBorder:e.inputActiveOptionBorder,inputActiveOptionForeground:e.inputActiveOptionForeground,inputActiveOptionBackground:e.inputActiveOptionBackground})}},yE=class extends nd{constructor(e){var t;super({icon:ue.regex,title:wQ+e.appendTitle,isChecked:e.isChecked,hoverDelegate:(t=e.hoverDelegate)!==null&&t!==void 0?t:ji("element"),inputActiveOptionBorder:e.inputActiveOptionBorder,inputActiveOptionForeground:e.inputActiveOptionForeground,inputActiveOptionBackground:e.inputActiveOptionBackground})}};_();v();b();ke();ye();_();v();b();_();v();b();var SE=class{constructor(e,t=0,i=e.length,o=t-1){this.items=e,this.start=t,this.end=i,this.index=o}current(){return this.index===this.start-1||this.index===this.end?null:this.items[this.index]}next(){return this.index=Math.min(this.index+1,this.end),this.current()}previous(){return this.index=Math.max(this.index-1,this.start-1),this.current()}first(){return this.index=this.start,this.current()}last(){return this.index=this.end-1,this.current()}};var xE=class{constructor(e=[],t=10){this._initialize(e),this._limit=t,this._onChange()}getHistory(){return this._elements}add(e){this._history.delete(e),this._history.add(e),this._onChange()}next(){return this._navigator.next()}previous(){return this._currentPosition()!==0?this._navigator.previous():null}current(){return this._navigator.current()}first(){return this._navigator.first()}last(){return this._navigator.last()}isLast(){return this._currentPosition()>=this._elements.length-1}isNowhere(){return this._navigator.current()===null}has(e){return this._history.has(e)}_onChange(){this._reduceToLimit();let e=this._elements;this._navigator=new SE(e,0,e.length,e.length)}_reduceToLimit(){let e=this._elements;e.length>this._limit&&this._initialize(e.slice(e.length-this._limit))}_currentPosition(){let e=this._navigator.current();return e?this._elements.indexOf(e):-1}_initialize(e){this._history=new Set;for(let t of e)this._history.add(t)}get _elements(){let e=[];return this._history.forEach(t=>e.push(t)),e}};hs();Ge();var o1=ve;var LP=class extends co{constructor(e,t,i){var o;super(),this.state="idle",this.maxHeight=Number.POSITIVE_INFINITY,this._onDidChange=this._register(new B),this.onDidChange=this._onDidChange.event,this._onDidHeightChange=this._register(new B),this.onDidHeightChange=this._onDidHeightChange.event,this.contextViewProvider=t,this.options=i,this.message=null,this.placeholder=this.options.placeholder||"",this.tooltip=(o=this.options.tooltip)!==null&&o!==void 0?o:this.placeholder||"",this.ariaLabel=this.options.ariaLabel||"",this.options.validationOptions&&(this.validation=this.options.validationOptions.validation),this.element=me(e,o1(".monaco-inputbox.idle"));let s=this.options.flexibleHeight?"textarea":"input",r=me(this.element,o1(".ibwrapper"));if(this.input=me(r,o1(s+".input.empty")),this.input.setAttribute("autocorrect","off"),this.input.setAttribute("autocapitalize","off"),this.input.setAttribute("spellcheck","false"),this.onfocus(this.input,()=>this.element.classList.add("synthetic-focus")),this.onblur(this.input,()=>this.element.classList.remove("synthetic-focus")),this.options.flexibleHeight){this.maxHeight=typeof this.options.flexibleMaxHeight=="number"?this.options.flexibleMaxHeight:Number.POSITIVE_INFINITY,this.mirror=me(r,o1("div.mirror")),this.mirror.innerText="\xA0",this.scrollableElement=new ix(this.element,{vertical:1}),this.options.flexibleWidth&&(this.input.setAttribute("wrap","off"),this.mirror.style.whiteSpace="pre",this.mirror.style.wordWrap="initial"),me(e,this.scrollableElement.getDomNode()),this._register(this.scrollableElement),this._register(this.scrollableElement.onScroll(c=>this.input.scrollTop=c.scrollTop));let a=this._register(new et(e.ownerDocument,"selectionchange")),l=ie.filter(a.event,()=>{let c=e.ownerDocument.getSelection();return c?.anchorNode===r});this._register(l(this.updateScrollDimensions,this)),this._register(this.onDidHeightChange(this.updateScrollDimensions,this))}else this.input.type=this.options.type||"text",this.input.setAttribute("wrap","off");this.ariaLabel&&this.input.setAttribute("aria-label",this.ariaLabel),this.placeholder&&!this.options.showPlaceholderOnFocus&&this.setPlaceHolder(this.placeholder),this.tooltip&&this.setTooltip(this.tooltip),this.oninput(this.input,()=>this.onValueChange()),this.onblur(this.input,()=>this.onBlur()),this.onfocus(this.input,()=>this.onFocus()),this._register(this.ignoreGesture(this.input)),setTimeout(()=>this.updateMirror(),0),this.options.actions&&(this.actionbar=this._register(new Eo(this.element)),this.actionbar.push(this.options.actions,{icon:!0,label:!1})),this.applyStyles()}onBlur(){this._hideMessage(),this.options.showPlaceholderOnFocus&&this.input.setAttribute("placeholder","")}onFocus(){this._showMessage(),this.options.showPlaceholderOnFocus&&this.input.setAttribute("placeholder",this.placeholder||"")}setPlaceHolder(e){this.placeholder=e,this.input.setAttribute("placeholder",e)}setTooltip(e){this.tooltip=e,this.hover?this.hover.update(e):this.hover=this._register(Qn().setupUpdatableHover(ji("mouse"),this.input,e))}get inputElement(){return this.input}get value(){return this.input.value}set value(e){this.input.value!==e&&(this.input.value=e,this.onValueChange())}get height(){return typeof this.cachedHeight=="number"?this.cachedHeight:p0(this.element)}focus(){this.input.focus()}blur(){this.input.blur()}hasFocus(){return _0(this.input)}select(e=null){this.input.select(),e&&(this.input.setSelectionRange(e.start,e.end),e.end===this.input.value.length&&(this.input.scrollLeft=this.input.scrollWidth))}isSelectionAtEnd(){return this.input.selectionEnd===this.input.value.length&&this.input.selectionStart===this.input.selectionEnd}getSelection(){var e;let t=this.input.selectionStart;if(t===null)return null;let i=(e=this.input.selectionEnd)!==null&&e!==void 0?e:t;return{start:t,end:i}}enable(){this.input.removeAttribute("disabled")}disable(){this.blur(),this.input.disabled=!0,this._hideMessage()}set paddingRight(e){this.input.style.width=`calc(100% - ${e}px)`,this.mirror&&(this.mirror.style.paddingRight=e+"px")}updateScrollDimensions(){if(typeof this.cachedContentHeight!="number"||typeof this.cachedHeight!="number"||!this.scrollableElement)return;let e=this.cachedContentHeight,t=this.cachedHeight,i=this.input.scrollTop;this.scrollableElement.setScrollDimensions({scrollHeight:e,height:t}),this.scrollableElement.setScrollPosition({scrollTop:i})}showMessage(e,t){if(this.state==="open"&&hn(this.message,e))return;this.message=e,this.element.classList.remove("idle"),this.element.classList.remove("info"),this.element.classList.remove("warning"),this.element.classList.remove("error"),this.element.classList.add(this.classForType(e.type));let i=this.stylesForType(this.message.type);this.element.style.border=`1px solid ${tr(i.border,"transparent")}`,this.message.content&&(this.hasFocus()||t)&&this._showMessage()}hideMessage(){this.message=null,this.element.classList.remove("info"),this.element.classList.remove("warning"),this.element.classList.remove("error"),this.element.classList.add("idle"),this._hideMessage(),this.applyStyles()}validate(){let e=null;return this.validation&&(e=this.validation(this.value),e?(this.inputElement.setAttribute("aria-invalid","true"),this.showMessage(e)):this.inputElement.hasAttribute("aria-invalid")&&(this.inputElement.removeAttribute("aria-invalid"),this.hideMessage())),e?.type}stylesForType(e){let t=this.options.inputBoxStyles;switch(e){case 1:return{border:t.inputValidationInfoBorder,background:t.inputValidationInfoBackground,foreground:t.inputValidationInfoForeground};case 2:return{border:t.inputValidationWarningBorder,background:t.inputValidationWarningBackground,foreground:t.inputValidationWarningForeground};default:return{border:t.inputValidationErrorBorder,background:t.inputValidationErrorBackground,foreground:t.inputValidationErrorForeground}}}classForType(e){switch(e){case 1:return"info";case 2:return"warning";default:return"error"}}_showMessage(){if(!this.contextViewProvider||!this.message)return;let e,t=()=>e.style.width=Vg(this.element)+"px";this.contextViewProvider.showContextView({getAnchor:()=>this.element,anchorAlignment:1,render:o=>{var s,r;if(!this.message)return null;e=me(o,o1(".monaco-inputbox-container")),t();let a={inline:!0,className:"monaco-inputbox-message"},l=this.message.formatContent?aV(this.message.content,a):rV(this.message.content,a);l.classList.add(this.classForType(this.message.type));let c=this.stylesForType(this.message.type);return l.style.backgroundColor=(s=c.background)!==null&&s!==void 0?s:"",l.style.color=(r=c.foreground)!==null&&r!==void 0?r:"",l.style.border=c.border?`1px solid ${c.border}`:"",me(e,l),null},onHide:()=>{this.state="closed"},layout:t});let i;this.message.type===3?i=p("alertErrorMessage","Error: {0}",this.message.content):this.message.type===2?i=p("alertWarningMessage","Warning: {0}",this.message.content):i=p("alertInfoMessage","Info: {0}",this.message.content),ob(i),this.state="open"}_hideMessage(){this.contextViewProvider&&(this.state==="open"&&this.contextViewProvider.hideContextView(),this.state="idle")}onValueChange(){this._onDidChange.fire(this.value),this.validate(),this.updateMirror(),this.input.classList.toggle("empty",!this.value),this.state==="open"&&this.contextViewProvider&&this.contextViewProvider.layout()}updateMirror(){if(!this.mirror)return;let e=this.value,i=e.charCodeAt(e.length-1)===10?" ":"";(e+i).replace(/\u000c/g,"")?this.mirror.textContent=e+i:this.mirror.innerText="\xA0",this.layout()}applyStyles(){var e,t,i;let o=this.options.inputBoxStyles,s=(e=o.inputBackground)!==null&&e!==void 0?e:"",r=(t=o.inputForeground)!==null&&t!==void 0?t:"",a=(i=o.inputBorder)!==null&&i!==void 0?i:"";this.element.style.backgroundColor=s,this.element.style.color=r,this.input.style.backgroundColor="inherit",this.input.style.color=r,this.element.style.border=`1px solid ${tr(a,"transparent")}`}layout(){if(!this.mirror)return;let e=this.cachedContentHeight;this.cachedContentHeight=p0(this.mirror),e!==this.cachedContentHeight&&(this.cachedHeight=Math.min(this.cachedContentHeight,this.maxHeight),this.input.style.height=this.cachedHeight+"px",this._onDidHeightChange.fire(this.cachedContentHeight))}insertAtCursor(e){let t=this.inputElement,i=t.selectionStart,o=t.selectionEnd,s=t.value;i!==null&&o!==null&&(this.value=s.substr(0,i)+e+s.substr(o),t.setSelectionRange(i+1,i+1),this.layout())}dispose(){var e;this._hideMessage(),this.message=null,(e=this.actionbar)===null||e===void 0||e.dispose(),super.dispose()}},LE=class extends LP{constructor(e,t,i){let o=p({key:"history.inputbox.hint.suffix.noparens",comment:['Text is the suffix of an input field placeholder coming after the action the input field performs, this will be used when the input field ends in a closing parenthesis ")", for example "Filter (e.g. text, !exclude)". The character inserted into the final string is \u21C5 to represent the up and down arrow keys.']}," or {0} for history","\u21C5"),s=p({key:"history.inputbox.hint.suffix.inparens",comment:['Text is the suffix of an input field placeholder coming after the action the input field performs, this will be used when the input field does NOT end in a closing parenthesis (eg. "Find"). The character inserted into the final string is \u21C5 to represent the up and down arrow keys.']}," ({0} for history)","\u21C5");super(e,t,i),this._onDidFocus=this._register(new B),this.onDidFocus=this._onDidFocus.event,this._onDidBlur=this._register(new B),this.onDidBlur=this._onDidBlur.event,this.history=new xE(i.history,100);let r=()=>{if(i.showHistoryHint&&i.showHistoryHint()&&!this.placeholder.endsWith(o)&&!this.placeholder.endsWith(s)&&this.history.getHistory().length){let a=this.placeholder.endsWith(")")?o:s,l=this.placeholder+a;i.showPlaceholderOnFocus&&!_0(this.input)?this.placeholder=l:this.setPlaceHolder(l)}};this.observer=new MutationObserver((a,l)=>{a.forEach(c=>{c.target.textContent||r()})}),this.observer.observe(this.input,{attributeFilter:["class"]}),this.onfocus(this.input,()=>r()),this.onblur(this.input,()=>{let a=l=>{if(this.placeholder.endsWith(l)){let c=this.placeholder.slice(0,this.placeholder.length-l.length);return i.showPlaceholderOnFocus?this.placeholder=c:this.setPlaceHolder(c),!0}else return!1};a(s)||a(o)})}dispose(){super.dispose(),this.observer&&(this.observer.disconnect(),this.observer=void 0)}addToHistory(e){this.value&&(e||this.value!==this.getCurrentValue())&&this.history.add(this.value)}isAtLastInHistory(){return this.history.isLast()}isNowhereInHistory(){return this.history.isNowhere()}showNextValue(){this.history.has(this.value)||this.addToHistory();let e=this.getNextValue();e&&(e=e===this.value?this.getNextValue():e),this.value=e??"",Uu(this.value?this.value:p("clearedInput","Cleared Input"))}showPreviousValue(){this.history.has(this.value)||this.addToHistory();let e=this.getPreviousValue();e&&(e=e===this.value?this.getPreviousValue():e),e&&(this.value=e,Uu(this.value))}setPlaceHolder(e){super.setPlaceHolder(e),this.setTooltip(e)}onBlur(){super.onBlur(),this._onDidBlur.fire()}onFocus(){super.onFocus(),this._onDidFocus.fire()}getCurrentValue(){let e=this.history.current();return e||(e=this.history.last(),this.history.next()),e}getPreviousValue(){return this.history.previous()||this.history.first()}getNextValue(){return this.history.next()}};ye();Ge();le();var yQ=p("defaultLabel","input"),s1=class extends co{constructor(e,t,i){super(),this.fixFocusOnOptionClickEnabled=!0,this.imeSessionInProgress=!1,this.additionalTogglesDisposables=this._register(new no),this.additionalToggles=[],this._onDidOptionChange=this._register(new B),this.onDidOptionChange=this._onDidOptionChange.event,this._onKeyDown=this._register(new B),this.onKeyDown=this._onKeyDown.event,this._onMouseDown=this._register(new B),this.onMouseDown=this._onMouseDown.event,this._onInput=this._register(new B),this._onKeyUp=this._register(new B),this._onCaseSensitiveKeyDown=this._register(new B),this.onCaseSensitiveKeyDown=this._onCaseSensitiveKeyDown.event,this._onRegexKeyDown=this._register(new B),this.onRegexKeyDown=this._onRegexKeyDown.event,this._lastHighlightFindOptions=0,this.placeholder=i.placeholder||"",this.validation=i.validation,this.label=i.label||yQ,this.showCommonFindToggles=!!i.showCommonFindToggles;let o=i.appendCaseSensitiveLabel||"",s=i.appendWholeWordsLabel||"",r=i.appendRegexLabel||"",a=i.history||[],l=!!i.flexibleHeight,c=!!i.flexibleWidth,d=i.flexibleMaxHeight;this.domNode=document.createElement("div"),this.domNode.classList.add("monaco-findInput"),this.inputBox=this._register(new LE(this.domNode,t,{placeholder:this.placeholder||"",ariaLabel:this.label||"",validationOptions:{validation:this.validation},history:a,showHistoryHint:i.showHistoryHint,flexibleHeight:l,flexibleWidth:c,flexibleMaxHeight:d,inputBoxStyles:i.inputBoxStyles}));let h=this._register(Mf());if(this.showCommonFindToggles){this.regex=this._register(new yE({appendTitle:r,isChecked:!1,hoverDelegate:h,...i.toggleStyles})),this._register(this.regex.onChange(f=>{this._onDidOptionChange.fire(f),!f&&this.fixFocusOnOptionClickEnabled&&this.inputBox.focus(),this.validate()})),this._register(this.regex.onKeyDown(f=>{this._onRegexKeyDown.fire(f)})),this.wholeWords=this._register(new wE({appendTitle:s,isChecked:!1,hoverDelegate:h,...i.toggleStyles})),this._register(this.wholeWords.onChange(f=>{this._onDidOptionChange.fire(f),!f&&this.fixFocusOnOptionClickEnabled&&this.inputBox.focus(),this.validate()})),this.caseSensitive=this._register(new CE({appendTitle:o,isChecked:!1,hoverDelegate:h,...i.toggleStyles})),this._register(this.caseSensitive.onChange(f=>{this._onDidOptionChange.fire(f),!f&&this.fixFocusOnOptionClickEnabled&&this.inputBox.focus(),this.validate()})),this._register(this.caseSensitive.onKeyDown(f=>{this._onCaseSensitiveKeyDown.fire(f)}));let u=[this.caseSensitive.domNode,this.wholeWords.domNode,this.regex.domNode];this.onkeydown(this.domNode,f=>{if(f.equals(15)||f.equals(17)||f.equals(9)){let g=u.indexOf(this.domNode.ownerDocument.activeElement);if(g>=0){let m=-1;f.equals(17)?m=(g+1)%u.length:f.equals(15)&&(g===0?m=u.length-1:m=g-1),f.equals(9)?(u[g].blur(),this.inputBox.focus()):m>=0&&u[m].focus(),He.stop(f,!0)}}})}this.controls=document.createElement("div"),this.controls.className="controls",this.controls.style.display=this.showCommonFindToggles?"":"none",this.caseSensitive&&this.controls.append(this.caseSensitive.domNode),this.wholeWords&&this.controls.appendChild(this.wholeWords.domNode),this.regex&&this.controls.appendChild(this.regex.domNode),this.setAdditionalToggles(i?.additionalToggles),this.controls&&this.domNode.appendChild(this.controls),e?.appendChild(this.domNode),this._register($(this.inputBox.inputElement,"compositionstart",u=>{this.imeSessionInProgress=!0})),this._register($(this.inputBox.inputElement,"compositionend",u=>{this.imeSessionInProgress=!1,this._onInput.fire()})),this.onkeydown(this.inputBox.inputElement,u=>this._onKeyDown.fire(u)),this.onkeyup(this.inputBox.inputElement,u=>this._onKeyUp.fire(u)),this.oninput(this.inputBox.inputElement,u=>this._onInput.fire()),this.onmousedown(this.inputBox.inputElement,u=>this._onMouseDown.fire(u))}get onDidChange(){return this.inputBox.onDidChange}layout(e){this.inputBox.layout(),this.updateInputBoxPadding(e.collapsedFindWidget)}enable(){var e,t,i;this.domNode.classList.remove("disabled"),this.inputBox.enable(),(e=this.regex)===null||e===void 0||e.enable(),(t=this.wholeWords)===null||t===void 0||t.enable(),(i=this.caseSensitive)===null||i===void 0||i.enable();for(let o of this.additionalToggles)o.enable()}disable(){var e,t,i;this.domNode.classList.add("disabled"),this.inputBox.disable(),(e=this.regex)===null||e===void 0||e.disable(),(t=this.wholeWords)===null||t===void 0||t.disable(),(i=this.caseSensitive)===null||i===void 0||i.disable();for(let o of this.additionalToggles)o.disable()}setFocusInputOnOptionClick(e){this.fixFocusOnOptionClickEnabled=e}setEnabled(e){e?this.enable():this.disable()}setAdditionalToggles(e){for(let t of this.additionalToggles)t.domNode.remove();this.additionalToggles=[],this.additionalTogglesDisposables.value=new ae;for(let t of e??[])this.additionalTogglesDisposables.value.add(t),this.controls.appendChild(t.domNode),this.additionalTogglesDisposables.value.add(t.onChange(i=>{this._onDidOptionChange.fire(i),!i&&this.fixFocusOnOptionClickEnabled&&this.inputBox.focus()})),this.additionalToggles.push(t);this.additionalToggles.length>0&&(this.controls.style.display=""),this.updateInputBoxPadding()}updateInputBoxPadding(e=!1){var t,i,o,s,r,a;e?this.inputBox.paddingRight=0:this.inputBox.paddingRight=((i=(t=this.caseSensitive)===null||t===void 0?void 0:t.width())!==null&&i!==void 0?i:0)+((s=(o=this.wholeWords)===null||o===void 0?void 0:o.width())!==null&&s!==void 0?s:0)+((a=(r=this.regex)===null||r===void 0?void 0:r.width())!==null&&a!==void 0?a:0)+this.additionalToggles.reduce((l,c)=>l+c.width(),0)}getValue(){return this.inputBox.value}setValue(e){this.inputBox.value!==e&&(this.inputBox.value=e)}select(){this.inputBox.select()}focus(){this.inputBox.focus()}getCaseSensitive(){var e,t;return(t=(e=this.caseSensitive)===null||e===void 0?void 0:e.checked)!==null&&t!==void 0?t:!1}setCaseSensitive(e){this.caseSensitive&&(this.caseSensitive.checked=e)}getWholeWords(){var e,t;return(t=(e=this.wholeWords)===null||e===void 0?void 0:e.checked)!==null&&t!==void 0?t:!1}setWholeWords(e){this.wholeWords&&(this.wholeWords.checked=e)}getRegex(){var e,t;return(t=(e=this.regex)===null||e===void 0?void 0:e.checked)!==null&&t!==void 0?t:!1}setRegex(e){this.regex&&(this.regex.checked=e,this.validate())}focusOnCaseSensitive(){var e;(e=this.caseSensitive)===null||e===void 0||e.focus()}highlightFindOptions(){this.domNode.classList.remove("highlight-"+this._lastHighlightFindOptions),this._lastHighlightFindOptions=1-this._lastHighlightFindOptions,this.domNode.classList.add("highlight-"+this._lastHighlightFindOptions)}validate(){this.inputBox.validate()}showMessage(e){this.inputBox.showMessage(e)}clearMessage(){this.inputBox.hideMessage()}};_();v();b();_();v();b();var as;(function(n){n[n.Expanded=0]="Expanded",n[n.Collapsed=1]="Collapsed",n[n.PreserveOrExpanded=2]="PreserveOrExpanded",n[n.PreserveOrCollapsed=3]="PreserveOrCollapsed"})(as||(as={}));var zh;(function(n){n[n.Unknown=0]="Unknown",n[n.Twistie=1]="Twistie",n[n.Element=2]="Element",n[n.Filter=3]="Filter"})(zh||(zh={}));var eo=class extends Error{constructor(e,t){super(`TreeError [${e}] ${t}`)}},qf=class{constructor(e){this.fn=e,this._map=new WeakMap}map(e){let t=this._map.get(e);return t||(t=this.fn(e),this._map.set(e,t)),t}};wt();Gt();AT();ye();js();function r1(n){return typeof n=="object"&&"visibility"in n&&"data"in n}function jf(n){switch(n){case!0:return 1;case!1:return 0;default:return n}}function kP(n){return typeof n.collapsible=="boolean"}var kE=class{constructor(e,t,i,o={}){var s;this.user=e,this.list=t,this.rootRef=[],this.eventBufferer=new kd,this._onDidChangeCollapseState=new B,this.onDidChangeCollapseState=this.eventBufferer.wrapEvent(this._onDidChangeCollapseState.event),this._onDidChangeRenderNodeCount=new B,this.onDidChangeRenderNodeCount=this.eventBufferer.wrapEvent(this._onDidChangeRenderNodeCount.event),this._onDidSplice=new B,this.onDidSplice=this._onDidSplice.event,this.refilterDelayer=new ka(Ew),this.collapseByDefault=typeof o.collapseByDefault>"u"?!1:o.collapseByDefault,this.allowNonCollapsibleParents=(s=o.allowNonCollapsibleParents)!==null&&s!==void 0?s:!1,this.filter=o.filter,this.autoExpandSingleChildren=typeof o.autoExpandSingleChildren>"u"?!1:o.autoExpandSingleChildren,this.root={parent:void 0,element:i,children:[],depth:0,visibleChildrenCount:0,visibleChildIndex:-1,collapsible:!1,collapsed:!1,renderNodeCount:0,visibility:1,visible:!0,filterData:void 0}}splice(e,t,i=ht.empty(),o={}){if(e.length===0)throw new eo(this.user,"Invalid tree location");o.diffIdentityProvider?this.spliceSmart(o.diffIdentityProvider,e,t,i,o):this.spliceSimple(e,t,i,o)}spliceSmart(e,t,i,o,s,r){var a;o===void 0&&(o=ht.empty()),r===void 0&&(r=(a=s.diffDepth)!==null&&a!==void 0?a:0);let{parentNode:l}=this.getParentNodeWithListIndex(t);if(!l.lastDiffIds)return this.spliceSimple(t,i,o,s);let c=[...o],d=t[t.length-1],h=new Eu({getElements:()=>l.lastDiffIds},{getElements:()=>[...l.children.slice(0,d),...c,...l.children.slice(d+i)].map(C=>e.getId(C.element).toString())}).ComputeDiff(!1);if(h.quitEarly)return l.lastDiffIds=void 0,this.spliceSimple(t,i,c,s);let u=t.slice(0,-1),f=(C,S,w)=>{if(r>0)for(let y=0;yw.originalStart-S.originalStart))f(g,m,g-(C.originalStart+C.originalLength)),g=C.originalStart,m=C.modifiedStart-d,this.spliceSimple([...u,g],C.originalLength,ht.slice(c,m,m+C.modifiedLength),s);f(g,m,g)}spliceSimple(e,t,i=ht.empty(),{onDidCreateNode:o,onDidDeleteNode:s,diffIdentityProvider:r}){let{parentNode:a,listIndex:l,revealed:c,visible:d}=this.getParentNodeWithListIndex(e),h=[],u=ht.map(i,k=>this.createTreeNode(k,a,a.visible?1:0,c,h,o)),f=e[e.length-1],g=0;for(let k=f;k>=0&&kr.getId(k.element).toString())):a.lastDiffIds=a.children.map(k=>r.getId(k.element).toString()):a.lastDiffIds=void 0;let y=0;for(let k of w)k.visible&&y++;if(y!==0)for(let k=f+m.length;kT+(N.visible?N.renderNodeCount:0),0);this._updateAncestorsRenderNodeCount(a,S-k),this.list.splice(l,k,h)}if(w.length>0&&s){let k=T=>{s(T),T.children.forEach(k)};w.forEach(k)}this._onDidSplice.fire({insertedNodes:m,deletedNodes:w});let x=a;for(;x;){if(x.visibility===2){this.refilterDelayer.trigger(()=>this.refilter());break}x=x.parent}}rerender(e){if(e.length===0)throw new eo(this.user,"Invalid tree location");let{node:t,listIndex:i,revealed:o}=this.getTreeNodeWithListIndex(e);t.visible&&o&&this.list.splice(i,1,[t])}has(e){return this.hasTreeNode(e)}getListIndex(e){let{listIndex:t,visible:i,revealed:o}=this.getTreeNodeWithListIndex(e);return i&&o?t:-1}getListRenderCount(e){return this.getTreeNode(e).renderNodeCount}isCollapsible(e){return this.getTreeNode(e).collapsible}setCollapsible(e,t){let i=this.getTreeNode(e);typeof t>"u"&&(t=!i.collapsible);let o={collapsible:t};return this.eventBufferer.bufferEvents(()=>this._setCollapseState(e,o))}isCollapsed(e){return this.getTreeNode(e).collapsed}setCollapsed(e,t,i){let o=this.getTreeNode(e);typeof t>"u"&&(t=!o.collapsed);let s={collapsed:t,recursive:i||!1};return this.eventBufferer.bufferEvents(()=>this._setCollapseState(e,s))}_setCollapseState(e,t){let{node:i,listIndex:o,revealed:s}=this.getTreeNodeWithListIndex(e),r=this._setListNodeCollapseState(i,o,s,t);if(i!==this.root&&this.autoExpandSingleChildren&&r&&!kP(t)&&i.collapsible&&!i.collapsed&&!t.recursive){let a=-1;for(let l=0;l-1){a=-1;break}else a=l;a>-1&&this._setCollapseState([...e,a],t)}return r}_setListNodeCollapseState(e,t,i,o){let s=this._setNodeCollapseState(e,o,!1);if(!i||!e.visible||!s)return s;let r=e.renderNodeCount,a=this.updateNodeAfterCollapseChange(e),l=r-(t===-1?0:1);return this.list.splice(t+1,l,a.slice(1)),s}_setNodeCollapseState(e,t,i){let o;if(e===this.root?o=!1:(kP(t)?(o=e.collapsible!==t.collapsible,e.collapsible=t.collapsible):e.collapsible?(o=e.collapsed!==t.collapsed,e.collapsed=t.collapsed):o=!1,o&&this._onDidChangeCollapseState.fire({node:e,deep:i})),!kP(t)&&t.recursive)for(let s of e.children)o=this._setNodeCollapseState(s,t,!0)||o;return o}expandTo(e){this.eventBufferer.bufferEvents(()=>{let t=this.getTreeNode(e);for(;t.parent;)t=t.parent,e=e.slice(0,e.length-1),t.collapsed&&this._setCollapseState(e,{collapsed:!1,recursive:!1})})}refilter(){let e=this.root.renderNodeCount,t=this.updateNodeAfterFilterChange(this.root);this.list.splice(0,e,t),this.refilterDelayer.cancel()}createTreeNode(e,t,i,o,s,r){let a={parent:t,element:e.element,children:[],depth:t.depth+1,visibleChildrenCount:0,visibleChildIndex:-1,collapsible:typeof e.collapsible=="boolean"?e.collapsible:typeof e.collapsed<"u",collapsed:typeof e.collapsed>"u"?this.collapseByDefault:e.collapsed,renderNodeCount:1,visibility:1,visible:!0,filterData:void 0},l=this._filterNode(a,i);a.visibility=l,o&&s.push(a);let c=e.children||ht.empty(),d=o&&l!==0&&!a.collapsed,h=0,u=1;for(let f of c){let g=this.createTreeNode(f,a,l,d,s,r);a.children.push(g),u+=g.renderNodeCount,g.visible&&(g.visibleChildIndex=h++)}return this.allowNonCollapsibleParents||(a.collapsible=a.collapsible||a.children.length>0),a.visibleChildrenCount=h,a.visible=l===2?h>0:l===1,a.visible?a.collapsed||(a.renderNodeCount=u):(a.renderNodeCount=0,o&&s.pop()),r?.(a),a}updateNodeAfterCollapseChange(e){let t=e.renderNodeCount,i=[];return this._updateNodeAfterCollapseChange(e,i),this._updateAncestorsRenderNodeCount(e.parent,i.length-t),i}_updateNodeAfterCollapseChange(e,t){if(e.visible===!1)return 0;if(t.push(e),e.renderNodeCount=1,!e.collapsed)for(let i of e.children)e.renderNodeCount+=this._updateNodeAfterCollapseChange(i,t);return this._onDidChangeRenderNodeCount.fire(e),e.renderNodeCount}updateNodeAfterFilterChange(e){let t=e.renderNodeCount,i=[];return this._updateNodeAfterFilterChange(e,e.visible?1:0,i),this._updateAncestorsRenderNodeCount(e.parent,i.length-t),i}_updateNodeAfterFilterChange(e,t,i,o=!0){let s;if(e!==this.root){if(s=this._filterNode(e,t),s===0)return e.visible=!1,e.renderNodeCount=0,!1;o&&i.push(e)}let r=i.length;e.renderNodeCount=e===this.root?0:1;let a=!1;if(!e.collapsed||s!==0){let l=0;for(let c of e.children)a=this._updateNodeAfterFilterChange(c,s,i,o&&!e.collapsed)||a,c.visible&&(c.visibleChildIndex=l++);e.visibleChildrenCount=l}else e.visibleChildrenCount=0;return e!==this.root&&(e.visible=s===2?a:s===1,e.visibility=s),e.visible?e.collapsed||(e.renderNodeCount+=i.length-r):(e.renderNodeCount=0,o&&i.pop()),this._onDidChangeRenderNodeCount.fire(e),e.visible}_updateAncestorsRenderNodeCount(e,t){if(t!==0)for(;e;)e.renderNodeCount+=t,this._onDidChangeRenderNodeCount.fire(e),e=e.parent}_filterNode(e,t){let i=this.filter?this.filter.filter(e.element,t):1;return typeof i=="boolean"?(e.filterData=void 0,i?1:0):r1(i)?(e.filterData=i.data,jf(i.visibility)):(e.filterData=void 0,jf(i))}hasTreeNode(e,t=this.root){if(!e||e.length===0)return!0;let[i,...o]=e;return i<0||i>t.children.length?!1:this.hasTreeNode(o,t.children[i])}getTreeNode(e,t=this.root){if(!e||e.length===0)return t;let[i,...o]=e;if(i<0||i>t.children.length)throw new eo(this.user,"Invalid tree location");return this.getTreeNode(o,t.children[i])}getTreeNodeWithListIndex(e){if(e.length===0)return{node:this.root,listIndex:-1,revealed:!0,visible:!1};let{parentNode:t,listIndex:i,revealed:o,visible:s}=this.getParentNodeWithListIndex(e),r=e[e.length-1];if(r<0||r>t.children.length)throw new eo(this.user,"Invalid tree location");let a=t.children[r];return{node:a,listIndex:i,revealed:o,visible:s&&a.visible}}getParentNodeWithListIndex(e,t=this.root,i=0,o=!0,s=!0){let[r,...a]=e;if(r<0||r>t.children.length)throw new eo(this.user,"Invalid tree location");for(let l=0;lt.element)),this.data=e}};function DP(n){return n instanceof Jc?new EP(n):n}var IP=class{constructor(e,t){this.modelProvider=e,this.dnd=t,this.autoExpandDisposable=H.None,this.disposables=new ae}getDragURI(e){return this.dnd.getDragURI(e.element)}getDragLabel(e,t){if(this.dnd.getDragLabel)return this.dnd.getDragLabel(e.map(i=>i.element),t)}onDragStart(e,t){var i,o;(o=(i=this.dnd).onDragStart)===null||o===void 0||o.call(i,DP(e),t)}onDragOver(e,t,i,o,s,r=!0){let a=this.dnd.onDragOver(DP(e),t&&t.element,i,o,s),l=this.autoExpandNode!==t;if(l&&(this.autoExpandDisposable.dispose(),this.autoExpandNode=t),typeof t>"u")return a;if(l&&typeof a!="boolean"&&a.autoExpand&&(this.autoExpandDisposable=s0(()=>{let f=this.modelProvider(),g=f.getNodeLocation(t);f.isCollapsed(g)&&f.setCollapsed(g,!1),this.autoExpandNode=void 0},500,this.disposables)),typeof a=="boolean"||!a.accept||typeof a.bubble>"u"||a.feedback){if(!r){let f=typeof a=="boolean"?a:a.accept,g=typeof a=="boolean"?void 0:a.effect;return{accept:f,effect:g,feedback:[i]}}return a}if(a.bubble===1){let f=this.modelProvider(),g=f.getNodeLocation(t),m=f.getParentNodeLocation(g),C=f.getNode(m),S=m&&f.getListIndex(m);return this.onDragOver(e,C,S,o,s,!1)}let c=this.modelProvider(),d=c.getNodeLocation(t),h=c.getListIndex(d),u=c.getListRenderCount(d);return{...a,feedback:Un(h,h+u)}}drop(e,t,i,o,s){this.autoExpandDisposable.dispose(),this.autoExpandNode=void 0,this.dnd.drop(DP(e),t&&t.element,i,o,s)}onDragEnd(e){var t,i;(i=(t=this.dnd).onDragEnd)===null||i===void 0||i.call(t,e)}dispose(){this.disposables.dispose(),this.dnd.dispose()}};function SQ(n,e){return e&&{...e,identityProvider:e.identityProvider&&{getId(t){return e.identityProvider.getId(t.element)}},dnd:e.dnd&&new IP(n,e.dnd),multipleSelectionController:e.multipleSelectionController&&{isSelectionSingleChangeEvent(t){return e.multipleSelectionController.isSelectionSingleChangeEvent({...t,element:t.element})},isSelectionRangeChangeEvent(t){return e.multipleSelectionController.isSelectionRangeChangeEvent({...t,element:t.element})}},accessibilityProvider:e.accessibilityProvider&&{...e.accessibilityProvider,getSetSize(t){let i=n(),o=i.getNodeLocation(t),s=i.getParentNodeLocation(o);return i.getNode(s).visibleChildrenCount},getPosInSet(t){return t.visibleChildIndex+1},isChecked:e.accessibilityProvider&&e.accessibilityProvider.isChecked?t=>e.accessibilityProvider.isChecked(t.element):void 0,getRole:e.accessibilityProvider&&e.accessibilityProvider.getRole?t=>e.accessibilityProvider.getRole(t.element):()=>"treeitem",getAriaLabel(t){return e.accessibilityProvider.getAriaLabel(t.element)},getWidgetAriaLabel(){return e.accessibilityProvider.getWidgetAriaLabel()},getWidgetRole:e.accessibilityProvider&&e.accessibilityProvider.getWidgetRole?()=>e.accessibilityProvider.getWidgetRole():()=>"tree",getAriaLevel:e.accessibilityProvider&&e.accessibilityProvider.getAriaLevel?t=>e.accessibilityProvider.getAriaLevel(t.element):t=>t.depth,getActiveDescendantId:e.accessibilityProvider.getActiveDescendantId&&(t=>e.accessibilityProvider.getActiveDescendantId(t.element))},keyboardNavigationLabelProvider:e.keyboardNavigationLabelProvider&&{...e.keyboardNavigationLabelProvider,getKeyboardNavigationLabel(t){return e.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(t.element)}}}}var t_=class{constructor(e){this.delegate=e}getHeight(e){return this.delegate.getHeight(e.element)}getTemplateId(e){return this.delegate.getTemplateId(e.element)}hasDynamicHeight(e){return!!this.delegate.hasDynamicHeight&&this.delegate.hasDynamicHeight(e.element)}setDynamicHeight(e,t){var i,o;(o=(i=this.delegate).setDynamicHeight)===null||o===void 0||o.call(i,e.element,t)}},Gf;(function(n){n.None="none",n.OnHover="onHover",n.Always="always"})(Gf||(Gf={}));var TP=class{get elements(){return this._elements}constructor(e,t=[]){this._elements=t,this.disposables=new ae,this.onDidChange=ie.forEach(e,i=>this._elements=i,this.disposables)}dispose(){this.disposables.dispose()}},IE=class n{constructor(e,t,i,o,s,r={}){var a;this.renderer=e,this.modelProvider=t,this.activeNodes=o,this.renderedIndentGuides=s,this.renderedElements=new Map,this.renderedNodes=new Map,this.indent=n.DefaultIndent,this.hideTwistiesOfChildlessElements=!1,this.shouldRenderIndentGuides=!1,this.activeIndentNodes=new Set,this.indentGuidesDisposable=H.None,this.disposables=new ae,this.templateId=e.templateId,this.updateOptions(r),ie.map(i,l=>l.node)(this.onDidChangeNodeTwistieState,this,this.disposables),(a=e.onDidChangeTwistieState)===null||a===void 0||a.call(e,this.onDidChangeTwistieState,this,this.disposables)}updateOptions(e={}){if(typeof e.indent<"u"){let t=Bn(e.indent,0,40);if(t!==this.indent){this.indent=t;for(let[i,o]of this.renderedNodes)this.renderTreeElement(i,o)}}if(typeof e.renderIndentGuides<"u"){let t=e.renderIndentGuides!==Gf.None;if(t!==this.shouldRenderIndentGuides){this.shouldRenderIndentGuides=t;for(let[i,o]of this.renderedNodes)this._renderIndentGuides(i,o);if(this.indentGuidesDisposable.dispose(),t){let i=new ae;this.activeNodes.onDidChange(this._onDidChangeActiveNodes,this,i),this.indentGuidesDisposable=i,this._onDidChangeActiveNodes(this.activeNodes.elements)}}}typeof e.hideTwistiesOfChildlessElements<"u"&&(this.hideTwistiesOfChildlessElements=e.hideTwistiesOfChildlessElements)}renderTemplate(e){let t=me(e,ve(".monaco-tl-row")),i=me(t,ve(".monaco-tl-indent")),o=me(t,ve(".monaco-tl-twistie")),s=me(t,ve(".monaco-tl-contents")),r=this.renderer.renderTemplate(s);return{container:e,indent:i,twistie:o,indentGuidesDisposable:H.None,templateData:r}}renderElement(e,t,i,o){this.renderedNodes.set(e,i),this.renderedElements.set(e.element,e),this.renderTreeElement(e,i),this.renderer.renderElement(e,t,i.templateData,o)}disposeElement(e,t,i,o){var s,r;i.indentGuidesDisposable.dispose(),(r=(s=this.renderer).disposeElement)===null||r===void 0||r.call(s,e,t,i.templateData,o),typeof o=="number"&&(this.renderedNodes.delete(e),this.renderedElements.delete(e.element))}disposeTemplate(e){this.renderer.disposeTemplate(e.templateData)}onDidChangeTwistieState(e){let t=this.renderedElements.get(e);t&&this.onDidChangeNodeTwistieState(t)}onDidChangeNodeTwistieState(e){let t=this.renderedNodes.get(e);t&&(this._onDidChangeActiveNodes(this.activeNodes.elements),this.renderTreeElement(e,t))}renderTreeElement(e,t){let i=n.DefaultIndent+(e.depth-1)*this.indent;t.twistie.style.paddingLeft=`${i}px`,t.indent.style.width=`${i+this.indent-16}px`,e.collapsible?t.container.setAttribute("aria-expanded",String(!e.collapsed)):t.container.removeAttribute("aria-expanded"),t.twistie.classList.remove(...Xe.asClassNameArray(ue.treeItemExpanded));let o=!1;this.renderer.renderTwistie&&(o=this.renderer.renderTwistie(e.element,t.twistie)),e.collapsible&&(!this.hideTwistiesOfChildlessElements||e.visibleChildrenCount>0)?(o||t.twistie.classList.add(...Xe.asClassNameArray(ue.treeItemExpanded)),t.twistie.classList.add("collapsible"),t.twistie.classList.toggle("collapsed",e.collapsed)):t.twistie.classList.remove("collapsible","collapsed"),this._renderIndentGuides(e,t)}_renderIndentGuides(e,t){if(Co(t.indent),t.indentGuidesDisposable.dispose(),!this.shouldRenderIndentGuides)return;let i=new ae,o=this.modelProvider();for(;;){let s=o.getNodeLocation(e),r=o.getParentNodeLocation(s);if(!r)break;let a=o.getNode(r),l=ve(".indent-guide",{style:`width: ${this.indent}px`});this.activeIndentNodes.has(a)&&l.classList.add("active"),t.indent.childElementCount===0?t.indent.appendChild(l):t.indent.insertBefore(l,t.indent.firstElementChild),this.renderedIndentGuides.add(a,l),i.add(be(()=>this.renderedIndentGuides.delete(a,l))),e=a}t.indentGuidesDisposable=i}_onDidChangeActiveNodes(e){if(!this.shouldRenderIndentGuides)return;let t=new Set,i=this.modelProvider();e.forEach(o=>{let s=i.getNodeLocation(o);try{let r=i.getParentNodeLocation(s);o.collapsible&&o.children.length>0&&!o.collapsed?t.add(o):r&&t.add(i.getNode(r))}catch{}}),this.activeIndentNodes.forEach(o=>{t.has(o)||this.renderedIndentGuides.forEach(o,s=>s.classList.remove("active"))}),t.forEach(o=>{this.activeIndentNodes.has(o)||this.renderedIndentGuides.forEach(o,s=>s.classList.add("active"))}),this.activeIndentNodes=t}dispose(){this.renderedNodes.clear(),this.renderedElements.clear(),this.indentGuidesDisposable.dispose(),li(this.disposables)}};IE.DefaultIndent=8;var NP=class{get totalCount(){return this._totalCount}get matchCount(){return this._matchCount}constructor(e,t,i){this.tree=e,this.keyboardNavigationLabelProvider=t,this._filter=i,this._totalCount=0,this._matchCount=0,this._pattern="",this._lowercasePattern="",this.disposables=new ae,e.onWillRefilter(this.reset,this,this.disposables)}filter(e,t){let i=1;if(this._filter){let r=this._filter.filter(e,t);if(typeof r=="boolean"?i=r?1:0:r1(r)?i=jf(r.visibility):i=r,i===0)return!1}if(this._totalCount++,!this._pattern)return this._matchCount++,{data:Tf.Default,visibility:i};let o=this.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(e),s=Array.isArray(o)?o:[o];for(let r of s){let a=r&&r.toString();if(typeof a>"u")return{data:Tf.Default,visibility:i};let l;if(this.tree.findMatchType===Vh.Contiguous){let c=a.toLowerCase().indexOf(this._lowercasePattern);if(c>-1){l=[Number.MAX_SAFE_INTEGER,0];for(let d=this._lowercasePattern.length;d>0;d--)l.push(c+d-1)}}else l=yp(this._pattern,this._lowercasePattern,0,a,a.toLowerCase(),0,{firstMatchCanBeWeak:!0,boostFullMatch:!0});if(l)return this._matchCount++,s.length===1?{data:l,visibility:i}:{data:{label:a,score:l},visibility:i}}return this.tree.findMode===ac.Filter?typeof this.tree.options.defaultFindVisibility=="number"?this.tree.options.defaultFindVisibility:this.tree.options.defaultFindVisibility?this.tree.options.defaultFindVisibility(e):2:{data:Tf.Default,visibility:i}}reset(){this._totalCount=0,this._matchCount=0}dispose(){li(this.disposables)}};var ac;(function(n){n[n.Highlight=0]="Highlight",n[n.Filter=1]="Filter"})(ac||(ac={}));var Vh;(function(n){n[n.Fuzzy=0]="Fuzzy",n[n.Contiguous=1]="Contiguous"})(Vh||(Vh={}));var AP=class{get pattern(){return this._pattern}get mode(){return this._mode}set mode(e){e!==this._mode&&(this._mode=e,this.widget&&(this.widget.mode=this._mode),this.tree.refilter(),this.render(),this._onDidChangeMode.fire(e))}get matchType(){return this._matchType}set matchType(e){e!==this._matchType&&(this._matchType=e,this.widget&&(this.widget.matchType=this._matchType),this.tree.refilter(),this.render(),this._onDidChangeMatchType.fire(e))}constructor(e,t,i,o,s,r={}){var a,l;this.tree=e,this.view=i,this.filter=o,this.contextViewProvider=s,this.options=r,this._pattern="",this.width=0,this._onDidChangeMode=new B,this.onDidChangeMode=this._onDidChangeMode.event,this._onDidChangeMatchType=new B,this.onDidChangeMatchType=this._onDidChangeMatchType.event,this._onDidChangePattern=new B,this._onDidChangeOpenState=new B,this.onDidChangeOpenState=this._onDidChangeOpenState.event,this.enabledDisposables=new ae,this.disposables=new ae,this._mode=(a=e.options.defaultFindMode)!==null&&a!==void 0?a:ac.Highlight,this._matchType=(l=e.options.defaultFindMatchType)!==null&&l!==void 0?l:Vh.Fuzzy,t.onDidSplice(this.onDidSpliceModel,this,this.disposables)}updateOptions(e={}){e.defaultFindMode!==void 0&&(this.mode=e.defaultFindMode),e.defaultFindMatchType!==void 0&&(this.matchType=e.defaultFindMatchType)}onDidSpliceModel(){!this.widget||this.pattern.length===0||(this.tree.refilter(),this.render())}render(){var e,t,i,o;let s=this.filter.totalCount>0&&this.filter.matchCount===0;this.pattern&&s?!((e=this.tree.options.showNotFoundMessage)!==null&&e!==void 0)||e?(t=this.widget)===null||t===void 0||t.showMessage({type:2,content:p("not found","No elements found.")}):(i=this.widget)===null||i===void 0||i.showMessage({type:2}):(o=this.widget)===null||o===void 0||o.clearMessage()}shouldAllowFocus(e){return!this.widget||!this.pattern||this.filter.totalCount>0&&this.filter.matchCount<=1?!0:!Tf.isDefault(e.filterData)}layout(e){var t;this.width=e,(t=this.widget)===null||t===void 0||t.layout(e)}dispose(){this._history=void 0,this._onDidChangePattern.dispose(),this.enabledDisposables.dispose(),this.disposables.dispose()}};function xQ(n,e){return n.position===e.position&&nU(n,e)}function nU(n,e){return n.node.element===e.node.element&&n.startIndex===e.startIndex&&n.height===e.height&&n.endIndex===e.endIndex}var MP=class{constructor(e=[]){this.stickyNodes=e}get count(){return this.stickyNodes.length}equal(e){return Ht(this.stickyNodes,e.stickyNodes,xQ)}lastNodePartiallyVisible(){if(this.count===0)return!1;let e=this.stickyNodes[this.count-1];if(this.count===1)return e.position!==0;let t=this.stickyNodes[this.count-2];return t.position+t.height!==e.position}animationStateChanged(e){if(!Ht(this.stickyNodes,e.stickyNodes,nU)||this.count===0)return!1;let t=this.stickyNodes[this.count-1],i=e.stickyNodes[e.count-1];return t.position!==i.position}},RP=class{constrainStickyScrollNodes(e,t,i){for(let o=0;oi||o>=t)return e.slice(0,o)}return e}},TE=class extends H{constructor(e,t,i,o,s,r={}){var a;super(),this.tree=e,this.model=t,this.view=i,this.treeDelegate=s,this.maxWidgetViewRatio=.4;let l=this.validateStickySettings(r);this.stickyScrollMaxItemCount=l.stickyScrollMaxItemCount,this.stickyScrollDelegate=(a=r.stickyScrollDelegate)!==null&&a!==void 0?a:new RP,this._widget=this._register(new PP(i.getScrollableElement(),i,e,o,s,r.accessibilityProvider)),this.onDidChangeHasFocus=this._widget.onDidChangeHasFocus,this.onContextMenu=this._widget.onContextMenu,this._register(i.onDidScroll(()=>this.update())),this._register(i.onDidChangeContentHeight(()=>this.update())),this._register(e.onDidChangeCollapseState(()=>this.update())),this.update()}get height(){return this._widget.height}getNodeAtHeight(e){let t;if(e===0?t=this.view.firstVisibleIndex:t=this.view.indexAt(e+this.view.scrollTop),!(t<0||t>=this.view.length))return this.view.element(t)}update(){let e=this.getNodeAtHeight(0);if(!e||this.tree.scrollTop===0){this._widget.setState(void 0);return}let t=this.findStickyState(e);this._widget.setState(t)}findStickyState(e){let t=[],i=e,o=0,s=this.getNextStickyNode(i,void 0,o);for(;s&&(t.push(s),o+=s.height,!(t.length<=this.stickyScrollMaxItemCount&&(i=this.getNextVisibleNode(s),!i)));)s=this.getNextStickyNode(i,s.node,o);let r=this.constrainStickyNodes(t);return r.length?new MP(r):void 0}getNextVisibleNode(e){return this.getNodeAtHeight(e.position+e.height)}getNextStickyNode(e,t,i){let o=this.getAncestorUnderPrevious(e,t);if(o&&!(o===e&&(!this.nodeIsUncollapsedParent(e)||this.nodeTopAlignsWithStickyNodesBottom(e,i))))return this.createStickyScrollNode(o,i)}nodeTopAlignsWithStickyNodesBottom(e,t){let i=this.getNodeIndex(e),o=this.view.getElementTop(i),s=t;return this.view.scrollTop===o-s}createStickyScrollNode(e,t){let i=this.treeDelegate.getHeight(e),{startIndex:o,endIndex:s}=this.getNodeRange(e),r=this.calculateStickyNodePosition(s,t,i);return{node:e,position:r,height:i,startIndex:o,endIndex:s}}getAncestorUnderPrevious(e,t=void 0){let i=e,o=this.getParentNode(i);for(;o;){if(o===t)return i;i=o,o=this.getParentNode(i)}if(t===void 0)return i}calculateStickyNodePosition(e,t,i){let o=this.view.getRelativeTop(e);if(o===null&&this.view.firstVisibleIndex===e&&e+1l&&t<=l?l-i:t}constrainStickyNodes(e){if(e.length===0)return[];let t=this.view.renderHeight*this.maxWidgetViewRatio,i=e[e.length-1];if(e.length<=this.stickyScrollMaxItemCount&&i.position+i.height<=t)return e;let o=this.stickyScrollDelegate.constrainStickyScrollNodes(e,this.stickyScrollMaxItemCount,t);if(!o.length)return[];let s=o[o.length-1];if(o.length>this.stickyScrollMaxItemCount||s.position+s.height>t)throw new Error("stickyScrollDelegate violates constraints");return o}getParentNode(e){let t=this.model.getNodeLocation(e),i=this.model.getParentNodeLocation(t);return i?this.model.getNode(i):void 0}nodeIsUncollapsedParent(e){let t=this.model.getNodeLocation(e);return this.model.getListRenderCount(t)>1}getNodeIndex(e){let t=this.model.getNodeLocation(e);return this.model.getListIndex(t)}getNodeRange(e){let t=this.model.getNodeLocation(e),i=this.model.getListIndex(t);if(i<0)throw new Error("Node not found in tree");let o=this.model.getListRenderCount(t),s=i+o-1;return{startIndex:i,endIndex:s}}nodePositionTopBelowWidget(e){let t=[],i=this.getParentNode(e);for(;i;)t.push(i),i=this.getParentNode(i);let o=0;for(let s=0;s0,i=!!e&&e.count>0;if(!t&&!i||t&&i&&this._previousState.equal(e))return;if(t!==i&&this.setVisible(i),!i){this._previousState=void 0,this._previousElements=[],this._previousStateDisposables.clear();return}let o=e.stickyNodes[e.count-1];if(this._previousState&&e.animationStateChanged(this._previousState))this._previousElements[this._previousState.count-1].style.top=`${o.position}px`;else{this._previousStateDisposables.clear();let s=Array(e.count);for(let r=e.count-1;r>=0;r--){let a=e.stickyNodes[r],{element:l,disposable:c}=this.createElement(a,r,e.count);s[r]=l,this._rootDomNode.appendChild(l),this._previousStateDisposables.add(c)}this.stickyScrollFocus.updateElements(s,e),this._previousElements=s}this._previousState=e,this._rootDomNode.style.height=`${o.position+o.height}px`}createElement(e,t,i){let o=e.startIndex,s=document.createElement("div");s.style.top=`${e.position}px`,this.tree.options.setRowHeight!==!1&&(s.style.height=`${e.height}px`),this.tree.options.setRowLineHeight!==!1&&(s.style.lineHeight=`${e.height}px`),s.classList.add("monaco-tree-sticky-row"),s.classList.add("monaco-list-row"),s.setAttribute("data-index",`${o}`),s.setAttribute("data-parity",o%2===0?"even":"odd"),s.setAttribute("id",this.view.getElementID(o));let r=this.setAccessibilityAttributes(s,e.node.element,t,i),a=this.treeDelegate.getTemplateId(e.node),l=this.treeRenderers.find(u=>u.templateId===a);if(!l)throw new Error(`No renderer found for template id ${a}`);let c=e.node;c===this.tree.getNode(this.tree.getNodeLocation(e.node))&&(c=new Proxy(e.node,{}));let d=l.renderTemplate(s);l.renderElement(c,e.startIndex,d,e.height);let h=be(()=>{r.dispose(),l.disposeElement(c,e.startIndex,d,e.height),l.disposeTemplate(d),s.remove()});return{element:s,disposable:h}}setAccessibilityAttributes(e,t,i,o){var s;if(!this.accessibilityProvider)return H.None;this.accessibilityProvider.getSetSize&&e.setAttribute("aria-setsize",String(this.accessibilityProvider.getSetSize(t,i,o))),this.accessibilityProvider.getPosInSet&&e.setAttribute("aria-posinset",String(this.accessibilityProvider.getPosInSet(t,i))),this.accessibilityProvider.getRole&&e.setAttribute("role",(s=this.accessibilityProvider.getRole(t))!==null&&s!==void 0?s:"treeitem");let r=this.accessibilityProvider.getAriaLabel(t),a=r&&typeof r!="string"?r:Rh(r),l=pt(d=>{let h=d.readObservable(a);h?e.setAttribute("aria-label",h):e.removeAttribute("aria-label")});typeof r=="string"||r&&e.setAttribute("aria-label",r.get());let c=this.accessibilityProvider.getAriaLevel&&this.accessibilityProvider.getAriaLevel(t);return typeof c=="number"&&e.setAttribute("aria-level",`${c}`),e.setAttribute("aria-selected",String(!1)),l}setVisible(e){this._rootDomNode.classList.toggle("empty",!e),e||this.stickyScrollFocus.updateElements([],void 0)}domFocus(){this.stickyScrollFocus.domFocus()}focusedLast(){return this.stickyScrollFocus.focusedLast()}dispose(){this.stickyScrollFocus.dispose(),this._previousStateDisposables.dispose(),this._rootDomNode.remove()}},OP=class extends H{get domHasFocus(){return this._domHasFocus}set domHasFocus(e){e!==this._domHasFocus&&(this._onDidChangeHasFocus.fire(e),this._domHasFocus=e)}constructor(e,t){super(),this.container=e,this.view=t,this.focusedIndex=-1,this.elements=[],this._onDidChangeHasFocus=new B,this.onDidChangeHasFocus=this._onDidChangeHasFocus.event,this._onContextMenu=new B,this.onContextMenu=this._onContextMenu.event,this._domHasFocus=!1,this.container.addEventListener("focus",()=>this.onFocus()),this.container.addEventListener("blur",()=>this.onBlur()),this._register(this.view.onDidFocus(()=>this.toggleStickyScrollFocused(!1))),this._register(this.view.onKeyDown(i=>this.onKeyDown(i))),this._register(this.view.onMouseDown(i=>this.onMouseDown(i))),this._register(this.view.onContextMenu(i=>this.handleContextMenu(i)))}handleContextMenu(e){let t=e.browserEvent.target;if(!jp(t)&&!qp(t)){this.focusedLast()&&this.view.domFocus();return}if(!Ia(e.browserEvent)){if(!this.state)throw new Error("Context menu should not be triggered when state is undefined");let r=this.state.stickyNodes.findIndex(a=>{var l;return a.node.element===((l=e.element)===null||l===void 0?void 0:l.element)});if(r===-1)throw new Error("Context menu should not be triggered when element is not in sticky scroll widget");this.container.focus(),this.setFocus(r);return}if(!this.state||this.focusedIndex<0)throw new Error("Context menu key should not be triggered when focus is not in sticky scroll widget");let o=this.state.stickyNodes[this.focusedIndex].node.element,s=this.elements[this.focusedIndex];this._onContextMenu.fire({element:o,anchor:s,browserEvent:e.browserEvent,isStickyScroll:!0})}onKeyDown(e){if(this.domHasFocus&&this.state){if(e.key==="ArrowUp")this.setFocusedElement(Math.max(0,this.focusedIndex-1)),e.preventDefault(),e.stopPropagation();else if(e.key==="ArrowDown"||e.key==="ArrowRight"){if(this.focusedIndex>=this.state.count-1){let t=this.state.stickyNodes[this.state.count-1].startIndex+1;this.view.domFocus(),this.view.setFocus([t]),this.scrollNodeUnderWidget(t,this.state)}else this.setFocusedElement(this.focusedIndex+1);e.preventDefault(),e.stopPropagation()}}}onMouseDown(e){let t=e.browserEvent.target;!jp(t)&&!qp(t)||(e.browserEvent.preventDefault(),e.browserEvent.stopPropagation())}updateElements(e,t){if(t&&t.count===0)throw new Error("Sticky scroll state must be undefined when there are no sticky nodes");if(t&&t.count!==e.length)throw new Error("Sticky scroll focus received illigel state");let i=this.focusedIndex;if(this.removeFocus(),this.elements=e,this.state=t,t){let o=Bn(i,0,t.count-1);this.setFocus(o)}else this.domHasFocus&&this.view.domFocus();this.container.tabIndex=t?0:-1}setFocusedElement(e){let t=this.state;if(!t)throw new Error("Cannot set focus when state is undefined");if(this.setFocus(e),!(e1?t.stickyNodes[t.count-2]:void 0,s=this.view.getElementTop(e),r=o?o.position+o.height+i.height:i.height;this.view.scrollTop=s-r}domFocus(){if(!this.state)throw new Error("Cannot focus when state is undefined");this.container.focus()}focusedLast(){return this.state?this.view.getHTMLElement().classList.contains("sticky-scroll-focused"):!1}removeFocus(){this.focusedIndex!==-1&&(this.toggleElementFocus(this.elements[this.focusedIndex],!1),this.focusedIndex=-1)}setFocus(e){if(0>e)throw new Error("addFocus() can not remove focus");if(!this.state&&e>=0)throw new Error("Cannot set focus index when state is undefined");if(this.state&&e>=this.state.count)throw new Error("Cannot set focus index to an index that does not exist");let t=this.focusedIndex;t>=0&&this.toggleElementFocus(this.elements[t],!1),e>=0&&this.toggleElementFocus(this.elements[e],!0),this.focusedIndex=e}toggleElementFocus(e,t){this.toggleElementActiveFocus(e,t&&this.domHasFocus),this.toggleElementPassiveFocus(e,t)}toggleCurrentElementActiveFocus(e){this.focusedIndex!==-1&&this.toggleElementActiveFocus(this.elements[this.focusedIndex],e)}toggleElementActiveFocus(e,t){e.classList.toggle("focused",t)}toggleElementPassiveFocus(e,t){e.classList.toggle("passive-focused",t)}toggleStickyScrollFocused(e){this.view.getHTMLElement().classList.toggle("sticky-scroll-focused",e)}onFocus(){if(!this.state||this.elements.length===0)throw new Error("Cannot focus when state is undefined or elements are empty");this.domHasFocus=!0,this.toggleStickyScrollFocused(!0),this.toggleCurrentElementActiveFocus(!0),this.focusedIndex===-1&&this.setFocus(0)}onBlur(){this.domHasFocus=!1,this.toggleCurrentElementActiveFocus(!1)}dispose(){this.toggleStickyScrollFocused(!1),this._onDidChangeHasFocus.fire(!1),super.dispose()}};function DE(n){let e=zh.Unknown;return $w(n.browserEvent.target,"monaco-tl-twistie","monaco-tl-row")?e=zh.Twistie:$w(n.browserEvent.target,"monaco-tl-contents","monaco-tl-row")?e=zh.Element:$w(n.browserEvent.target,"monaco-tree-type-filter","monaco-list")&&(e=zh.Filter),{browserEvent:n.browserEvent,element:n.element?n.element.element:null,target:e}}function LQ(n){let e=jp(n.browserEvent.target);return{element:n.element?n.element.element:null,browserEvent:n.browserEvent,anchor:n.anchor,isStickyScroll:e}}function EE(n,e){e(n),n.children.forEach(t=>EE(t,e))}var a1=class{get nodeSet(){return this._nodeSet||(this._nodeSet=this.createNodeSet()),this._nodeSet}constructor(e,t){this.getFirstViewElementWithTrait=e,this.identityProvider=t,this.nodes=[],this._onDidChange=new B,this.onDidChange=this._onDidChange.event}set(e,t){!t?.__forceEvent&&Ht(this.nodes,e)||this._set(e,!1,t)}_set(e,t,i){if(this.nodes=[...e],this.elements=void 0,this._nodeSet=void 0,!t){let o=this;this._onDidChange.fire({get elements(){return o.get()},browserEvent:i})}}get(){return this.elements||(this.elements=this.nodes.map(e=>e.element)),[...this.elements]}getNodes(){return this.nodes}has(e){return this.nodeSet.has(e)}onDidModelSplice({insertedNodes:e,deletedNodes:t}){if(!this.identityProvider){let l=this.createNodeSet(),c=d=>l.delete(d);t.forEach(d=>EE(d,c)),this.set([...l.values()]);return}let i=new Set,o=l=>i.add(this.identityProvider.getId(l.element).toString());t.forEach(l=>EE(l,o));let s=new Map,r=l=>s.set(this.identityProvider.getId(l.element).toString(),l);e.forEach(l=>EE(l,r));let a=[];for(let l of this.nodes){let c=this.identityProvider.getId(l.element).toString();if(!i.has(c))a.push(l);else{let h=s.get(c);h&&h.visible&&a.push(h)}}if(this.nodes.length>0&&a.length===0){let l=this.getFirstViewElementWithTrait();l&&a.push(l)}this._set(a,!0)}createNodeSet(){let e=new Set;for(let t of this.nodes)e.add(t);return e}},FP=class extends qv{constructor(e,t,i){super(e),this.tree=t,this.stickyScrollProvider=i}onViewPointer(e){if(Y5(e.browserEvent.target)||id(e.browserEvent.target)||Up(e.browserEvent.target)||e.browserEvent.isHandledByList)return;let t=e.element;if(!t)return super.onViewPointer(e);if(this.isSelectionRangeChangeEvent(e)||this.isSelectionSingleChangeEvent(e))return super.onViewPointer(e);let i=e.browserEvent.target,o=i.classList.contains("monaco-tl-twistie")||i.classList.contains("monaco-icon-label")&&i.classList.contains("folder-icon")&&e.browserEvent.offsetX<16,s=qp(e.browserEvent.target),r=!1;if(s?r=!0:typeof this.tree.expandOnlyOnTwistieClick=="function"?r=this.tree.expandOnlyOnTwistieClick(t.element):r=!!this.tree.expandOnlyOnTwistieClick,s)this.handleStickyScrollMouseEvent(e,t);else{if(r&&!o&&e.browserEvent.detail!==2)return super.onViewPointer(e);if(!this.tree.expandOnDoubleClick&&e.browserEvent.detail===2)return super.onViewPointer(e)}if(t.collapsible&&(!s||o)){let a=this.tree.getNodeLocation(t),l=e.browserEvent.altKey;if(this.tree.setFocus([a]),this.tree.toggleCollapsed(a,l),o){e.browserEvent.isHandledByList=!0;return}}s||super.onViewPointer(e)}handleStickyScrollMouseEvent(e,t){if(EH(e.browserEvent.target)||IH(e.browserEvent.target))return;let i=this.stickyScrollProvider();if(!i)throw new Error("Sticky scroll controller not found");let o=this.list.indexOf(t),s=this.list.getElementTop(o),r=i.nodePositionTopBelowWidget(t);this.tree.scrollTop=s-r,this.list.domFocus(),this.list.setFocus([o]),this.list.setSelection([o])}onDoubleClick(e){e.browserEvent.target.classList.contains("monaco-tl-twistie")||!this.tree.expandOnDoubleClick||e.browserEvent.isHandledByList||super.onDoubleClick(e)}onMouseDown(e){let t=e.browserEvent.target;if(!jp(t)&&!qp(t)){super.onMouseDown(e);return}}onContextMenu(e){let t=e.browserEvent.target;if(!jp(t)&&!qp(t)){super.onContextMenu(e);return}}},BP=class extends Do{constructor(e,t,i,o,s,r,a,l){super(e,t,i,o,l),this.focusTrait=s,this.selectionTrait=r,this.anchorTrait=a}createMouseController(e){return new FP(this,e.tree,e.stickyScrollProvider)}splice(e,t,i=[]){if(super.splice(e,t,i),i.length===0)return;let o=[],s=[],r;i.forEach((a,l)=>{this.focusTrait.has(a)&&o.push(e+l),this.selectionTrait.has(a)&&s.push(e+l),this.anchorTrait.has(a)&&(r=e+l)}),o.length>0&&super.setFocus(xr([...super.getFocus(),...o])),s.length>0&&super.setSelection(xr([...super.getSelection(),...s])),typeof r=="number"&&super.setAnchor(r)}setFocus(e,t,i=!1){super.setFocus(e,t),i||this.focusTrait.set(e.map(o=>this.element(o)),t)}setSelection(e,t,i=!1){super.setSelection(e,t),i||this.selectionTrait.set(e.map(o=>this.element(o)),t)}setAnchor(e,t=!1){super.setAnchor(e),t||(typeof e>"u"?this.anchorTrait.set([]):this.anchorTrait.set([this.element(e)]))}},i_=class{get onDidScroll(){return this.view.onDidScroll}get onDidChangeFocus(){return this.eventBufferer.wrapEvent(this.focus.onDidChange)}get onDidChangeSelection(){return this.eventBufferer.wrapEvent(this.selection.onDidChange)}get onMouseDblClick(){return ie.filter(ie.map(this.view.onMouseDblClick,DE),e=>e.target!==zh.Filter)}get onMouseOver(){return ie.map(this.view.onMouseOver,DE)}get onMouseOut(){return ie.map(this.view.onMouseOut,DE)}get onContextMenu(){var e,t;return ie.any(ie.filter(ie.map(this.view.onContextMenu,LQ),i=>!i.isStickyScroll),(t=(e=this.stickyScrollController)===null||e===void 0?void 0:e.onContextMenu)!==null&&t!==void 0?t:ie.None)}get onPointer(){return ie.map(this.view.onPointer,DE)}get onKeyDown(){return this.view.onKeyDown}get onDidFocus(){return this.view.onDidFocus}get onDidChangeModel(){return ie.signal(this.model.onDidSplice)}get onDidChangeCollapseState(){return this.model.onDidChangeCollapseState}get findMode(){var e,t;return(t=(e=this.findController)===null||e===void 0?void 0:e.mode)!==null&&t!==void 0?t:ac.Highlight}set findMode(e){this.findController&&(this.findController.mode=e)}get findMatchType(){var e,t;return(t=(e=this.findController)===null||e===void 0?void 0:e.matchType)!==null&&t!==void 0?t:Vh.Fuzzy}set findMatchType(e){this.findController&&(this.findController.matchType=e)}get expandOnDoubleClick(){return typeof this._options.expandOnDoubleClick>"u"?!0:this._options.expandOnDoubleClick}get expandOnlyOnTwistieClick(){return typeof this._options.expandOnlyOnTwistieClick>"u"?!0:this._options.expandOnlyOnTwistieClick}get onDidDispose(){return this.view.onDidDispose}constructor(e,t,i,o,s={}){var r;this._user=e,this._options=s,this.eventBufferer=new kd,this.onDidChangeFindOpenState=ie.None,this.onDidChangeStickyScrollFocused=ie.None,this.disposables=new ae,this._onWillRefilter=new B,this.onWillRefilter=this._onWillRefilter.event,this._onDidUpdateOptions=new B,this.treeDelegate=new t_(i);let a=new B_,l=new B_,c=this.disposables.add(new TP(l.event)),d=new Jg;this.renderers=o.map(m=>new IE(m,()=>this.model,a.event,c,d,s));for(let m of this.renderers)this.disposables.add(m);let h;s.keyboardNavigationLabelProvider&&(h=new NP(this,s.keyboardNavigationLabelProvider,s.filter),s={...s,filter:h},this.disposables.add(h)),this.focus=new a1(()=>this.view.getFocusedElements()[0],s.identityProvider),this.selection=new a1(()=>this.view.getSelectedElements()[0],s.identityProvider),this.anchor=new a1(()=>this.view.getAnchorElement(),s.identityProvider),this.view=new BP(e,t,this.treeDelegate,this.renderers,this.focus,this.selection,this.anchor,{...SQ(()=>this.model,s),tree:this,stickyScrollProvider:()=>this.stickyScrollController}),this.model=this.createModel(e,this.view,s),a.input=this.model.onDidChangeCollapseState;let u=ie.forEach(this.model.onDidSplice,m=>{this.eventBufferer.bufferEvents(()=>{this.focus.onDidModelSplice(m),this.selection.onDidModelSplice(m)})},this.disposables);u(()=>null,null,this.disposables);let f=this.disposables.add(new B),g=this.disposables.add(new ka(0));if(this.disposables.add(ie.any(u,this.focus.onDidChange,this.selection.onDidChange)(()=>{g.trigger(()=>{let m=new Set;for(let C of this.focus.getNodes())m.add(C);for(let C of this.selection.getNodes())m.add(C);f.fire([...m.values()])})})),l.input=f.event,s.keyboardSupport!==!1){let m=ie.chain(this.view.onKeyDown,C=>C.filter(S=>!id(S.target)).map(S=>new bt(S)));ie.chain(m,C=>C.filter(S=>S.keyCode===15))(this.onLeftArrow,this,this.disposables),ie.chain(m,C=>C.filter(S=>S.keyCode===17))(this.onRightArrow,this,this.disposables),ie.chain(m,C=>C.filter(S=>S.keyCode===10))(this.onSpace,this,this.disposables)}if((!((r=s.findWidgetEnabled)!==null&&r!==void 0)||r)&&s.keyboardNavigationLabelProvider&&s.contextViewProvider){let m=this.options.findWidgetStyles?{styles:this.options.findWidgetStyles}:void 0;this.findController=new AP(this,this.model,this.view,h,s.contextViewProvider,m),this.focusNavigationFilter=C=>this.findController.shouldAllowFocus(C),this.onDidChangeFindOpenState=this.findController.onDidChangeOpenState,this.disposables.add(this.findController),this.onDidChangeFindMode=this.findController.onDidChangeMode,this.onDidChangeFindMatchType=this.findController.onDidChangeMatchType}else this.onDidChangeFindMode=ie.None,this.onDidChangeFindMatchType=ie.None;s.enableStickyScroll&&(this.stickyScrollController=new TE(this,this.model,this.view,this.renderers,this.treeDelegate,s),this.onDidChangeStickyScrollFocused=this.stickyScrollController.onDidChangeHasFocus),this.styleElement=Xi(this.view.getHTMLElement()),this.getHTMLElement().classList.toggle("always",this._options.renderIndentGuides===Gf.Always)}updateOptions(e={}){var t;this._options={...this._options,...e};for(let i of this.renderers)i.updateOptions(e);this.view.updateOptions(this._options),(t=this.findController)===null||t===void 0||t.updateOptions(e),this.updateStickyScroll(e),this._onDidUpdateOptions.fire(this._options),this.getHTMLElement().classList.toggle("always",this._options.renderIndentGuides===Gf.Always)}get options(){return this._options}updateStickyScroll(e){var t;!this.stickyScrollController&&this._options.enableStickyScroll?(this.stickyScrollController=new TE(this,this.model,this.view,this.renderers,this.treeDelegate,this._options),this.onDidChangeStickyScrollFocused=this.stickyScrollController.onDidChangeHasFocus):this.stickyScrollController&&!this._options.enableStickyScroll&&(this.onDidChangeStickyScrollFocused=ie.None,this.stickyScrollController.dispose(),this.stickyScrollController=void 0),(t=this.stickyScrollController)===null||t===void 0||t.updateOptions(e)}getHTMLElement(){return this.view.getHTMLElement()}get scrollTop(){return this.view.scrollTop}set scrollTop(e){this.view.scrollTop=e}get scrollHeight(){return this.view.scrollHeight}get renderHeight(){return this.view.renderHeight}get ariaLabel(){return this.view.ariaLabel}set ariaLabel(e){this.view.ariaLabel=e}domFocus(){var e;!((e=this.stickyScrollController)===null||e===void 0)&&e.focusedLast()?this.stickyScrollController.domFocus():this.view.domFocus()}layout(e,t){var i;this.view.layout(e,t),pa(t)&&((i=this.findController)===null||i===void 0||i.layout(t))}style(e){var t,i;let o=`.${this.view.domId}`,s=[];e.treeIndentGuidesStroke&&(s.push(`.monaco-list${o}:hover .monaco-tl-indent > .indent-guide, .monaco-list${o}.always .monaco-tl-indent > .indent-guide { border-color: ${e.treeInactiveIndentGuidesStroke}; }`),s.push(`.monaco-list${o} .monaco-tl-indent > .indent-guide.active { border-color: ${e.treeIndentGuidesStroke}; }`));let r=(t=e.treeStickyScrollBackground)!==null&&t!==void 0?t:e.listBackground;r&&(s.push(`.monaco-list${o} .monaco-scrollable-element .monaco-tree-sticky-container { background-color: ${r}; }`),s.push(`.monaco-list${o} .monaco-scrollable-element .monaco-tree-sticky-container .monaco-tree-sticky-row { background-color: ${r}; }`)),e.treeStickyScrollBorder&&s.push(`.monaco-list${o} .monaco-scrollable-element .monaco-tree-sticky-container { border-bottom: 1px solid ${e.treeStickyScrollBorder}; }`),e.treeStickyScrollShadow&&s.push(`.monaco-list${o} .monaco-scrollable-element .monaco-tree-sticky-container .monaco-tree-sticky-container-shadow { box-shadow: ${e.treeStickyScrollShadow} 0 6px 6px -6px inset; height: 3px; }`),e.listFocusForeground&&(s.push(`.monaco-list${o}.sticky-scroll-focused .monaco-scrollable-element .monaco-tree-sticky-container:focus .monaco-list-row.focused { color: ${e.listFocusForeground}; }`),s.push(`.monaco-list${o}:not(.sticky-scroll-focused) .monaco-scrollable-element .monaco-tree-sticky-container .monaco-list-row.focused { color: inherit; }`));let a=tr(e.listFocusAndSelectionOutline,tr(e.listSelectionOutline,(i=e.listFocusOutline)!==null&&i!==void 0?i:""));a&&(s.push(`.monaco-list${o}.sticky-scroll-focused .monaco-scrollable-element .monaco-tree-sticky-container:focus .monaco-list-row.focused.selected { outline: 1px solid ${a}; outline-offset: -1px;}`),s.push(`.monaco-list${o}:not(.sticky-scroll-focused) .monaco-scrollable-element .monaco-tree-sticky-container .monaco-list-row.focused.selected { outline: inherit;}`)),e.listFocusOutline&&(s.push(`.monaco-list${o}.sticky-scroll-focused .monaco-scrollable-element .monaco-tree-sticky-container:focus .monaco-list-row.focused { outline: 1px solid ${e.listFocusOutline}; outline-offset: -1px; }`),s.push(`.monaco-list${o}:not(.sticky-scroll-focused) .monaco-scrollable-element .monaco-tree-sticky-container .monaco-list-row.focused { outline: inherit; }`),s.push(`.monaco-workbench.context-menu-visible .monaco-list${o}.last-focused.sticky-scroll-focused .monaco-scrollable-element .monaco-tree-sticky-container .monaco-list-row.passive-focused { outline: 1px solid ${e.listFocusOutline}; outline-offset: -1px; }`),s.push(`.monaco-workbench.context-menu-visible .monaco-list${o}.last-focused.sticky-scroll-focused .monaco-list-rows .monaco-list-row.focused { outline: inherit; }`),s.push(`.monaco-workbench.context-menu-visible .monaco-list${o}.last-focused:not(.sticky-scroll-focused) .monaco-tree-sticky-container .monaco-list-rows .monaco-list-row.focused { outline: inherit; }`)),this.styleElement.textContent=s.join(` +`),this.view.style(e)}getParentElement(e){let t=this.model.getParentNodeLocation(e);return this.model.getNode(t).element}getFirstElementChild(e){return this.model.getFirstElementChild(e)}getNode(e){return this.model.getNode(e)}getNodeLocation(e){return this.model.getNodeLocation(e)}collapse(e,t=!1){return this.model.setCollapsed(e,!0,t)}expand(e,t=!1){return this.model.setCollapsed(e,!1,t)}toggleCollapsed(e,t=!1){return this.model.setCollapsed(e,void 0,t)}isCollapsible(e){return this.model.isCollapsible(e)}setCollapsible(e,t){return this.model.setCollapsible(e,t)}isCollapsed(e){return this.model.isCollapsed(e)}refilter(){this._onWillRefilter.fire(void 0),this.model.refilter()}setSelection(e,t){this.eventBufferer.bufferEvents(()=>{let i=e.map(s=>this.model.getNode(s));this.selection.set(i,t);let o=e.map(s=>this.model.getListIndex(s)).filter(s=>s>-1);this.view.setSelection(o,t,!0)})}getSelection(){return this.selection.get()}setFocus(e,t){this.eventBufferer.bufferEvents(()=>{let i=e.map(s=>this.model.getNode(s));this.focus.set(i,t);let o=e.map(s=>this.model.getListIndex(s)).filter(s=>s>-1);this.view.setFocus(o,t,!0)})}focusNext(e=1,t=!1,i,o=Ia(i)&&i.altKey?void 0:this.focusNavigationFilter){this.view.focusNext(e,t,i,o)}focusPrevious(e=1,t=!1,i,o=Ia(i)&&i.altKey?void 0:this.focusNavigationFilter){this.view.focusPrevious(e,t,i,o)}focusNextPage(e,t=Ia(e)&&e.altKey?void 0:this.focusNavigationFilter){return this.view.focusNextPage(e,t)}focusPreviousPage(e,t=Ia(e)&&e.altKey?void 0:this.focusNavigationFilter){return this.view.focusPreviousPage(e,t,()=>{var i,o;return(o=(i=this.stickyScrollController)===null||i===void 0?void 0:i.height)!==null&&o!==void 0?o:0})}focusFirst(e,t=Ia(e)&&e.altKey?void 0:this.focusNavigationFilter){this.view.focusFirst(e,t)}getFocus(){return this.focus.get()}reveal(e,t){this.model.expandTo(e);let i=this.model.getListIndex(e);if(i!==-1)if(!this.stickyScrollController)this.view.reveal(i,t);else{let o=this.stickyScrollController.nodePositionTopBelowWidget(this.getNode(e));this.view.reveal(i,t,o)}}onLeftArrow(e){e.preventDefault(),e.stopPropagation();let t=this.view.getFocusedElements();if(t.length===0)return;let i=t[0],o=this.model.getNodeLocation(i);if(!this.model.setCollapsed(o,!0)){let r=this.model.getParentNodeLocation(o);if(!r)return;let a=this.model.getListIndex(r);this.view.reveal(a),this.view.setFocus([a])}}onRightArrow(e){e.preventDefault(),e.stopPropagation();let t=this.view.getFocusedElements();if(t.length===0)return;let i=t[0],o=this.model.getNodeLocation(i);if(!this.model.setCollapsed(o,!1)){if(!i.children.some(l=>l.visible))return;let[r]=this.view.getFocus(),a=r+1;this.view.reveal(a),this.view.setFocus([a])}}onSpace(e){e.preventDefault(),e.stopPropagation();let t=this.view.getFocusedElements();if(t.length===0)return;let i=t[0],o=this.model.getNodeLocation(i),s=e.browserEvent.altKey;this.model.setCollapsed(o,void 0,s)}dispose(){var e;li(this.disposables),(e=this.stickyScrollController)===null||e===void 0||e.dispose(),this.view.dispose()}};_();v();b();_();v();b();_();v();b();_();v();b();js();var Hh=class{constructor(e,t,i={}){this.user=e,this.rootRef=null,this.nodes=new Map,this.nodesByIdentity=new Map,this.model=new kE(e,t,null,i),this.onDidSplice=this.model.onDidSplice,this.onDidChangeCollapseState=this.model.onDidChangeCollapseState,this.onDidChangeRenderNodeCount=this.model.onDidChangeRenderNodeCount,i.sorter&&(this.sorter={compare(o,s){return i.sorter.compare(o.element,s.element)}}),this.identityProvider=i.identityProvider}setChildren(e,t=ht.empty(),i={}){let o=this.getElementLocation(e);this._setChildren(o,this.preserveCollapseState(t),i)}_setChildren(e,t=ht.empty(),i){let o=new Set,s=new Set,r=l=>{var c;if(l.element===null)return;let d=l;if(o.add(d.element),this.nodes.set(d.element,d),this.identityProvider){let h=this.identityProvider.getId(d.element).toString();s.add(h),this.nodesByIdentity.set(h,d)}(c=i.onDidCreateNode)===null||c===void 0||c.call(i,d)},a=l=>{var c;if(l.element===null)return;let d=l;if(o.has(d.element)||this.nodes.delete(d.element),this.identityProvider){let h=this.identityProvider.getId(d.element).toString();s.has(h)||this.nodesByIdentity.delete(h)}(c=i.onDidDeleteNode)===null||c===void 0||c.call(i,d)};this.model.splice([...e,0],Number.MAX_VALUE,t,{...i,onDidCreateNode:r,onDidDeleteNode:a})}preserveCollapseState(e=ht.empty()){return this.sorter&&(e=[...e].sort(this.sorter.compare.bind(this.sorter))),ht.map(e,t=>{let i=this.nodes.get(t.element);if(!i&&this.identityProvider){let r=this.identityProvider.getId(t.element).toString();i=this.nodesByIdentity.get(r)}if(!i){let r;return typeof t.collapsed>"u"?r=void 0:t.collapsed===as.Collapsed||t.collapsed===as.PreserveOrCollapsed?r=!0:t.collapsed===as.Expanded||t.collapsed===as.PreserveOrExpanded?r=!1:r=!!t.collapsed,{...t,children:this.preserveCollapseState(t.children),collapsed:r}}let o=typeof t.collapsible=="boolean"?t.collapsible:i.collapsible,s;return typeof t.collapsed>"u"||t.collapsed===as.PreserveOrCollapsed||t.collapsed===as.PreserveOrExpanded?s=i.collapsed:t.collapsed===as.Collapsed?s=!0:t.collapsed===as.Expanded?s=!1:s=!!t.collapsed,{...t,collapsible:o,collapsed:s,children:this.preserveCollapseState(t.children)}})}rerender(e){let t=this.getElementLocation(e);this.model.rerender(t)}getFirstElementChild(e=null){let t=this.getElementLocation(e);return this.model.getFirstElementChild(t)}has(e){return this.nodes.has(e)}getListIndex(e){let t=this.getElementLocation(e);return this.model.getListIndex(t)}getListRenderCount(e){let t=this.getElementLocation(e);return this.model.getListRenderCount(t)}isCollapsible(e){let t=this.getElementLocation(e);return this.model.isCollapsible(t)}setCollapsible(e,t){let i=this.getElementLocation(e);return this.model.setCollapsible(i,t)}isCollapsed(e){let t=this.getElementLocation(e);return this.model.isCollapsed(t)}setCollapsed(e,t,i){let o=this.getElementLocation(e);return this.model.setCollapsed(o,t,i)}expandTo(e){let t=this.getElementLocation(e);this.model.expandTo(t)}refilter(){this.model.refilter()}getNode(e=null){if(e===null)return this.model.getNode(this.model.rootRef);let t=this.nodes.get(e);if(!t)throw new eo(this.user,`Tree element not found: ${e}`);return t}getNodeLocation(e){return e.element}getParentNodeLocation(e){if(e===null)throw new eo(this.user,"Invalid getParentNodeLocation call");let t=this.nodes.get(e);if(!t)throw new eo(this.user,`Tree element not found: ${e}`);let i=this.model.getNodeLocation(t),o=this.model.getParentNodeLocation(i);return this.model.getNode(o).element}getElementLocation(e){if(e===null)return[];let t=this.nodes.get(e);if(!t)throw new eo(this.user,`Tree element not found: ${e}`);return this.model.getNodeLocation(t)}};wt();ye();js();function NE(n){let e=[n.element],t=n.incompressible||!1;return{element:{elements:e,incompressible:t},children:ht.map(ht.from(n.children),NE),collapsible:n.collapsible,collapsed:n.collapsed}}function AE(n){let e=[n.element],t=n.incompressible||!1,i,o;for(;[o,i]=ht.consume(ht.from(n.children),2),!(o.length!==1||o[0].incompressible);)n=o[0],e.push(n.element);return{element:{elements:e,incompressible:t},children:ht.map(ht.concat(o,i),AE),collapsible:n.collapsible,collapsed:n.collapsed}}function WP(n,e=0){let t;return eWP(i,0)),e===0&&n.element.incompressible?{element:n.element.elements[e],children:t,incompressible:!0,collapsible:n.collapsible,collapsed:n.collapsed}:{element:n.element.elements[e],children:t,collapsible:n.collapsible,collapsed:n.collapsed}}function oU(n){return WP(n,0)}function sU(n,e,t){return n.element===e?{...n,children:t}:{...n,children:ht.map(ht.from(n.children),i=>sU(i,e,t))}}var kQ=n=>({getId(e){return e.elements.map(t=>n.getId(t).toString()).join("\0")}}),zP=class{get onDidSplice(){return this.model.onDidSplice}get onDidChangeCollapseState(){return this.model.onDidChangeCollapseState}get onDidChangeRenderNodeCount(){return this.model.onDidChangeRenderNodeCount}constructor(e,t,i={}){this.user=e,this.rootRef=null,this.nodes=new Map,this.model=new Hh(e,t,i),this.enabled=typeof i.compressionEnabled>"u"?!0:i.compressionEnabled,this.identityProvider=i.identityProvider}setChildren(e,t=ht.empty(),i){let o=i.diffIdentityProvider&&kQ(i.diffIdentityProvider);if(e===null){let g=ht.map(t,this.enabled?AE:NE);this._setChildren(null,g,{diffIdentityProvider:o,diffDepth:1/0});return}let s=this.nodes.get(e);if(!s)throw new eo(this.user,"Unknown compressed tree node");let r=this.model.getNode(s),a=this.model.getParentNodeLocation(s),l=this.model.getNode(a),c=oU(r),d=sU(c,e,t),h=(this.enabled?AE:NE)(d),u=i.diffIdentityProvider?(g,m)=>i.diffIdentityProvider.getId(g)===i.diffIdentityProvider.getId(m):void 0;if(Ht(h.element.elements,r.element.elements,u)){this._setChildren(s,h.children||ht.empty(),{diffIdentityProvider:o,diffDepth:1});return}let f=l.children.map(g=>g===r?h:g);this._setChildren(l.element,f,{diffIdentityProvider:o,diffDepth:r.depth-l.depth})}isCompressionEnabled(){return this.enabled}setCompressionEnabled(e){if(e===this.enabled)return;this.enabled=e;let i=this.model.getNode().children,o=ht.map(i,oU),s=ht.map(o,e?AE:NE);this._setChildren(null,s,{diffIdentityProvider:this.identityProvider,diffDepth:1/0})}_setChildren(e,t,i){let o=new Set,s=a=>{for(let l of a.element.elements)o.add(l),this.nodes.set(l,a.element)},r=a=>{for(let l of a.element.elements)o.has(l)||this.nodes.delete(l)};this.model.setChildren(e,t,{...i,onDidCreateNode:s,onDidDeleteNode:r})}has(e){return this.nodes.has(e)}getListIndex(e){let t=this.getCompressedNode(e);return this.model.getListIndex(t)}getListRenderCount(e){let t=this.getCompressedNode(e);return this.model.getListRenderCount(t)}getNode(e){if(typeof e>"u")return this.model.getNode();let t=this.getCompressedNode(e);return this.model.getNode(t)}getNodeLocation(e){let t=this.model.getNodeLocation(e);return t===null?null:t.elements[t.elements.length-1]}getParentNodeLocation(e){let t=this.getCompressedNode(e),i=this.model.getParentNodeLocation(t);return i===null?null:i.elements[i.elements.length-1]}getFirstElementChild(e){let t=this.getCompressedNode(e);return this.model.getFirstElementChild(t)}isCollapsible(e){let t=this.getCompressedNode(e);return this.model.isCollapsible(t)}setCollapsible(e,t){let i=this.getCompressedNode(e);return this.model.setCollapsible(i,t)}isCollapsed(e){let t=this.getCompressedNode(e);return this.model.isCollapsed(t)}setCollapsed(e,t,i){let o=this.getCompressedNode(e);return this.model.setCollapsed(o,t,i)}expandTo(e){let t=this.getCompressedNode(e);this.model.expandTo(t)}rerender(e){let t=this.getCompressedNode(e);this.model.rerender(t)}refilter(){this.model.refilter()}getCompressedNode(e){if(e===null)return null;let t=this.nodes.get(e);if(!t)throw new eo(this.user,`Tree element not found: ${e}`);return t}},DQ=n=>n[n.length-1],VP=class n{get element(){return this.node.element===null?null:this.unwrapper(this.node.element)}get children(){return this.node.children.map(e=>new n(this.unwrapper,e))}get depth(){return this.node.depth}get visibleChildrenCount(){return this.node.visibleChildrenCount}get visibleChildIndex(){return this.node.visibleChildIndex}get collapsible(){return this.node.collapsible}get collapsed(){return this.node.collapsed}get visible(){return this.node.visible}get filterData(){return this.node.filterData}constructor(e,t){this.unwrapper=e,this.node=t}};function EQ(n,e){return{splice(t,i,o){e.splice(t,i,o.map(s=>n.map(s)))},updateElementHeight(t,i){e.updateElementHeight(t,i)}}}function IQ(n,e){return{...e,identityProvider:e.identityProvider&&{getId(t){return e.identityProvider.getId(n(t))}},sorter:e.sorter&&{compare(t,i){return e.sorter.compare(t.elements[0],i.elements[0])}},filter:e.filter&&{filter(t,i){return e.filter.filter(n(t),i)}}}}var ME=class{get onDidSplice(){return ie.map(this.model.onDidSplice,({insertedNodes:e,deletedNodes:t})=>({insertedNodes:e.map(i=>this.nodeMapper.map(i)),deletedNodes:t.map(i=>this.nodeMapper.map(i))}))}get onDidChangeCollapseState(){return ie.map(this.model.onDidChangeCollapseState,({node:e,deep:t})=>({node:this.nodeMapper.map(e),deep:t}))}get onDidChangeRenderNodeCount(){return ie.map(this.model.onDidChangeRenderNodeCount,e=>this.nodeMapper.map(e))}constructor(e,t,i={}){this.rootRef=null,this.elementMapper=i.elementMapper||DQ;let o=s=>this.elementMapper(s.elements);this.nodeMapper=new qf(s=>new VP(o,s)),this.model=new zP(e,EQ(this.nodeMapper,t),IQ(o,i))}setChildren(e,t=ht.empty(),i={}){this.model.setChildren(e,t,i)}isCompressionEnabled(){return this.model.isCompressionEnabled()}setCompressionEnabled(e){this.model.setCompressionEnabled(e)}has(e){return this.model.has(e)}getListIndex(e){return this.model.getListIndex(e)}getListRenderCount(e){return this.model.getListRenderCount(e)}getNode(e){return this.nodeMapper.map(this.model.getNode(e))}getNodeLocation(e){return e.element}getParentNodeLocation(e){return this.model.getParentNodeLocation(e)}getFirstElementChild(e){let t=this.model.getFirstElementChild(e);return t===null||typeof t>"u"?t:this.elementMapper(t.elements)}isCollapsible(e){return this.model.isCollapsible(e)}setCollapsible(e,t){return this.model.setCollapsible(e,t)}isCollapsed(e){return this.model.isCollapsed(e)}setCollapsed(e,t,i){return this.model.setCollapsed(e,t,i)}expandTo(e){return this.model.expandTo(e)}rerender(e){return this.model.rerender(e)}refilter(){return this.model.refilter()}getCompressedTreeNode(e=null){return this.model.getNode(e)}};js();var TQ=function(n,e,t,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},Zf=class extends i_{get onDidChangeCollapseState(){return this.model.onDidChangeCollapseState}constructor(e,t,i,o,s={}){super(e,t,i,o,s),this.user=e}setChildren(e,t=ht.empty(),i){this.model.setChildren(e,t,i)}rerender(e){if(e===void 0){this.view.rerender();return}this.model.rerender(e)}hasElement(e){return this.model.has(e)}createModel(e,t,i){return new Hh(e,t,i)}},RE=class{get compressedTreeNodeProvider(){return this._compressedTreeNodeProvider()}constructor(e,t,i){this._compressedTreeNodeProvider=e,this.stickyScrollDelegate=t,this.renderer=i,this.templateId=i.templateId,i.onDidChangeTwistieState&&(this.onDidChangeTwistieState=i.onDidChangeTwistieState)}renderTemplate(e){return{compressedTreeNode:void 0,data:this.renderer.renderTemplate(e)}}renderElement(e,t,i,o){let s=this.stickyScrollDelegate.getCompressedNode(e);s||(s=this.compressedTreeNodeProvider.getCompressedTreeNode(e.element)),s.element.elements.length===1?(i.compressedTreeNode=void 0,this.renderer.renderElement(e,t,i.data,o)):(i.compressedTreeNode=s,this.renderer.renderCompressedElements(s,t,i.data,o))}disposeElement(e,t,i,o){var s,r,a,l;i.compressedTreeNode?(r=(s=this.renderer).disposeCompressedElements)===null||r===void 0||r.call(s,i.compressedTreeNode,t,i.data,o):(l=(a=this.renderer).disposeElement)===null||l===void 0||l.call(a,e,t,i.data,o)}disposeTemplate(e){this.renderer.disposeTemplate(e.data)}renderTwistie(e,t){return this.renderer.renderTwistie?this.renderer.renderTwistie(e,t):!1}};TQ([Yt],RE.prototype,"compressedTreeNodeProvider",null);var HP=class{constructor(e){this.modelProvider=e,this.compressedStickyNodes=new Map}getCompressedNode(e){return this.compressedStickyNodes.get(e)}constrainStickyScrollNodes(e,t,i){if(this.compressedStickyNodes.clear(),e.length===0)return[];for(let o=0;oi||o>=t-1&&tthis,a=new HP(()=>this.model),l=o.map(c=>new RE(r,a,c));super(e,t,i,l,{...NQ(r,s),stickyScrollDelegate:a})}setChildren(e,t=ht.empty(),i){this.model.setChildren(e,t,i)}createModel(e,t,i){return new ME(e,t,i)}updateOptions(e={}){super.updateOptions(e),typeof e.compressionEnabled<"u"&&this.model.setCompressionEnabled(e.compressionEnabled)}getCompressedTreeNode(e=null){return this.model.getCompressedTreeNode(e)}};Gt();$n();Ln();xt();ye();js();le();xi();function UP(n){return{...n,children:[],refreshPromise:void 0,stale:!0,slow:!1,forceExpanded:!1}}function $P(n,e){return e.parent?e.parent===n?!0:$P(n,e.parent):!1}function AQ(n,e){return n===e||$P(n,e)||$P(e,n)}var qP=class n{get element(){return this.node.element.element}get children(){return this.node.children.map(e=>new n(e))}get depth(){return this.node.depth}get visibleChildrenCount(){return this.node.visibleChildrenCount}get visibleChildIndex(){return this.node.visibleChildIndex}get collapsible(){return this.node.collapsible}get collapsed(){return this.node.collapsed}get visible(){return this.node.visible}get filterData(){return this.node.filterData}constructor(e){this.node=e}},jP=class{constructor(e,t,i){this.renderer=e,this.nodeMapper=t,this.onDidChangeTwistieState=i,this.renderedNodes=new Map,this.templateId=e.templateId}renderTemplate(e){return{templateData:this.renderer.renderTemplate(e)}}renderElement(e,t,i,o){this.renderer.renderElement(this.nodeMapper.map(e),t,i.templateData,o)}renderTwistie(e,t){return e.slow?(t.classList.add(...Xe.asClassNameArray(ue.treeItemLoading)),!0):(t.classList.remove(...Xe.asClassNameArray(ue.treeItemLoading)),!1)}disposeElement(e,t,i,o){var s,r;(r=(s=this.renderer).disposeElement)===null||r===void 0||r.call(s,this.nodeMapper.map(e),t,i.templateData,o)}disposeTemplate(e){this.renderer.disposeTemplate(e.templateData)}dispose(){this.renderedNodes.clear()}};function rU(n){return{browserEvent:n.browserEvent,elements:n.elements.map(e=>e.element)}}function aU(n){return{browserEvent:n.browserEvent,element:n.element&&n.element.element,target:n.target}}var GP=class extends Jc{constructor(e){super(e.elements.map(t=>t.element)),this.data=e}};function KP(n){return n instanceof Jc?new GP(n):n}var ZP=class{constructor(e){this.dnd=e}getDragURI(e){return this.dnd.getDragURI(e.element)}getDragLabel(e,t){if(this.dnd.getDragLabel)return this.dnd.getDragLabel(e.map(i=>i.element),t)}onDragStart(e,t){var i,o;(o=(i=this.dnd).onDragStart)===null||o===void 0||o.call(i,KP(e),t)}onDragOver(e,t,i,o,s,r=!0){return this.dnd.onDragOver(KP(e),t&&t.element,i,o,s)}drop(e,t,i,o,s){this.dnd.drop(KP(e),t&&t.element,i,o,s)}onDragEnd(e){var t,i;(i=(t=this.dnd).onDragEnd)===null||i===void 0||i.call(t,e)}dispose(){this.dnd.dispose()}};function lU(n){return n&&{...n,collapseByDefault:!0,identityProvider:n.identityProvider&&{getId(e){return n.identityProvider.getId(e.element)}},dnd:n.dnd&&new ZP(n.dnd),multipleSelectionController:n.multipleSelectionController&&{isSelectionSingleChangeEvent(e){return n.multipleSelectionController.isSelectionSingleChangeEvent({...e,element:e.element})},isSelectionRangeChangeEvent(e){return n.multipleSelectionController.isSelectionRangeChangeEvent({...e,element:e.element})}},accessibilityProvider:n.accessibilityProvider&&{...n.accessibilityProvider,getPosInSet:void 0,getSetSize:void 0,getRole:n.accessibilityProvider.getRole?e=>n.accessibilityProvider.getRole(e.element):()=>"treeitem",isChecked:n.accessibilityProvider.isChecked?e=>{var t;return!!(!((t=n.accessibilityProvider)===null||t===void 0)&&t.isChecked(e.element))}:void 0,getAriaLabel(e){return n.accessibilityProvider.getAriaLabel(e.element)},getWidgetAriaLabel(){return n.accessibilityProvider.getWidgetAriaLabel()},getWidgetRole:n.accessibilityProvider.getWidgetRole?()=>n.accessibilityProvider.getWidgetRole():()=>"tree",getAriaLevel:n.accessibilityProvider.getAriaLevel&&(e=>n.accessibilityProvider.getAriaLevel(e.element)),getActiveDescendantId:n.accessibilityProvider.getActiveDescendantId&&(e=>n.accessibilityProvider.getActiveDescendantId(e.element))},filter:n.filter&&{filter(e,t){return n.filter.filter(e.element,t)}},keyboardNavigationLabelProvider:n.keyboardNavigationLabelProvider&&{...n.keyboardNavigationLabelProvider,getKeyboardNavigationLabel(e){return n.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(e.element)}},sorter:void 0,expandOnlyOnTwistieClick:typeof n.expandOnlyOnTwistieClick>"u"?void 0:typeof n.expandOnlyOnTwistieClick!="function"?n.expandOnlyOnTwistieClick:e=>n.expandOnlyOnTwistieClick(e.element),defaultFindVisibility:e=>e.hasChildren&&e.stale?1:typeof n.defaultFindVisibility=="number"?n.defaultFindVisibility:typeof n.defaultFindVisibility>"u"?2:n.defaultFindVisibility(e.element)}}function YP(n,e){e(n),n.children.forEach(t=>YP(t,e))}var l1=class{get onDidScroll(){return this.tree.onDidScroll}get onDidChangeFocus(){return ie.map(this.tree.onDidChangeFocus,rU)}get onDidChangeSelection(){return ie.map(this.tree.onDidChangeSelection,rU)}get onMouseDblClick(){return ie.map(this.tree.onMouseDblClick,aU)}get onPointer(){return ie.map(this.tree.onPointer,aU)}get onDidFocus(){return this.tree.onDidFocus}get onDidChangeModel(){return this.tree.onDidChangeModel}get onDidChangeCollapseState(){return this.tree.onDidChangeCollapseState}get onDidChangeFindOpenState(){return this.tree.onDidChangeFindOpenState}get onDidChangeStickyScrollFocused(){return this.tree.onDidChangeStickyScrollFocused}get onDidDispose(){return this.tree.onDidDispose}constructor(e,t,i,o,s,r={}){this.user=e,this.dataSource=s,this.nodes=new Map,this.subTreeRefreshPromises=new Map,this.refreshPromises=new Map,this._onDidRender=new B,this._onDidChangeNodeSlowState=new B,this.nodeMapper=new qf(a=>new qP(a)),this.disposables=new ae,this.identityProvider=r.identityProvider,this.autoExpandSingleChildren=typeof r.autoExpandSingleChildren>"u"?!1:r.autoExpandSingleChildren,this.sorter=r.sorter,this.getDefaultCollapseState=a=>r.collapseByDefault?r.collapseByDefault(a)?as.PreserveOrCollapsed:as.PreserveOrExpanded:void 0,this.tree=this.createTree(e,t,i,o,r),this.onDidChangeFindMode=this.tree.onDidChangeFindMode,this.onDidChangeFindMatchType=this.tree.onDidChangeFindMatchType,this.root=UP({element:void 0,parent:null,hasChildren:!0,defaultCollapseState:void 0}),this.identityProvider&&(this.root={...this.root,id:null}),this.nodes.set(null,this.root),this.tree.onDidChangeCollapseState(this._onDidChangeCollapseState,this,this.disposables)}createTree(e,t,i,o,s){let r=new t_(i),a=o.map(c=>new jP(c,this.nodeMapper,this._onDidChangeNodeSlowState.event)),l=lU(s)||{};return new Zf(e,t,r,a,l)}updateOptions(e={}){this.tree.updateOptions(e)}getHTMLElement(){return this.tree.getHTMLElement()}get scrollTop(){return this.tree.scrollTop}set scrollTop(e){this.tree.scrollTop=e}get scrollHeight(){return this.tree.scrollHeight}get renderHeight(){return this.tree.renderHeight}domFocus(){this.tree.domFocus()}layout(e,t){this.tree.layout(e,t)}style(e){this.tree.style(e)}getInput(){return this.root.element}async setInput(e,t){this.refreshPromises.forEach(o=>o.cancel()),this.refreshPromises.clear(),this.root.element=e;let i=t&&{viewState:t,focus:[],selection:[]};await this._updateChildren(e,!0,!1,i),i&&(this.tree.setFocus(i.focus),this.tree.setSelection(i.selection)),t&&typeof t.scrollTop=="number"&&(this.scrollTop=t.scrollTop)}async _updateChildren(e=this.root.element,t=!0,i=!1,o,s){if(typeof this.root.element>"u")throw new eo(this.user,"Tree input not set");this.root.refreshPromise&&(await this.root.refreshPromise,await ie.toPromise(this._onDidRender.event));let r=this.getDataNode(e);if(await this.refreshAndRenderNode(r,t,o,s),i)try{this.tree.rerender(r)}catch{}}rerender(e){if(e===void 0||e===this.root.element){this.tree.rerender();return}let t=this.getDataNode(e);this.tree.rerender(t)}getNode(e=this.root.element){let t=this.getDataNode(e),i=this.tree.getNode(t===this.root?null:t);return this.nodeMapper.map(i)}collapse(e,t=!1){let i=this.getDataNode(e);return this.tree.collapse(i===this.root?null:i,t)}async expand(e,t=!1){if(typeof this.root.element>"u")throw new eo(this.user,"Tree input not set");this.root.refreshPromise&&(await this.root.refreshPromise,await ie.toPromise(this._onDidRender.event));let i=this.getDataNode(e);if(this.tree.hasElement(i)&&!this.tree.isCollapsible(i)||(i.refreshPromise&&(await this.root.refreshPromise,await ie.toPromise(this._onDidRender.event)),i!==this.root&&!i.refreshPromise&&!this.tree.isCollapsed(i)))return!1;let o=this.tree.expand(i===this.root?null:i,t);return i.refreshPromise&&(await this.root.refreshPromise,await ie.toPromise(this._onDidRender.event)),o}setSelection(e,t){let i=e.map(o=>this.getDataNode(o));this.tree.setSelection(i,t)}getSelection(){return this.tree.getSelection().map(t=>t.element)}setFocus(e,t){let i=e.map(o=>this.getDataNode(o));this.tree.setFocus(i,t)}getFocus(){return this.tree.getFocus().map(t=>t.element)}reveal(e,t){this.tree.reveal(this.getDataNode(e),t)}getParentElement(e){let t=this.tree.getParentElement(this.getDataNode(e));return t&&t.element}getFirstElementChild(e=this.root.element){let t=this.getDataNode(e),i=this.tree.getFirstElementChild(t===this.root?null:t);return i&&i.element}getDataNode(e){let t=this.nodes.get(e===this.root.element?null:e);if(!t)throw new eo(this.user,`Data tree node not found: ${e}`);return t}async refreshAndRenderNode(e,t,i,o){await this.refreshNode(e,t,i),!this.disposables.isDisposed&&this.render(e,i,o)}async refreshNode(e,t,i){let o;if(this.subTreeRefreshPromises.forEach((s,r)=>{!o&&AQ(r,e)&&(o=s.then(()=>this.refreshNode(e,t,i)))}),o)return o;if(e!==this.root&&this.tree.getNode(e).collapsed){e.hasChildren=!!this.dataSource.hasChildren(e.element),e.stale=!0,this.setChildren(e,[],t,i);return}return this.doRefreshSubTree(e,t,i)}async doRefreshSubTree(e,t,i){let o;e.refreshPromise=new Promise(s=>o=s),this.subTreeRefreshPromises.set(e,e.refreshPromise),e.refreshPromise.finally(()=>{e.refreshPromise=void 0,this.subTreeRefreshPromises.delete(e)});try{let s=await this.doRefreshNode(e,t,i);e.stale=!1,await Tw.settled(s.map(r=>this.doRefreshSubTree(r,t,i)))}finally{o()}}async doRefreshNode(e,t,i){e.hasChildren=!!this.dataSource.hasChildren(e.element);let o;if(!e.hasChildren)o=Promise.resolve(ht.empty());else{let s=this.doGetChildren(e);if(_I(s))o=Promise.resolve(s);else{let r=kc(800);r.then(()=>{e.slow=!0,this._onDidChangeNodeSlowState.fire(e)},a=>null),o=s.finally(()=>r.cancel())}}try{let s=await o;return this.setChildren(e,s,t,i)}catch(s){if(e!==this.root&&this.tree.hasElement(e)&&this.tree.collapse(e),yd(s))return[];throw s}finally{e.slow&&(e.slow=!1,this._onDidChangeNodeSlowState.fire(e))}}doGetChildren(e){let t=this.refreshPromises.get(e);if(t)return t;let i=this.dataSource.getChildren(e.element);return _I(i)?this.processChildren(i):(t=PT(async()=>this.processChildren(await i)),this.refreshPromises.set(e,t),t.finally(()=>{this.refreshPromises.delete(e)}))}_onDidChangeCollapseState({node:e,deep:t}){e.element!==null&&!e.collapsed&&e.element.stale&&(t?this.collapse(e.element.element):this.refreshAndRenderNode(e.element,!1).catch(ut))}setChildren(e,t,i,o){let s=[...t];if(e.children.length===0&&s.length===0)return[];let r=new Map,a=new Map;for(let d of e.children)r.set(d.element,d),this.identityProvider&&a.set(d.id,{node:d,collapsed:this.tree.hasElement(d)&&this.tree.isCollapsed(d)});let l=[],c=s.map(d=>{let h=!!this.dataSource.hasChildren(d);if(!this.identityProvider){let m=UP({element:d,parent:e,hasChildren:h,defaultCollapseState:this.getDefaultCollapseState(d)});return h&&m.defaultCollapseState===as.PreserveOrExpanded&&l.push(m),m}let u=this.identityProvider.getId(d).toString(),f=a.get(u);if(f){let m=f.node;return r.delete(m.element),this.nodes.delete(m.element),this.nodes.set(d,m),m.element=d,m.hasChildren=h,i?f.collapsed?(m.children.forEach(C=>YP(C,S=>this.nodes.delete(S.element))),m.children.splice(0,m.children.length),m.stale=!0):l.push(m):h&&!f.collapsed&&l.push(m),m}let g=UP({element:d,parent:e,id:u,hasChildren:h,defaultCollapseState:this.getDefaultCollapseState(d)});return o&&o.viewState.focus&&o.viewState.focus.indexOf(u)>-1&&o.focus.push(g),o&&o.viewState.selection&&o.viewState.selection.indexOf(u)>-1&&o.selection.push(g),(o&&o.viewState.expanded&&o.viewState.expanded.indexOf(u)>-1||h&&g.defaultCollapseState===as.PreserveOrExpanded)&&l.push(g),g});for(let d of r.values())YP(d,h=>this.nodes.delete(h.element));for(let d of c)this.nodes.set(d.element,d);return e.children.splice(0,e.children.length,...c),e!==this.root&&this.autoExpandSingleChildren&&c.length===1&&l.length===0&&(c[0].forceExpanded=!0,l.push(c[0])),l}render(e,t,i){let o=e.children.map(r=>this.asTreeElement(r,t)),s=i&&{...i,diffIdentityProvider:i.diffIdentityProvider&&{getId(r){return i.diffIdentityProvider.getId(r.element)}}};this.tree.setChildren(e===this.root?null:e,o,s),e!==this.root&&this.tree.setCollapsible(e,e.hasChildren),this._onDidRender.fire()}asTreeElement(e,t){if(e.stale)return{element:e,collapsible:e.hasChildren,collapsed:!0};let i;return t&&t.viewState.expanded&&e.id&&t.viewState.expanded.indexOf(e.id)>-1?i=!1:e.forceExpanded?(i=!1,e.forceExpanded=!1):i=e.defaultCollapseState,{element:e,children:e.hasChildren?ht.map(e.children,o=>this.asTreeElement(o,t)):[],collapsible:e.hasChildren,collapsed:i}}processChildren(e){return this.sorter&&(e=[...e].sort(this.sorter.compare.bind(this.sorter))),e}dispose(){this.disposables.dispose(),this.tree.dispose()}},XP=class n{get element(){return{elements:this.node.element.elements.map(e=>e.element),incompressible:this.node.element.incompressible}}get children(){return this.node.children.map(e=>new n(e))}get depth(){return this.node.depth}get visibleChildrenCount(){return this.node.visibleChildrenCount}get visibleChildIndex(){return this.node.visibleChildIndex}get collapsible(){return this.node.collapsible}get collapsed(){return this.node.collapsed}get visible(){return this.node.visible}get filterData(){return this.node.filterData}constructor(e){this.node=e}},QP=class{constructor(e,t,i,o){this.renderer=e,this.nodeMapper=t,this.compressibleNodeMapperProvider=i,this.onDidChangeTwistieState=o,this.renderedNodes=new Map,this.disposables=[],this.templateId=e.templateId}renderTemplate(e){return{templateData:this.renderer.renderTemplate(e)}}renderElement(e,t,i,o){this.renderer.renderElement(this.nodeMapper.map(e),t,i.templateData,o)}renderCompressedElements(e,t,i,o){this.renderer.renderCompressedElements(this.compressibleNodeMapperProvider().map(e),t,i.templateData,o)}renderTwistie(e,t){return e.slow?(t.classList.add(...Xe.asClassNameArray(ue.treeItemLoading)),!0):(t.classList.remove(...Xe.asClassNameArray(ue.treeItemLoading)),!1)}disposeElement(e,t,i,o){var s,r;(r=(s=this.renderer).disposeElement)===null||r===void 0||r.call(s,this.nodeMapper.map(e),t,i.templateData,o)}disposeCompressedElements(e,t,i,o){var s,r;(r=(s=this.renderer).disposeCompressedElements)===null||r===void 0||r.call(s,this.compressibleNodeMapperProvider().map(e),t,i.templateData,o)}disposeTemplate(e){this.renderer.disposeTemplate(e.templateData)}dispose(){this.renderedNodes.clear(),this.disposables=li(this.disposables)}};function MQ(n){let e=n&&lU(n);return e&&{...e,keyboardNavigationLabelProvider:e.keyboardNavigationLabelProvider&&{...e.keyboardNavigationLabelProvider,getCompressedNodeKeyboardNavigationLabel(t){return n.keyboardNavigationLabelProvider.getCompressedNodeKeyboardNavigationLabel(t.map(i=>i.element))}}}}var PE=class extends l1{constructor(e,t,i,o,s,r,a={}){super(e,t,i,s,r,a),this.compressionDelegate=o,this.compressibleNodeMapper=new qf(l=>new XP(l)),this.filter=a.filter}createTree(e,t,i,o,s){let r=new t_(i),a=o.map(c=>new QP(c,this.nodeMapper,()=>this.compressibleNodeMapper,this._onDidChangeNodeSlowState.event)),l=MQ(s)||{};return new n_(e,t,r,a,l)}asTreeElement(e,t){return{incompressible:this.compressionDelegate.isIncompressible(e.element),...super.asTreeElement(e,t)}}updateOptions(e={}){this.tree.updateOptions(e)}render(e,t,i){if(!this.identityProvider)return super.render(e,t);let o=f=>this.identityProvider.getId(f).toString(),s=f=>{let g=new Set;for(let m of f){let C=this.tree.getCompressedTreeNode(m===this.root?null:m);if(C.element)for(let S of C.element.elements)g.add(o(S.element))}return g},r=s(this.tree.getSelection()),a=s(this.tree.getFocus());super.render(e,t,i);let l=this.getSelection(),c=!1,d=this.getFocus(),h=!1,u=f=>{let g=f.element;if(g)for(let m=0;m{let i=this.filter.filter(t,1),o=RQ(i);if(o===2)throw new Error("Recursive tree visibility not supported in async data compressed trees");return o===1})),super.processChildren(e)}};function RQ(n){return typeof n=="boolean"?n?1:0:r1(n)?jf(n.visibility):jf(n)}_();v();b();var OE=class extends i_{constructor(e,t,i,o,s,r={}){super(e,t,i,o,r),this.user=e,this.dataSource=s,this.identityProvider=r.identityProvider}createModel(e,t,i){return new Hh(e,t,i)}};ye();le();Ge();Fo();Du();Oi();_();v();b();Lt();Ge();Oi();var iat=new xe("isMac",Be,p("isMac","Whether the operating system is macOS")),nat=new xe("isLinux",mi,p("isLinux","Whether the operating system is Linux")),oat=new xe("isWindows",Li,p("isWindows","Whether the operating system is Windows")),sat=new xe("isWeb",hl,p("isWeb","Whether the platform is a web browser")),rat=new xe("isMacNative",Be&&!hl,p("isMacNative","Whether the operating system is macOS on a non-browser platform")),aat=new xe("isIOS",Rs,p("isIOS","Whether the operating system is iOS")),lat=new xe("isMobile",J1,p("isMobile","Whether the platform is a mobile web browser")),cat=new xe("isDevelopment",!1,!0),dat=new xe("productQualityType","",p("productQualityType","Quality type of VS Code")),JP="inputFocus",hat=new xe(JP,!1,p("inputFocus","Whether keyboard focus is inside an input box"));qe();Oo();var sd=function(n,e,t,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},Qt=function(n,e){return function(t,i){e(t,i,n)}},ol=De("listService"),BE=class{get lastFocusedList(){return this._lastFocusedWidget}constructor(){this.disposables=new ae,this.lists=[],this._lastFocusedWidget=void 0,this._hasCreatedStyleController=!1}setLastFocusedList(e){var t,i;e!==this._lastFocusedWidget&&((t=this._lastFocusedWidget)===null||t===void 0||t.getHTMLElement().classList.remove("last-focused"),this._lastFocusedWidget=e,(i=this._lastFocusedWidget)===null||i===void 0||i.getHTMLElement().classList.add("last-focused"))}register(e,t){if(this._hasCreatedStyleController||(this._hasCreatedStyleController=!0,new jv(Xi(),"").style(Hf)),this.lists.some(o=>o.widget===e))throw new Error("Cannot register the same widget multiple times");let i={widget:e,extraContextKeys:t};return this.lists.push(i),_0(e.getHTMLElement())&&this.setLastFocusedList(e),_o(e.onDidFocus(()=>this.setLastFocusedList(e)),be(()=>this.lists.splice(this.lists.indexOf(i),1)),e.onDidDispose(()=>{this.lists=this.lists.filter(o=>o!==i),this._lastFocusedWidget===e&&this.setLastFocusedList(void 0)}))}dispose(){this.disposables.dispose()}},c1=new xe("listScrollAtBoundary","none"),Oat=Dt.or(c1.isEqualTo("top"),c1.isEqualTo("both")),Fat=Dt.or(c1.isEqualTo("bottom"),c1.isEqualTo("both")),pU=new xe("listFocus",!0),_U=new xe("treestickyScrollFocused",!1),qE=new xe("listSupportsMultiselect",!0),Bat=Dt.and(pU,Dt.not(JP),_U.negate()),nO=new xe("listHasSelectionOrFocus",!1),oO=new xe("listDoubleSelection",!1),sO=new xe("listMultiSelection",!1),jE=new xe("listSelectionNavigation",!1),PQ=new xe("listSupportsFind",!0),OQ=new xe("treeElementCanCollapse",!1),FQ=new xe("treeElementHasParent",!1),BQ=new xe("treeElementCanExpand",!1),WQ=new xe("treeElementHasChild",!1),zQ=new xe("treeFindOpen",!1),bU="listTypeNavigationMode",vU="listAutomaticKeyboardNavigation";function GE(n,e){let t=n.createScoped(e.getHTMLElement());return pU.bindTo(t),t}function ZE(n,e){let t=c1.bindTo(n),i=()=>{let o=e.scrollTop===0,s=e.scrollHeight-e.renderHeight-e.scrollTop<1;o&&s?t.set("both"):o?t.set("top"):s?t.set("bottom"):t.set("none")};return i(),e.onDidScroll(i)}var Xf="workbench.list.multiSelectModifier",FE="workbench.list.openMode",_r="workbench.list.horizontalScrolling",rO="workbench.list.defaultFindMode",aO="workbench.list.typeNavigationMode",WE="workbench.list.keyboardNavigation",il="workbench.list.scrollByPage",lO="workbench.list.defaultFindMatchType",d1="workbench.tree.indent",zE="workbench.tree.renderIndentGuides",nl="workbench.list.smoothScrolling",lc="workbench.list.mouseWheelScrollSensitivity",cc="workbench.list.fastScrollSensitivity",VE="workbench.tree.expandMode",HE="workbench.tree.enableStickyScroll",UE="workbench.tree.stickyScrollMaxItemCount";function dc(n){return n.getValue(Xf)==="alt"}var eO=class extends H{constructor(e){super(),this.configurationService=e,this.useAltAsMultipleSelectionModifier=dc(e),this.registerListeners()}registerListeners(){this._register(this.configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration(Xf)&&(this.useAltAsMultipleSelectionModifier=dc(this.configurationService))}))}isSelectionSingleChangeEvent(e){return this.useAltAsMultipleSelectionModifier?e.browserEvent.altKey:X5(e)}isSelectionRangeChangeEvent(e){return Q5(e)}};function YE(n,e){var t;let i=n.get(Rt),o=n.get(fi),s=new ae;return[{...e,keyboardNavigationDelegate:{mightProducePrintableCharacter(a){return o.mightProducePrintableCharacter(a)}},smoothScrolling:!!i.getValue(nl),mouseWheelScrollSensitivity:i.getValue(lc),fastScrollSensitivity:i.getValue(cc),multipleSelectionController:(t=e.multipleSelectionController)!==null&&t!==void 0?t:s.add(new eO(i)),keyboardNavigationEventFilter:VQ(o),scrollByPage:!!i.getValue(il)},s]}var cU=class extends Do{constructor(e,t,i,o,s,r,a,l,c){let d=typeof s.horizontalScrolling<"u"?s.horizontalScrolling:!!l.getValue(_r),[h,u]=c.invokeFunction(YE,s);super(e,t,i,o,{keyboardSupport:!1,...h,horizontalScrolling:d}),this.disposables.add(u),this.contextKeyService=GE(r,this),this.disposables.add(ZE(this.contextKeyService,this)),this.listSupportsMultiSelect=qE.bindTo(this.contextKeyService),this.listSupportsMultiSelect.set(s.multipleSelectionSupport!==!1),jE.bindTo(this.contextKeyService).set(!!s.selectionNavigation),this.listHasSelectionOrFocus=nO.bindTo(this.contextKeyService),this.listDoubleSelection=oO.bindTo(this.contextKeyService),this.listMultiSelection=sO.bindTo(this.contextKeyService),this.horizontalScrolling=s.horizontalScrolling,this._useAltAsMultipleSelectionModifier=dc(l),this.disposables.add(this.contextKeyService),this.disposables.add(a.register(this)),this.updateStyles(s.overrideStyles),this.disposables.add(this.onDidChangeSelection(()=>{let g=this.getSelection(),m=this.getFocus();this.contextKeyService.bufferChangeEvents(()=>{this.listHasSelectionOrFocus.set(g.length>0||m.length>0),this.listMultiSelection.set(g.length>1),this.listDoubleSelection.set(g.length===2)})})),this.disposables.add(this.onDidChangeFocus(()=>{let g=this.getSelection(),m=this.getFocus();this.listHasSelectionOrFocus.set(g.length>0||m.length>0)})),this.disposables.add(l.onDidChangeConfiguration(g=>{g.affectsConfiguration(Xf)&&(this._useAltAsMultipleSelectionModifier=dc(l));let m={};if(g.affectsConfiguration(_r)&&this.horizontalScrolling===void 0){let C=!!l.getValue(_r);m={...m,horizontalScrolling:C}}if(g.affectsConfiguration(il)){let C=!!l.getValue(il);m={...m,scrollByPage:C}}if(g.affectsConfiguration(nl)){let C=!!l.getValue(nl);m={...m,smoothScrolling:C}}if(g.affectsConfiguration(lc)){let C=l.getValue(lc);m={...m,mouseWheelScrollSensitivity:C}}if(g.affectsConfiguration(cc)){let C=l.getValue(cc);m={...m,fastScrollSensitivity:C}}Object.keys(m).length>0&&this.updateOptions(m)})),this.navigator=new KE(this,{configurationService:l,...s}),this.disposables.add(this.navigator)}updateOptions(e){super.updateOptions(e),e.overrideStyles!==void 0&&this.updateStyles(e.overrideStyles),e.multipleSelectionSupport!==void 0&&this.listSupportsMultiSelect.set(!!e.multipleSelectionSupport)}updateStyles(e){this.style(e?Uf(e):Hf)}};cU=sd([Qt(5,rt),Qt(6,ol),Qt(7,Rt),Qt(8,Ye)],cU);var dU=class extends _E{constructor(e,t,i,o,s,r,a,l,c){let d=typeof s.horizontalScrolling<"u"?s.horizontalScrolling:!!l.getValue(_r),[h,u]=c.invokeFunction(YE,s);super(e,t,i,o,{keyboardSupport:!1,...h,horizontalScrolling:d}),this.disposables=new ae,this.disposables.add(u),this.contextKeyService=GE(r,this),this.disposables.add(ZE(this.contextKeyService,this.widget)),this.horizontalScrolling=s.horizontalScrolling,this.listSupportsMultiSelect=qE.bindTo(this.contextKeyService),this.listSupportsMultiSelect.set(s.multipleSelectionSupport!==!1),jE.bindTo(this.contextKeyService).set(!!s.selectionNavigation),this._useAltAsMultipleSelectionModifier=dc(l),this.disposables.add(this.contextKeyService),this.disposables.add(a.register(this)),this.updateStyles(s.overrideStyles),this.disposables.add(l.onDidChangeConfiguration(g=>{g.affectsConfiguration(Xf)&&(this._useAltAsMultipleSelectionModifier=dc(l));let m={};if(g.affectsConfiguration(_r)&&this.horizontalScrolling===void 0){let C=!!l.getValue(_r);m={...m,horizontalScrolling:C}}if(g.affectsConfiguration(il)){let C=!!l.getValue(il);m={...m,scrollByPage:C}}if(g.affectsConfiguration(nl)){let C=!!l.getValue(nl);m={...m,smoothScrolling:C}}if(g.affectsConfiguration(lc)){let C=l.getValue(lc);m={...m,mouseWheelScrollSensitivity:C}}if(g.affectsConfiguration(cc)){let C=l.getValue(cc);m={...m,fastScrollSensitivity:C}}Object.keys(m).length>0&&this.updateOptions(m)})),this.navigator=new KE(this,{configurationService:l,...s}),this.disposables.add(this.navigator)}updateOptions(e){super.updateOptions(e),e.overrideStyles!==void 0&&this.updateStyles(e.overrideStyles),e.multipleSelectionSupport!==void 0&&this.listSupportsMultiSelect.set(!!e.multipleSelectionSupport)}updateStyles(e){this.style(e?Uf(e):Hf)}dispose(){this.disposables.dispose(),super.dispose()}};dU=sd([Qt(5,rt),Qt(6,ol),Qt(7,Rt),Qt(8,Ye)],dU);var hU=class extends n1{constructor(e,t,i,o,s,r,a,l,c,d){let h=typeof r.horizontalScrolling<"u"?r.horizontalScrolling:!!c.getValue(_r),[u,f]=d.invokeFunction(YE,r);super(e,t,i,o,s,{keyboardSupport:!1,...u,horizontalScrolling:h}),this.disposables.add(f),this.contextKeyService=GE(a,this),this.disposables.add(ZE(this.contextKeyService,this)),this.listSupportsMultiSelect=qE.bindTo(this.contextKeyService),this.listSupportsMultiSelect.set(r.multipleSelectionSupport!==!1),jE.bindTo(this.contextKeyService).set(!!r.selectionNavigation),this.listHasSelectionOrFocus=nO.bindTo(this.contextKeyService),this.listDoubleSelection=oO.bindTo(this.contextKeyService),this.listMultiSelection=sO.bindTo(this.contextKeyService),this.horizontalScrolling=r.horizontalScrolling,this._useAltAsMultipleSelectionModifier=dc(c),this.disposables.add(this.contextKeyService),this.disposables.add(l.register(this)),this.updateStyles(r.overrideStyles),this.disposables.add(this.onDidChangeSelection(()=>{let m=this.getSelection(),C=this.getFocus();this.contextKeyService.bufferChangeEvents(()=>{this.listHasSelectionOrFocus.set(m.length>0||C.length>0),this.listMultiSelection.set(m.length>1),this.listDoubleSelection.set(m.length===2)})})),this.disposables.add(this.onDidChangeFocus(()=>{let m=this.getSelection(),C=this.getFocus();this.listHasSelectionOrFocus.set(m.length>0||C.length>0)})),this.disposables.add(c.onDidChangeConfiguration(m=>{m.affectsConfiguration(Xf)&&(this._useAltAsMultipleSelectionModifier=dc(c));let C={};if(m.affectsConfiguration(_r)&&this.horizontalScrolling===void 0){let S=!!c.getValue(_r);C={...C,horizontalScrolling:S}}if(m.affectsConfiguration(il)){let S=!!c.getValue(il);C={...C,scrollByPage:S}}if(m.affectsConfiguration(nl)){let S=!!c.getValue(nl);C={...C,smoothScrolling:S}}if(m.affectsConfiguration(lc)){let S=c.getValue(lc);C={...C,mouseWheelScrollSensitivity:S}}if(m.affectsConfiguration(cc)){let S=c.getValue(cc);C={...C,fastScrollSensitivity:S}}Object.keys(C).length>0&&this.updateOptions(C)})),this.navigator=new tO(this,{configurationService:c,...r}),this.disposables.add(this.navigator)}updateOptions(e){super.updateOptions(e),e.overrideStyles!==void 0&&this.updateStyles(e.overrideStyles),e.multipleSelectionSupport!==void 0&&this.listSupportsMultiSelect.set(!!e.multipleSelectionSupport)}updateStyles(e){this.style(e?Uf(e):Hf)}dispose(){this.disposables.dispose(),super.dispose()}};hU=sd([Qt(6,rt),Qt(7,ol),Qt(8,Rt),Qt(9,Ye)],hU);var h1=class extends H{constructor(e,t){var i;super(),this.widget=e,this._onDidOpen=this._register(new B),this.onDidOpen=this._onDidOpen.event,this._register(ie.filter(this.widget.onDidChangeSelection,o=>Ia(o.browserEvent))(o=>this.onSelectionFromKeyboard(o))),this._register(this.widget.onPointer(o=>this.onPointer(o.element,o.browserEvent))),this._register(this.widget.onMouseDblClick(o=>this.onMouseDblClick(o.element,o.browserEvent))),typeof t?.openOnSingleClick!="boolean"&&t?.configurationService?(this.openOnSingleClick=t?.configurationService.getValue(FE)!=="doubleClick",this._register(t?.configurationService.onDidChangeConfiguration(o=>{o.affectsConfiguration(FE)&&(this.openOnSingleClick=t?.configurationService.getValue(FE)!=="doubleClick")}))):this.openOnSingleClick=(i=t?.openOnSingleClick)!==null&&i!==void 0?i:!0}onSelectionFromKeyboard(e){if(e.elements.length!==1)return;let t=e.browserEvent,i=typeof t.preserveFocus=="boolean"?t.preserveFocus:!0,o=typeof t.pinned=="boolean"?t.pinned:!i,s=!1;this._open(this.getSelectedElement(),i,o,s,e.browserEvent)}onPointer(e,t){if(!this.openOnSingleClick||t.detail===2)return;let o=t.button===1,s=!0,r=o,a=t.ctrlKey||t.metaKey||t.altKey;this._open(e,s,r,a,t)}onMouseDblClick(e,t){if(!t)return;let i=t.target;if(i.classList.contains("monaco-tl-twistie")||i.classList.contains("monaco-icon-label")&&i.classList.contains("folder-icon")&&t.offsetX<16)return;let s=!1,r=!0,a=t.ctrlKey||t.metaKey||t.altKey;this._open(e,s,r,a,t)}_open(e,t,i,o,s){e&&this._onDidOpen.fire({editorOptions:{preserveFocus:t,pinned:i,revealIfVisible:!0},sideBySide:o,element:e,browserEvent:s})}},KE=class extends h1{constructor(e,t){super(e,t),this.widget=e}getSelectedElement(){return this.widget.getSelectedElements()[0]}},tO=class extends h1{constructor(e,t){super(e,t)}getSelectedElement(){return this.widget.getSelectedElements()[0]}},iO=class extends h1{constructor(e,t){super(e,t)}getSelectedElement(){var e;return(e=this.widget.getSelection()[0])!==null&&e!==void 0?e:void 0}};function VQ(n){let e=!1;return t=>{if(t.toKeyCodeChord().isModifierKey())return!1;if(e)return e=!1,!1;let i=n.softDispatch(t,t.target);return i.kind===1?(e=!0,!1):(e=!1,i.kind===0)}}var $E=class extends Zf{constructor(e,t,i,o,s,r,a,l,c){let{options:d,getTypeNavigationMode:h,disposable:u}=r.invokeFunction(u1,s);super(e,t,i,o,d),this.disposables.add(u),this.internals=new Yf(this,s,h,s.overrideStyles,a,l,c),this.disposables.add(this.internals)}updateOptions(e){super.updateOptions(e),this.internals.updateOptions(e)}};$E=sd([Qt(5,Ye),Qt(6,rt),Qt(7,ol),Qt(8,Rt)],$E);var uU=class extends n_{constructor(e,t,i,o,s,r,a,l,c){let{options:d,getTypeNavigationMode:h,disposable:u}=r.invokeFunction(u1,s);super(e,t,i,o,d),this.disposables.add(u),this.internals=new Yf(this,s,h,s.overrideStyles,a,l,c),this.disposables.add(this.internals)}updateOptions(e={}){super.updateOptions(e),e.overrideStyles&&this.internals.updateStyleOverrides(e.overrideStyles),this.internals.updateOptions(e)}};uU=sd([Qt(5,Ye),Qt(6,rt),Qt(7,ol),Qt(8,Rt)],uU);var fU=class extends OE{constructor(e,t,i,o,s,r,a,l,c,d){let{options:h,getTypeNavigationMode:u,disposable:f}=a.invokeFunction(u1,r);super(e,t,i,o,s,h),this.disposables.add(f),this.internals=new Yf(this,r,u,r.overrideStyles,l,c,d),this.disposables.add(this.internals)}updateOptions(e={}){super.updateOptions(e),e.overrideStyles!==void 0&&this.internals.updateStyleOverrides(e.overrideStyles),this.internals.updateOptions(e)}};fU=sd([Qt(6,Ye),Qt(7,rt),Qt(8,ol),Qt(9,Rt)],fU);var gU=class extends l1{get onDidOpen(){return this.internals.onDidOpen}constructor(e,t,i,o,s,r,a,l,c,d){let{options:h,getTypeNavigationMode:u,disposable:f}=a.invokeFunction(u1,r);super(e,t,i,o,s,h),this.disposables.add(f),this.internals=new Yf(this,r,u,r.overrideStyles,l,c,d),this.disposables.add(this.internals)}updateOptions(e={}){super.updateOptions(e),e.overrideStyles&&this.internals.updateStyleOverrides(e.overrideStyles),this.internals.updateOptions(e)}};gU=sd([Qt(6,Ye),Qt(7,rt),Qt(8,ol),Qt(9,Rt)],gU);var mU=class extends PE{constructor(e,t,i,o,s,r,a,l,c,d,h){let{options:u,getTypeNavigationMode:f,disposable:g}=l.invokeFunction(u1,a);super(e,t,i,o,s,r,u),this.disposables.add(g),this.internals=new Yf(this,a,f,a.overrideStyles,c,d,h),this.disposables.add(this.internals)}updateOptions(e){super.updateOptions(e),this.internals.updateOptions(e)}};mU=sd([Qt(7,Ye),Qt(8,rt),Qt(9,ol),Qt(10,Rt)],mU);function CU(n){let e=n.getValue(rO);if(e==="highlight")return ac.Highlight;if(e==="filter")return ac.Filter;let t=n.getValue(WE);if(t==="simple"||t==="highlight")return ac.Highlight;if(t==="filter")return ac.Filter}function wU(n){let e=n.getValue(lO);if(e==="fuzzy")return Vh.Fuzzy;if(e==="contiguous")return Vh.Contiguous}function u1(n,e){var t;let i=n.get(Rt),o=n.get(Qc),s=n.get(rt),r=n.get(Ye),a=()=>{let f=s.getContextKeyValue(bU);if(f==="automatic")return el.Automatic;if(f==="trigger")return el.Trigger;if(s.getContextKeyValue(vU)===!1)return el.Trigger;let m=i.getValue(aO);if(m==="automatic")return el.Automatic;if(m==="trigger")return el.Trigger},l=e.horizontalScrolling!==void 0?e.horizontalScrolling:!!i.getValue(_r),[c,d]=r.invokeFunction(YE,e),h=e.paddingBottom,u=e.renderIndentGuides!==void 0?e.renderIndentGuides:i.getValue(zE);return{getTypeNavigationMode:a,disposable:d,options:{keyboardSupport:!1,...c,indent:typeof i.getValue(d1)=="number"?i.getValue(d1):void 0,renderIndentGuides:u,smoothScrolling:!!i.getValue(nl),defaultFindMode:CU(i),defaultFindMatchType:wU(i),horizontalScrolling:l,scrollByPage:!!i.getValue(il),paddingBottom:h,hideTwistiesOfChildlessElements:e.hideTwistiesOfChildlessElements,expandOnlyOnTwistieClick:(t=e.expandOnlyOnTwistieClick)!==null&&t!==void 0?t:i.getValue(VE)==="doubleClick",contextViewProvider:o,findWidgetStyles:FH,enableStickyScroll:!!i.getValue(HE),stickyScrollMaxItemCount:Number(i.getValue(UE))}}}var Yf=class{get onDidOpen(){return this.navigator.onDidOpen}constructor(e,t,i,o,s,r,a){var l;this.tree=e,this.disposables=[],this.contextKeyService=GE(s,e),this.disposables.push(ZE(this.contextKeyService,e)),this.listSupportsMultiSelect=qE.bindTo(this.contextKeyService),this.listSupportsMultiSelect.set(t.multipleSelectionSupport!==!1),jE.bindTo(this.contextKeyService).set(!!t.selectionNavigation),this.listSupportFindWidget=PQ.bindTo(this.contextKeyService),this.listSupportFindWidget.set((l=t.findWidgetEnabled)!==null&&l!==void 0?l:!0),this.hasSelectionOrFocus=nO.bindTo(this.contextKeyService),this.hasDoubleSelection=oO.bindTo(this.contextKeyService),this.hasMultiSelection=sO.bindTo(this.contextKeyService),this.treeElementCanCollapse=OQ.bindTo(this.contextKeyService),this.treeElementHasParent=FQ.bindTo(this.contextKeyService),this.treeElementCanExpand=BQ.bindTo(this.contextKeyService),this.treeElementHasChild=WQ.bindTo(this.contextKeyService),this.treeFindOpen=zQ.bindTo(this.contextKeyService),this.treeStickyScrollFocused=_U.bindTo(this.contextKeyService),this._useAltAsMultipleSelectionModifier=dc(a),this.updateStyleOverrides(o);let d=()=>{let u=e.getFocus()[0];if(!u)return;let f=e.getNode(u);this.treeElementCanCollapse.set(f.collapsible&&!f.collapsed),this.treeElementHasParent.set(!!e.getParentElement(u)),this.treeElementCanExpand.set(f.collapsible&&f.collapsed),this.treeElementHasChild.set(!!e.getFirstElementChild(u))},h=new Set;h.add(bU),h.add(vU),this.disposables.push(this.contextKeyService,r.register(e),e.onDidChangeSelection(()=>{let u=e.getSelection(),f=e.getFocus();this.contextKeyService.bufferChangeEvents(()=>{this.hasSelectionOrFocus.set(u.length>0||f.length>0),this.hasMultiSelection.set(u.length>1),this.hasDoubleSelection.set(u.length===2)})}),e.onDidChangeFocus(()=>{let u=e.getSelection(),f=e.getFocus();this.hasSelectionOrFocus.set(u.length>0||f.length>0),d()}),e.onDidChangeCollapseState(d),e.onDidChangeModel(d),e.onDidChangeFindOpenState(u=>this.treeFindOpen.set(u)),e.onDidChangeStickyScrollFocused(u=>this.treeStickyScrollFocused.set(u)),a.onDidChangeConfiguration(u=>{let f={};if(u.affectsConfiguration(Xf)&&(this._useAltAsMultipleSelectionModifier=dc(a)),u.affectsConfiguration(d1)){let g=a.getValue(d1);f={...f,indent:g}}if(u.affectsConfiguration(zE)&&t.renderIndentGuides===void 0){let g=a.getValue(zE);f={...f,renderIndentGuides:g}}if(u.affectsConfiguration(nl)){let g=!!a.getValue(nl);f={...f,smoothScrolling:g}}if(u.affectsConfiguration(rO)||u.affectsConfiguration(WE)){let g=CU(a);f={...f,defaultFindMode:g}}if(u.affectsConfiguration(aO)||u.affectsConfiguration(WE)){let g=i();f={...f,typeNavigationMode:g}}if(u.affectsConfiguration(lO)){let g=wU(a);f={...f,defaultFindMatchType:g}}if(u.affectsConfiguration(_r)&&t.horizontalScrolling===void 0){let g=!!a.getValue(_r);f={...f,horizontalScrolling:g}}if(u.affectsConfiguration(il)){let g=!!a.getValue(il);f={...f,scrollByPage:g}}if(u.affectsConfiguration(VE)&&t.expandOnlyOnTwistieClick===void 0&&(f={...f,expandOnlyOnTwistieClick:a.getValue(VE)==="doubleClick"}),u.affectsConfiguration(HE)){let g=a.getValue(HE);f={...f,enableStickyScroll:g}}if(u.affectsConfiguration(UE)){let g=Math.max(1,a.getValue(UE));f={...f,stickyScrollMaxItemCount:g}}if(u.affectsConfiguration(lc)){let g=a.getValue(lc);f={...f,mouseWheelScrollSensitivity:g}}if(u.affectsConfiguration(cc)){let g=a.getValue(cc);f={...f,fastScrollSensitivity:g}}Object.keys(f).length>0&&e.updateOptions(f)}),this.contextKeyService.onDidChangeContext(u=>{u.affectsSome(h)&&e.updateOptions({typeNavigationMode:i()})})),this.navigator=new iO(e,{configurationService:a,...t}),this.disposables.push(this.navigator)}updateOptions(e){e.multipleSelectionSupport!==void 0&&this.listSupportsMultiSelect.set(!!e.multipleSelectionSupport)}updateStyleOverrides(e){this.tree.style(e?Uf(e):Hf)}dispose(){this.disposables=li(this.disposables)}};Yf=sd([Qt(4,rt),Qt(5,ol),Qt(6,Rt)],Yf);var HQ=Vt.as(ar.Configuration);HQ.registerConfiguration({id:"workbench",order:7,title:p("workbenchConfigurationTitle","Workbench"),type:"object",properties:{[Xf]:{type:"string",enum:["ctrlCmd","alt"],markdownEnumDescriptions:[p("multiSelectModifier.ctrlCmd","Maps to `Control` on Windows and Linux and to `Command` on macOS."),p("multiSelectModifier.alt","Maps to `Alt` on Windows and Linux and to `Option` on macOS.")],default:"ctrlCmd",description:p({key:"multiSelectModifier",comment:["- `ctrlCmd` refers to a value the setting can take and should not be localized.","- `Control` and `Command` refer to the modifier keys Ctrl or Cmd on the keyboard and can be localized."]},"The modifier to be used to add an item in trees and lists to a multi-selection with the mouse (for example in the explorer, open editors and scm view). The 'Open to Side' mouse gestures - if supported - will adapt such that they do not conflict with the multiselect modifier.")},[FE]:{type:"string",enum:["singleClick","doubleClick"],default:"singleClick",description:p({key:"openModeModifier",comment:["`singleClick` and `doubleClick` refers to a value the setting can take and should not be localized."]},"Controls how to open items in trees and lists using the mouse (if supported). Note that some trees and lists might choose to ignore this setting if it is not applicable.")},[_r]:{type:"boolean",default:!1,description:p("horizontalScrolling setting","Controls whether lists and trees support horizontal scrolling in the workbench. Warning: turning on this setting has a performance implication.")},[il]:{type:"boolean",default:!1,description:p("list.scrollByPage","Controls whether clicks in the scrollbar scroll page by page.")},[d1]:{type:"number",default:8,minimum:4,maximum:40,description:p("tree indent setting","Controls tree indentation in pixels.")},[zE]:{type:"string",enum:["none","onHover","always"],default:"onHover",description:p("render tree indent guides","Controls whether the tree should render indent guides.")},[nl]:{type:"boolean",default:!1,description:p("list smoothScrolling setting","Controls whether lists and trees have smooth scrolling.")},[lc]:{type:"number",default:1,markdownDescription:p("Mouse Wheel Scroll Sensitivity","A multiplier to be used on the `deltaX` and `deltaY` of mouse wheel scroll events.")},[cc]:{type:"number",default:5,markdownDescription:p("Fast Scroll Sensitivity","Scrolling speed multiplier when pressing `Alt`.")},[rO]:{type:"string",enum:["highlight","filter"],enumDescriptions:[p("defaultFindModeSettingKey.highlight","Highlight elements when searching. Further up and down navigation will traverse only the highlighted elements."),p("defaultFindModeSettingKey.filter","Filter elements when searching.")],default:"highlight",description:p("defaultFindModeSettingKey","Controls the default find mode for lists and trees in the workbench.")},[WE]:{type:"string",enum:["simple","highlight","filter"],enumDescriptions:[p("keyboardNavigationSettingKey.simple","Simple keyboard navigation focuses elements which match the keyboard input. Matching is done only on prefixes."),p("keyboardNavigationSettingKey.highlight","Highlight keyboard navigation highlights elements which match the keyboard input. Further up and down navigation will traverse only the highlighted elements."),p("keyboardNavigationSettingKey.filter","Filter keyboard navigation will filter out and hide all the elements which do not match the keyboard input.")],default:"highlight",description:p("keyboardNavigationSettingKey","Controls the keyboard navigation style for lists and trees in the workbench. Can be simple, highlight and filter."),deprecated:!0,deprecationMessage:p("keyboardNavigationSettingKeyDeprecated","Please use 'workbench.list.defaultFindMode' and 'workbench.list.typeNavigationMode' instead.")},[lO]:{type:"string",enum:["fuzzy","contiguous"],enumDescriptions:[p("defaultFindMatchTypeSettingKey.fuzzy","Use fuzzy matching when searching."),p("defaultFindMatchTypeSettingKey.contiguous","Use contiguous matching when searching.")],default:"fuzzy",description:p("defaultFindMatchTypeSettingKey","Controls the type of matching used when searching lists and trees in the workbench.")},[VE]:{type:"string",enum:["singleClick","doubleClick"],default:"singleClick",description:p("expand mode","Controls how tree folders are expanded when clicking the folder names. Note that some trees and lists might choose to ignore this setting if it is not applicable.")},[HE]:{type:"boolean",default:!0,description:p("sticky scroll","Controls whether sticky scrolling is enabled in trees.")},[UE]:{type:"number",minimum:1,default:7,markdownDescription:p("sticky scroll maximum items","Controls the number of sticky elements displayed in the tree when `#workbench.tree.enableStickyScroll#` is enabled.")},[aO]:{type:"string",enum:["automatic","trigger"],default:"automatic",markdownDescription:p("typeNavigationMode2","Controls how type navigation works in lists and trees in the workbench. When set to `trigger`, type navigation begins once the `list.triggerTypeNavigation` command is run.")}}});Qi();le();oo();Lt();_();v();b();ke();_();v();b();ke();Ef();le();hs();var Uh=class n extends H{constructor(e,t){var i;super(),this.options=t,this.text="",this.title="",this.highlights=[],this.didEverRender=!1,this.supportIcons=(i=t?.supportIcons)!==null&&i!==void 0?i:!1,this.domNode=me(e,ve("span.monaco-highlighted-label"))}get element(){return this.domNode}set(e,t=[],i="",o){e||(e=""),o&&(e=n.escapeNewLines(e,t)),!(this.didEverRender&&this.text===e&&this.title===i&&hn(this.highlights,t))&&(this.text=e,this.title=i,this.highlights=t,this.render())}render(){var e,t,i,o;let s=[],r=0;for(let a of this.highlights){if(a.end===a.start)continue;if(r{o=s===`\r +`?-1:0,r+=i;for(let a of t)a.end<=r||(a.start>=r&&(a.start+=o),a.end>=r&&(a.end+=o));return i+=o,"\u23CE"})}};le();hs();xi();xp();var Qf=class{constructor(e){this._element=e}get element(){return this._element}set textContent(e){this.disposed||e===this._textContent||(this._textContent=e,this._element.textContent=e)}set className(e){this.disposed||e===this._className||(this._className=e,this._element.className=e)}set empty(e){this.disposed||e===this._empty||(this._empty=e,this._element.style.marginLeft=e?"0":"")}dispose(){this.disposed=!0}},f1=class extends H{constructor(e,t){var i;super(),this.customHovers=new Map,this.creationOptions=t,this.domNode=this._register(new Qf(me(e,ve(".monaco-icon-label")))),this.labelContainer=me(this.domNode.element,ve(".monaco-icon-label-container")),this.nameContainer=me(this.labelContainer,ve("span.monaco-icon-name-container")),t?.supportHighlights||t?.supportIcons?this.nameNode=this._register(new dO(this.nameContainer,!!t.supportIcons)):this.nameNode=new cO(this.nameContainer),this.hoverDelegate=(i=t?.hoverDelegate)!==null&&i!==void 0?i:ji("mouse")}get element(){return this.domNode.element}setLabel(e,t,i){var o;let s=["monaco-icon-label"],r=["monaco-icon-label-container"],a="";if(i&&(i.extraClasses&&s.push(...i.extraClasses),i.italic&&s.push("italic"),i.strikethrough&&s.push("strikethrough"),i.disabledCommand&&r.push("disabled"),i.title&&(typeof i.title=="string"?a+=i.title:a+=e)),this.domNode.className=s.join(" "),this.domNode.element.setAttribute("aria-label",a),this.labelContainer.className=r.join(" "),this.setupHover(i?.descriptionTitle?this.labelContainer:this.element,i?.title),this.nameNode.setLabel(e,i),t||this.descriptionNode){let l=this.getOrCreateDescriptionNode();l instanceof Uh?(l.set(t||"",i?i.descriptionMatches:void 0,void 0,i?.labelEscapeNewLines),this.setupHover(l.element,i?.descriptionTitle)):(l.textContent=t&&i?.labelEscapeNewLines?Uh.escapeNewLines(t,[]):t||"",this.setupHover(l.element,i?.descriptionTitle||""),l.empty=!t)}if(i?.suffix||this.suffixNode){let l=this.getOrCreateSuffixNode();l.textContent=(o=i?.suffix)!==null&&o!==void 0?o:""}}setupHover(e,t){let i=this.customHovers.get(e);if(i&&(i.dispose(),this.customHovers.delete(e)),!t){e.removeAttribute("title");return}if(this.hoverDelegate.showNativeHover){let s=function(r,a){tn(a)?r.title=pD(a):a?.markdownNotSupportedFallback?r.title=a.markdownNotSupportedFallback:r.removeAttribute("title")};var o=s;s(e,t)}else{let s=Qn().setupUpdatableHover(this.hoverDelegate,e,t);s&&this.customHovers.set(e,s)}}dispose(){super.dispose();for(let e of this.customHovers.values())e.dispose();this.customHovers.clear()}getOrCreateSuffixNode(){if(!this.suffixNode){let e=this._register(new Qf(q7(this.nameContainer,ve("span.monaco-icon-suffix-container"))));this.suffixNode=this._register(new Qf(me(e.element,ve("span.label-suffix"))))}return this.suffixNode}getOrCreateDescriptionNode(){var e;if(!this.descriptionNode){let t=this._register(new Qf(me(this.labelContainer,ve("span.monaco-icon-description-container"))));!((e=this.creationOptions)===null||e===void 0)&&e.supportDescriptionHighlights?this.descriptionNode=this._register(new Uh(me(t.element,ve("span.label-description")),{supportIcons:!!this.creationOptions.supportIcons})):this.descriptionNode=this._register(new Qf(me(t.element,ve("span.label-description"))))}return this.descriptionNode}},cO=class{constructor(e){this.container=e,this.label=void 0,this.singleLabel=void 0}setLabel(e,t){if(!(this.label===e&&hn(this.options,t)))if(this.label=e,this.options=t,typeof e=="string")this.singleLabel||(this.container.innerText="",this.container.classList.remove("multiple"),this.singleLabel=me(this.container,ve("a.label-name",{id:t?.domId}))),this.singleLabel.textContent=e;else{this.container.innerText="",this.container.classList.add("multiple"),this.singleLabel=void 0;for(let i=0;i{let s={start:i,end:i+o.length},r=t.map(a=>cn.intersect(s,a)).filter(a=>!cn.isEmpty(a)).map(({start:a,end:l})=>({start:a-i,end:l-i}));return i=s.end+e.length,r})}var dO=class extends H{constructor(e,t){super(),this.container=e,this.supportIcons=t,this.label=void 0,this.singleLabel=void 0}setLabel(e,t){if(!(this.label===e&&hn(this.options,t)))if(this.label=e,this.options=t,typeof e=="string")this.singleLabel||(this.container.innerText="",this.container.classList.remove("multiple"),this.singleLabel=this._register(new Uh(me(this.container,ve("a.label-name",{id:t?.domId})),{supportIcons:this.supportIcons}))),this.singleLabel.set(e,t?.matches,void 0,t?.labelEscapeNewLines);else{this.container.innerText="",this.container.classList.add("multiple"),this.singleLabel=void 0;let i=t?.separator||"/",o=UQ(e,i,t?.matches);for(let s=0;s{let n=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"});return{collator:n,collatorIsNumeric:n.resolvedOptions().numeric}}),Olt=new qn(()=>({collator:new Intl.Collator(void 0,{numeric:!0})})),Flt=new qn(()=>({collator:new Intl.Collator(void 0,{numeric:!0,sensitivity:"accent"})}));function KQ(n,e,t=!1){let i=n||"",o=e||"",s=yU.value.collator.compare(i,o);return yU.value.collatorIsNumeric&&s===0&&i!==o?io.length)return 1}return 0}ot();Gt();xt();var t2=function(n,e,t,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},LU=function(n,e){return function(t,i){e(t,i,n)}},hO,sl=ve,Ui;(function(n){n[n.First=1]="First",n[n.Second=2]="Second",n[n.Last=3]="Last",n[n.Next=4]="Next",n[n.Previous=5]="Previous",n[n.NextPage=6]="NextPage",n[n.PreviousPage=7]="PreviousPage",n[n.NextSeparator=8]="NextSeparator",n[n.PreviousSeparator=9]="PreviousSeparator"})(Ui||(Ui={}));var JE=class{constructor(e,t,i){this.index=e,this.hasCheckbox=t,this._hidden=!1,this._init=new qn(()=>{var o;let s=(o=i.label)!==null&&o!==void 0?o:"",r=Sp(s).text.trim(),a=i.ariaLabel||[s,this.saneDescription,this.saneDetail].map(l=>EV(l)).filter(l=>!!l).join(", ");return{saneLabel:s,saneSortLabel:r,saneAriaLabel:a}}),this._saneDescription=i.description,this._saneTooltip=i.tooltip}get saneLabel(){return this._init.value.saneLabel}get saneSortLabel(){return this._init.value.saneSortLabel}get saneAriaLabel(){return this._init.value.saneAriaLabel}get element(){return this._element}set element(e){this._element=e}get hidden(){return this._hidden}set hidden(e){this._hidden=e}get saneDescription(){return this._saneDescription}set saneDescription(e){this._saneDescription=e}get saneDetail(){return this._saneDetail}set saneDetail(e){this._saneDetail=e}get saneTooltip(){return this._saneTooltip}set saneTooltip(e){this._saneTooltip=e}get labelHighlights(){return this._labelHighlights}set labelHighlights(e){this._labelHighlights=e}get descriptionHighlights(){return this._descriptionHighlights}set descriptionHighlights(e){this._descriptionHighlights=e}get detailHighlights(){return this._detailHighlights}set detailHighlights(e){this._detailHighlights=e}},to=class extends JE{constructor(e,t,i,o,s,r){var a,l,c;super(e,t,s),this.fireButtonTriggered=i,this._onChecked=o,this.item=s,this._separator=r,this._checked=!1,this.onChecked=t?ie.map(ie.filter(this._onChecked.event,d=>d.element===this),d=>d.checked):ie.None,this._saneDetail=s.detail,this._labelHighlights=(a=s.highlights)===null||a===void 0?void 0:a.label,this._descriptionHighlights=(l=s.highlights)===null||l===void 0?void 0:l.description,this._detailHighlights=(c=s.highlights)===null||c===void 0?void 0:c.detail}get separator(){return this._separator}set separator(e){this._separator=e}get checked(){return this._checked}set checked(e){e!==this._checked&&(this._checked=e,this._onChecked.fire({element:this,checked:e}))}get checkboxDisabled(){return!!this.item.disabled}},hc;(function(n){n[n.NONE=0]="NONE",n[n.MOUSE_HOVER=1]="MOUSE_HOVER",n[n.ACTIVE_ITEM=2]="ACTIVE_ITEM"})(hc||(hc={}));var uc=class extends JE{constructor(e,t,i){super(e,!1,i),this.fireSeparatorButtonTriggered=t,this.separator=i,this.children=new Array,this.focusInsideSeparator=hc.NONE}},uO=class{getHeight(e){return e instanceof uc?30:e.saneDetail?44:22}getTemplateId(e){return e instanceof to?g1.ID:m1.ID}},fO=class{getWidgetAriaLabel(){return p("quickInput","Quick Input")}getAriaLabel(e){var t;return!((t=e.separator)===null||t===void 0)&&t.label?`${e.saneAriaLabel}, ${e.separator.label}`:e.saneAriaLabel}getWidgetRole(){return"listbox"}getRole(e){return e.hasCheckbox?"checkbox":"option"}isChecked(e){if(!(!e.hasCheckbox||!(e instanceof to)))return{get value(){return e.checked},onDidChange:t=>e.onChecked(()=>t())}}},e2=class{constructor(e){this.hoverDelegate=e}renderTemplate(e){let t=Object.create(null);t.toDisposeElement=new ae,t.toDisposeTemplate=new ae,t.entry=me(e,sl(".quick-input-list-entry"));let i=me(t.entry,sl("label.quick-input-list-label"));t.toDisposeTemplate.add(Ut(i,se.CLICK,c=>{t.checkbox.offsetParent||c.preventDefault()})),t.checkbox=me(i,sl("input.quick-input-list-checkbox")),t.checkbox.type="checkbox";let o=me(i,sl(".quick-input-list-rows")),s=me(o,sl(".quick-input-list-row")),r=me(o,sl(".quick-input-list-row"));t.label=new f1(s,{supportHighlights:!0,supportDescriptionHighlights:!0,supportIcons:!0,hoverDelegate:this.hoverDelegate}),t.toDisposeTemplate.add(t.label),t.icon=Ug(t.label.element,sl(".quick-input-list-icon"));let a=me(s,sl(".quick-input-list-entry-keybinding"));t.keybinding=new QE(a,po),t.toDisposeTemplate.add(t.keybinding);let l=me(r,sl(".quick-input-list-label-meta"));return t.detail=new f1(l,{supportHighlights:!0,supportIcons:!0,hoverDelegate:this.hoverDelegate}),t.toDisposeTemplate.add(t.detail),t.separator=me(t.entry,sl(".quick-input-list-separator")),t.actionBar=new Eo(t.entry,this.hoverDelegate?{hoverDelegate:this.hoverDelegate}:void 0),t.actionBar.domNode.classList.add("quick-input-list-entry-action-bar"),t.toDisposeTemplate.add(t.actionBar),t}disposeTemplate(e){e.toDisposeElement.dispose(),e.toDisposeTemplate.dispose()}disposeElement(e,t,i){i.toDisposeElement.clear(),i.actionBar.clear()}},g1=hO=class extends e2{constructor(e,t){super(e),this.themeService=t,this._itemsWithSeparatorsFrequency=new Map}get templateId(){return hO.ID}renderTemplate(e){let t=super.renderTemplate(e);return t.toDisposeTemplate.add(Ut(t.checkbox,se.CHANGE,i=>{t.element.checked=t.checkbox.checked})),t}renderElement(e,t,i){var o,s,r;let a=e.element;i.element=a,a.element=(o=i.entry)!==null&&o!==void 0?o:void 0;let l=a.item;i.checkbox.checked=a.checked,i.toDisposeElement.add(a.onChecked(m=>i.checkbox.checked=m)),i.checkbox.disabled=a.checkboxDisabled;let{labelHighlights:c,descriptionHighlights:d,detailHighlights:h}=a;if(l.iconPath){let m=Qu(this.themeService.getColorTheme().type)?l.iconPath.dark:(s=l.iconPath.light)!==null&&s!==void 0?s:l.iconPath.dark,C=Oe.revive(m);i.icon.className="quick-input-list-icon",i.icon.style.backgroundImage=Mr(C)}else i.icon.style.backgroundImage="",i.icon.className=l.iconClass?`quick-input-list-icon ${l.iconClass}`:"";let u;!a.saneTooltip&&a.saneDescription&&(u={markdown:{value:a.saneDescription,supportThemeIcons:!0},markdownNotSupportedFallback:a.saneDescription});let f={matches:c||[],descriptionTitle:u,descriptionMatches:d||[],labelEscapeNewLines:!0};if(f.extraClasses=l.iconClasses,f.italic=l.italic,f.strikethrough=l.strikethrough,i.entry.classList.remove("quick-input-list-separator-as-item"),i.label.setLabel(a.saneLabel,a.saneDescription,f),i.keybinding.set(l.keybinding),a.saneDetail){let m;a.saneTooltip||(m={markdown:{value:a.saneDetail,supportThemeIcons:!0},markdownNotSupportedFallback:a.saneDetail}),i.detail.element.style.display="",i.detail.setLabel(a.saneDetail,void 0,{matches:h,title:m,labelEscapeNewLines:!0})}else i.detail.element.style.display="none";!((r=a.separator)===null||r===void 0)&&r.label?(i.separator.textContent=a.separator.label,i.separator.style.display="",this.addItemWithSeparator(a)):i.separator.style.display="none",i.entry.classList.toggle("quick-input-list-separator-border",!!a.separator);let g=l.buttons;g&&g.length?(i.actionBar.push(g.map((m,C)=>Qp(m,`id-${C}`,()=>a.fireButtonTriggered({button:m,item:a.item}))),{icon:!0,label:!1}),i.entry.classList.add("has-actions")):i.entry.classList.remove("has-actions")}disposeElement(e,t,i){this.removeItemWithSeparator(e.element),super.disposeElement(e,t,i)}isItemWithSeparatorVisible(e){return this._itemsWithSeparatorsFrequency.has(e)}addItemWithSeparator(e){this._itemsWithSeparatorsFrequency.set(e,(this._itemsWithSeparatorsFrequency.get(e)||0)+1)}removeItemWithSeparator(e){let t=this._itemsWithSeparatorsFrequency.get(e)||0;t>1?this._itemsWithSeparatorsFrequency.set(e,t-1):this._itemsWithSeparatorsFrequency.delete(e)}};g1.ID="quickpickitem";g1=hO=t2([LU(1,an)],g1);var m1=class n extends e2{constructor(){super(...arguments),this._visibleSeparatorsFrequency=new Map}get templateId(){return n.ID}get visibleSeparators(){return[...this._visibleSeparatorsFrequency.keys()]}isSeparatorVisible(e){return this._visibleSeparatorsFrequency.has(e)}renderElement(e,t,i){var o;let s=e.element;i.element=s,s.element=(o=i.entry)!==null&&o!==void 0?o:void 0,s.element.classList.toggle("focus-inside",!!s.focusInsideSeparator);let r=s.separator,{labelHighlights:a,descriptionHighlights:l,detailHighlights:c}=s;i.icon.style.backgroundImage="",i.icon.className="";let d;!s.saneTooltip&&s.saneDescription&&(d={markdown:{value:s.saneDescription,supportThemeIcons:!0},markdownNotSupportedFallback:s.saneDescription});let h={matches:a||[],descriptionTitle:d,descriptionMatches:l||[],labelEscapeNewLines:!0};if(i.entry.classList.add("quick-input-list-separator-as-item"),i.label.setLabel(s.saneLabel,s.saneDescription,h),s.saneDetail){let f;s.saneTooltip||(f={markdown:{value:s.saneDetail,supportThemeIcons:!0},markdownNotSupportedFallback:s.saneDetail}),i.detail.element.style.display="",i.detail.setLabel(s.saneDetail,void 0,{matches:c,title:f,labelEscapeNewLines:!0})}else i.detail.element.style.display="none";i.separator.style.display="none",i.entry.classList.add("quick-input-list-separator-border");let u=r.buttons;u&&u.length?(i.actionBar.push(u.map((f,g)=>Qp(f,`id-${g}`,()=>s.fireSeparatorButtonTriggered({button:f,separator:s.separator}))),{icon:!0,label:!1}),i.entry.classList.add("has-actions")):i.entry.classList.remove("has-actions"),this.addSeparator(s)}disposeElement(e,t,i){var o;this.removeSeparator(e.element),this.isSeparatorVisible(e.element)||(o=e.element.element)===null||o===void 0||o.classList.remove("focus-inside"),super.disposeElement(e,t,i)}addSeparator(e){this._visibleSeparatorsFrequency.set(e,(this._visibleSeparatorsFrequency.get(e)||0)+1)}removeSeparator(e){let t=this._visibleSeparatorsFrequency.get(e)||0;t>1?this._visibleSeparatorsFrequency.set(e,t-1):this._visibleSeparatorsFrequency.delete(e)}};m1.ID="quickpickseparator";var o_=class extends H{constructor(e,t,i,o,s){super(),this.parent=e,this.hoverDelegate=t,this.linkOpenerDelegate=i,this._onKeyDown=new B,this.onKeyDown=this._onKeyDown.event,this._onLeave=new B,this.onLeave=this._onLeave.event,this._onChangedAllVisibleChecked=new B,this.onChangedAllVisibleChecked=this._onChangedAllVisibleChecked.event,this._onChangedCheckedCount=new B,this.onChangedCheckedCount=this._onChangedCheckedCount.event,this._onChangedVisibleCount=new B,this.onChangedVisibleCount=this._onChangedVisibleCount.event,this._onChangedCheckedElements=new B,this.onChangedCheckedElements=this._onChangedCheckedElements.event,this._onButtonTriggered=new B,this.onButtonTriggered=this._onButtonTriggered.event,this._onSeparatorButtonTriggered=new B,this.onSeparatorButtonTriggered=this._onSeparatorButtonTriggered.event,this._onTriggerEmptySelectionOrFocus=new B,this._elementChecked=new B,this._inputElements=new Array,this._elementTree=new Array,this._itemElements=new Array,this._elementDisposable=this._register(new ae),this._shouldFireCheckedEvents=!0,this._matchOnDescription=!1,this._matchOnDetail=!1,this._matchOnLabel=!0,this._matchOnLabelMode="fuzzy",this._sortByLabel=!0,this._container=me(this.parent,sl(".quick-input-list")),this._separatorRenderer=new m1(t),this._itemRenderer=s.createInstance(g1,t),this._tree=this._register(s.createInstance($E,"QuickInput",this._container,new uO,[this._itemRenderer,this._separatorRenderer],{accessibilityProvider:new fO,setRowLineHeight:!1,multipleSelectionSupport:!1,hideTwistiesOfChildlessElements:!0,renderIndentGuides:Gf.None,findWidgetEnabled:!1,indent:0,horizontalScrolling:!1,allowNonCollapsibleParents:!0,identityProvider:{getId:r=>{let a=r.item||r.separator;if(a===void 0)return"";if(a.id!==void 0)return a.id;let l=`label:${a.label}`;return l+=`$$description:${a.description}`,a.type!=="separator"&&(l+=`$$detail:${a.detail}`),l}},alwaysConsumeMouseWheel:!0})),this._tree.getHTMLElement().id=o,this._registerListeners()}get onDidChangeFocus(){return ie.map(ie.any(this._tree.onDidChangeFocus,this._onTriggerEmptySelectionOrFocus.event),e=>e.elements.filter(t=>t instanceof to).map(t=>t.item))}get onDidChangeSelection(){return ie.map(ie.any(this._tree.onDidChangeSelection,this._onTriggerEmptySelectionOrFocus.event),e=>({items:e.elements.filter(t=>t instanceof to).map(t=>t.item),event:e.browserEvent}))}get scrollTop(){return this._tree.scrollTop}set scrollTop(e){this._tree.scrollTop=e}get ariaLabel(){return this._tree.ariaLabel}set ariaLabel(e){this._tree.ariaLabel=e??""}set enabled(e){this._tree.getHTMLElement().style.pointerEvents=e?"":"none"}get matchOnDescription(){return this._matchOnDescription}set matchOnDescription(e){this._matchOnDescription=e}get matchOnDetail(){return this._matchOnDetail}set matchOnDetail(e){this._matchOnDetail=e}get matchOnLabel(){return this._matchOnLabel}set matchOnLabel(e){this._matchOnLabel=e}get matchOnLabelMode(){return this._matchOnLabelMode}set matchOnLabelMode(e){this._matchOnLabelMode=e}get sortByLabel(){return this._sortByLabel}set sortByLabel(e){this._sortByLabel=e}_registerListeners(){this._registerOnKeyDown(),this._registerOnContainerClick(),this._registerOnMouseMiddleClick(),this._registerOnElementChecked(),this._registerOnContextMenu(),this._registerHoverListeners(),this._registerSelectionChangeListener(),this._registerSeparatorActionShowingListeners()}_registerOnKeyDown(){this._register(this._tree.onKeyDown(e=>{let t=new bt(e);switch(t.keyCode){case 10:this.toggleCheckbox();break;case 31:(Be?e.metaKey:e.ctrlKey)&&this._tree.setFocus(this._itemElements);break;case 16:{let i=this._tree.getFocus();i.length===1&&i[0]===this._itemElements[0]&&this._onLeave.fire();break}case 18:{let i=this._tree.getFocus();i.length===1&&i[0]===this._itemElements[this._itemElements.length-1]&&this._onLeave.fire();break}}this._onKeyDown.fire(t)}))}_registerOnContainerClick(){this._register($(this._container,se.CLICK,e=>{(e.x||e.y)&&this._onLeave.fire()}))}_registerOnMouseMiddleClick(){this._register($(this._container,se.AUXCLICK,e=>{e.button===1&&this._onLeave.fire()}))}_registerOnElementChecked(){this._register(this._elementChecked.event(e=>this._fireCheckedEvents()))}_registerOnContextMenu(){this._register(this._tree.onContextMenu(e=>{e.element&&(e.browserEvent.preventDefault(),this._tree.setSelection([e.element]))}))}_registerHoverListeners(){let e=this._register(new Pg(this.hoverDelegate.delay));this._register(this._tree.onMouseOver(async t=>{var i;if(t.browserEvent.target instanceof HTMLAnchorElement){e.cancel();return}if(!(!(t.browserEvent.relatedTarget instanceof HTMLAnchorElement)&&yi(t.browserEvent.relatedTarget,(i=t.element)===null||i===void 0?void 0:i.element)))try{await e.trigger(async()=>{t.element instanceof to&&this.showHover(t.element)})}catch(o){if(!yd(o))throw o}})),this._register(this._tree.onMouseOut(t=>{var i;yi(t.browserEvent.relatedTarget,(i=t.element)===null||i===void 0?void 0:i.element)||e.cancel()}))}_registerSeparatorActionShowingListeners(){this._register(this._tree.onDidChangeFocus(e=>{let t=e.elements[0]?this._tree.getParentElement(e.elements[0]):null;for(let i of this._separatorRenderer.visibleSeparators){let o=i===t;!!(i.focusInsideSeparator&hc.ACTIVE_ITEM)!==o&&(o?i.focusInsideSeparator|=hc.ACTIVE_ITEM:i.focusInsideSeparator&=~hc.ACTIVE_ITEM,this._tree.rerender(i))}})),this._register(this._tree.onMouseOver(e=>{let t=e.element?this._tree.getParentElement(e.element):null;for(let i of this._separatorRenderer.visibleSeparators){if(i!==t)continue;!!(i.focusInsideSeparator&hc.MOUSE_HOVER)||(i.focusInsideSeparator|=hc.MOUSE_HOVER,this._tree.rerender(i))}})),this._register(this._tree.onMouseOut(e=>{let t=e.element?this._tree.getParentElement(e.element):null;for(let i of this._separatorRenderer.visibleSeparators){if(i!==t)continue;!!(i.focusInsideSeparator&hc.MOUSE_HOVER)&&(i.focusInsideSeparator&=~hc.MOUSE_HOVER,this._tree.rerender(i))}}))}_registerSelectionChangeListener(){this._register(this._tree.onDidChangeSelection(e=>{let t=e.elements.filter(i=>i instanceof to);t.length!==e.elements.length&&(e.elements.length===1&&e.elements[0]instanceof uc&&(this._tree.setFocus([e.elements[0].children[0]]),this._tree.reveal(e.elements[0],0)),this._tree.setSelection(t))}))}getAllVisibleChecked(){return this._allVisibleChecked(this._itemElements,!1)}getCheckedCount(){return this._itemElements.filter(e=>e.checked).length}getVisibleCount(){return this._itemElements.filter(e=>!e.hidden).length}setAllVisibleChecked(e){try{this._shouldFireCheckedEvents=!1,this._itemElements.forEach(t=>{!t.hidden&&!t.checkboxDisabled&&(t.checked=e)})}finally{this._shouldFireCheckedEvents=!0,this._fireCheckedEvents()}}setElements(e){this._elementDisposable.clear(),this._inputElements=e;let t=this.parent.classList.contains("show-checkboxes"),i;this._itemElements=new Array,this._elementTree=e.reduce((r,a,l)=>{let c;if(a.type==="separator"){if(!a.buttons)return r;i=new uc(l,d=>this.fireSeparatorButtonTriggered(d),a),c=i}else{let d=l>0?e[l-1]:void 0,h;d&&d.type==="separator"&&!d.buttons&&(i=void 0,h=d);let u=new to(l,t,f=>this.fireButtonTriggered(f),this._elementChecked,a,h);if(this._itemElements.push(u),i)return i.children.push(u),r;c=u}return r.push(c),r},new Array);let o=new Array,s=0;for(let r of this._elementTree)r instanceof uc?(o.push({element:r,collapsible:!1,collapsed:!1,children:r.children.map(a=>({element:a,collapsible:!1,collapsed:!1}))}),s+=r.children.length+1):(o.push({element:r,collapsible:!1,collapsed:!1}),s++);this._tree.setChildren(null,o),this._onChangedVisibleCount.fire(s)}setFocusedElements(e){let t=e.map(i=>this._itemElements.find(o=>o.item===i)).filter(i=>!!i);if(this._tree.setFocus(t),e.length>0){let i=this._tree.getFocus()[0];i&&this._tree.reveal(i)}}getActiveDescendant(){return this._tree.getHTMLElement().getAttribute("aria-activedescendant")}setSelectedElements(e){let t=e.map(i=>this._itemElements.find(o=>o.item===i)).filter(i=>!!i);this._tree.setSelection(t)}getCheckedElements(){return this._itemElements.filter(e=>e.checked).map(e=>e.item)}setCheckedElements(e){try{this._shouldFireCheckedEvents=!1;let t=new Set;for(let i of e)t.add(i);for(let i of this._itemElements)i.checked=t.has(i.item)}finally{this._shouldFireCheckedEvents=!0,this._fireCheckedEvents()}}focus(e){var t;if(this._itemElements.length)switch(e===Ui.Second&&this._itemElements.length<2&&(e=Ui.First),e){case Ui.First:this._tree.scrollTop=0,this._tree.focusFirst(void 0,i=>i.element instanceof to);break;case Ui.Second:this._tree.scrollTop=0,this._tree.setFocus([this._itemElements[1]]);break;case Ui.Last:this._tree.scrollTop=this._tree.scrollHeight,this._tree.setFocus([this._itemElements[this._itemElements.length-1]]);break;case Ui.Next:this._tree.focusNext(void 0,!0,void 0,i=>i.element instanceof to?(this._tree.reveal(i.element),!0):!1);break;case Ui.Previous:this._tree.focusPrevious(void 0,!0,void 0,i=>{if(!(i.element instanceof to))return!1;let o=this._tree.getParentElement(i.element);return o===null||o.children[0]!==i.element?this._tree.reveal(i.element):this._tree.reveal(o),!0});break;case Ui.NextPage:this._tree.focusNextPage(void 0,i=>i.element instanceof to?(this._tree.reveal(i.element),!0):!1);break;case Ui.PreviousPage:this._tree.focusPreviousPage(void 0,i=>{if(!(i.element instanceof to))return!1;let o=this._tree.getParentElement(i.element);return o===null||o.children[0]!==i.element?this._tree.reveal(i.element):this._tree.reveal(o),!0});break;case Ui.NextSeparator:{let i=!1,o=this._tree.getFocus()[0];this._tree.focusNext(void 0,!0,void 0,r=>{if(i)return!0;if(r.element instanceof uc)i=!0,this._separatorRenderer.isSeparatorVisible(r.element)?this._tree.reveal(r.element.children[0]):this._tree.reveal(r.element,0);else if(r.element instanceof to){if(r.element.separator)return this._itemRenderer.isItemWithSeparatorVisible(r.element)?this._tree.reveal(r.element):this._tree.reveal(r.element,0),!0;if(r.element===this._elementTree[0])return this._tree.reveal(r.element,0),!0}return!1});let s=this._tree.getFocus()[0];o===s&&(this._tree.scrollTop=this._tree.scrollHeight,this._tree.setFocus([this._itemElements[this._itemElements.length-1]]));break}case Ui.PreviousSeparator:{let i,o=!!(!((t=this._tree.getFocus()[0])===null||t===void 0)&&t.separator);this._tree.focusPrevious(void 0,!0,void 0,s=>{if(s.element instanceof uc)o?i||(this._separatorRenderer.isSeparatorVisible(s.element)?this._tree.reveal(s.element):this._tree.reveal(s.element,0),i=s.element.children[0]):o=!0;else if(s.element instanceof to&&!i){if(s.element.separator)this._itemRenderer.isItemWithSeparatorVisible(s.element)?this._tree.reveal(s.element):this._tree.reveal(s.element,0),i=s.element;else if(s.element===this._elementTree[0])return this._tree.reveal(s.element,0),!0}return!1}),i&&this._tree.setFocus([i]);break}}}clearFocus(){this._tree.setFocus([])}domFocus(){this._tree.domFocus()}layout(e){this._tree.getHTMLElement().style.maxHeight=e?`${Math.floor(e/44)*44+6}px`:"",this._tree.layout()}filter(e){if(!(this._sortByLabel||this._matchOnLabel||this._matchOnDescription||this._matchOnDetail))return this._tree.layout(),!1;let t=e;if(e=e.trim(),!e||!(this.matchOnLabel||this.matchOnDescription||this.matchOnDetail))this._itemElements.forEach(l=>{l.labelHighlights=void 0,l.descriptionHighlights=void 0,l.detailHighlights=void 0,l.hidden=!1;let c=l.index&&this._inputElements[l.index-1];l.item&&(l.separator=c&&c.type==="separator"&&!c.buttons?c:void 0)});else{let l;this._elementTree.forEach(c=>{var d,h,u,f;let g;this.matchOnLabelMode==="fuzzy"?g=this.matchOnLabel&&(d=_D(e,Sp(c.saneLabel)))!==null&&d!==void 0?d:void 0:g=this.matchOnLabel&&(h=qQ(t,Sp(c.saneLabel)))!==null&&h!==void 0?h:void 0;let m=this.matchOnDescription&&(u=_D(e,Sp(c.saneDescription||"")))!==null&&u!==void 0?u:void 0,C=this.matchOnDetail&&(f=_D(e,Sp(c.saneDetail||"")))!==null&&f!==void 0?f:void 0;if(g||m||C?(c.labelHighlights=g,c.descriptionHighlights=m,c.detailHighlights=C,c.hidden=!1):(c.labelHighlights=void 0,c.descriptionHighlights=void 0,c.detailHighlights=void 0,c.hidden=c.item?!c.item.alwaysShow:!0),c.item?c.separator=void 0:c.separator&&(c.hidden=!0),!this.sortByLabel){let S=c.index&&this._inputElements[c.index-1];l=S&&S.type==="separator"?S:l,l&&!c.hidden&&(c.separator=l,l=void 0)}})}let i=this._elementTree.filter(l=>!l.hidden);if(this.sortByLabel&&e){let l=e.toLowerCase();i.sort((c,d)=>jQ(c,d,l))}let o,s=i.reduce((l,c,d)=>(c instanceof to?o?o.children.push(c):l.push(c):c instanceof uc&&(c.children=[],o=c,l.push(c)),l),new Array),r=new Array;for(let l of s)l instanceof uc?r.push({element:l,collapsible:!1,collapsed:!1,children:l.children.map(c=>({element:c,collapsible:!1,collapsed:!1}))}):r.push({element:l,collapsible:!1,collapsed:!1});let a=this._tree.getFocus().length;return this._tree.setChildren(null,r),a>0&&r.length===0&&this._onTriggerEmptySelectionOrFocus.fire({elements:[]}),this._tree.layout(),this._onChangedAllVisibleChecked.fire(this.getAllVisibleChecked()),this._onChangedVisibleCount.fire(i.length),!0}toggleCheckbox(){try{this._shouldFireCheckedEvents=!1;let e=this._tree.getFocus().filter(i=>i instanceof to),t=this._allVisibleChecked(e);for(let i of e)i.checkboxDisabled||(i.checked=!t)}finally{this._shouldFireCheckedEvents=!0,this._fireCheckedEvents()}}display(e){this._container.style.display=e?"":"none"}isDisplayed(){return this._container.style.display!=="none"}style(e){this._tree.style(e)}toggleHover(){let e=this._tree.getFocus()[0];if(!e?.saneTooltip||!(e instanceof to))return;if(this._lastHover&&!this._lastHover.isDisposed){this._lastHover.dispose();return}this.showHover(e);let t=new ae;t.add(this._tree.onDidChangeFocus(i=>{i.elements[0]instanceof to&&this.showHover(i.elements[0])})),this._lastHover&&t.add(this._lastHover),this._elementDisposable.add(t)}_allVisibleChecked(e,t=!0){for(let i=0,o=e.length;i{this.linkOpenerDelegate(s)},appearance:{showPointer:!0},container:this._container,position:{hoverPosition:1}},!1))}};t2([Yt],o_.prototype,"onDidChangeFocus",null);t2([Yt],o_.prototype,"onDidChangeSelection",null);o_=t2([LU(4,Ye)],o_);function qQ(n,e){let{text:t,iconOffsets:i}=e;if(!i||i.length===0)return xU(n,t);let o=Sc(t," "),s=t.length-o.length,r=xU(n,o);if(r)for(let a of r){let l=i[a.start+s]+s;a.start+=l,a.end+=l}return r}function xU(n,e){let t=e.toLowerCase().indexOf(n.toLowerCase());return t!==-1?[{start:t,end:t+n.length}]:null}function jQ(n,e,t){let i=n.labelHighlights||[],o=e.labelHighlights||[];return i.length&&!o.length?-1:!i.length&&o.length?1:i.length===0&&o.length===0?0:SU(n.saneSortLabel,e.saneSortLabel,t)}var GQ=function(n,e,t,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},kU=function(n,e){return function(t,i){e(t,i,n)}},i2={iconClass:Xe.asClassName(ue.quickInputBack),tooltip:p("quickInput.back","Back"),handle:-1},p1=class n extends H{constructor(e){super(),this.ui=e,this._widgetUpdated=!1,this.visible=!1,this._enabled=!0,this._busy=!1,this._ignoreFocusOut=!1,this._buttons=[],this.buttonsUpdated=!1,this._toggles=[],this.togglesUpdated=!1,this.noValidationMessage=n.noPromptMessage,this._severity=Ci.Ignore,this.onDidTriggerButtonEmitter=this._register(new B),this.onDidHideEmitter=this._register(new B),this.onWillHideEmitter=this._register(new B),this.onDisposeEmitter=this._register(new B),this.visibleDisposables=this._register(new ae),this.onDidHide=this.onDidHideEmitter.event}get title(){return this._title}set title(e){this._title=e,this.update()}get description(){return this._description}set description(e){this._description=e,this.update()}get step(){return this._steps}set step(e){this._steps=e,this.update()}get totalSteps(){return this._totalSteps}set totalSteps(e){this._totalSteps=e,this.update()}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this.update()}get contextKey(){return this._contextKey}set contextKey(e){this._contextKey=e,this.update()}get busy(){return this._busy}set busy(e){this._busy=e,this.update()}get ignoreFocusOut(){return this._ignoreFocusOut}set ignoreFocusOut(e){let t=this._ignoreFocusOut!==e&&!Rs;this._ignoreFocusOut=e&&!Rs,t&&this.update()}get buttons(){return this._buttons}set buttons(e){this._buttons=e,this.buttonsUpdated=!0,this.update()}get toggles(){return this._toggles}set toggles(e){this._toggles=e??[],this.togglesUpdated=!0,this.update()}get validationMessage(){return this._validationMessage}set validationMessage(e){this._validationMessage=e,this.update()}get severity(){return this._severity}set severity(e){this._severity=e,this.update()}show(){this.visible||(this.visibleDisposables.add(this.ui.onDidTriggerButton(e=>{this.buttons.indexOf(e)!==-1&&this.onDidTriggerButtonEmitter.fire(e)})),this.ui.show(this),this.visible=!0,this._lastValidationMessage=void 0,this._lastSeverity=void 0,this.buttons.length&&(this.buttonsUpdated=!0),this.toggles.length&&(this.togglesUpdated=!0),this.update())}hide(){this.visible&&this.ui.hide()}didHide(e=Wh.Other){this.visible=!1,this.visibleDisposables.clear(),this.onDidHideEmitter.fire({reason:e})}willHide(e=Wh.Other){this.onWillHideEmitter.fire({reason:e})}update(){var e,t;if(!this.visible)return;let i=this.getTitle();i&&this.ui.title.textContent!==i?this.ui.title.textContent=i:!i&&this.ui.title.innerHTML!==" "&&(this.ui.title.innerText="\xA0");let o=this.getDescription();if(this.ui.description1.textContent!==o&&(this.ui.description1.textContent=o),this.ui.description2.textContent!==o&&(this.ui.description2.textContent=o),this._widgetUpdated&&(this._widgetUpdated=!1,this._widget?Wi(this.ui.widget,this._widget):Wi(this.ui.widget)),this.busy&&!this.busyDelay&&(this.busyDelay=new Xo,this.busyDelay.setIfNotSet(()=>{this.visible&&this.ui.progressBar.infinite()},800)),!this.busy&&this.busyDelay&&(this.ui.progressBar.stop(),this.busyDelay.cancel(),this.busyDelay=void 0),this.buttonsUpdated){this.buttonsUpdated=!1,this.ui.leftActionBar.clear();let r=this.buttons.filter(l=>l===i2).map((l,c)=>Qp(l,`id-${c}`,async()=>this.onDidTriggerButtonEmitter.fire(l)));this.ui.leftActionBar.push(r,{icon:!0,label:!1}),this.ui.rightActionBar.clear();let a=this.buttons.filter(l=>l!==i2).map((l,c)=>Qp(l,`id-${c}`,async()=>this.onDidTriggerButtonEmitter.fire(l)));this.ui.rightActionBar.push(a,{icon:!0,label:!1})}if(this.togglesUpdated){this.togglesUpdated=!1;let r=(t=(e=this.toggles)===null||e===void 0?void 0:e.filter(a=>a instanceof nd))!==null&&t!==void 0?t:[];this.ui.inputBox.toggles=r}this.ui.ignoreFocusOut=this.ignoreFocusOut,this.ui.setEnabled(this.enabled),this.ui.setContextKey(this.contextKey);let s=this.validationMessage||this.noValidationMessage;this._lastValidationMessage!==s&&(this._lastValidationMessage=s,Wi(this.ui.message),JH(s,this.ui.message,{callback:r=>{this.ui.linkOpenerDelegate(r)},disposables:this.visibleDisposables})),this._lastSeverity!==this.severity&&(this._lastSeverity=this.severity,this.showMessageDecoration(this.severity))}getTitle(){return this.title&&this.step?`${this.title} (${this.getSteps()})`:this.title?this.title:this.step?this.getSteps():""}getDescription(){return this.description||""}getSteps(){return this.step&&this.totalSteps?p("quickInput.steps","{0}/{1}",this.step,this.totalSteps):this.step?String(this.step):""}showMessageDecoration(e){if(this.ui.inputBox.showDecoration(e),e!==Ci.Ignore){let t=this.ui.inputBox.stylesForType(e);this.ui.message.style.color=t.foreground?`${t.foreground}`:"",this.ui.message.style.backgroundColor=t.background?`${t.background}`:"",this.ui.message.style.border=t.border?`1px solid ${t.border}`:"",this.ui.message.style.marginBottom="-2px"}else this.ui.message.style.color="",this.ui.message.style.backgroundColor="",this.ui.message.style.border="",this.ui.message.style.marginBottom=""}dispose(){this.hide(),this.onDisposeEmitter.fire(),super.dispose()}};p1.noPromptMessage=p("inputModeEntry","Press 'Enter' to confirm your input or 'Escape' to cancel");var s_=class n extends p1{constructor(){super(...arguments),this._value="",this.onDidChangeValueEmitter=this._register(new B),this.onWillAcceptEmitter=this._register(new B),this.onDidAcceptEmitter=this._register(new B),this.onDidCustomEmitter=this._register(new B),this._items=[],this.itemsUpdated=!1,this._canSelectMany=!1,this._canAcceptInBackground=!1,this._matchOnDescription=!1,this._matchOnDetail=!1,this._matchOnLabel=!0,this._matchOnLabelMode="fuzzy",this._sortByLabel=!0,this._keepScrollPosition=!1,this._itemActivation=la.FIRST,this._activeItems=[],this.activeItemsUpdated=!1,this.activeItemsToConfirm=[],this.onDidChangeActiveEmitter=this._register(new B),this._selectedItems=[],this.selectedItemsUpdated=!1,this.selectedItemsToConfirm=[],this.onDidChangeSelectionEmitter=this._register(new B),this.onDidTriggerItemButtonEmitter=this._register(new B),this.onDidTriggerSeparatorButtonEmitter=this._register(new B),this.valueSelectionUpdated=!0,this._ok="default",this._customButton=!1,this.filterValue=e=>e,this.onDidChangeValue=this.onDidChangeValueEmitter.event,this.onWillAccept=this.onWillAcceptEmitter.event,this.onDidAccept=this.onDidAcceptEmitter.event,this.onDidChangeActive=this.onDidChangeActiveEmitter.event,this.onDidChangeSelection=this.onDidChangeSelectionEmitter.event,this.onDidTriggerItemButton=this.onDidTriggerItemButtonEmitter.event,this.onDidTriggerSeparatorButton=this.onDidTriggerSeparatorButtonEmitter.event}get quickNavigate(){return this._quickNavigate}set quickNavigate(e){this._quickNavigate=e,this.update()}get value(){return this._value}set value(e){this.doSetValue(e)}doSetValue(e,t){this._value!==e&&(this._value=e,t||this.update(),this.visible&&this.ui.list.filter(this.filterValue(this._value))&&this.trySelectFirst(),this.onDidChangeValueEmitter.fire(this._value))}set ariaLabel(e){this._ariaLabel=e,this.update()}get ariaLabel(){return this._ariaLabel}get placeholder(){return this._placeholder}set placeholder(e){this._placeholder=e,this.update()}get items(){return this._items}get scrollTop(){return this.ui.list.scrollTop}set scrollTop(e){this.ui.list.scrollTop=e}set items(e){this._items=e,this.itemsUpdated=!0,this.update()}get canSelectMany(){return this._canSelectMany}set canSelectMany(e){this._canSelectMany=e,this.update()}get canAcceptInBackground(){return this._canAcceptInBackground}set canAcceptInBackground(e){this._canAcceptInBackground=e}get matchOnDescription(){return this._matchOnDescription}set matchOnDescription(e){this._matchOnDescription=e,this.update()}get matchOnDetail(){return this._matchOnDetail}set matchOnDetail(e){this._matchOnDetail=e,this.update()}get matchOnLabel(){return this._matchOnLabel}set matchOnLabel(e){this._matchOnLabel=e,this.update()}get matchOnLabelMode(){return this._matchOnLabelMode}set matchOnLabelMode(e){this._matchOnLabelMode=e,this.update()}get sortByLabel(){return this._sortByLabel}set sortByLabel(e){this._sortByLabel=e,this.update()}get keepScrollPosition(){return this._keepScrollPosition}set keepScrollPosition(e){this._keepScrollPosition=e}get itemActivation(){return this._itemActivation}set itemActivation(e){this._itemActivation=e}get activeItems(){return this._activeItems}set activeItems(e){this._activeItems=e,this.activeItemsUpdated=!0,this.update()}get selectedItems(){return this._selectedItems}set selectedItems(e){this._selectedItems=e,this.selectedItemsUpdated=!0,this.update()}get keyMods(){return this._quickNavigate?YH:this.ui.keyMods}get valueSelection(){let e=this.ui.inputBox.getSelection();if(e)return[e.start,e.end]}set valueSelection(e){this._valueSelection=e,this.valueSelectionUpdated=!0,this.update()}get customButton(){return this._customButton}set customButton(e){this._customButton=e,this.update()}get customLabel(){return this._customButtonLabel}set customLabel(e){this._customButtonLabel=e,this.update()}get customHover(){return this._customButtonHover}set customHover(e){this._customButtonHover=e,this.update()}get ok(){return this._ok}set ok(e){this._ok=e,this.update()}get hideInput(){return!!this._hideInput}set hideInput(e){this._hideInput=e,this.update()}trySelectFirst(){this.canSelectMany||this.ui.list.focus(Ui.First)}show(){this.visible||(this.visibleDisposables.add(this.ui.inputBox.onDidChange(e=>{this.doSetValue(e,!0)})),this.visibleDisposables.add((this._hideInput?this.ui.list:this.ui.inputBox).onKeyDown(e=>{switch(e.keyCode){case 18:this.quickNavigate===void 0&&(Be?e.metaKey:e.altKey)?this.ui.list.focus(Ui.NextSeparator):this.ui.list.focus(Ui.Next),this.canSelectMany&&this.ui.list.domFocus(),He.stop(e,!0);break;case 16:this.quickNavigate===void 0&&(Be?e.metaKey:e.altKey)?this.ui.list.focus(Ui.PreviousSeparator):this.ui.list.focus(Ui.Previous),this.canSelectMany&&this.ui.list.domFocus(),He.stop(e,!0);break;case 12:this.ui.list.focus(Ui.NextPage),this.canSelectMany&&this.ui.list.domFocus(),He.stop(e,!0);break;case 11:this.ui.list.focus(Ui.PreviousPage),this.canSelectMany&&this.ui.list.domFocus(),He.stop(e,!0);break;case 17:if(!this._canAcceptInBackground||!this.ui.inputBox.isSelectionAtEnd())return;this.activeItems[0]&&(this._selectedItems=[this.activeItems[0]],this.onDidChangeSelectionEmitter.fire(this.selectedItems),this.handleAccept(!0));break;case 14:(e.ctrlKey||e.metaKey)&&!e.shiftKey&&!e.altKey&&(this.ui.list.focus(Ui.First),He.stop(e,!0));break;case 13:(e.ctrlKey||e.metaKey)&&!e.shiftKey&&!e.altKey&&(this.ui.list.focus(Ui.Last),He.stop(e,!0));break}})),this.visibleDisposables.add(this.ui.onDidAccept(()=>{this.canSelectMany?this.ui.list.getCheckedElements().length||(this._selectedItems=[],this.onDidChangeSelectionEmitter.fire(this.selectedItems)):this.activeItems[0]&&(this._selectedItems=[this.activeItems[0]],this.onDidChangeSelectionEmitter.fire(this.selectedItems)),this.handleAccept(!1)})),this.visibleDisposables.add(this.ui.onDidCustom(()=>{this.onDidCustomEmitter.fire()})),this.visibleDisposables.add(this.ui.list.onDidChangeFocus(e=>{this.activeItemsUpdated||this.activeItemsToConfirm!==this._activeItems&&Ht(e,this._activeItems,(t,i)=>t===i)||(this._activeItems=e,this.onDidChangeActiveEmitter.fire(e))})),this.visibleDisposables.add(this.ui.list.onDidChangeSelection(({items:e,event:t})=>{if(this.canSelectMany){e.length&&this.ui.list.setSelectedElements([]);return}this.selectedItemsToConfirm!==this._selectedItems&&Ht(e,this._selectedItems,(i,o)=>i===o)||(this._selectedItems=e,this.onDidChangeSelectionEmitter.fire(e),e.length&&this.handleAccept(Hg(t)&&t.button===1))})),this.visibleDisposables.add(this.ui.list.onChangedCheckedElements(e=>{this.canSelectMany&&(this.selectedItemsToConfirm!==this._selectedItems&&Ht(e,this._selectedItems,(t,i)=>t===i)||(this._selectedItems=e,this.onDidChangeSelectionEmitter.fire(e)))})),this.visibleDisposables.add(this.ui.list.onButtonTriggered(e=>this.onDidTriggerItemButtonEmitter.fire(e))),this.visibleDisposables.add(this.ui.list.onSeparatorButtonTriggered(e=>this.onDidTriggerSeparatorButtonEmitter.fire(e))),this.visibleDisposables.add(this.registerQuickNavigation()),this.valueSelectionUpdated=!0),super.show()}handleAccept(e){let t=!1;this.onWillAcceptEmitter.fire({veto:()=>t=!0}),t||this.onDidAcceptEmitter.fire({inBackground:e})}registerQuickNavigation(){return $(this.ui.container,se.KEY_UP,e=>{if(this.canSelectMany||!this._quickNavigate)return;let t=new bt(e),i=t.keyCode;this._quickNavigate.keybindings.some(r=>{let a=r.getChords();return a.length>1?!1:a[0].shiftKey&&i===4?!(t.ctrlKey||t.altKey||t.metaKey):!!(a[0].altKey&&i===6||a[0].ctrlKey&&i===5||a[0].metaKey&&i===57)})&&(this.activeItems[0]&&(this._selectedItems=[this.activeItems[0]],this.onDidChangeSelectionEmitter.fire(this.selectedItems),this.handleAccept(!1)),this._quickNavigate=void 0)})}update(){if(!this.visible)return;let e=this.keepScrollPosition?this.scrollTop:0,t=!!this.description,i={title:!!this.title||!!this.step||!!this.buttons.length,description:t,checkAll:this.canSelectMany&&!this._hideCheckAll,checkBox:this.canSelectMany,inputBox:!this._hideInput,progressBar:!this._hideInput||t,visibleCount:!0,count:this.canSelectMany&&!this._hideCountBadge,ok:this.ok==="default"?this.canSelectMany:this.ok,list:!0,message:!!this.validationMessage,customButton:this.customButton};this.ui.setVisibilities(i),super.update(),this.ui.inputBox.value!==this.value&&(this.ui.inputBox.value=this.value),this.valueSelectionUpdated&&(this.valueSelectionUpdated=!1,this.ui.inputBox.select(this._valueSelection&&{start:this._valueSelection[0],end:this._valueSelection[1]})),this.ui.inputBox.placeholder!==(this.placeholder||"")&&(this.ui.inputBox.placeholder=this.placeholder||"");let o=this.ariaLabel;if(!o&&i.inputBox&&(o=this.placeholder||n.DEFAULT_ARIA_LABEL,this.title&&(o+=` - ${this.title}`)),this.ui.list.ariaLabel!==o&&(this.ui.list.ariaLabel=o??null),this.ui.list.matchOnDescription=this.matchOnDescription,this.ui.list.matchOnDetail=this.matchOnDetail,this.ui.list.matchOnLabel=this.matchOnLabel,this.ui.list.matchOnLabelMode=this.matchOnLabelMode,this.ui.list.sortByLabel=this.sortByLabel,this.itemsUpdated){this.itemsUpdated=!1;let s=this._activeItems;switch(this.ui.list.setElements(this.items),this.ui.list.filter(this.filterValue(this.ui.inputBox.value)),this.ui.checkAll.checked=this.ui.list.getAllVisibleChecked(),this.ui.visibleCount.setCount(this.ui.list.getVisibleCount()),this.ui.count.setCount(this.ui.list.getCheckedCount()),this._itemActivation){case la.NONE:s.length>0&&(this._activeItems=[],this.onDidChangeActiveEmitter.fire(this._activeItems)),this._itemActivation=la.FIRST;break;case la.SECOND:this.ui.list.focus(Ui.Second),this._itemActivation=la.FIRST;break;case la.LAST:this.ui.list.focus(Ui.Last),this._itemActivation=la.FIRST;break;default:this.trySelectFirst();break}}this.ui.container.classList.contains("show-checkboxes")!==!!this.canSelectMany&&(this.canSelectMany?this.ui.list.clearFocus():this.trySelectFirst()),this.activeItemsUpdated&&(this.activeItemsUpdated=!1,this.activeItemsToConfirm=this._activeItems,this.ui.list.setFocusedElements(this.activeItems),this.activeItemsToConfirm===this._activeItems&&(this.activeItemsToConfirm=null)),this.selectedItemsUpdated&&(this.selectedItemsUpdated=!1,this.selectedItemsToConfirm=this._selectedItems,this.canSelectMany?this.ui.list.setCheckedElements(this.selectedItems):this.ui.list.setSelectedElements(this.selectedItems),this.selectedItemsToConfirm===this._selectedItems&&(this.selectedItemsToConfirm=null)),this.ui.customButton.label=this.customLabel||"",this.ui.customButton.element.title=this.customHover||"",i.inputBox||(this.ui.list.domFocus(),this.canSelectMany&&this.ui.list.focus(Ui.First)),this.keepScrollPosition&&(this.scrollTop=e)}};s_.DEFAULT_ARIA_LABEL=p("quickInputBox.ariaLabel","Type to narrow down results.");var n2=class extends p1{constructor(){super(...arguments),this._value="",this.valueSelectionUpdated=!0,this._password=!1,this.onDidValueChangeEmitter=this._register(new B),this.onDidAcceptEmitter=this._register(new B),this.onDidChangeValue=this.onDidValueChangeEmitter.event,this.onDidAccept=this.onDidAcceptEmitter.event}get value(){return this._value}set value(e){this._value=e||"",this.update()}get placeholder(){return this._placeholder}set placeholder(e){this._placeholder=e,this.update()}get password(){return this._password}set password(e){this._password=e,this.update()}show(){this.visible||(this.visibleDisposables.add(this.ui.inputBox.onDidChange(e=>{e!==this.value&&(this._value=e,this.onDidValueChangeEmitter.fire(e))})),this.visibleDisposables.add(this.ui.onDidAccept(()=>this.onDidAcceptEmitter.fire())),this.valueSelectionUpdated=!0),super.show()}update(){if(!this.visible)return;this.ui.container.classList.remove("hidden-input");let e={title:!!this.title||!!this.step||!!this.buttons.length,description:!!this.description||!!this.step,inputBox:!0,message:!0,progressBar:!0};this.ui.setVisibilities(e),super.update(),this.ui.inputBox.value!==this.value&&(this.ui.inputBox.value=this.value),this.valueSelectionUpdated&&(this.valueSelectionUpdated=!1,this.ui.inputBox.select(this._valueSelection&&{start:this._valueSelection[0],end:this._valueSelection[1]})),this.ui.inputBox.placeholder!==(this.placeholder||"")&&(this.ui.inputBox.placeholder=this.placeholder||""),this.ui.inputBox.password!==this.password&&(this.ui.inputBox.password=this.password)}},o2=class extends xh{constructor(e,t){super("element",!1,i=>this.getOverrideOptions(i),e,t)}getOverrideOptions(e){var t;let i=(e.content instanceof HTMLElement?(t=e.content.textContent)!==null&&t!==void 0?t:"":typeof e.content=="string"?e.content:e.content.value).includes(` +`);return{persistence:{hideOnKeyDown:!1},appearance:{showHoverHint:i,skipFadeInAnimation:!0}}}};o2=GQ([kU(0,Rt),kU(1,Lh)],o2);_();v();b();ke();_();v();b();ke();Fw();oo();Ef();gn();ye();Lp();le();Ln();var edt={buttonBackground:"#0E639C",buttonHoverBackground:"#006BB3",buttonSeparator:Z.white.toString(),buttonForeground:Z.white.toString(),buttonBorder:void 0,buttonSecondaryBackground:void 0,buttonSecondaryForeground:void 0,buttonSecondaryHoverBackground:void 0},Jf=class extends H{get onDidClick(){return this._onDidClick.event}constructor(e,t){super(),this._label="",this._onDidClick=this._register(new B),this._onDidEscape=this._register(new B),this.options=t,this._element=document.createElement("a"),this._element.classList.add("monaco-button"),this._element.tabIndex=0,this._element.setAttribute("role","button"),this._element.classList.toggle("secondary",!!t.secondary);let i=t.secondary?t.buttonSecondaryBackground:t.buttonBackground,o=t.secondary?t.buttonSecondaryForeground:t.buttonForeground;this._element.style.color=o||"",this._element.style.backgroundColor=i||"",t.supportShortLabel&&(this._labelShortElement=document.createElement("div"),this._labelShortElement.classList.add("monaco-button-label-short"),this._element.appendChild(this._labelShortElement),this._labelElement=document.createElement("div"),this._labelElement.classList.add("monaco-button-label"),this._element.appendChild(this._labelElement),this._element.classList.add("monaco-text-button-with-short-label")),typeof t.title=="string"&&this.setTitle(t.title),typeof t.ariaLabel=="string"&&this._element.setAttribute("aria-label",t.ariaLabel),e.appendChild(this._element),this._register(ui.addTarget(this._element)),[se.CLICK,It.Tap].forEach(s=>{this._register($(this._element,s,r=>{if(!this.enabled){He.stop(r);return}this._onDidClick.fire(r)}))}),this._register($(this._element,se.KEY_DOWN,s=>{let r=new bt(s),a=!1;this.enabled&&(r.equals(3)||r.equals(10))?(this._onDidClick.fire(s),a=!0):r.equals(9)&&(this._onDidEscape.fire(s),this._element.blur(),a=!0),a&&He.stop(r,!0)})),this._register($(this._element,se.MOUSE_OVER,s=>{this._element.classList.contains("disabled")||this.updateBackground(!0)})),this._register($(this._element,se.MOUSE_OUT,s=>{this.updateBackground(!1)})),this.focusTracker=this._register(Ic(this._element)),this._register(this.focusTracker.onDidFocus(()=>{this.enabled&&this.updateBackground(!0)})),this._register(this.focusTracker.onDidBlur(()=>{this.enabled&&this.updateBackground(!1)}))}dispose(){super.dispose(),this._element.remove()}getContentElements(e){let t=[];for(let i of ra(e))if(typeof i=="string"){if(i=i.trim(),i==="")continue;let o=document.createElement("span");o.textContent=i,t.push(o)}else t.push(i);return t}updateBackground(e){let t;this.options.secondary?t=e?this.options.buttonSecondaryHoverBackground:this.options.buttonSecondaryBackground:t=e?this.options.buttonHoverBackground:this.options.buttonBackground,t&&(this._element.style.backgroundColor=t)}get element(){return this._element}set label(e){var t;if(this._label===e||ic(this._label)&&ic(e)&&IV(this._label,e))return;this._element.classList.add("monaco-text-button");let i=this.options.supportShortLabel?this._labelElement:this._element;if(ic(e)){let s=kp(e,{inline:!0});s.dispose();let r=(t=s.element.querySelector("p"))===null||t===void 0?void 0:t.innerHTML;if(r){let a=Pw(r,{ADD_TAGS:["b","i","u","code","span"],ALLOWED_ATTR:["class"],RETURN_TRUSTED_TYPE:!0});i.innerHTML=a}else Wi(i)}else this.options.supportIcons?Wi(i,...this.getContentElements(e)):i.textContent=e;let o="";typeof this.options.title=="string"?o=this.options.title:this.options.title&&(o=PV(e)),this.setTitle(o),typeof this.options.ariaLabel=="string"?this._element.setAttribute("aria-label",this.options.ariaLabel):this.options.ariaLabel&&this._element.setAttribute("aria-label",o),this._label=e}get label(){return this._label}set icon(e){this._element.classList.add(...Xe.asClassNameArray(e))}set enabled(e){e?(this._element.classList.remove("disabled"),this._element.setAttribute("aria-disabled",String(!1)),this._element.tabIndex=0):(this._element.classList.add("disabled"),this._element.setAttribute("aria-disabled",String(!0)))}get enabled(){return!this._element.classList.contains("disabled")}setTitle(e){var t;!this._hover&&e!==""?this._hover=this._register(Qn().setupUpdatableHover((t=this.options.hoverDelegate)!==null&&t!==void 0?t:ji("mouse"),this._element,e)):this._hover&&this._hover.update(e)}};_();v();b();ke();ot();var _1=class{constructor(e,t,i){this.options=t,this.styles=i,this.count=0,this.element=me(e,ve(".monaco-count-badge")),this.countFormat=this.options.countFormat||"{0}",this.titleFormat=this.options.titleFormat||"",this.setCount(this.options.count||0)}setCount(e){this.count=e,this.render()}setTitleFormat(e){this.titleFormat=e,this.render()}render(){var e,t;this.element.textContent=du(this.countFormat,this.count),this.element.title=du(this.titleFormat,this.count),this.element.style.backgroundColor=(e=this.styles.badgeBackground)!==null&&e!==void 0?e:"",this.element.style.color=(t=this.styles.badgeForeground)!==null&&t!==void 0?t:"",this.styles.badgeBorder&&(this.element.style.border=`1px solid ${this.styles.badgeBorder}`)}};_();v();b();ke();Gt();le();var DU="done",EU="active",gO="infinite",mO="infinite-long-running",IU="discrete",b1=class n extends H{constructor(e,t){super(),this.progressSignal=this._register(new no),this.workedVal=0,this.showDelayedScheduler=this._register(new di(()=>b0(this.element),0)),this.longRunningScheduler=this._register(new di(()=>this.infiniteLongRunning(),n.LONG_RUNNING_INFINITE_THRESHOLD)),this.create(e,t)}create(e,t){this.element=document.createElement("div"),this.element.classList.add("monaco-progress-container"),this.element.setAttribute("role","progressbar"),this.element.setAttribute("aria-valuemin","0"),e.appendChild(this.element),this.bit=document.createElement("div"),this.bit.classList.add("progress-bit"),this.bit.style.backgroundColor=t?.progressBarBackground||"#0E70C0",this.element.appendChild(this.bit)}off(){this.bit.style.width="inherit",this.bit.style.opacity="1",this.element.classList.remove(EU,gO,mO,IU),this.workedVal=0,this.totalWork=void 0,this.longRunningScheduler.cancel(),this.progressSignal.clear()}stop(){return this.doDone(!1)}doDone(e){return this.element.classList.add(DU),this.element.classList.contains(gO)?(this.bit.style.opacity="0",e?setTimeout(()=>this.off(),200):this.off()):(this.bit.style.width="inherit",e?setTimeout(()=>this.off(),200):this.off()),this}infinite(){return this.bit.style.width="2%",this.bit.style.opacity="1",this.element.classList.remove(IU,DU,mO),this.element.classList.add(EU,gO),this.longRunningScheduler.schedule(),this}infiniteLongRunning(){this.element.classList.add(mO)}getContainer(){return this.element}};b1.LONG_RUNNING_INFINITE_THRESHOLD=1e4;fs();ye();le();Ge();_();v();b();ke();le();var ZQ=ve,s2=class extends H{constructor(e,t,i){super(),this.parent=e,this.onKeyDown=s=>Ut(this.findInput.inputBox.inputElement,se.KEY_DOWN,s),this.onDidChange=s=>this.findInput.onDidChange(s),this.container=me(this.parent,ZQ(".quick-input-box")),this.findInput=this._register(new s1(this.container,void 0,{label:"",inputBoxStyles:t,toggleStyles:i}));let o=this.findInput.inputBox.inputElement;o.role="combobox",o.ariaHasPopup="menu",o.ariaAutoComplete="list",o.ariaExpanded="true"}get value(){return this.findInput.getValue()}set value(e){this.findInput.setValue(e)}select(e=null){this.findInput.inputBox.select(e)}getSelection(){return this.findInput.inputBox.getSelection()}isSelectionAtEnd(){return this.findInput.inputBox.isSelectionAtEnd()}get placeholder(){return this.findInput.inputBox.inputElement.getAttribute("placeholder")||""}set placeholder(e){this.findInput.inputBox.setPlaceHolder(e)}get password(){return this.findInput.inputBox.inputElement.type==="password"}set password(e){this.findInput.inputBox.inputElement.type=e?"password":"text"}set enabled(e){this.findInput.inputBox.inputElement.toggleAttribute("readonly",!e)}set toggles(e){this.findInput.setAdditionalToggles(e)}setAttribute(e,t){this.findInput.inputBox.inputElement.setAttribute(e,t)}showDecoration(e){e===Ci.Ignore?this.findInput.clearMessage():this.findInput.showMessage({type:e===Ci.Info?1:e===Ci.Warning?2:3,content:""})}stylesForType(e){return this.findInput.inputBox.stylesForType(e===Ci.Info?1:e===Ci.Warning?2:3)}setFocus(){this.findInput.focus()}layout(){this.findInput.inputBox.layout()}};vo();qe();var YQ=function(n,e,t,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},TU=function(n,e){return function(t,i){e(t,i,n)}},pO,Is=ve,v1=pO=class extends H{get container(){return this._container}constructor(e,t,i){super(),this.options=e,this.layoutService=t,this.instantiationService=i,this.enabled=!0,this.onDidAcceptEmitter=this._register(new B),this.onDidCustomEmitter=this._register(new B),this.onDidTriggerButtonEmitter=this._register(new B),this.keyMods={ctrlCmd:!1,alt:!1},this.controller=null,this.onShowEmitter=this._register(new B),this.onShow=this.onShowEmitter.event,this.onHideEmitter=this._register(new B),this.onHide=this.onHideEmitter.event,this.idPrefix=e.idPrefix,this._container=e.container,this.styles=e.styles,this._register(ie.runAndSubscribe(fu,({window:o,disposables:s})=>this.registerKeyModsListeners(o,s),{window:gt,disposables:this._store})),this._register(R7(o=>{this.ui&&ge(this.ui.container)===o&&(this.reparentUI(this.layoutService.mainContainer),this.layout(this.layoutService.mainContainerDimension,this.layoutService.mainContainerOffset.quickPickTop))}))}registerKeyModsListeners(e,t){let i=o=>{this.keyMods.ctrlCmd=o.ctrlKey||o.metaKey,this.keyMods.alt=o.altKey};for(let o of[se.KEY_DOWN,se.KEY_UP,se.MOUSE_DOWN])t.add($(e,o,i,!0))}getUI(e){if(this.ui)return e&&ge(this._container)!==ge(this.layoutService.activeContainer)&&(this.reparentUI(this.layoutService.activeContainer),this.layout(this.layoutService.activeContainerDimension,this.layoutService.activeContainerOffset.quickPickTop)),this.ui;let t=me(this._container,Is(".quick-input-widget.show-file-icons"));t.tabIndex=-1,t.style.display="none";let i=Xi(t),o=me(t,Is(".quick-input-titlebar")),s=this._register(new Eo(o,{hoverDelegate:this.options.hoverDelegate}));s.domNode.classList.add("quick-input-left-action-bar");let r=me(o,Is(".quick-input-title")),a=this._register(new Eo(o,{hoverDelegate:this.options.hoverDelegate}));a.domNode.classList.add("quick-input-right-action-bar");let l=me(t,Is(".quick-input-header")),c=me(l,Is("input.quick-input-check-all"));c.type="checkbox",c.setAttribute("aria-label",p("quickInput.checkAll","Toggle all checkboxes")),this._register(Ut(c,se.CHANGE,z=>{let te=c.checked;G.setAllVisibleChecked(te)})),this._register($(c,se.CLICK,z=>{(z.x||z.y)&&f.setFocus()}));let d=me(l,Is(".quick-input-description")),h=me(l,Is(".quick-input-and-message")),u=me(h,Is(".quick-input-filter")),f=this._register(new s2(u,this.styles.inputBox,this.styles.toggle));f.setAttribute("aria-describedby",`${this.idPrefix}message`);let g=me(u,Is(".quick-input-visible-count"));g.setAttribute("aria-live","polite"),g.setAttribute("aria-atomic","true");let m=new _1(g,{countFormat:p({key:"quickInput.visibleCount",comment:["This tells the user how many items are shown in a list of items to select from. The items can be anything. Currently not visible, but read by screen readers."]},"{0} Results")},this.styles.countBadge),C=me(u,Is(".quick-input-count"));C.setAttribute("aria-live","polite");let S=new _1(C,{countFormat:p({key:"quickInput.countSelected",comment:["This tells the user how many items are selected in a list of items to select from. The items can be anything."]},"{0} Selected")},this.styles.countBadge),w=me(l,Is(".quick-input-action")),y=this._register(new Jf(w,this.styles.button));y.label=p("ok","OK"),this._register(y.onDidClick(z=>{this.onDidAcceptEmitter.fire()}));let x=me(l,Is(".quick-input-action")),k=this._register(new Jf(x,{...this.styles.button,supportIcons:!0}));k.label=p("custom","Custom"),this._register(k.onDidClick(z=>{this.onDidCustomEmitter.fire()}));let T=me(h,Is(`#${this.idPrefix}message.quick-input-message`)),N=this._register(new b1(t,this.styles.progressBar));N.getContainer().classList.add("quick-input-progress");let M=me(t,Is(".quick-input-html-widget"));M.tabIndex=-1;let W=me(t,Is(".quick-input-description")),j=this.idPrefix+"list",G=this._register(this.instantiationService.createInstance(o_,t,this.options.hoverDelegate,this.options.linkOpenerDelegate,j));f.setAttribute("aria-controls",j),this._register(G.onDidChangeFocus(()=>{var z;f.setAttribute("aria-activedescendant",(z=G.getActiveDescendant())!==null&&z!==void 0?z:"")})),this._register(G.onChangedAllVisibleChecked(z=>{c.checked=z})),this._register(G.onChangedVisibleCount(z=>{m.setCount(z)})),this._register(G.onChangedCheckedCount(z=>{S.setCount(z)})),this._register(G.onLeave(()=>{setTimeout(()=>{this.controller&&(f.setFocus(),this.controller instanceof s_&&this.controller.canSelectMany&&G.clearFocus())},0)}));let V=Ic(t);return this._register(V),this._register($(t,se.FOCUS,z=>{yi(z.relatedTarget,t)||(this.previousFocusElement=z.relatedTarget instanceof HTMLElement?z.relatedTarget:void 0)},!0)),this._register(V.onDidBlur(()=>{!this.getUI().ignoreFocusOut&&!this.options.ignoreFocusOut()&&this.hide(Wh.Blur),this.previousFocusElement=void 0})),this._register($(t,se.FOCUS,z=>{f.setFocus()})),this._register(Ut(t,se.KEY_DOWN,z=>{if(!yi(z.target,M))switch(z.keyCode){case 3:He.stop(z,!0),this.enabled&&this.onDidAcceptEmitter.fire();break;case 9:He.stop(z,!0),this.hide(Wh.Gesture);break;case 2:if(!z.altKey&&!z.ctrlKey&&!z.metaKey){let te=[".quick-input-list .monaco-action-bar .always-visible",".quick-input-list-entry:hover .monaco-action-bar",".monaco-list-row.focused .monaco-action-bar"];if(t.classList.contains("show-checkboxes")?te.push("input"):te.push("input[type=text]"),this.getUI().list.isDisplayed()&&te.push(".monaco-list"),this.getUI().message&&te.push(".quick-input-message a"),this.getUI().widget){if(yi(z.target,this.getUI().widget))break;te.push(".quick-input-html-widget")}let ee=t.querySelectorAll(te.join(", "));z.shiftKey&&z.target===ee[0]?(He.stop(z,!0),G.clearFocus()):!z.shiftKey&&yi(z.target,ee[ee.length-1])&&(He.stop(z,!0),ee[0].focus())}break;case 10:z.ctrlKey&&(He.stop(z,!0),this.getUI().list.toggleHover());break}})),this.ui={container:t,styleSheet:i,leftActionBar:s,titleBar:o,title:r,description1:W,description2:d,widget:M,rightActionBar:a,checkAll:c,inputContainer:h,filterContainer:u,inputBox:f,visibleCountContainer:g,visibleCount:m,countContainer:C,count:S,okContainer:w,ok:y,message:T,customButtonContainer:x,customButton:k,list:G,progressBar:N,onDidAccept:this.onDidAcceptEmitter.event,onDidCustom:this.onDidCustomEmitter.event,onDidTriggerButton:this.onDidTriggerButtonEmitter.event,ignoreFocusOut:!1,keyMods:this.keyMods,show:z=>this.show(z),hide:()=>this.hide(),setVisibilities:z=>this.setVisibilities(z),setEnabled:z=>this.setEnabled(z),setContextKey:z=>this.options.setContextKey(z),linkOpenerDelegate:z=>this.options.linkOpenerDelegate(z)},this.updateStyles(),this.ui}reparentUI(e){this.ui&&(this._container=e,me(this._container,this.ui.container))}pick(e,t={},i=Mo.None){return new Promise((o,s)=>{let r=d=>{var h;r=o,(h=t.onKeyMods)===null||h===void 0||h.call(t,a.keyMods),o(d)};if(i.isCancellationRequested){r(void 0);return}let a=this.createQuickPick(),l,c=[a,a.onDidAccept(()=>{if(a.canSelectMany)r(a.selectedItems.slice()),a.hide();else{let d=a.activeItems[0];d&&(r(d),a.hide())}}),a.onDidChangeActive(d=>{let h=d[0];h&&t.onDidFocus&&t.onDidFocus(h)}),a.onDidChangeSelection(d=>{if(!a.canSelectMany){let h=d[0];h&&(r(h),a.hide())}}),a.onDidTriggerItemButton(d=>t.onDidTriggerItemButton&&t.onDidTriggerItemButton({...d,removeItem:()=>{let h=a.items.indexOf(d.item);if(h!==-1){let u=a.items.slice(),f=u.splice(h,1),g=a.activeItems.filter(C=>C!==f[0]),m=a.keepScrollPosition;a.keepScrollPosition=!0,a.items=u,g&&(a.activeItems=g),a.keepScrollPosition=m}}})),a.onDidTriggerSeparatorButton(d=>{var h;return(h=t.onDidTriggerSeparatorButton)===null||h===void 0?void 0:h.call(t,d)}),a.onDidChangeValue(d=>{l&&!d&&(a.activeItems.length!==1||a.activeItems[0]!==l)&&(a.activeItems=[l])}),i.onCancellationRequested(()=>{a.hide()}),a.onDidHide(()=>{li(c),r(void 0)})];a.title=t.title,a.canSelectMany=!!t.canPickMany,a.placeholder=t.placeHolder,a.ignoreFocusOut=!!t.ignoreFocusLost,a.matchOnDescription=!!t.matchOnDescription,a.matchOnDetail=!!t.matchOnDetail,a.matchOnLabel=t.matchOnLabel===void 0||t.matchOnLabel,a.quickNavigate=t.quickNavigate,a.hideInput=!!t.hideInput,a.contextKey=t.contextKey,a.busy=!0,Promise.all([e,t.activeItem]).then(([d,h])=>{l=h,a.busy=!1,a.items=d,a.canSelectMany&&(a.selectedItems=d.filter(u=>u.type!=="separator"&&u.picked)),l&&(a.activeItems=[l])}),a.show(),Promise.resolve(e).then(void 0,d=>{s(d),a.hide()})})}createQuickPick(){let e=this.getUI(!0);return new s_(e)}createInputBox(){let e=this.getUI(!0);return new n2(e)}show(e){let t=this.getUI(!0);this.onShowEmitter.fire();let i=this.controller;this.controller=e,i?.didHide(),this.setEnabled(!0),t.leftActionBar.clear(),t.title.textContent="",t.description1.textContent="",t.description2.textContent="",Wi(t.widget),t.rightActionBar.clear(),t.checkAll.checked=!1,t.inputBox.placeholder="",t.inputBox.password=!1,t.inputBox.showDecoration(Ci.Ignore),t.visibleCount.setCount(0),t.count.setCount(0),Wi(t.message),t.progressBar.stop(),t.list.setElements([]),t.list.matchOnDescription=!1,t.list.matchOnDetail=!1,t.list.matchOnLabel=!0,t.list.sortByLabel=!0,t.ignoreFocusOut=!1,t.inputBox.toggles=void 0;let o=this.options.backKeybindingLabel();i2.tooltip=o?p("quickInput.backWithKeybinding","Back ({0})",o):p("quickInput.back","Back"),t.container.style.display="",this.updateLayout(),t.inputBox.setFocus()}isVisible(){return!!this.ui&&this.ui.container.style.display!=="none"}setVisibilities(e){let t=this.getUI();t.title.style.display=e.title?"":"none",t.description1.style.display=e.description&&(e.inputBox||e.checkAll)?"":"none",t.description2.style.display=e.description&&!(e.inputBox||e.checkAll)?"":"none",t.checkAll.style.display=e.checkAll?"":"none",t.inputContainer.style.display=e.inputBox?"":"none",t.filterContainer.style.display=e.inputBox?"":"none",t.visibleCountContainer.style.display=e.visibleCount?"":"none",t.countContainer.style.display=e.count?"":"none",t.okContainer.style.display=e.ok?"":"none",t.customButtonContainer.style.display=e.customButton?"":"none",t.message.style.display=e.message?"":"none",t.progressBar.getContainer().style.display=e.progressBar?"":"none",t.list.display(!!e.list),t.container.classList.toggle("show-checkboxes",!!e.checkBox),t.container.classList.toggle("hidden-input",!e.inputBox&&!e.description),this.updateLayout()}setEnabled(e){if(e!==this.enabled){this.enabled=e;for(let t of this.getUI().leftActionBar.viewItems)t.action.enabled=e;for(let t of this.getUI().rightActionBar.viewItems)t.action.enabled=e;this.getUI().checkAll.disabled=!e,this.getUI().inputBox.enabled=e,this.getUI().ok.enabled=e,this.getUI().list.enabled=e}}hide(e){var t,i;let o=this.controller;if(!o)return;o.willHide(e);let s=(t=this.ui)===null||t===void 0?void 0:t.container,r=s&&!qw(s);if(this.controller=null,this.onHideEmitter.fire(),s&&(s.style.display="none"),!r){let a=this.previousFocusElement;for(;a&&!a.offsetParent;)a=(i=a.parentElement)!==null&&i!==void 0?i:void 0;a?.offsetParent?(a.focus(),this.previousFocusElement=void 0):this.options.returnFocus()}o.didHide(e)}layout(e,t){this.dimension=e,this.titleBarOffset=t,this.updateLayout()}updateLayout(){if(this.ui&&this.isVisible()){this.ui.container.style.top=`${this.titleBarOffset}px`;let e=this.ui.container.style,t=Math.min(this.dimension.width*.62,pO.MAX_WIDTH);e.width=t+"px",e.marginLeft="-"+t/2+"px",this.ui.inputBox.layout(),this.ui.list.layout(this.dimension&&this.dimension.height*.4)}}applyStyles(e){this.styles=e,this.updateStyles()}updateStyles(){if(this.ui){let{quickInputTitleBackground:e,quickInputBackground:t,quickInputForeground:i,widgetBorder:o,widgetShadow:s}=this.styles.widget;this.ui.titleBar.style.backgroundColor=e??"",this.ui.container.style.backgroundColor=t??"",this.ui.container.style.color=i??"",this.ui.container.style.border=o?`1px solid ${o}`:"",this.ui.container.style.boxShadow=s?`0 0 8px 2px ${s}`:"",this.ui.list.style(this.styles.list);let r=[];this.styles.pickerGroup.pickerGroupBorder&&r.push(`.quick-input-list .quick-input-list-entry { border-top-color: ${this.styles.pickerGroup.pickerGroupBorder}; }`),this.styles.pickerGroup.pickerGroupForeground&&r.push(`.quick-input-list .quick-input-list-separator { color: ${this.styles.pickerGroup.pickerGroupForeground}; }`),this.styles.pickerGroup.pickerGroupForeground&&r.push(".quick-input-list .quick-input-list-separator-as-item { color: var(--vscode-descriptionForeground); }"),(this.styles.keybindingLabel.keybindingLabelBackground||this.styles.keybindingLabel.keybindingLabelBorder||this.styles.keybindingLabel.keybindingLabelBottomBorder||this.styles.keybindingLabel.keybindingLabelShadow||this.styles.keybindingLabel.keybindingLabelForeground)&&(r.push(".quick-input-list .monaco-keybinding > .monaco-keybinding-key {"),this.styles.keybindingLabel.keybindingLabelBackground&&r.push(`background-color: ${this.styles.keybindingLabel.keybindingLabelBackground};`),this.styles.keybindingLabel.keybindingLabelBorder&&r.push(`border-color: ${this.styles.keybindingLabel.keybindingLabelBorder};`),this.styles.keybindingLabel.keybindingLabelBottomBorder&&r.push(`border-bottom-color: ${this.styles.keybindingLabel.keybindingLabelBottomBorder};`),this.styles.keybindingLabel.keybindingLabelShadow&&r.push(`box-shadow: inset 0 -1px 0 ${this.styles.keybindingLabel.keybindingLabelShadow};`),this.styles.keybindingLabel.keybindingLabelForeground&&r.push(`color: ${this.styles.keybindingLabel.keybindingLabelForeground};`),r.push("}"));let a=r.join(` +`);a!==this.ui.styleSheet.textContent&&(this.ui.styleSheet.textContent=a)}}};v1.MAX_WIDTH=600;v1=pO=YQ([TU(1,ss),TU(2,Ye)],v1);Fo();ke();var XQ=function(n,e,t,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},C1=function(n,e){return function(t,i){e(t,i,n)}},r2=class extends lx{get controller(){return this._controller||(this._controller=this._register(this.createController())),this._controller}get hasController(){return!!this._controller}get quickAccess(){return this._quickAccess||(this._quickAccess=this._register(this.instantiationService.createInstance(mE))),this._quickAccess}constructor(e,t,i,o,s){super(i),this.instantiationService=e,this.contextKeyService=t,this.layoutService=o,this.configurationService=s,this._onShow=this._register(new B),this._onHide=this._register(new B),this.contexts=new Map}createController(e=this.layoutService,t){let i={idPrefix:"quickInput_",container:e.activeContainer,ignoreFocusOut:()=>!1,backKeybindingLabel:()=>{},setContextKey:s=>this.setContextKey(s),linkOpenerDelegate:s=>{this.instantiationService.invokeFunction(r=>{r.get(Jl).open(s,{allowCommands:!0,fromUserGesture:!0})})},returnFocus:()=>e.focus(),styles:this.computeStyles(),hoverDelegate:this._register(this.instantiationService.createInstance(o2))},o=this._register(this.instantiationService.createInstance(v1,{...i,...t}));return o.layout(e.activeContainerDimension,e.activeContainerOffset.quickPickTop),this._register(e.onDidLayoutActiveContainer(s=>{ge(e.activeContainer)===ge(o.container)&&o.layout(s,e.activeContainerOffset.quickPickTop)})),this._register(e.onDidChangeActiveContainer(()=>{o.isVisible()||o.layout(e.activeContainerDimension,e.activeContainerOffset.quickPickTop)})),this._register(o.onShow(()=>{this.resetContextKeys(),this._onShow.fire()})),this._register(o.onHide(()=>{this.resetContextKeys(),this._onHide.fire()})),o}setContextKey(e){let t;e&&(t=this.contexts.get(e),t||(t=new xe(e,!1).bindTo(this.contextKeyService),this.contexts.set(e,t))),!(t&&t.get())&&(this.resetContextKeys(),t?.set(!0))}resetContextKeys(){this.contexts.forEach(e=>{e.get()&&e.reset()})}pick(e,t={},i=Mo.None){return this.controller.pick(e,t,i)}createQuickPick(){return this.controller.createQuickPick()}createInputBox(){return this.controller.createInputBox()}updateStyles(){this.hasController&&this.controller.applyStyles(this.computeStyles())}computeStyles(){return{widget:{quickInputBackground:he(QA),quickInputForeground:he(b6),quickInputTitleBackground:he(v6),widgetBorder:he(nB),widgetShadow:he(Va)},inputBox:iP,toggle:tP,countBadge:BH,button:PH,progressBar:OH,keybindingLabel:RH,list:Uf({listBackground:QA,listFocusBackground:cb,listFocusForeground:lb,listInactiveFocusForeground:lb,listInactiveSelectionIconForeground:FS,listInactiveFocusBackground:cb,listFocusOutline:ni,listInactiveFocusOutline:ni}),pickerGroup:{pickerGroupBorder:he(C6),pickerGroupForeground:he(OS)}}}};r2=XQ([C1(0,Ye),C1(1,rt),C1(2,an),C1(3,ss),C1(4,Rt)],r2);bg();Fo();var NU=function(n,e,t,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},eg=function(n,e){return function(t,i){e(t,i,n)}},_O=class extends r2{constructor(e,t,i,o,s,r){super(t,i,o,new Uk(e.getContainerDomNode(),s),r),this.host=void 0;let a=r_.get(e);if(a){let l=a.widget;this.host={_serviceBrand:void 0,get mainContainer(){return l.getDomNode()},getContainer(){return l.getDomNode()},whenContainerStylesLoaded(){},get containers(){return[l.getDomNode()]},get activeContainer(){return l.getDomNode()},get mainContainerDimension(){return e.getLayoutInfo()},get activeContainerDimension(){return e.getLayoutInfo()},get onDidLayoutMainContainer(){return e.onDidLayoutChange},get onDidLayoutActiveContainer(){return e.onDidLayoutChange},get onDidLayoutContainer(){return ie.map(e.onDidLayoutChange,c=>({container:l.getDomNode(),dimension:c}))},get onDidChangeActiveContainer(){return ie.None},get onDidAddContainer(){return ie.None},get mainContainerOffset(){return{top:0,quickPickTop:0}},get activeContainerOffset(){return{top:0,quickPickTop:0}},focus:()=>e.focus()}}else this.host=void 0}createController(){return super.createController(this.host)}};_O=NU([eg(1,Ye),eg(2,rt),eg(3,an),eg(4,Zt),eg(5,Rt)],_O);var a2=class{get activeService(){let e=this.codeEditorService.getFocusedCodeEditor();if(!e)throw new Error("Quick input service needs a focused editor to work.");let t=this.mapEditorToService.get(e);if(!t){let i=t=this.instantiationService.createInstance(_O,e);this.mapEditorToService.set(e,t),wa(e.onDidDispose)(()=>{i.dispose(),this.mapEditorToService.delete(e)})}return t}get quickAccess(){return this.activeService.quickAccess}constructor(e,t){this.instantiationService=e,this.codeEditorService=t,this.mapEditorToService=new Map}pick(e,t={},i=Mo.None){return this.activeService.pick(e,t,i)}createQuickPick(){return this.activeService.createQuickPick()}createInputBox(){return this.activeService.createInputBox()}};a2=NU([eg(0,Ye),eg(1,Zt)],a2);var r_=class n{static get(e){return e.getContribution(n.ID)}constructor(e){this.editor=e,this.widget=new l2(this.editor)}dispose(){this.widget.dispose()}};r_.ID="editor.controller.quickInput";var l2=class n{constructor(e){this.codeEditor=e,this.domNode=document.createElement("div"),this.codeEditor.addOverlayWidget(this)}getId(){return n.ID}getDomNode(){return this.domNode}getPosition(){return{preference:2}}dispose(){this.codeEditor.removeOverlayWidget(this)}};l2.ID="editor.contrib.quickInputWidget";vy(r_.ID,r_,4);_();v();b();ke();ps();gn();ye();Yo();um();_();v();b();gn();var bO=class{constructor(e,t,i,o,s){this._parsedThemeRuleBrand=void 0,this.token=e,this.index=t,this.fontStyle=i,this.foreground=o,this.background=s}};function QQ(n){if(!n||!Array.isArray(n))return[];let e=[],t=0;for(let i=0,o=n.length;i{let u=nJ(d.token,h.token);return u!==0?u:d.index-h.index});let t=0,i="000000",o="ffffff";for(;n.length>=1&&n[0].token==="";){let d=n.shift();d.fontStyle!==-1&&(t=d.fontStyle),d.foreground!==null&&(i=d.foreground),d.background!==null&&(o=d.background)}let s=new vO;for(let d of e)s.getId(d);let r=s.getId(i),a=s.getId(o),l=new CO(t,r,a),c=new wO(l);for(let d=0,h=n.length;d"u"){let o=this._match(t),s=iJ(t);i=(o.metadata|s<<8)>>>0,this._cache.set(t,i)}return(i|e<<0)>>>0}},tJ=/\b(comment|string|regex|regexp)\b/;function iJ(n){let e=n.match(tJ);if(!e)return 0;switch(e[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"regexp":return 3}throw new Error("Unexpected match for standard token type!")}function nJ(n,e){return ne?1:0}var CO=class n{constructor(e,t,i){this._themeTrieElementRuleBrand=void 0,this._fontStyle=e,this._foreground=t,this._background=i,this.metadata=(this._fontStyle<<11|this._foreground<<15|this._background<<24)>>>0}clone(){return new n(this._fontStyle,this._foreground,this._background)}acceptOverwrite(e,t,i){e!==-1&&(this._fontStyle=e),t!==0&&(this._foreground=t),i!==0&&(this._background=i),this.metadata=(this._fontStyle<<11|this._foreground<<15|this._background<<24)>>>0}},wO=class n{constructor(e){this._themeTrieElementBrand=void 0,this._mainRule=e,this._children=new Map}match(e){if(e==="")return this._mainRule;let t=e.indexOf("."),i,o;t===-1?(i=e,o=""):(i=e.substring(0,t),o=e.substring(t+1));let s=this._children.get(i);return typeof s<"u"?s.match(o):this._mainRule}insert(e,t,i,o){if(e===""){this._mainRule.acceptOverwrite(t,i,o);return}let s=e.indexOf("."),r,a;s===-1?(r=e,a=""):(r=e.substring(0,s),a=e.substring(s+1));let l=this._children.get(r);typeof l>"u"&&(l=new n(this._mainRule.clone()),this._children.set(r,l)),l.insert(a,t,i,o)}};function AU(n){let e=[];for(let t=1,i=n.length;t({format:o.format,location:o.location.toString()}))}}n.toJSONObject=e;function t(i){let o=s=>tn(s)?s:void 0;if(i&&Array.isArray(i.src)&&i.src.every(s=>tn(s.format)&&tn(s.location)))return{weight:o(i.weight),style:o(i.style),src:i.src.map(s=>({format:s.format,location:Oe.parse(s.location)}))}}n.fromJSONObject=t})(BU||(BU={}));var yO=class{constructor(){this._onDidChange=new B,this.onDidChange=this._onDidChange.event,this.iconSchema={definitions:{icons:{type:"object",properties:{fontId:{type:"string",description:p("iconDefinition.fontId","The id of the font to use. If not set, the font that is defined first is used.")},fontCharacter:{type:"string",description:p("iconDefinition.fontCharacter","The font character associated with the icon definition.")}},additionalProperties:!1,defaultSnippets:[{body:{fontCharacter:"\\\\e030"}}]}},type:"object",properties:{}},this.iconReferenceSchema={type:"string",pattern:`^${Xe.iconNameExpression}$`,enum:[],enumDescriptions:[]},this.iconsById={},this.iconFontsById={}}registerIcon(e,t,i,o){let s=this.iconsById[e];if(s){if(i&&!s.description){s.description=i,this.iconSchema.properties[e].markdownDescription=`${i} $(${e})`;let l=this.iconReferenceSchema.enum.indexOf(e);l!==-1&&(this.iconReferenceSchema.enumDescriptions[l]=i),this._onDidChange.fire()}return s}let r={id:e,description:i,defaults:t,deprecationMessage:o};this.iconsById[e]=r;let a={$ref:"#/definitions/icons"};return o&&(a.deprecationMessage=o),i&&(a.markdownDescription=`${i}: $(${e})`),this.iconSchema.properties[e]=a,this.iconReferenceSchema.enum.push(e),this.iconReferenceSchema.enumDescriptions.push(i||""),this._onDidChange.fire(),{id:e}}getIcons(){return Object.keys(this.iconsById).map(e=>this.iconsById[e])}getIcon(e){return this.iconsById[e]}getIconSchema(){return this.iconSchema}toString(){let e=(s,r)=>s.id.localeCompare(r.id),t=s=>{for(;Xe.isThemeIcon(s.defaults);)s=this.iconsById[s.defaults.id];return`codicon codicon-${s?s.id:""}`},i=[];i.push("| preview | identifier | default codicon ID | description"),i.push("| ----------- | --------------------------------- | --------------------------------- | --------------------------------- |");let o=Object.keys(this.iconsById).map(s=>this.iconsById[s]);for(let s of o.filter(r=>!!r.description).sort(e))i.push(`||${s.id}|${Xe.isThemeIcon(s.defaults)?s.defaults.id:s.id}|${s.description||""}|`);i.push("| preview | identifier "),i.push("| ----------- | --------------------------------- |");for(let s of o.filter(r=>!Xe.isThemeIcon(r.defaults)).sort(e))i.push(`||${s.id}|`);return i.join(` +`)}},tg=new yO;Vt.add(oJ.IconContribution,tg);function fc(n,e,t,i){return tg.registerIcon(n,e,t,i)}function SO(){return tg}function sJ(){let n=_C();for(let e in n){let t="\\"+n[e].toString(16);tg.registerIcon(e,{fontCharacter:t})}}sJ();var zU="vscode://schemas/icons",VU=Vt.as(Lu.JSONContribution);VU.registerSchema(zU,tg.getIconSchema());var WU=new di(()=>VU.notifySchemaChanged(zU),200);tg.onDidChange(()=>{WU.isScheduled()||WU.schedule()});var iut=fc("widget-close",ue.close,p("widgetClose","Icon for the close action in widgets.")),nut=fc("goto-previous-location",ue.arrowUp,p("previousChangeIcon","Icon for goto previous editor location.")),out=fc("goto-next-location",ue.arrowDown,p("nextChangeIcon","Icon for goto next editor location.")),sut=Xe.modify(ue.sync,"spin"),rut=Xe.modify(ue.loading,"spin");function HU(n){let e=new ae,t=e.add(new B),i=SO();return e.add(i.onDidChange(()=>t.fire())),n&&e.add(n.onDidProductIconThemeChange(()=>t.fire())),{dispose:()=>e.dispose(),onDidChange:t.event,getCSS(){let o=n?n.getProductIconTheme():new y1,s={},r=[],a=[];for(let l of i.getIcons()){let c=o.getIcon(l);if(!c)continue;let d=c.font,h=`--vscode-icon-${l.id}-font-family`,u=`--vscode-icon-${l.id}-content`;d?(s[d.id]=d.definition,a.push(`${h}: ${Xw(d.id)};`,`${u}: '${c.fontCharacter}';`),r.push(`.codicon-${l.id}:before { content: '${c.fontCharacter}'; font-family: ${Xw(d.id)}; }`)):(a.push(`${u}: '${c.fontCharacter}'; ${h}: 'codicon';`),r.push(`.codicon-${l.id}:before { content: '${c.fontCharacter}'; }`))}for(let l in s){let c=s[l],d=c.weight?`font-weight: ${c.weight};`:"",h=c.style?`font-style: ${c.style};`:"",u=c.src.map(f=>`${Mr(f.location)} format('${f.format}')`).join(", ");r.push(`@font-face { src: ${u}; font-family: ${Xw(l)};${d}${h} font-display: block; }`)}return r.push(`:root { ${a.join(" ")} }`),r.join(` +`)}}}var y1=class{getIcon(e){let t=SO(),i=e.defaults;for(;Xe.isThemeIcon(i);){let o=t.getIcon(i.id);if(!o)return;i=o.defaults}return i}};vo();var Kh="vs",S1="vs-dark",a_="hc-black",l_="hc-light",UU=Vt.as(VA.ColorContribution),rJ=Vt.as(bM.ThemingContribution),h2=class{constructor(e,t){this.semanticHighlighting=!1,this.themeData=t;let i=t.base;e.length>0?(d2(e)?this.id=e:this.id=i+" "+e,this.themeName=e):(this.id=i,this.themeName=i),this.colors=null,this.defaultColors=Object.create(null),this._tokenTheme=null}get base(){return this.themeData.base}notifyBaseUpdated(){this.themeData.inherit&&(this.colors=null,this._tokenTheme=null)}getColors(){if(!this.colors){let e=new Map;for(let t in this.themeData.colors)e.set(t,Z.fromHex(this.themeData.colors[t]));if(this.themeData.inherit){let t=xO(this.themeData.base);for(let i in t.colors)e.has(i)||e.set(i,Z.fromHex(t.colors[i]))}this.colors=e}return this.colors}getColor(e,t){let i=this.getColors().get(e);if(i)return i;if(t!==!1)return this.getDefault(e)}getDefault(e){let t=this.defaultColors[e];return t||(t=UU.resolveDefaultColor(e,this),this.defaultColors[e]=t,t)}defines(e){return this.getColors().has(e)}get type(){switch(this.base){case Kh:return Ss.LIGHT;case a_:return Ss.HIGH_CONTRAST_DARK;case l_:return Ss.HIGH_CONTRAST_LIGHT;default:return Ss.DARK}}get tokenTheme(){if(!this._tokenTheme){let e=[],t=[];if(this.themeData.inherit){let s=xO(this.themeData.base);e=s.rules,s.encodedTokensColors&&(t=s.encodedTokensColors)}let i=this.themeData.colors["editor.foreground"],o=this.themeData.colors["editor.background"];if(i||o){let s={token:""};i&&(s.foreground=i),o&&(s.background=o),e.push(s)}e=e.concat(this.themeData.rules),this.themeData.encodedTokensColors&&(t=this.themeData.encodedTokensColors),this._tokenTheme=w1.createFromRawTokenTheme(e,t)}return this._tokenTheme}getTokenStyleMetadata(e,t,i){let s=this.tokenTheme._match([e].concat(t).join(".")).metadata,r=mn.getForeground(s),a=mn.getFontStyle(s);return{foreground:r,italic:!!(a&1),bold:!!(a&2),underline:!!(a&4),strikethrough:!!(a&8)}}};function d2(n){return n===Kh||n===S1||n===a_||n===l_}function xO(n){switch(n){case Kh:return MU;case S1:return RU;case a_:return PU;case l_:return OU}}function c2(n){let e=xO(n);return new h2(n,e)}var u2=class extends H{constructor(){super(),this._onColorThemeChange=this._register(new B),this.onDidColorThemeChange=this._onColorThemeChange.event,this._onProductIconThemeChange=this._register(new B),this.onDidProductIconThemeChange=this._onProductIconThemeChange.event,this._environment=Object.create(null),this._builtInProductIconTheme=new y1,this._autoDetectHighContrast=!0,this._knownThemes=new Map,this._knownThemes.set(Kh,c2(Kh)),this._knownThemes.set(S1,c2(S1)),this._knownThemes.set(a_,c2(a_)),this._knownThemes.set(l_,c2(l_));let e=this._register(HU(this));this._codiconCSS=e.getCSS(),this._themeCSS="",this._allCSS=`${this._codiconCSS} +${this._themeCSS}`,this._globalStyleElement=null,this._styleElements=[],this._colorMapOverride=null,this.setTheme(Kh),this._onOSSchemeChanged(),this._register(e.onDidChange(()=>{this._codiconCSS=e.getCSS(),this._updateCSS()})),TT(gt,"(forced-colors: active)",()=>{this._onOSSchemeChanged()})}registerEditorContainer(e){return gu(e)?this._registerShadowDomContainer(e):this._registerRegularEditorContainer()}_registerRegularEditorContainer(){return this._globalStyleElement||(this._globalStyleElement=Xi(void 0,e=>{e.className="monaco-colors",e.textContent=this._allCSS}),this._styleElements.push(this._globalStyleElement)),H.None}_registerShadowDomContainer(e){let t=Xi(e,i=>{i.className="monaco-colors",i.textContent=this._allCSS});return this._styleElements.push(t),{dispose:()=>{for(let i=0;i{i.base===e&&i.notifyBaseUpdated()}),this._theme.themeName===e&&this.setTheme(e)}getColorTheme(){return this._theme}setColorMapOverride(e){this._colorMapOverride=e,this._updateThemeOrColorMap()}setTheme(e){let t;this._knownThemes.has(e)?t=this._knownThemes.get(e):t=this._knownThemes.get(Kh),this._updateActualTheme(t)}_updateActualTheme(e){!e||this._theme===e||(this._theme=e,this._updateThemeOrColorMap())}_onOSSchemeChanged(){if(this._autoDetectHighContrast){let e=gt.matchMedia("(forced-colors: active)").matches;if(e!==Ol(this._theme.type)){let t;Qu(this._theme.type)?t=e?a_:S1:t=e?l_:Kh,this._updateActualTheme(this._knownThemes.get(t))}}}setAutoDetectHighContrast(e){this._autoDetectHighContrast=e,this._onOSSchemeChanged()}_updateThemeOrColorMap(){let e=[],t={},i={addRule:r=>{t[r]||(e.push(r),t[r]=!0)}};rJ.getThemingParticipants().forEach(r=>r(this._theme,i,this._environment));let o=[];for(let r of UU.getColors()){let a=this._theme.getColor(r.id,!0);a&&o.push(`${DS(r.id)}: ${a.toString()};`)}i.addRule(`.monaco-editor, .monaco-diff-editor, .monaco-component { ${o.join(` +`)} }`);let s=this._colorMapOverride||this._theme.tokenTheme.getColorMap();i.addRule(AU(s)),this._themeCSS=e.join(` +`),this._updateCSS(),Bt.setColorMap(s),this._onColorThemeChange.fire(this._theme)}_updateCSS(){this._allCSS=`${this._codiconCSS} +${this._themeCSS}`,this._styleElements.forEach(e=>e.textContent=this._allCSS)}getFileIconTheme(){return{hasFileIcons:!1,hasFolderIcons:!1,hidesExplorerArrows:!1}}getProductIconTheme(){return this._builtInProductIconTheme}};x1();_();v();b();ke();vo();ye();le();Fo();Oi();var aJ=function(n,e,t,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},LO=function(n,e){return function(t,i){e(t,i,n)}},f2=class extends H{constructor(e,t,i){super(),this._contextKeyService=e,this._layoutService=t,this._configurationService=i,this._accessibilitySupport=0,this._onDidChangeScreenReaderOptimized=new B,this._onDidChangeReducedMotion=new B,this._accessibilityModeEnabledContext=P8.bindTo(this._contextKeyService);let o=()=>this._accessibilityModeEnabledContext.set(this.isScreenReaderOptimized());this._register(this._configurationService.onDidChangeConfiguration(r=>{r.affectsConfiguration("editor.accessibilitySupport")&&(o(),this._onDidChangeScreenReaderOptimized.fire()),r.affectsConfiguration("workbench.reduceMotion")&&(this._configMotionReduced=this._configurationService.getValue("workbench.reduceMotion"),this._onDidChangeReducedMotion.fire())})),o(),this._register(this.onDidChangeScreenReaderOptimized(()=>o()));let s=gt.matchMedia("(prefers-reduced-motion: reduce)");this._systemMotionReduced=s.matches,this._configMotionReduced=this._configurationService.getValue("workbench.reduceMotion"),this.initReducedMotionListeners(s)}initReducedMotionListeners(e){this._register($(e,"change",()=>{this._systemMotionReduced=e.matches,this._configMotionReduced==="auto"&&this._onDidChangeReducedMotion.fire()}));let t=()=>{let i=this.isMotionReduced();this._layoutService.mainContainer.classList.toggle("reduce-motion",i),this._layoutService.mainContainer.classList.toggle("enable-motion",!i)};t(),this._register(this.onDidChangeReducedMotion(()=>t()))}get onDidChangeScreenReaderOptimized(){return this._onDidChangeScreenReaderOptimized.event}isScreenReaderOptimized(){let e=this._configurationService.getValue("editor.accessibilitySupport");return e==="on"||e==="auto"&&this._accessibilitySupport===2}get onDidChangeReducedMotion(){return this._onDidChangeReducedMotion.event}isMotionReduced(){let e=this._configMotionReduced;return e==="on"||e==="auto"&&this._systemMotionReduced}getAccessibilitySupport(){return this._accessibilitySupport}};f2=aJ([LO(0,rt),LO(1,ss),LO(2,Rt)],f2);zr();_();v();b();Gt();ye();le();zr();ir();Oi();Po();wt();Ge();var p2=function(n,e,t,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},gc=function(n,e){return function(t,i){e(t,i,n)}},c_,$h,g2=class{constructor(e,t,i){this._commandService=e,this._keybindingService=t,this._hiddenStates=new m2(i)}createMenu(e,t,i){return new DO(e,this._hiddenStates,{emitEventsForSubmenuChanges:!1,eventDebounceDelay:50,...i},this._commandService,this._keybindingService,t)}resetHiddenStates(e){this._hiddenStates.reset(e)}};g2=p2([gc(0,kn),gc(1,fi),gc(2,Vf)],g2);var m2=c_=class{constructor(e){this._storageService=e,this._disposables=new ae,this._onDidChange=new B,this.onDidChange=this._onDidChange.event,this._ignoreChangeEvent=!1,this._hiddenByDefaultCache=new Map;try{let t=e.get(c_._key,0,"{}");this._data=JSON.parse(t)}catch{this._data=Object.create(null)}this._disposables.add(e.onDidChangeValue(0,c_._key,this._disposables)(()=>{if(!this._ignoreChangeEvent)try{let t=e.get(c_._key,0,"{}");this._data=JSON.parse(t)}catch(t){console.log("FAILED to read storage after UPDATE",t)}this._onDidChange.fire()}))}dispose(){this._onDidChange.dispose(),this._disposables.dispose()}_isHiddenByDefault(e,t){var i;return(i=this._hiddenByDefaultCache.get(`${e.id}/${t}`))!==null&&i!==void 0?i:!1}setDefaultState(e,t,i){this._hiddenByDefaultCache.set(`${e.id}/${t}`,i)}isHidden(e,t){var i,o;let s=this._isHiddenByDefault(e,t),r=(o=(i=this._data[e.id])===null||i===void 0?void 0:i.includes(t))!==null&&o!==void 0?o:!1;return s?!r:r}updateHidden(e,t,i){this._isHiddenByDefault(e,t)&&(i=!i);let s=this._data[e.id];if(i)s?s.indexOf(t)<0&&s.push(t):this._data[e.id]=[t];else if(s){let r=s.indexOf(t);r>=0&&GF(s,r),s.length===0&&delete this._data[e.id]}this._persist()}reset(e){if(e===void 0)this._data=Object.create(null),this._persist();else{for(let{id:t}of e)this._data[t]&&delete this._data[t];this._persist()}}_persist(){try{this._ignoreChangeEvent=!0;let e=JSON.stringify(this._data);this._storageService.store(c_._key,e,0,0)}finally{this._ignoreChangeEvent=!1}}};m2._key="menu.hiddenCommands";m2=c_=p2([gc(0,Vf)],m2);var kO=$h=class{constructor(e,t,i,o,s,r){this._id=e,this._hiddenStates=t,this._collectContextKeysForSubmenus=i,this._commandService=o,this._keybindingService=s,this._contextKeyService=r,this._menuGroups=[],this._structureContextKeys=new Set,this._preconditionContextKeys=new Set,this._toggledContextKeys=new Set,this.refresh()}get structureContextKeys(){return this._structureContextKeys}get preconditionContextKeys(){return this._preconditionContextKeys}get toggledContextKeys(){return this._toggledContextKeys}refresh(){this._menuGroups.length=0,this._structureContextKeys.clear(),this._preconditionContextKeys.clear(),this._toggledContextKeys.clear();let e=Fs.getMenuItems(this._id),t;e.sort($h._compareMenuItems);for(let i of e){let o=i.group||"";(!t||t[0]!==o)&&(t=[o,[]],this._menuGroups.push(t)),t[1].push(i),this._collectContextKeys(i)}}_collectContextKeys(e){if($h._fillInKbExprKeys(e.when,this._structureContextKeys),jg(e)){if(e.command.precondition&&$h._fillInKbExprKeys(e.command.precondition,this._preconditionContextKeys),e.command.toggled){let t=e.command.toggled.condition||e.command.toggled;$h._fillInKbExprKeys(t,this._toggledContextKeys)}}else this._collectContextKeysForSubmenus&&Fs.getMenuItems(e.submenu).forEach(this._collectContextKeys,this)}createActionGroups(e){let t=[];for(let i of this._menuGroups){let[o,s]=i,r=[];for(let a of s)if(this._contextKeyService.contextMatchesRules(a.when)){let l=jg(a);l&&this._hiddenStates.setDefaultState(this._id,a.command.id,!!a.isHiddenByDefault);let c=lJ(this._id,l?a.command:a,this._hiddenStates);if(l){let d=EO(a.command.id,a.when,this._commandService,this._keybindingService);r.push(new Br(a.command,a.alt,e,c,d,this._contextKeyService,this._commandService))}else{let d=new $h(a.submenu,this._hiddenStates,this._collectContextKeysForSubmenus,this._commandService,this._keybindingService,this._contextKeyService).createActionGroups(e),h=zi.join(...d.map(u=>u[1]));h.length>0&&r.push(new wl(a,c,h))}}r.length>0&&t.push([o,r])}return t}static _fillInKbExprKeys(e,t){if(e)for(let i of e.keys())t.add(i)}static _compareMenuItems(e,t){let i=e.group,o=t.group;if(i!==o){if(i){if(!o)return-1}else return 1;if(i==="navigation")return-1;if(o==="navigation")return 1;let a=i.localeCompare(o);if(a!==0)return a}let s=e.order||0,r=t.order||0;return sr?1:$h._compareTitles(jg(e)?e.command.title:e.title,jg(t)?t.command.title:t.title)}static _compareTitles(e,t){let i=typeof e=="string"?e:e.original,o=typeof t=="string"?t:t.original;return i.localeCompare(o)}};kO=$h=p2([gc(3,kn),gc(4,fi),gc(5,rt)],kO);var DO=class{constructor(e,t,i,o,s,r){this._disposables=new ae,this._menuInfo=new kO(e,t,i.emitEventsForSubmenuChanges,o,s,r);let a=new di(()=>{this._menuInfo.refresh(),this._onDidChange.fire({menu:this,isStructuralChange:!0,isEnablementChange:!0,isToggleChange:!0})},i.eventDebounceDelay);this._disposables.add(a),this._disposables.add(Fs.onDidChangeMenu(h=>{h.has(e)&&a.schedule()}));let l=this._disposables.add(new ae),c=h=>{let u=!1,f=!1,g=!1;for(let m of h)if(u=u||m.isStructuralChange,f=f||m.isEnablementChange,g=g||m.isToggleChange,u&&f&&g)break;return{menu:this,isStructuralChange:u,isEnablementChange:f,isToggleChange:g}},d=()=>{l.add(r.onDidChangeContext(h=>{let u=h.affectsSome(this._menuInfo.structureContextKeys),f=h.affectsSome(this._menuInfo.preconditionContextKeys),g=h.affectsSome(this._menuInfo.toggledContextKeys);(u||f||g)&&this._onDidChange.fire({menu:this,isStructuralChange:u,isEnablementChange:f,isToggleChange:g})})),l.add(t.onDidChange(h=>{this._onDidChange.fire({menu:this,isStructuralChange:!0,isEnablementChange:!1,isToggleChange:!1})}))};this._onDidChange=new wg({onWillAddFirstListener:d,onDidRemoveLastListener:l.clear.bind(l),delay:i.eventDebounceDelay,merge:c}),this.onDidChange=this._onDidChange.event}getActions(e){return this._menuInfo.createActionGroups(e)}dispose(){this._disposables.dispose(),this._onDidChange.dispose()}};DO=p2([gc(3,kn),gc(4,fi),gc(5,rt)],DO);function lJ(n,e,t){let i=r3(e)?e.submenu.id:e.id,o=typeof e.title=="string"?e.title:e.title.value,s=zd({id:`hide/${n.id}/${i}`,label:p("hide.label","Hide '{0}'",o),run(){t.updateHidden(n,i,!0)}}),r=zd({id:`toggle/${n.id}/${i}`,label:o,get checked(){return!t.isHidden(n,i)},run(){t.updateHidden(n,i,!!this.checked)}});return{hide:s,toggle:r,get isHidden(){return!r.checked}}}function EO(n,e=void 0,t,i){return zd({id:`configureKeybinding/${n}`,label:p("configure keybinding","Configure Keybinding"),run(){let s=!!!i.lookupKeybinding(n)&&e?e.serialize():void 0;t.executeCommand("workbench.action.openGlobalKeybindings",`@command:${n}`+(s?` +when:${s}`:""))}})}_();v();b();ps();ke();vo();Gt();ye();Bg();le();Aa();var cJ=function(n,e,t,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},KU=function(n,e){return function(t,i){e(t,i,n)}},IO,L1=IO=class extends H{constructor(e,t){super(),this.layoutService=e,this.logService=t,this.mapTextToType=new Map,this.findText="",this.resources=[],this.resourcesStateHash=void 0,(ms||yw)&&this.installWebKitWriteTextWorkaround(),this._register(ie.runAndSubscribe(fu,({window:i,disposables:o})=>{o.add($(i.document,"copy",()=>this.clearResources()))},{window:gt,disposables:this._store}))}installWebKitWriteTextWorkaround(){let e=()=>{let t=new Og;this.webKitPendingClipboardWritePromise&&!this.webKitPendingClipboardWritePromise.isSettled&&this.webKitPendingClipboardWritePromise.cancel(),this.webKitPendingClipboardWritePromise=t,navigator.clipboard.write([new ClipboardItem({"text/plain":t.p})]).catch(async i=>{(!(i instanceof Error)||i.name!=="NotAllowedError"||!t.isRejected)&&this.logService.error(i)})};this._register(ie.runAndSubscribe(this.layoutService.onDidAddContainer,({container:t,disposables:i})=>{i.add($(t,"click",e)),i.add($(t,"keydown",e))},{container:this.layoutService.mainContainer,disposables:this._store}))}async writeText(e,t){if(this.writeResources([]),t){this.mapTextToType.set(t,e);return}if(this.webKitPendingClipboardWritePromise)return this.webKitPendingClipboardWritePromise.complete(e);try{return await navigator.clipboard.writeText(e)}catch(i){console.error(i)}this.fallbackWriteText(e)}fallbackWriteText(e){let t=jw(),i=t.activeElement,o=t.body.appendChild(ve("textarea",{"aria-hidden":!0}));o.style.height="1px",o.style.width="1px",o.style.position="absolute",o.value=e,o.focus(),o.select(),t.execCommand("copy"),i instanceof HTMLElement&&i.focus(),t.body.removeChild(o)}async readText(e){if(e)return this.mapTextToType.get(e)||"";try{return await navigator.clipboard.readText()}catch(t){console.error(t)}return""}async readFindText(){return this.findText}async writeFindText(e){this.findText=e}async writeResources(e){e.length===0?this.clearResources():(this.resources=e,this.resourcesStateHash=await this.computeResourcesStateHash())}async readResources(){let e=await this.computeResourcesStateHash();return this.resourcesStateHash!==e&&this.clearResources(),this.resources}async computeResourcesStateHash(){if(this.resources.length===0)return;let e=await this.readText();return zw(e.substring(0,IO.MAX_RESOURCE_STATE_SOURCE_LENGTH))}clearResources(){this.resources=[],this.resourcesStateHash=void 0}};L1.MAX_RESOURCE_STATE_SOURCE_LENGTH=1e3;L1=IO=cJ([KU(0,ss),KU(1,En)],L1);_();v();b();qe();var d_=De("clipboardService");_();v();b();ye();js();le();hs();sn();Ge();ir();Fo();Oi();var dJ=function(n,e,t,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},hJ=function(n,e){return function(t,i){e(t,i,n)}},k1="data-keybinding-context",D1=class{constructor(e,t){this._id=e,this._parent=t,this._value=Object.create(null),this._value._contextId=e}get value(){return{...this._value}}setValue(e,t){return this._value[e]!==t?(this._value[e]=t,!0):!1}removeValue(e){return e in this._value?(delete this._value[e],!0):!1}getValue(e){let t=this._value[e];return typeof t>"u"&&this._parent?this._parent.getValue(e):t}},qh=class extends D1{constructor(){super(-1,null)}setValue(e,t){return!1}removeValue(e){return!1}getValue(e){}};qh.INSTANCE=new qh;var _2=class n extends D1{constructor(e,t,i){super(e,null),this._configurationService=t,this._values=Av.forConfigKeys(),this._listener=this._configurationService.onDidChangeConfiguration(o=>{if(o.source===7){let s=Array.from(this._values,([r])=>r);this._values.clear(),i.fire(new v2(s))}else{let s=[];for(let r of o.affectedKeys){let a=`config.${r}`,l=this._values.findSuperstr(a);l!==void 0&&(s.push(...ht.map(l,([c])=>c)),this._values.deleteSuperstr(a)),this._values.has(a)&&(s.push(a),this._values.delete(a))}i.fire(new v2(s))}})}dispose(){this._listener.dispose()}getValue(e){if(e.indexOf(n._keyPrefix)!==0)return super.getValue(e);if(this._values.has(e))return this._values.get(e);let t=e.substr(n._keyPrefix.length),i=this._configurationService.getValue(t),o;switch(typeof i){case"number":case"boolean":case"string":o=i;break;default:Array.isArray(i)?o=JSON.stringify(i):o=i}return this._values.set(e,o),o}setValue(e,t){return super.setValue(e,t)}removeValue(e){return super.removeValue(e)}};_2._keyPrefix="config.";var TO=class{constructor(e,t,i){this._service=e,this._key=t,this._defaultValue=i,this.reset()}set(e){this._service.setContext(this._key,e)}reset(){typeof this._defaultValue>"u"?this._service.removeContext(this._key):this._service.setContext(this._key,this._defaultValue)}get(){return this._service.getContextKeyValue(this._key)}},b2=class{constructor(e){this.key=e}affectsSome(e){return e.has(this.key)}allKeysContainedIn(e){return this.affectsSome(e)}},v2=class{constructor(e){this.keys=e}affectsSome(e){for(let t of this.keys)if(e.has(t))return!0;return!1}allKeysContainedIn(e){return this.keys.every(t=>e.has(t))}},NO=class{constructor(e){this.events=e}affectsSome(e){for(let t of this.events)if(t.affectsSome(e))return!0;return!1}allKeysContainedIn(e){return this.events.every(t=>t.allKeysContainedIn(e))}};function uJ(n,e){return n.allKeysContainedIn(new Set(Object.keys(e)))}var C2=class extends H{constructor(e){super(),this._onDidChangeContext=this._register(new ul({merge:t=>new NO(t)})),this.onDidChangeContext=this._onDidChangeContext.event,this._isDisposed=!1,this._myContextId=e}createKey(e,t){if(this._isDisposed)throw new Error("AbstractContextKeyService has been disposed");return new TO(this,e,t)}bufferChangeEvents(e){this._onDidChangeContext.pause();try{e()}finally{this._onDidChangeContext.resume()}}createScoped(e){if(this._isDisposed)throw new Error("AbstractContextKeyService has been disposed");return new AO(this,e)}contextMatchesRules(e){if(this._isDisposed)throw new Error("AbstractContextKeyService has been disposed");let t=this.getContextValuesContainer(this._myContextId);return e?e.evaluate(t):!0}getContextKeyValue(e){if(!this._isDisposed)return this.getContextValuesContainer(this._myContextId).getValue(e)}setContext(e,t){if(this._isDisposed)return;let i=this.getContextValuesContainer(this._myContextId);i&&i.setValue(e,t)&&this._onDidChangeContext.fire(new b2(e))}removeContext(e){this._isDisposed||this.getContextValuesContainer(this._myContextId).removeValue(e)&&this._onDidChangeContext.fire(new b2(e))}getContext(e){return this._isDisposed?qh.INSTANCE:this.getContextValuesContainer(fJ(e))}dispose(){super.dispose(),this._isDisposed=!0}},w2=class extends C2{constructor(e){super(0),this._contexts=new Map,this._lastContextId=0;let t=this._register(new _2(this._myContextId,e,this._onDidChangeContext));this._contexts.set(this._myContextId,t)}getContextValuesContainer(e){return this._isDisposed?qh.INSTANCE:this._contexts.get(e)||qh.INSTANCE}createChildContext(e=this._myContextId){if(this._isDisposed)throw new Error("ContextKeyService has been disposed");let t=++this._lastContextId;return this._contexts.set(t,new D1(t,this.getContextValuesContainer(e))),t}disposeContext(e){this._isDisposed||this._contexts.delete(e)}};w2=dJ([hJ(0,Rt)],w2);var AO=class extends C2{constructor(e,t){if(super(e.createChildContext()),this._parentChangeListener=this._register(new no),this._parent=e,this._updateParentChangeListener(),this._domNode=t,this._domNode.hasAttribute(k1)){let i="";this._domNode.classList&&(i=Array.from(this._domNode.classList.values()).join(", ")),console.error(`Element already has context attribute${i?": "+i:""}`)}this._domNode.setAttribute(k1,String(this._myContextId))}_updateParentChangeListener(){this._parentChangeListener.value=this._parent.onDidChangeContext(e=>{let i=this._parent.getContextValuesContainer(this._myContextId).value;uJ(e,i)||this._onDidChangeContext.fire(e)})}dispose(){this._isDisposed||(this._parent.disposeContext(this._myContextId),this._domNode.removeAttribute(k1),super.dispose())}getContextValuesContainer(e){return this._isDisposed?qh.INSTANCE:this._parent.getContextValuesContainer(e)}createChildContext(e=this._myContextId){if(this._isDisposed)throw new Error("ScopedContextKeyService has been disposed");return this._parent.createChildContext(e)}disposeContext(e){this._isDisposed||this._parent.disposeContext(e)}};function fJ(n){for(;n;){if(n.hasAttribute(k1)){let e=n.getAttribute(k1);return e?parseInt(e,10):NaN}n=n.parentElement}return 0}function gJ(n,e,t){n.get(rt).createKey(String(e),mJ(t))}function mJ(n){return Z1(n,e=>{if(typeof e=="object"&&e.$mid===1)return Oe.revive(e).toString();if(e instanceof Oe)return e.toString()})}Pi.registerCommand("_setContext",gJ);Pi.registerCommand({id:"getContextKeyInfo",handler(){return[...xe.all()].sort((n,e)=>n.key.localeCompare(e.key))},metadata:{description:p("getContextKeyInfo","A command that returns information about context keys"),args:[]}});Pi.registerCommand("_generateContextKeyInfo",function(){let n=[],e=new Set;for(let t of xe.all())e.has(t.key)||(e.add(t.key),n.push(t));n.sort((t,i)=>t.key.localeCompare(i.key)),console.log(JSON.stringify(n,void 0,2))});My();_();v();b();Gt();xt();le();My();_();v();b();var MO=class{constructor(e,t){this.key=e,this.data=t,this.incoming=new Map,this.outgoing=new Map}},E1=class{constructor(e){this._hashFn=e,this._nodes=new Map}roots(){let e=[];for(let t of this._nodes.values())t.outgoing.size===0&&e.push(t);return e}insertEdge(e,t){let i=this.lookupOrInsertNode(e),o=this.lookupOrInsertNode(t);i.outgoing.set(o.key,o),o.incoming.set(i.key,i)}removeNode(e){let t=this._hashFn(e);this._nodes.delete(t);for(let i of this._nodes.values())i.outgoing.delete(t),i.incoming.delete(t)}lookupOrInsertNode(e){let t=this._hashFn(e),i=this._nodes.get(t);return i||(i=new MO(t,e),this._nodes.set(t,i)),i}isEmpty(){return this._nodes.size===0}toString(){let e=[];for(let[t,i]of this._nodes)e.push(`${t} + (-> incoming)[${[...i.incoming.keys()].join(", ")}] + (outgoing ->)[${[...i.outgoing.keys()].join(",")}] +`);return e.join(` +`)}findCycleSlow(){for(let[e,t]of this._nodes){let i=new Set([e]),o=this._findCycle(t,i);if(o)return o}}_findCycle(e,t){for(let[i,o]of e.outgoing){if(t.has(i))return[...t,i].join(" -> ");t.add(i);let s=this._findCycle(o,t);if(s)return s;t.delete(i)}}};qe();kr();var pJ=!1,y2=class extends Error{constructor(e){var t;super("cyclic dependency between services"),this.message=(t=e.findCycleSlow())!==null&&t!==void 0?t:`UNABLE to detect cycle, dumping graph: +${e.toString()}`}},S2=class n{constructor(e=new sa,t=!1,i,o=pJ){var s;this._services=e,this._strict=t,this._parent=i,this._enableTracing=o,this._isDisposed=!1,this._servicesToMaybeDispose=new Set,this._children=new Set,this._activeInstantiations=new Set,this._services.set(Ye,this),this._globalGraph=o?(s=i?._globalGraph)!==null&&s!==void 0?s:new E1(r=>r):void 0}dispose(){if(!this._isDisposed){this._isDisposed=!0,li(this._children),this._children.clear();for(let e of this._servicesToMaybeDispose)aC(e)&&e.dispose();this._servicesToMaybeDispose.clear()}}_throwIfDisposed(){if(this._isDisposed)throw new Error("InstantiationService has been disposed")}createChild(e){this._throwIfDisposed();let t=new class extends n{dispose(){this._children.delete(t),super.dispose()}}(e,this._strict,this,this._enableTracing);return this._children.add(t),t}invokeFunction(e,...t){this._throwIfDisposed();let i=rd.traceInvocation(this._enableTracing,e),o=!1;try{return e({get:r=>{if(o)throw _g("service accessor is only valid during the invocation of its target method");let a=this._getOrCreateServiceInstance(r,i);if(!a)throw new Error(`[invokeFunction] unknown service '${r}'`);return a}},...t)}finally{o=!0,i.stop()}}createInstance(e,...t){this._throwIfDisposed();let i,o;return e instanceof Cs?(i=rd.traceCreation(this._enableTracing,e.ctor),o=this._createInstance(e.ctor,e.staticArguments.concat(t),i)):(i=rd.traceCreation(this._enableTracing,e),o=this._createInstance(e,t,i)),i.stop(),o}_createInstance(e,t=[],i){let o=Pr.getServiceDependencies(e).sort((a,l)=>a.index-l.index),s=[];for(let a of o){let l=this._getOrCreateServiceInstance(a.id,i);l||this._throwIfStrict(`[createInstance] ${e.name} depends on UNKNOWN service ${a.id}.`,!1),s.push(l)}let r=o.length>0?o[0].index:t.length;if(t.length!==r){console.trace(`[createInstance] First service dependency of ${e.name} at position ${r+1} conflicts with ${t.length} static arguments`);let a=r-t.length;a>0?t=t.concat(new Array(a)):t=t.slice(0,r)}return Reflect.construct(e,t.concat(s))}_setCreatedServiceInstance(e,t){if(this._services.get(e)instanceof Cs)this._services.set(e,t);else if(this._parent)this._parent._setCreatedServiceInstance(e,t);else throw new Error("illegalState - setting UNKNOWN service instance")}_getServiceInstanceOrDescriptor(e){let t=this._services.get(e);return!t&&this._parent?this._parent._getServiceInstanceOrDescriptor(e):t}_getOrCreateServiceInstance(e,t){this._globalGraph&&this._globalGraphImplicitDependency&&this._globalGraph.insertEdge(this._globalGraphImplicitDependency,String(e));let i=this._getServiceInstanceOrDescriptor(e);return i instanceof Cs?this._safeCreateAndCacheServiceInstance(e,i,t.branch(e,!0)):(t.branch(e,!1),i)}_safeCreateAndCacheServiceInstance(e,t,i){if(this._activeInstantiations.has(e))throw new Error(`illegal state - RECURSIVELY instantiating service '${e}'`);this._activeInstantiations.add(e);try{return this._createAndCacheServiceInstance(e,t,i)}finally{this._activeInstantiations.delete(e)}}_createAndCacheServiceInstance(e,t,i){var o;let s=new E1(l=>l.id.toString()),r=0,a=[{id:e,desc:t,_trace:i}];for(;a.length;){let l=a.pop();if(s.lookupOrInsertNode(l),r++>1e3)throw new y2(s);for(let c of Pr.getServiceDependencies(l.desc.ctor)){let d=this._getServiceInstanceOrDescriptor(c.id);if(d||this._throwIfStrict(`[createInstance] ${e} depends on ${c.id} which is NOT registered.`,!0),(o=this._globalGraph)===null||o===void 0||o.insertEdge(String(l.id),String(c.id)),d instanceof Cs){let h={id:c.id,desc:d,_trace:l._trace.branch(c.id,!0)};s.insertEdge(l,h),a.push(h)}}}for(;;){let l=s.roots();if(l.length===0){if(!s.isEmpty())throw new y2(s);break}for(let{data:c}of l){if(this._getServiceInstanceOrDescriptor(c.id)instanceof Cs){let h=this._createServiceInstanceWithOwner(c.id,c.desc.ctor,c.desc.staticArguments,c.desc.supportsDelayedInstantiation,c._trace);this._setCreatedServiceInstance(c.id,h)}s.removeNode(c)}}return this._getServiceInstanceOrDescriptor(e)}_createServiceInstanceWithOwner(e,t,i=[],o,s){if(this._services.get(e)instanceof Cs)return this._createServiceInstance(e,t,i,o,s,this._servicesToMaybeDispose);if(this._parent)return this._parent._createServiceInstanceWithOwner(e,t,i,o,s);throw new Error(`illegalState - creating UNKNOWN service instance ${t.name}`)}_createServiceInstance(e,t,i=[],o,s,r){if(o){let a=new n(void 0,this._strict,this,this._enableTracing);a._globalGraphImplicitDependency=String(e);let l=new Map,c=new Iw(()=>{let d=a._createInstance(t,i,s);for(let[h,u]of l){let f=d[h];if(typeof f=="function")for(let g of u)g.disposable=f.apply(d,g.listener)}return l.clear(),r.add(d),d});return new Proxy(Object.create(null),{get(d,h){if(!c.isInitialized&&typeof h=="string"&&(h.startsWith("onDid")||h.startsWith("onWill"))){let g=l.get(h);return g||(g=new Ii,l.set(h,g)),(C,S,w)=>{if(c.isInitialized)return c.value[h](C,S,w);{let y={listener:[C,S,w],disposable:void 0},x=g.push(y);return be(()=>{var T;x(),(T=y.disposable)===null||T===void 0||T.dispose()})}}}if(h in d)return d[h];let u=c.value,f=u[h];return typeof f!="function"||(f=f.bind(u),d[h]=f),f},set(d,h,u){return c.value[h]=u,!0},getPrototypeOf(d){return t.prototype}})}else{let a=this._createInstance(t,i,s);return r.add(a),a}}_throwIfStrict(e,t){if(t&&console.warn(e),this._strict)throw new Error(e)}},rd=class n{static traceInvocation(e,t){return e?new n(2,t.name||new Error().stack.split(` +`).slice(3,4).join(` +`)):n._None}static traceCreation(e,t){return e?new n(1,t.name):n._None}constructor(e,t){this.type=e,this.name=t,this._start=Date.now(),this._dep=[]}branch(e,t){let i=new n(3,e.toString());return this._dep.push([e,t,i]),i}stop(){let e=Date.now()-this._start;n._totals+=e;let t=!1;function i(s,r){let a=[],l=new Array(s+1).join(" ");for(let[c,d,h]of r._dep)if(d&&h){t=!0,a.push(`${l}CREATES -> ${c}`);let u=i(s+1,h);u&&a.push(u)}else a.push(`${l}uses -> ${c}`);return a.join(` +`)}let o=[`${this.type===1?"CREATE":"CALL"} ${this.name}`,`${i(1,this)}`,`DONE, took ${e.toFixed(2)}ms (grand total ${n._totals.toFixed(2)}ms)`];(e>2||t)&&n.all.add(o.join(` +`))}};rd.all=new Set;rd._None=new class extends rd{constructor(){super(0,null)}stop(){}branch(){return this}};rd._totals=0;_();v();b();wt();ye();js();cr();er();sn();var _J=new Set([Ze.inMemory,Ze.vscodeSourceControl,Ze.walkThrough,Ze.walkThroughSnippet,Ze.vscodeChatCodeBlock]),RO=class{constructor(){this._byResource=new Gn,this._byOwner=new Map}set(e,t,i){let o=this._byResource.get(e);o||(o=new Map,this._byResource.set(e,o)),o.set(t,i);let s=this._byOwner.get(t);s||(s=new Gn,this._byOwner.set(t,s)),s.set(e,i)}get(e,t){let i=this._byResource.get(e);return i?.get(t)}delete(e,t){let i=!1,o=!1,s=this._byResource.get(e);s&&(i=s.delete(t));let r=this._byOwner.get(t);if(r&&(o=r.delete(e)),i!==o)throw new Error("illegal state");return i&&o}values(e){var t,i,o,s;return typeof e=="string"?(i=(t=this._byOwner.get(e))===null||t===void 0?void 0:t.values())!==null&&i!==void 0?i:ht.empty():Oe.isUri(e)?(s=(o=this._byResource.get(e))===null||o===void 0?void 0:o.values())!==null&&s!==void 0?s:ht.empty():ht.map(ht.concat(...this._byOwner.values()),r=>r[1])}},PO=class{constructor(e){this.errors=0,this.infos=0,this.warnings=0,this.unknowns=0,this._data=new Gn,this._service=e,this._subscription=e.onMarkerChanged(this._update,this)}dispose(){this._subscription.dispose()}_update(e){for(let t of e){let i=this._data.get(t);i&&this._substract(i);let o=this._resourceStats(t);this._add(o),this._data.set(t,o)}}_resourceStats(e){let t={errors:0,warnings:0,infos:0,unknowns:0};if(_J.has(e.scheme))return t;for(let{severity:i}of this._service.read({resource:e}))i===Es.Error?t.errors+=1:i===Es.Warning?t.warnings+=1:i===Es.Info?t.infos+=1:t.unknowns+=1;return t}_substract(e){this.errors-=e.errors,this.warnings-=e.warnings,this.infos-=e.infos,this.unknowns-=e.unknowns}_add(e){this.errors+=e.errors,this.warnings+=e.warnings,this.infos+=e.infos,this.unknowns+=e.unknowns}},x2=class n{constructor(){this._onMarkerChanged=new wg({delay:0,merge:n._merge}),this.onMarkerChanged=this._onMarkerChanged.event,this._data=new RO,this._stats=new PO(this)}dispose(){this._stats.dispose(),this._onMarkerChanged.dispose()}remove(e,t){for(let i of t||[])this.changeOne(e,i,[])}changeOne(e,t,i){if(XF(i))this._data.delete(t,e)&&this._onMarkerChanged.fire([t]);else{let o=[];for(let s of i){let r=n._toMarker(e,t,s);r&&o.push(r)}this._data.set(t,e,o),this._onMarkerChanged.fire([t])}}static _toMarker(e,t,i){let{code:o,severity:s,message:r,source:a,startLineNumber:l,startColumn:c,endLineNumber:d,endColumn:h,relatedInformation:u,tags:f}=i;if(r)return l=l>0?l:1,c=c>0?c:1,d=d>=l?d:l,h=h>0?h:c,{resource:t,owner:e,code:o,severity:s,message:r,source:a,startLineNumber:l,startColumn:c,endLineNumber:d,endColumn:h,relatedInformation:u,tags:f}}changeAll(e,t){let i=[],o=this._data.values(e);if(o)for(let s of o){let r=ht.first(s);r&&(i.push(r.resource),this._data.delete(r.resource,e))}if(eu(t)){let s=new Gn;for(let{resource:r,marker:a}of t){let l=n._toMarker(e,r,a);if(!l)continue;let c=s.get(r);c?c.push(l):(s.set(r,[l]),i.push(r))}for(let[r,a]of s)this._data.set(r,e,a)}i.length>0&&this._onMarkerChanged.fire(i)}read(e=Object.create(null)){let{owner:t,resource:i,severities:o,take:s}=e;if((!s||s<0)&&(s=-1),t&&i){let r=this._data.get(i,t);if(r){let a=[];for(let l of r)if(n._accept(l,o)){let c=a.push(l);if(s>0&&c===s)break}return a}else return[]}else if(!t&&!i){let r=[];for(let a of this._data.values())for(let l of a)if(n._accept(l,o)){let c=r.push(l);if(s>0&&c===s)return r}return r}else{let r=this._data.values(i??t),a=[];for(let l of r)for(let c of l)if(n._accept(c,o)){let d=a.push(c);if(s>0&&d===s)return a}return a}}static _accept(e,t){return t===void 0||(t&e.severity)===e.severity}static _merge(e){let t=new Gn;for(let i of e)for(let o of i)t.set(o,!0);return Array.from(t.keys())}};_();v();b();le();Du();Oo();var L2=class extends H{get configurationModel(){return this._configurationModel}constructor(e){super(),this.logService=e,this._configurationModel=ko.createEmptyModel(this.logService)}reload(){return this.resetConfigurationModel(),this.configurationModel}getConfigurationDefaultOverrides(){return{}}resetConfigurationModel(){this._configurationModel=ko.createEmptyModel(this.logService);let e=Vt.as(ar.Configuration).getConfigurationProperties();this.updateConfigurationModel(Object.keys(e),e)}updateConfigurationModel(e,t){let i=this.getConfigurationDefaultOverrides();for(let o of e){let s=i[o],r=t[o];s!==void 0?this._configurationModel.addValue(o,s):r?this._configurationModel.addValue(o,r.default):this._configurationModel.removeValue(o)}}};_();v();b();Ge();qe();var rl=De("accessibilitySignalService"),zgt=Symbol("AcknowledgeDocCommentsToken"),Re=class n{static register(e){return new n(e.fileName)}constructor(e){this.fileName=e}};Re.error=Re.register({fileName:"error.mp3"});Re.warning=Re.register({fileName:"warning.mp3"});Re.foldedArea=Re.register({fileName:"foldedAreas.mp3"});Re.break=Re.register({fileName:"break.mp3"});Re.quickFixes=Re.register({fileName:"quickFixes.mp3"});Re.taskCompleted=Re.register({fileName:"taskCompleted.mp3"});Re.taskFailed=Re.register({fileName:"taskFailed.mp3"});Re.terminalBell=Re.register({fileName:"terminalBell.mp3"});Re.diffLineInserted=Re.register({fileName:"diffLineInserted.mp3"});Re.diffLineDeleted=Re.register({fileName:"diffLineDeleted.mp3"});Re.diffLineModified=Re.register({fileName:"diffLineModified.mp3"});Re.chatRequestSent=Re.register({fileName:"chatRequestSent.mp3"});Re.chatResponseReceived1=Re.register({fileName:"chatResponseReceived1.mp3"});Re.chatResponseReceived2=Re.register({fileName:"chatResponseReceived2.mp3"});Re.chatResponseReceived3=Re.register({fileName:"chatResponseReceived3.mp3"});Re.chatResponseReceived4=Re.register({fileName:"chatResponseReceived4.mp3"});Re.clear=Re.register({fileName:"clear.mp3"});Re.save=Re.register({fileName:"save.mp3"});Re.format=Re.register({fileName:"format.mp3"});Re.voiceRecordingStarted=Re.register({fileName:"voiceRecordingStarted.mp3"});Re.voiceRecordingStopped=Re.register({fileName:"voiceRecordingStopped.mp3"});Re.progress=Re.register({fileName:"progress.mp3"});var OO=class{constructor(e){this.randomOneOf=e}},Ve=class n{constructor(e,t,i,o,s,r){this.sound=e,this.name=t,this.legacySoundSettingsKey=i,this.settingsKey=o,this.legacyAnnouncementSettingsKey=s,this.announcementMessage=r}static register(e){let t=new OO("randomOneOf"in e.sound?e.sound.randomOneOf:[e.sound]),i=new n(t,e.name,e.legacySoundSettingsKey,e.settingsKey,e.legacyAnnouncementSettingsKey,e.announcementMessage);return n._signals.add(i),i}};Ve._signals=new Set;Ve.errorAtPosition=Ve.register({name:p("accessibilitySignals.positionHasError.name","Error at Position"),sound:Re.error,announcementMessage:p("accessibility.signals.positionHasError","Error"),settingsKey:"accessibility.signals.positionHasError"});Ve.warningAtPosition=Ve.register({name:p("accessibilitySignals.positionHasWarning.name","Warning at Position"),sound:Re.warning,announcementMessage:p("accessibility.signals.positionHasWarning","Warning"),settingsKey:"accessibility.signals.positionHasWarning"});Ve.errorOnLine=Ve.register({name:p("accessibilitySignals.lineHasError.name","Error on Line"),sound:Re.error,legacySoundSettingsKey:"audioCues.lineHasError",legacyAnnouncementSettingsKey:"accessibility.alert.error",announcementMessage:p("accessibility.signals.lineHasError","Error on Line"),settingsKey:"accessibility.signals.lineHasError"});Ve.warningOnLine=Ve.register({name:p("accessibilitySignals.lineHasWarning.name","Warning on Line"),sound:Re.warning,legacySoundSettingsKey:"audioCues.lineHasWarning",legacyAnnouncementSettingsKey:"accessibility.alert.warning",announcementMessage:p("accessibility.signals.lineHasWarning","Warning on Line"),settingsKey:"accessibility.signals.lineHasWarning"});Ve.foldedArea=Ve.register({name:p("accessibilitySignals.lineHasFoldedArea.name","Folded Area on Line"),sound:Re.foldedArea,legacySoundSettingsKey:"audioCues.lineHasFoldedArea",legacyAnnouncementSettingsKey:"accessibility.alert.foldedArea",announcementMessage:p("accessibility.signals.lineHasFoldedArea","Folded"),settingsKey:"accessibility.signals.lineHasFoldedArea"});Ve.break=Ve.register({name:p("accessibilitySignals.lineHasBreakpoint.name","Breakpoint on Line"),sound:Re.break,legacySoundSettingsKey:"audioCues.lineHasBreakpoint",legacyAnnouncementSettingsKey:"accessibility.alert.breakpoint",announcementMessage:p("accessibility.signals.lineHasBreakpoint","Breakpoint"),settingsKey:"accessibility.signals.lineHasBreakpoint"});Ve.inlineSuggestion=Ve.register({name:p("accessibilitySignals.lineHasInlineSuggestion.name","Inline Suggestion on Line"),sound:Re.quickFixes,legacySoundSettingsKey:"audioCues.lineHasInlineSuggestion",settingsKey:"accessibility.signals.lineHasInlineSuggestion"});Ve.terminalQuickFix=Ve.register({name:p("accessibilitySignals.terminalQuickFix.name","Terminal Quick Fix"),sound:Re.quickFixes,legacySoundSettingsKey:"audioCues.terminalQuickFix",legacyAnnouncementSettingsKey:"accessibility.alert.terminalQuickFix",announcementMessage:p("accessibility.signals.terminalQuickFix","Quick Fix"),settingsKey:"accessibility.signals.terminalQuickFix"});Ve.onDebugBreak=Ve.register({name:p("accessibilitySignals.onDebugBreak.name","Debugger Stopped on Breakpoint"),sound:Re.break,legacySoundSettingsKey:"audioCues.onDebugBreak",legacyAnnouncementSettingsKey:"accessibility.alert.onDebugBreak",announcementMessage:p("accessibility.signals.onDebugBreak","Breakpoint"),settingsKey:"accessibility.signals.onDebugBreak"});Ve.noInlayHints=Ve.register({name:p("accessibilitySignals.noInlayHints","No Inlay Hints on Line"),sound:Re.error,legacySoundSettingsKey:"audioCues.noInlayHints",legacyAnnouncementSettingsKey:"accessibility.alert.noInlayHints",announcementMessage:p("accessibility.signals.noInlayHints","No Inlay Hints"),settingsKey:"accessibility.signals.noInlayHints"});Ve.taskCompleted=Ve.register({name:p("accessibilitySignals.taskCompleted","Task Completed"),sound:Re.taskCompleted,legacySoundSettingsKey:"audioCues.taskCompleted",legacyAnnouncementSettingsKey:"accessibility.alert.taskCompleted",announcementMessage:p("accessibility.signals.taskCompleted","Task Completed"),settingsKey:"accessibility.signals.taskCompleted"});Ve.taskFailed=Ve.register({name:p("accessibilitySignals.taskFailed","Task Failed"),sound:Re.taskFailed,legacySoundSettingsKey:"audioCues.taskFailed",legacyAnnouncementSettingsKey:"accessibility.alert.taskFailed",announcementMessage:p("accessibility.signals.taskFailed","Task Failed"),settingsKey:"accessibility.signals.taskFailed"});Ve.terminalCommandFailed=Ve.register({name:p("accessibilitySignals.terminalCommandFailed","Terminal Command Failed"),sound:Re.error,legacySoundSettingsKey:"audioCues.terminalCommandFailed",legacyAnnouncementSettingsKey:"accessibility.alert.terminalCommandFailed",announcementMessage:p("accessibility.signals.terminalCommandFailed","Command Failed"),settingsKey:"accessibility.signals.terminalCommandFailed"});Ve.terminalBell=Ve.register({name:p("accessibilitySignals.terminalBell","Terminal Bell"),sound:Re.terminalBell,legacySoundSettingsKey:"audioCues.terminalBell",legacyAnnouncementSettingsKey:"accessibility.alert.terminalBell",announcementMessage:p("accessibility.signals.terminalBell","Terminal Bell"),settingsKey:"accessibility.signals.terminalBell"});Ve.notebookCellCompleted=Ve.register({name:p("accessibilitySignals.notebookCellCompleted","Notebook Cell Completed"),sound:Re.taskCompleted,legacySoundSettingsKey:"audioCues.notebookCellCompleted",legacyAnnouncementSettingsKey:"accessibility.alert.notebookCellCompleted",announcementMessage:p("accessibility.signals.notebookCellCompleted","Notebook Cell Completed"),settingsKey:"accessibility.signals.notebookCellCompleted"});Ve.notebookCellFailed=Ve.register({name:p("accessibilitySignals.notebookCellFailed","Notebook Cell Failed"),sound:Re.taskFailed,legacySoundSettingsKey:"audioCues.notebookCellFailed",legacyAnnouncementSettingsKey:"accessibility.alert.notebookCellFailed",announcementMessage:p("accessibility.signals.notebookCellFailed","Notebook Cell Failed"),settingsKey:"accessibility.signals.notebookCellFailed"});Ve.diffLineInserted=Ve.register({name:p("accessibilitySignals.diffLineInserted","Diff Line Inserted"),sound:Re.diffLineInserted,legacySoundSettingsKey:"audioCues.diffLineInserted",settingsKey:"accessibility.signals.diffLineInserted"});Ve.diffLineDeleted=Ve.register({name:p("accessibilitySignals.diffLineDeleted","Diff Line Deleted"),sound:Re.diffLineDeleted,legacySoundSettingsKey:"audioCues.diffLineDeleted",settingsKey:"accessibility.signals.diffLineDeleted"});Ve.diffLineModified=Ve.register({name:p("accessibilitySignals.diffLineModified","Diff Line Modified"),sound:Re.diffLineModified,legacySoundSettingsKey:"audioCues.diffLineModified",settingsKey:"accessibility.signals.diffLineModified"});Ve.chatRequestSent=Ve.register({name:p("accessibilitySignals.chatRequestSent","Chat Request Sent"),sound:Re.chatRequestSent,legacySoundSettingsKey:"audioCues.chatRequestSent",legacyAnnouncementSettingsKey:"accessibility.alert.chatRequestSent",announcementMessage:p("accessibility.signals.chatRequestSent","Chat Request Sent"),settingsKey:"accessibility.signals.chatRequestSent"});Ve.chatResponseReceived=Ve.register({name:p("accessibilitySignals.chatResponseReceived","Chat Response Received"),legacySoundSettingsKey:"audioCues.chatResponseReceived",sound:{randomOneOf:[Re.chatResponseReceived1,Re.chatResponseReceived2,Re.chatResponseReceived3,Re.chatResponseReceived4]},settingsKey:"accessibility.signals.chatResponseReceived"});Ve.progress=Ve.register({name:p("accessibilitySignals.progress","Progress"),sound:Re.progress,legacySoundSettingsKey:"audioCues.chatResponsePending",legacyAnnouncementSettingsKey:"accessibility.alert.chatResponseProgress",announcementMessage:p("accessibility.signals.progress","Progress"),settingsKey:"accessibility.signals.progress"});Ve.clear=Ve.register({name:p("accessibilitySignals.clear","Clear"),sound:Re.clear,legacySoundSettingsKey:"audioCues.clear",legacyAnnouncementSettingsKey:"accessibility.alert.clear",announcementMessage:p("accessibility.signals.clear","Clear"),settingsKey:"accessibility.signals.clear"});Ve.save=Ve.register({name:p("accessibilitySignals.save","Save"),sound:Re.save,legacySoundSettingsKey:"audioCues.save",legacyAnnouncementSettingsKey:"accessibility.alert.save",announcementMessage:p("accessibility.signals.save","Save"),settingsKey:"accessibility.signals.save"});Ve.format=Ve.register({name:p("accessibilitySignals.format","Format"),sound:Re.format,legacySoundSettingsKey:"audioCues.format",legacyAnnouncementSettingsKey:"accessibility.alert.format",announcementMessage:p("accessibility.signals.format","Format"),settingsKey:"accessibility.signals.format"});Ve.voiceRecordingStarted=Ve.register({name:p("accessibilitySignals.voiceRecordingStarted","Voice Recording Started"),sound:Re.voiceRecordingStarted,legacySoundSettingsKey:"audioCues.voiceRecordingStarted",settingsKey:"accessibility.signals.voiceRecordingStarted"});Ve.voiceRecordingStopped=Ve.register({name:p("accessibilitySignals.voiceRecordingStopped","Voice Recording Stopped"),sound:Re.voiceRecordingStopped,legacySoundSettingsKey:"audioCues.voiceRecordingStopped",settingsKey:"accessibility.signals.voiceRecordingStopped"});_();v();b();le();Aa();var k2=class extends H{constructor(e,t=[]){super(),this.logger=new _y([e,...t]),this._register(e.onDidChangeLogLevel(i=>this.setLevel(i)))}get onDidChangeLogLevel(){return this.logger.onDidChangeLogLevel}setLevel(e){this.logger.setLevel(e)}getLevel(){return this.logger.getLevel()}trace(e,...t){this.logger.trace(e,...t)}debug(e,...t){this.logger.debug(e,...t)}info(e,...t){this.logger.info(e,...t)}warn(e,...t){this.logger.warn(e,...t)}error(e,...t){this.logger.error(e,...t)}};_();v();b();var $U=[];function Xgt(n){$U.push(n)}function qU(){return $U.slice(0)}xt();I4();vo();cr();var ad=function(n,e,t,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},vn=function(n,e){return function(t,i){e(t,i,n)}},FO=class{constructor(e){this.disposed=!1,this.model=e,this._onWillDispose=new B}get textEditorModel(){return this.model}dispose(){this.disposed=!0,this._onWillDispose.fire()}},BO=class{constructor(e){this.modelService=e}createModelReference(e){let t=this.modelService.getModel(e);return t?Promise.resolve(new rC(new FO(t))):Promise.reject(new Error("Model not found"))}};BO=ad([vn(0,xn)],BO);var D2=class n{show(){return n.NULL_PROGRESS_RUNNER}async showWhile(e,t){await e}};D2.NULL_PROGRESS_RUNNER={done:()=>{},total:()=>{},worked:()=>{}};var WO=class{withProgress(e,t,i){return t({report:()=>{}})}},zO=class{constructor(){this.isExtensionDevelopment=!1,this.isBuilt=!1}},VO=class{async confirm(e){return{confirmed:this.doConfirm(e.message,e.detail),checkboxChecked:!1}}doConfirm(e,t){let i=e;return t&&(i=i+` + +`+t),gt.confirm(i)}async prompt(e){var t,i;let o;if(this.doConfirm(e.message,e.detail)){let r=[...(t=e.buttons)!==null&&t!==void 0?t:[]];e.cancelButton&&typeof e.cancelButton!="string"&&typeof e.cancelButton!="boolean"&&r.push(e.cancelButton),o=await((i=r[0])===null||i===void 0?void 0:i.run({checkboxChecked:!1}))}return{result:o}}async error(e,t){await this.prompt({type:Ci.Error,message:e,detail:t})}},E2=class n{info(e){return this.notify({severity:Ci.Info,message:e})}warn(e){return this.notify({severity:Ci.Warning,message:e})}error(e){return this.notify({severity:Ci.Error,message:e})}notify(e){switch(e.severity){case Ci.Error:console.error(e.message);break;case Ci.Warning:console.warn(e.message);break;default:console.log(e.message);break}return n.NO_OP}prompt(e,t,i,o){return n.NO_OP}status(e,t){return H.None}};E2.NO_OP=new Wk;var HO=class{constructor(e){this._onWillExecuteCommand=new B,this._onDidExecuteCommand=new B,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this._instantiationService=e}executeCommand(e,...t){let i=Pi.getCommand(e);if(!i)return Promise.reject(new Error(`command '${e}' not found`));try{this._onWillExecuteCommand.fire({commandId:e,args:t});let o=this._instantiationService.invokeFunction.apply(this._instantiationService,[i.handler,...t]);return this._onDidExecuteCommand.fire({commandId:e,args:t}),Promise.resolve(o)}catch(o){return Promise.reject(o)}}};HO=ad([vn(0,Ye)],HO);var jh=class extends ID{constructor(e,t,i,o,s,r){super(e,t,i,o,s),this._cachedResolver=null,this._dynamicKeybindings=[],this._domNodeListeners=[];let a=f=>{let g=new ae;g.add($(f,se.KEY_DOWN,m=>{let C=new bt(m);this._dispatch(C,C.target)&&(C.preventDefault(),C.stopPropagation())})),g.add($(f,se.KEY_UP,m=>{let C=new bt(m);this._singleModifierDispatch(C,C.target)&&C.preventDefault()})),this._domNodeListeners.push(new UO(f,g))},l=f=>{for(let g=0;g{f.getOption(61)||a(f.getContainerDomNode())},d=f=>{f.getOption(61)||l(f.getContainerDomNode())};this._register(r.onCodeEditorAdd(c)),this._register(r.onCodeEditorRemove(d)),r.listCodeEditors().forEach(c);let h=f=>{a(f.getContainerDomNode())},u=f=>{l(f.getContainerDomNode())};this._register(r.onDiffEditorAdd(h)),this._register(r.onDiffEditorRemove(u)),r.listDiffEditors().forEach(h)}addDynamicKeybinding(e,t,i,o){return _o(Pi.registerCommand(e,i),this.addDynamicKeybindings([{keybinding:t,command:e,when:o}]))}addDynamicKeybindings(e){let t=e.map(i=>{var o;return{keybinding:i0(i.keybinding,po),command:(o=i.command)!==null&&o!==void 0?o:null,commandArgs:i.commandArgs,when:i.when,weight1:1e3,weight2:0,extensionId:null,isBuiltinExtension:!1}});return this._dynamicKeybindings=this._dynamicKeybindings.concat(t),this.updateResolver(),be(()=>{for(let i=0;ithis._log(i))}return this._cachedResolver}_documentHasFocus(){return gt.document.hasFocus()}_toNormalizedKeybindingItems(e,t){let i=[],o=0;for(let s of e){let r=s.when||void 0,a=s.keybinding;if(!a)i[o++]=new Tv(void 0,s.command,s.commandArgs,r,t,null,!1);else{let l=Nv.resolveKeybinding(a,po);for(let c of l)i[o++]=new Tv(c,s.command,s.commandArgs,r,t,null,!1)}}return i}resolveKeyboardEvent(e){let t=new pl(e.ctrlKey,e.shiftKey,e.altKey,e.metaKey,e.keyCode);return new Nv([t],po)}};jh=ad([vn(0,rt),vn(1,kn),vn(2,nr),vn(3,Ko),vn(4,En),vn(5,Zt)],jh);var UO=class extends H{constructor(e,t){super(),this.domNode=e,this._register(t)}};function jU(n){return n&&typeof n=="object"&&(!n.overrideIdentifier||typeof n.overrideIdentifier=="string")&&(!n.resource||n.resource instanceof Oe)}var I2=class{constructor(e){this.logService=e,this._onDidChangeConfiguration=new B,this.onDidChangeConfiguration=this._onDidChangeConfiguration.event;let t=new L2(e);this._configuration=new Ev(t.reload(),ko.createEmptyModel(e),ko.createEmptyModel(e),ko.createEmptyModel(e),ko.createEmptyModel(e),ko.createEmptyModel(e),new Gn,ko.createEmptyModel(e),new Gn,e),t.dispose()}getValue(e,t){let i=typeof e=="string"?e:void 0,o=jU(e)?e:jU(t)?t:{};return this._configuration.getValue(i,o,void 0)}updateValues(e){let t={data:this._configuration.toData()},i=[];for(let o of e){let[s,r]=o;this.getValue(s)!==r&&(this._configuration.updateValue(s,r),i.push(s))}if(i.length>0){let o=new DD({keys:i,overrides:[]},t,this._configuration,void 0,this.logService);o.source=8,this._onDidChangeConfiguration.fire(o)}return Promise.resolve()}updateValue(e,t,i,o){return this.updateValues([[e,t]])}inspect(e,t={}){return this._configuration.inspect(e,t,void 0)}};I2=ad([vn(0,En)],I2);var KO=class{constructor(e,t,i){this.configurationService=e,this.modelService=t,this.languageService=i,this._onDidChangeConfiguration=new B,this.configurationService.onDidChangeConfiguration(o=>{this._onDidChangeConfiguration.fire({affectedKeys:o.affectedKeys,affectsConfiguration:(s,r)=>o.affectsConfiguration(r)})})}getValue(e,t,i){let o=U.isIPosition(t)?t:null,s=o?typeof i=="string"?i:void 0:typeof t=="string"?t:void 0,r=e?this.getLanguage(e,o):void 0;return typeof s>"u"?this.configurationService.getValue({resource:e,overrideIdentifier:r}):this.configurationService.getValue(s,{resource:e,overrideIdentifier:r})}getLanguage(e,t){let i=this.modelService.getModel(e);return i?t?i.getLanguageIdAtPosition(t.lineNumber,t.column):i.getLanguageId():this.languageService.guessLanguageIdByFilepathOrFirstLine(e)}};KO=ad([vn(0,Rt),vn(1,xn),vn(2,ii)],KO);var $O=class{constructor(e){this.configurationService=e}getEOL(e,t){let i=this.configurationService.getValue("files.eol",{overrideIdentifier:t,resource:e});return i&&typeof i=="string"&&i!=="auto"?i:mi||Be?` +`:`\r +`}};$O=ad([vn(0,Rt)],$O);var qO=class{publicLog2(){}},T2=class n{constructor(){let e=Oe.from({scheme:n.SCHEME,authority:"model",path:"/"});this.workspace={id:D5,folders:[new AD({uri:e,name:"",index:0})]}}getWorkspace(){return this.workspace}getWorkspaceFolder(e){return e&&e.scheme===n.SCHEME?this.workspace.folders[0]:null}};T2.SCHEME="inmemory";function I1(n,e,t){if(!e||!(n instanceof I2))return;let i=[];Object.keys(e).forEach(o=>{VV(o)&&i.push([`editor.${o}`,e[o]]),t&&HV(o)&&i.push([`diffEditor.${o}`,e[o]])}),i.length>0&&n.updateValues(i)}var jO=class{constructor(e){this._modelService=e}hasPreviewHandler(){return!1}async apply(e,t){let i=Array.isArray(e)?e:Ep.convert(e),o=new Map;for(let a of i){if(!(a instanceof Ip))throw new Error("bad edit - only text edits are supported");let l=this._modelService.getModel(a.resource);if(!l)throw new Error("bad edit - model not found");if(typeof a.versionId=="number"&&l.getVersionId()!==a.versionId)throw new Error("bad state - model changed in the meantime");let c=o.get(l);c||(c=[],o.set(l,c)),c.push(Af.replaceMove(P.lift(a.textEdit.range),a.textEdit.text))}let s=0,r=0;for(let[a,l]of o)a.pushStackElement(),a.pushEditOperations([],l,()=>[]),a.pushStackElement(),r+=1,s+=l.length;return{ariaSummary:du(MD.bulkEditServiceSummary,s,r),isApplied:s>0}}};jO=ad([vn(0,xn)],jO);var GO=class{getUriLabel(e,t){return e.scheme==="file"?e.fsPath:e.path}getUriBasenameLabel(e){return qb(e)}},ZO=class extends wD{constructor(e,t){super(e),this._codeEditorService=t}showContextView(e,t,i){if(!t){let o=this._codeEditorService.getFocusedCodeEditor()||this._codeEditorService.getActiveCodeEditor();o&&(t=o.getContainerDomNode())}return super.showContextView(e,t,i)}};ZO=ad([vn(0,ss),vn(1,Zt)],ZO);var YO=class{constructor(){this._neverEmitter=new B,this.onDidChangeTrust=this._neverEmitter.event}isWorkspaceTrusted(){return!0}},XO=class extends Ov{constructor(){super()}},QO=class extends k2{constructor(){super(new py)}},JO=class extends aE{constructor(e,t,i,o,s,r){super(e,t,i,o,s,r),this.configure({blockMouse:!1})}};JO=ad([vn(0,nr),vn(1,Ko),vn(2,Qc),vn(3,fi),vn(4,Wr),vn(5,rt)],JO);var eF=class{async playSignal(e,t){}};_t(En,QO,0);_t(Rt,I2,0);_t(fS,KO,0);_t(gS,$O,0);_t(YV,T2,0);_t(GV,GO,0);_t(nr,qO,0);_t(Kk,VO,0);_t(Yk,zO,0);_t(Ko,E2,0);_t(tl,x2,0);_t(ii,XO,0);_t(ls,u2,0);_t(xn,Jv,0);_t(LS,hE,0);_t(rt,w2,0);_t(ZV,WO,0);_t(Ap,D2,0);_t(Vf,eE,0);_t(rc,mS,0);_t(WV,jO,0);_t(nH,YO,0);_t(Wd,BO,0);_t(ao,f2,0);_t(ol,BE,0);_t(kn,HO,0);_t(fi,jh,0);_t(gE,a2,0);_t(Qc,ZO,0);_t(Jl,cE,0);_t(d_,L1,0);_t(Ds,JO,0);_t(Wr,g2,0);_t(rl,eF,0);var Ae;(function(n){let e=new sa;for(let[l,c]of BN())e.set(l,c);let t=new S2(e,!0);e.set(Ye,t);function i(l){o||r({});let c=e.get(l);if(!c)throw new Error("Missing service "+l);return c instanceof Cs?t.invokeFunction(d=>d.get(l)):c}n.get=i;let o=!1,s=new B;function r(l){if(o)return t;o=!0;for(let[d,h]of BN())e.get(d)||e.set(d,h);for(let d in l)if(l.hasOwnProperty(d)){let h=De(d);e.get(h)instanceof Cs&&e.set(h,l[d])}let c=qU();for(let d of c)try{t.createInstance(d)}catch(h){ut(h)}return s.fire(),t}n.initialize=r;function a(l){if(o)return l();let c=new ae,d=c.add(s.event(()=>{d.dispose(),c.add(l())}));return c}n.withServices=a})(Ae||(Ae={}));x1();zr();ir();Fo();Oi();qe();Qi();E5();_u();Hr();Ma();lr();Ou();_();v();b();ke();Dl();xt();ye();le();bn();Hv();Ud();Or();_();v();b();var h_=class n{static capture(e){if(e.getScrollTop()===0||e.hasPendingScrollAnimation())return new n(e.getScrollTop(),e.getContentHeight(),null,0,null);let t=null,i=0,o=e.getVisibleRanges();if(o.length>0){t=o[0].getStartPosition();let s=e.getTopForPosition(t.lineNumber,t.column);i=e.getScrollTop()-s}return new n(e.getScrollTop(),e.getContentHeight(),t,i,e.getPosition())}constructor(e,t,i,o,s){this._initialScrollTop=e,this._initialContentHeight=t,this._visiblePosition=i,this._visiblePositionScrollDelta=o,this._cursorPosition=s}restore(e){if(!(this._initialContentHeight===e.getContentHeight()&&this._initialScrollTop===e.getScrollTop())&&this._visiblePosition){let t=e.getTopForPosition(this._visiblePosition.lineNumber,this._visiblePosition.column);e.setScrollTop(t+this._visiblePositionScrollDelta)}}restoreRelativeVerticalPositionOfCursor(e){if(this._initialContentHeight===e.getContentHeight()&&this._initialScrollTop===e.getScrollTop())return;let t=e.getPosition();if(!this._cursorPosition||!t)return;let i=e.getTopForLineNumber(t.lineNumber)-e.getTopForLineNumber(this._cursorPosition.lineNumber);e.setScrollTop(e.getScrollTop()+i)}};_();v();b();ke();Po();wt();$n();le();bn();Ln();ca();Bo();es();ft();Ke();Hr();Pc();Ge();qe();var hF=function(n,e,t,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},uF=function(n,e){return function(t,i){e(t,i,n)}},yJ=fc("diff-review-insert",ue.add,p("accessibleDiffViewerInsertIcon","Icon for 'Insert' in accessible diff viewer.")),SJ=fc("diff-review-remove",ue.remove,p("accessibleDiffViewerRemoveIcon","Icon for 'Remove' in accessible diff viewer.")),xJ=fc("diff-review-close",ue.close,p("accessibleDiffViewerCloseIcon","Icon for 'Close' in accessible diff viewer.")),ld=class extends H{constructor(e,t,i,o,s,r,a,l,c){super(),this._parentNode=e,this._visible=t,this._setVisible=i,this._canClose=o,this._width=s,this._height=r,this._diffs=a,this._models=l,this._instantiationService=c,this._state=pr(this,(d,h)=>{let u=this._visible.read(d);if(this._parentNode.style.visibility=u?"visible":"hidden",!u)return null;let f=h.add(this._instantiationService.createInstance(oF,this._diffs,this._models,this._setVisible,this._canClose)),g=h.add(this._instantiationService.createInstance(dF,this._parentNode,f,this._width,this._height,this._models));return{model:f,view:g}}).recomputeInitiallyAndOnChange(this._store)}next(){ri(e=>{let t=this._visible.get();this._setVisible(!0,e),t&&this._state.get().model.nextGroup(e)})}prev(){ri(e=>{this._setVisible(!0,e),this._state.get().model.previousGroup(e)})}close(){ri(e=>{this._setVisible(!1,e)})}};ld._ttPolicy=Bs("diffReview",{createHTML:n=>n});ld=hF([uF(8,Ye)],ld);var oF=class extends H{constructor(e,t,i,o,s){super(),this._diffs=e,this._models=t,this._setVisible=i,this.canClose=o,this._accessibilitySignalService=s,this._groups=ct(this,[]),this._currentGroupIdx=ct(this,0),this._currentElementIdx=ct(this,0),this.groups=this._groups,this.currentGroup=this._currentGroupIdx.map((r,a)=>this._groups.read(a)[r]),this.currentGroupIndex=this._currentGroupIdx,this.currentElement=this._currentElementIdx.map((r,a)=>{var l;return(l=this.currentGroup.read(a))===null||l===void 0?void 0:l.lines[r]}),this._register(pt(r=>{let a=this._diffs.read(r);if(!a){this._groups.set([],void 0);return}let l=LJ(a,this._models.getOriginalModel().getLineCount(),this._models.getModifiedModel().getLineCount());ri(c=>{let d=this._models.getModifiedPosition();if(d){let h=l.findIndex(u=>d?.lineNumber{let a=this.currentElement.read(r);a?.type===jo.Deleted?this._accessibilitySignalService.playSignal(Ve.diffLineDeleted,{source:"accessibleDiffViewer.currentElementChanged"}):a?.type===jo.Added&&this._accessibilitySignalService.playSignal(Ve.diffLineInserted,{source:"accessibleDiffViewer.currentElementChanged"})})),this._register(pt(r=>{var a;let l=this.currentElement.read(r);if(l&&l.type!==jo.Header){let c=(a=l.modifiedLineNumber)!==null&&a!==void 0?a:l.diff.modified.startLineNumber;this._models.modifiedSetSelection(P.fromPositions(new U(c,1)))}}))}_goToGroupDelta(e,t){let i=this.groups.get();!i||i.length<=1||Pf(t,o=>{this._currentGroupIdx.set(ze.ofLength(i.length).clipCyclic(this._currentGroupIdx.get()+e),o),this._currentElementIdx.set(0,o)})}nextGroup(e){this._goToGroupDelta(1,e)}previousGroup(e){this._goToGroupDelta(-1,e)}_goToLineDelta(e){let t=this.currentGroup.get();!t||t.lines.length<=1||ri(i=>{this._currentElementIdx.set(ze.ofLength(t.lines.length).clip(this._currentElementIdx.get()+e),i)})}goToNextLine(){this._goToLineDelta(1)}goToPreviousLine(){this._goToLineDelta(-1)}goToLine(e){let t=this.currentGroup.get();if(!t)return;let i=t.lines.indexOf(e);i!==-1&&ri(o=>{this._currentElementIdx.set(i,o)})}revealCurrentElementInEditor(){if(!this.canClose.get())return;this._setVisible(!1,void 0);let e=this.currentElement.get();e&&(e.type===jo.Deleted?this._models.originalReveal(P.fromPositions(new U(e.originalLineNumber,1))):this._models.modifiedReveal(e.type!==jo.Header?P.fromPositions(new U(e.modifiedLineNumber,1)):void 0))}close(){this.canClose.get()&&(this._setVisible(!1,void 0),this._models.modifiedFocus())}};oF=hF([uF(4,rl)],oF);var T1=3;function LJ(n,e,t){let i=[];for(let o of ag(n,(s,r)=>r.modified.startLineNumber-s.modified.endLineNumberExclusive<2*T1)){let s=[];s.push(new rF);let r=new Ne(Math.max(1,o[0].original.startLineNumber-T1),Math.min(o[o.length-1].original.endLineNumberExclusive+T1,e+1)),a=new Ne(Math.max(1,o[0].modified.startLineNumber-T1),Math.min(o[o.length-1].modified.endLineNumberExclusive+T1,t+1));K1(o,(d,h)=>{let u=new Ne(d?d.original.endLineNumberExclusive:r.startLineNumber,h?h.original.startLineNumber:r.endLineNumberExclusive),f=new Ne(d?d.modified.endLineNumberExclusive:a.startLineNumber,h?h.modified.startLineNumber:a.endLineNumberExclusive);u.forEach(g=>{s.push(new cF(g,f.startLineNumber+(g-u.startLineNumber)))}),h&&(h.original.forEach(g=>{s.push(new aF(h,g))}),h.modified.forEach(g=>{s.push(new lF(h,g))}))});let l=o[0].modified.join(o[o.length-1].modified),c=o[0].original.join(o[o.length-1].original);i.push(new sF(new So(l,c),s))}return i}var jo;(function(n){n[n.Header=0]="Header",n[n.Unchanged=1]="Unchanged",n[n.Deleted=2]="Deleted",n[n.Added=3]="Added"})(jo||(jo={}));var sF=class{constructor(e,t){this.range=e,this.lines=t}},rF=class{constructor(){this.type=jo.Header}},aF=class{constructor(e,t){this.diff=e,this.originalLineNumber=t,this.type=jo.Deleted,this.modifiedLineNumber=void 0}},lF=class{constructor(e,t){this.diff=e,this.modifiedLineNumber=t,this.type=jo.Added,this.originalLineNumber=void 0}},cF=class{constructor(e,t){this.originalLineNumber=e,this.modifiedLineNumber=t,this.type=jo.Unchanged}},dF=class extends H{constructor(e,t,i,o,s,r){super(),this._element=e,this._model=t,this._width=i,this._height=o,this._models=s,this._languageService=r,this.domNode=this._element,this.domNode.className="monaco-component diff-review monaco-editor-background";let a=document.createElement("div");a.className="diff-review-actions",this._actionBar=this._register(new Eo(a)),this._register(pt(l=>{this._actionBar.clear(),this._model.canClose.read(l)&&this._actionBar.push(new Ro("diffreview.close",p("label.close","Close"),"close-diff-review "+Xe.asClassName(xJ),!0,async()=>t.close()),{label:!1,icon:!0})})),this._content=document.createElement("div"),this._content.className="diff-review-content",this._content.setAttribute("role","code"),this._scrollbar=this._register(new uh(this._content,{})),Wi(this.domNode,this._scrollbar.getDomNode(),a),this._register(pt(l=>{this._height.read(l),this._width.read(l),this._scrollbar.scanDomNode()})),this._register(be(()=>{Wi(this.domNode)})),this._register(br(this.domNode,{width:this._width,height:this._height})),this._register(br(this._content,{width:this._width,height:this._height})),this._register(Jn((l,c)=>{this._model.currentGroup.read(l),this._render(c)})),this._register(Ut(this.domNode,"keydown",l=>{(l.equals(18)||l.equals(2066)||l.equals(530))&&(l.preventDefault(),this._model.goToNextLine()),(l.equals(16)||l.equals(2064)||l.equals(528))&&(l.preventDefault(),this._model.goToPreviousLine()),(l.equals(9)||l.equals(2057)||l.equals(521)||l.equals(1033))&&(l.preventDefault(),this._model.close()),(l.equals(10)||l.equals(3))&&(l.preventDefault(),this._model.revealCurrentElementInEditor())}))}_render(e){let t=this._models.getOriginalOptions(),i=this._models.getModifiedOptions(),o=document.createElement("div");o.className="diff-review-table",o.setAttribute("role","list"),o.setAttribute("aria-label",p("ariaLabel","Accessible Diff Viewer. Use arrow up and down to navigate.")),Si(o,i.get(50)),Wi(this._content,o);let s=this._models.getOriginalModel(),r=this._models.getModifiedModel();if(!s||!r)return;let a=s.getOptions(),l=r.getOptions(),c=i.get(67),d=this._model.currentGroup.get();for(let h of d?.lines||[]){if(!d)break;let u;if(h.type===jo.Header){let g=document.createElement("div");g.className="diff-review-row",g.setAttribute("role","listitem");let m=d.range,C=this._model.currentGroupIndex.get(),S=this._model.groups.get().length,w=T=>T===0?p("no_lines_changed","no lines changed"):T===1?p("one_line_changed","1 line changed"):p("more_lines_changed","{0} lines changed",T),y=w(m.original.length),x=w(m.modified.length);g.setAttribute("aria-label",p({key:"header",comment:["This is the ARIA label for a git diff header.","A git diff header looks like this: @@ -154,12 +159,39 @@.","That encodes that at original line 154 (which is now line 159), 12 lines were removed/changed with 39 lines.","Variables 0 and 1 refer to the diff index out of total number of diffs.","Variables 2 and 4 will be numbers (a line number).",'Variables 3 and 5 will be "no lines changed", "1 line changed" or "X lines changed", localized separately.']},"Difference {0} of {1}: original line {2}, {3}, modified line {4}, {5}",C+1,S,m.original.startLineNumber,y,m.modified.startLineNumber,x));let k=document.createElement("div");k.className="diff-review-cell diff-review-summary",k.appendChild(document.createTextNode(`${C+1}/${S}: @@ -${m.original.startLineNumber},${m.original.length} +${m.modified.startLineNumber},${m.modified.length} @@`)),g.appendChild(k),u=g}else u=this._createRow(h,c,this._width.get(),t,s,a,i,r,l);o.appendChild(u);let f=We(g=>this._model.currentElement.read(g)===h);e.add(pt(g=>{let m=f.read(g);u.tabIndex=m?0:-1,m&&u.focus()})),e.add($(u,"focus",()=>{this._model.goToLine(h)}))}this._scrollbar.scanDomNode()}_createRow(e,t,i,o,s,r,a,l,c){let d=o.get(145),h=d.glyphMarginWidth+d.lineNumbersWidth,u=a.get(145),f=10+u.glyphMarginWidth+u.lineNumbersWidth,g="diff-review-row",m="",C="diff-review-spacer",S=null;switch(e.type){case jo.Added:g="diff-review-row line-insert",m=" char-insert",S=yJ;break;case jo.Deleted:g="diff-review-row line-delete",m=" char-delete",S=SJ;break}let w=document.createElement("div");w.style.minWidth=i+"px",w.className=g,w.setAttribute("role","listitem"),w.ariaLevel="";let y=document.createElement("div");y.className="diff-review-cell",y.style.height=`${t}px`,w.appendChild(y);let x=document.createElement("span");x.style.width=h+"px",x.style.minWidth=h+"px",x.className="diff-review-line-number"+m,e.originalLineNumber!==void 0?x.appendChild(document.createTextNode(String(e.originalLineNumber))):x.innerText="\xA0",y.appendChild(x);let k=document.createElement("span");k.style.width=f+"px",k.style.minWidth=f+"px",k.style.paddingRight="10px",k.className="diff-review-line-number"+m,e.modifiedLineNumber!==void 0?k.appendChild(document.createTextNode(String(e.modifiedLineNumber))):k.innerText="\xA0",y.appendChild(k);let T=document.createElement("span");if(T.className=C,S){let W=document.createElement("span");W.className=Xe.asClassName(S),W.innerText="\xA0\xA0",T.appendChild(W)}else T.innerText="\xA0\xA0";y.appendChild(T);let N;if(e.modifiedLineNumber!==void 0){let W=this._getLineHtml(l,a,c.tabSize,e.modifiedLineNumber,this._languageService.languageIdCodec);ld._ttPolicy&&(W=ld._ttPolicy.createHTML(W)),y.insertAdjacentHTML("beforeend",W),N=l.getLineContent(e.modifiedLineNumber)}else{let W=this._getLineHtml(s,o,r.tabSize,e.originalLineNumber,this._languageService.languageIdCodec);ld._ttPolicy&&(W=ld._ttPolicy.createHTML(W)),y.insertAdjacentHTML("beforeend",W),N=s.getLineContent(e.originalLineNumber)}N.length===0&&(N=p("blankLine","blank"));let M="";switch(e.type){case jo.Unchanged:e.originalLineNumber===e.modifiedLineNumber?M=p({key:"unchangedLine",comment:["The placeholders are contents of the line and should not be translated."]},"{0} unchanged line {1}",N,e.originalLineNumber):M=p("equalLine","{0} original line {1} modified line {2}",N,e.originalLineNumber,e.modifiedLineNumber);break;case jo.Added:M=p("insertLine","+ {0} modified line {1}",N,e.modifiedLineNumber);break;case jo.Deleted:M=p("deleteLine","- {0} original line {1}",N,e.originalLineNumber);break}return w.setAttribute("aria-label",M),w}_getLineHtml(e,t,i,o,s){let r=e.getLineContent(o),a=t.get(50),l=Hi.createEmpty(r,s),c=Wo.isBasicASCII(r,e.mightContainNonBasicASCII()),d=Wo.containsRTL(r,c,e.mightContainRTL());return gm(new qr(a.isMonospace&&!t.get(33),a.canUseHalfwidthRightwardsArrow,r,!1,c,d,0,l,[],i,0,a.spaceWidth,a.middotWidth,a.wsmiddotWidth,t.get(117),t.get(99),t.get(94),t.get(51)!==Zs.OFF,null)).html}};dF=hF([uF(5,ii)],dF);var R2=class{constructor(e){this.editors=e}getOriginalModel(){return this.editors.original.getModel()}getOriginalOptions(){return this.editors.original.getOptions()}originalReveal(e){this.editors.original.revealRange(e),this.editors.original.setSelection(e),this.editors.original.focus()}getModifiedModel(){return this.editors.modified.getModel()}getModifiedOptions(){return this.editors.modified.getOptions()}modifiedReveal(e){e&&(this.editors.modified.revealRange(e),this.editors.modified.setSelection(e)),this.editors.modified.focus()}modifiedSetSelection(e){this.editors.modified.setSelection(e)}modifiedFocus(){this.editors.modified.focus()}getModifiedPosition(){var e;return(e=this.editors.modified.getPosition())!==null&&e!==void 0?e:void 0}};_();v();b();le();bn();_();v();b();ke();Po();wt();Dl();$n();le();bn();Ln();ca();es();Ge();var cd=class n extends H{constructor(e,t,i,o,s){super(),this._rootElement=e,this._diffModel=t,this._originalEditorLayoutInfo=i,this._modifiedEditorLayoutInfo=o,this._editors=s,this._originalScrollTop=$t(this._editors.original.onDidScrollChange,()=>this._editors.original.getScrollTop()),this._modifiedScrollTop=$t(this._editors.modified.onDidScrollChange,()=>this._editors.modified.getScrollTop()),this._viewZonesChanged=fo("onDidChangeViewZones",this._editors.modified.onDidChangeViewZones),this.width=ct(this,0),this._modifiedViewZonesChangedSignal=fo("modified.onDidChangeViewZones",this._editors.modified.onDidChangeViewZones),this._originalViewZonesChangedSignal=fo("original.onDidChangeViewZones",this._editors.original.onDidChangeViewZones),this._state=pr(this,(d,h)=>{var u;this._element.replaceChildren();let f=this._diffModel.read(d),g=(u=f?.diff.read(d))===null||u===void 0?void 0:u.movedTexts;if(!g||g.length===0){this.width.set(0,void 0);return}this._viewZonesChanged.read(d);let m=this._originalEditorLayoutInfo.read(d),C=this._modifiedEditorLayoutInfo.read(d);if(!m||!C){this.width.set(0,void 0);return}this._modifiedViewZonesChangedSignal.read(d),this._originalViewZonesChangedSignal.read(d);let S=g.map(M=>{function W(Se,pe){let Pe=pe.getTopForLineNumber(Se.startLineNumber,!0),Qe=pe.getTopForLineNumber(Se.endLineNumberExclusive,!0);return(Pe+Qe)/2}let j=W(M.lineRangeMapping.original,this._editors.original),G=this._originalScrollTop.read(d),V=W(M.lineRangeMapping.modified,this._editors.modified),z=this._modifiedScrollTop.read(d),te=j-G,ee=V-z,ce=Math.min(j,V),Ce=Math.max(j,V);return{range:new ze(ce,Ce),from:te,to:ee,fromWithoutScroll:j,toWithoutScroll:V,move:M}});S.sort(e9(Io(M=>M.fromWithoutScroll>M.toWithoutScroll,t9),Io(M=>M.fromWithoutScroll>M.toWithoutScroll?M.fromWithoutScroll:-M.toWithoutScroll,ma)));let w=fF.compute(S.map(M=>M.range)),y=10,x=m.verticalScrollbarWidth,k=(w.getTrackCount()-1)*10+y*2,T=x+k+(C.contentLeft-n.movedCodeBlockPadding),N=0;for(let M of S){let W=w.getTrack(N),j=x+y+W*10,G=15,V=15,z=T,te=C.glyphMarginWidth+C.lineNumbersWidth,ee=18,ce=document.createElementNS("http://www.w3.org/2000/svg","rect");ce.classList.add("arrow-rectangle"),ce.setAttribute("x",`${z-te}`),ce.setAttribute("y",`${M.to-ee/2}`),ce.setAttribute("width",`${te}`),ce.setAttribute("height",`${ee}`),this._element.appendChild(ce);let Ce=document.createElementNS("http://www.w3.org/2000/svg","g"),Se=document.createElementNS("http://www.w3.org/2000/svg","path");Se.setAttribute("d",`M 0 ${M.from} L ${j} ${M.from} L ${j} ${M.to} L ${z-V} ${M.to}`),Se.setAttribute("fill","none"),Ce.appendChild(Se);let pe=document.createElementNS("http://www.w3.org/2000/svg","polygon");pe.classList.add("arrow"),h.add(pt(Pe=>{Se.classList.toggle("currentMove",M.move===f.activeMovedText.read(Pe)),pe.classList.toggle("currentMove",M.move===f.activeMovedText.read(Pe))})),pe.setAttribute("points",`${z-V},${M.to-G/2} ${z},${M.to} ${z-V},${M.to+G/2}`),Ce.appendChild(pe),this._element.appendChild(Ce),N++}this.width.set(k,void 0)}),this._element=document.createElementNS("http://www.w3.org/2000/svg","svg"),this._element.setAttribute("class","moved-blocks-lines"),this._rootElement.appendChild(this._element),this._register(be(()=>this._element.remove())),this._register(pt(d=>{let h=this._originalEditorLayoutInfo.read(d),u=this._modifiedEditorLayoutInfo.read(d);!h||!u||(this._element.style.left=`${h.width-h.verticalScrollbarWidth}px`,this._element.style.height=`${h.height}px`,this._element.style.width=`${h.verticalScrollbarWidth+h.contentLeft-n.movedCodeBlockPadding+this.width.read(d)}px`)})),this._register(Ph(this._state));let r=We(d=>{let h=this._diffModel.read(d),u=h?.diff.read(d);return u?u.movedTexts.map(f=>({move:f,original:new Gh(Rh(f.lineRangeMapping.original.startLineNumber-1),18),modified:new Gh(Rh(f.lineRangeMapping.modified.startLineNumber-1),18)})):[]});this._register(m_(this._editors.original,r.map(d=>d.map(h=>h.original)))),this._register(m_(this._editors.modified,r.map(d=>d.map(h=>h.modified)))),this._register(Jn((d,h)=>{let u=r.read(d);for(let f of u)h.add(new P2(this._editors.original,f.original,f.move,"original",this._diffModel.get())),h.add(new P2(this._editors.modified,f.modified,f.move,"modified",this._diffModel.get()))}));let a=fo("original.onDidFocusEditorWidget",d=>this._editors.original.onDidFocusEditorWidget(()=>setTimeout(()=>d(void 0),0))),l=fo("modified.onDidFocusEditorWidget",d=>this._editors.modified.onDidFocusEditorWidget(()=>setTimeout(()=>d(void 0),0))),c="modified";this._register(Mh({createEmptyChangeSummary:()=>{},handleChange:(d,h)=>(d.didChange(a)&&(c="original"),d.didChange(l)&&(c="modified"),!0)},d=>{a.read(d),l.read(d);let h=this._diffModel.read(d);if(!h)return;let u=h.diff.read(d),f;if(u&&c==="original"){let g=this._editors.originalCursor.read(d);g&&(f=u.movedTexts.find(m=>m.lineRangeMapping.original.contains(g.lineNumber)))}if(u&&c==="modified"){let g=this._editors.modifiedCursor.read(d);g&&(f=u.movedTexts.find(m=>m.lineRangeMapping.modified.contains(g.lineNumber)))}f!==h.movedTextToCompare.get()&&h.movedTextToCompare.set(void 0,void 0),h.setActiveMovedText(f)}))}};cd.movedCodeBlockPadding=4;var fF=class n{static compute(e){let t=[],i=[];for(let o of e){let s=t.findIndex(r=>!r.intersectsStrict(o));s===-1&&(t.length>=6?s=Y3(t,Io(a=>a.intersectWithRangeLength(o),ma)):(s=t.length,t.push(new nS))),t[s].addRange(o),i.push(s)}return new n(t.length,i)}constructor(e,t){this._trackCount=e,this.trackPerLineIdx=t}getTrack(e){return this.trackPerLineIdx[e]}getTrackCount(){return this._trackCount}},P2=class extends f_{constructor(e,t,i,o,s){let r=kt("div.diff-hidden-lines-widget");super(e,t,r.root),this._editor=e,this._move=i,this._kind=o,this._diffModel=s,this._nodes=kt("div.diff-moved-code-block",{style:{marginRight:"4px"}},[kt("div.text-content@textContent"),kt("div.action-bar@actionBar")]),r.root.appendChild(this._nodes.root);let a=$t(this._editor.onDidLayoutChange,()=>this._editor.getLayoutInfo());this._register(br(this._nodes.root,{paddingRight:a.map(u=>u.verticalScrollbarWidth)}));let l;i.changes.length>0?l=this._kind==="original"?p("codeMovedToWithChanges","Code moved with changes to line {0}-{1}",this._move.lineRangeMapping.modified.startLineNumber,this._move.lineRangeMapping.modified.endLineNumberExclusive-1):p("codeMovedFromWithChanges","Code moved with changes from line {0}-{1}",this._move.lineRangeMapping.original.startLineNumber,this._move.lineRangeMapping.original.endLineNumberExclusive-1):l=this._kind==="original"?p("codeMovedTo","Code moved to line {0}-{1}",this._move.lineRangeMapping.modified.startLineNumber,this._move.lineRangeMapping.modified.endLineNumberExclusive-1):p("codeMovedFrom","Code moved from line {0}-{1}",this._move.lineRangeMapping.original.startLineNumber,this._move.lineRangeMapping.original.endLineNumberExclusive-1);let c=this._register(new Eo(this._nodes.actionBar,{highlightToggledItems:!0})),d=new Ro("",l,"",!1);c.push(d,{icon:!1,label:!0});let h=new Ro("","Compare",Xe.asClassName(ue.compareChanges),!0,()=>{this._editor.focus(),this._diffModel.movedTextToCompare.set(this._diffModel.movedTextToCompare.get()===i?void 0:this._move,void 0)});this._register(pt(u=>{let f=this._diffModel.movedTextToCompare.read(u)===i;h.checked=f})),c.push(h,{icon:!1,label:!0})}};_();v();b();$n();Ln();sv();Ge();is();var C0t=F("diffEditor.move.border",{dark:"#8b8b8b9c",light:"#8b8b8b9c",hcDark:"#8b8b8b9c",hcLight:"#8b8b8b9c"},p("diffEditor.move.border","The border color for text that got moved in the diff editor.")),w0t=F("diffEditor.moveActive.border",{dark:"#FFA500",light:"#FFA500",hcDark:"#FFA500",hcLight:"#FFA500"},p("diffEditor.moveActive.border","The active border color for text that got moved in the diff editor.")),y0t=F("diffEditor.unchangedRegionShadow",{dark:"#000000",light:"#737373BF",hcDark:"#000000",hcLight:"#737373BF"},p("diffEditor.unchangedRegionShadow","The color of the shadow around unchanged region widgets.")),kJ=fc("diff-insert",ue.add,p("diffInsertIcon","Line decoration for inserts in the diff editor.")),gF=fc("diff-remove",ue.remove,p("diffRemoveIcon","Line decoration for removals in the diff editor.")),mF=qi.register({className:"line-insert",description:"line-insert",isWholeLine:!0,linesDecorationsClassName:"insert-sign "+Xe.asClassName(kJ),marginClassName:"gutter-insert"}),pF=qi.register({className:"line-delete",description:"line-delete",isWholeLine:!0,linesDecorationsClassName:"delete-sign "+Xe.asClassName(gF),marginClassName:"gutter-delete"}),_F=qi.register({className:"line-insert",description:"line-insert",isWholeLine:!0,marginClassName:"gutter-insert"}),bF=qi.register({className:"line-delete",description:"line-delete",isWholeLine:!0,marginClassName:"gutter-delete"}),vF=qi.register({className:"char-insert",description:"char-insert",shouldFillLineOnLineBreak:!0}),JU=qi.register({className:"char-insert",description:"char-insert",isWholeLine:!0}),eK=qi.register({className:"char-insert diff-range-empty",description:"char-insert diff-range-empty"}),N1=qi.register({className:"char-delete",description:"char-delete",shouldFillLineOnLineBreak:!0}),tK=qi.register({className:"char-delete",description:"char-delete",isWholeLine:!0}),iK=qi.register({className:"char-delete diff-range-empty",description:"char-delete diff-range-empty"});ca();var O2=class extends H{constructor(e,t,i,o){super(),this._editors=e,this._diffModel=t,this._options=i,this._decorations=We(this,s=>{var r;let a=(r=this._diffModel.read(s))===null||r===void 0?void 0:r.diff.read(s);if(!a)return null;let l=this._diffModel.read(s).movedTextToCompare.read(s),c=this._options.renderIndicators.read(s),d=this._options.showEmptyDecorations.read(s),h=[],u=[];if(!l)for(let g of a.mappings)if(g.lineRangeMapping.original.isEmpty||h.push({range:g.lineRangeMapping.original.toInclusiveRange(),options:c?pF:bF}),g.lineRangeMapping.modified.isEmpty||u.push({range:g.lineRangeMapping.modified.toInclusiveRange(),options:c?mF:_F}),g.lineRangeMapping.modified.isEmpty||g.lineRangeMapping.original.isEmpty)g.lineRangeMapping.original.isEmpty||h.push({range:g.lineRangeMapping.original.toInclusiveRange(),options:tK}),g.lineRangeMapping.modified.isEmpty||u.push({range:g.lineRangeMapping.modified.toInclusiveRange(),options:JU});else for(let m of g.lineRangeMapping.innerChanges||[])g.lineRangeMapping.original.contains(m.originalRange.startLineNumber)&&h.push({range:m.originalRange,options:m.originalRange.isEmpty()&&d?iK:N1}),g.lineRangeMapping.modified.contains(m.modifiedRange.startLineNumber)&&u.push({range:m.modifiedRange,options:m.modifiedRange.isEmpty()&&d?eK:vF});if(l)for(let g of l.changes){let m=g.original.toInclusiveRange();m&&h.push({range:m,options:c?pF:bF});let C=g.modified.toInclusiveRange();C&&u.push({range:C,options:c?mF:_F});for(let S of g.innerChanges||[])h.push({range:S.originalRange,options:N1}),u.push({range:S.modifiedRange,options:vF})}let f=this._diffModel.read(s).activeMovedText.read(s);for(let g of a.movedTexts)h.push({range:g.lineRangeMapping.original.toInclusiveRange(),options:{description:"moved",blockClassName:"movedOriginal"+(g===f?" currentMove":""),blockPadding:[cd.movedCodeBlockPadding,0,cd.movedCodeBlockPadding,cd.movedCodeBlockPadding]}}),u.push({range:g.lineRangeMapping.modified.toInclusiveRange(),options:{description:"moved",blockClassName:"movedModified"+(g===f?" currentMove":""),blockPadding:[4,0,4,4]}});return{originalDecorations:h,modifiedDecorations:u}}),this._register(g_(this._editors.original,this._decorations.map(s=>s?.originalDecorations||[]))),this._register(g_(this._editors.modified,this._decorations.map(s=>s?.modifiedDecorations||[])))}};_();v();b();le();bn();var F2=class extends H{constructor(e,t,i,o){super(),this._options=e,this._domNode=t,this._dimensions=i,this._sashes=o,this._sashRatio=ct(this,void 0),this.sashLeft=We(this,s=>{var r;let a=(r=this._sashRatio.read(s))!==null&&r!==void 0?r:this._options.splitViewDefaultRatio.read(s);return this._computeSashLeft(a,s)}),this._sash=this._register(new $f(this._domNode,{getVerticalSashTop:s=>0,getVerticalSashLeft:s=>this.sashLeft.get(),getVerticalSashHeight:s=>this._dimensions.height.get()},{orientation:0})),this._startSashPosition=void 0,this._register(this._sash.onDidStart(()=>{this._startSashPosition=this.sashLeft.get()})),this._register(this._sash.onDidChange(s=>{let r=this._dimensions.width.get(),a=this._computeSashLeft((this._startSashPosition+(s.currentX-s.startX))/r,void 0);this._sashRatio.set(a/r,void 0)})),this._register(this._sash.onDidEnd(()=>this._sash.layout())),this._register(this._sash.onDidReset(()=>this._sashRatio.set(void 0,void 0))),this._register(pt(s=>{let r=this._sashes.read(s);r&&(this._sash.orthogonalEndSash=r.bottom)})),this._register(pt(s=>{let r=this._options.enableSplitViewResizing.read(s);this._sash.state=r?3:0,this.sashLeft.read(s),this._dimensions.height.read(s),this._sash.layout()}))}_computeSashLeft(e,t){let i=this._dimensions.width.read(t),o=Math.floor(this._options.splitViewDefaultRatio.read(t)*i),s=this._options.enableSplitViewResizing.read(t)?Math.floor(e*i):o,r=100;return i<=r*2?o:si-r?i-r:s}};_();v();b();ke();wt();Gt();$n();le();bn();Ln();xi();_();v();b();Gt();fs();le();bn();_();v();b();Ur();qe();ye();vg();Bo();dE();Gg();var nK=function(n,e,t,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},CF=function(n,e){return function(t,i){e(t,i,n)}},ng,yF=De("diffProviderFactoryService"),wF=class{constructor(e){this.instantiationService=e}createDiffProvider(e){return this.instantiationService.createInstance(B2,e)}};wF=nK([CF(0,Ye)],wF);_t(yF,wF,1);var B2=ng=class{constructor(e,t,i){this.editorWorkerService=t,this.telemetryService=i,this.onDidChangeEventEmitter=new B,this.onDidChange=this.onDidChangeEventEmitter.event,this.diffAlgorithm="advanced",this.diffAlgorithmOnDidChangeSubscription=void 0,this.setOptions(e)}dispose(){var e;(e=this.diffAlgorithmOnDidChangeSubscription)===null||e===void 0||e.dispose()}async computeDiff(e,t,i,o){var s,r;if(typeof this.diffAlgorithm!="string")return this.diffAlgorithm.computeDiff(e,t,i,o);if(e.isDisposed()||t.isDisposed())return{changes:[],identical:!0,quitEarly:!1,moves:[]};if(e.getLineCount()===1&&e.getLineMaxColumn(1)===1)return t.getLineCount()===1&&t.getLineMaxColumn(1)===1?{changes:[],identical:!0,quitEarly:!1,moves:[]}:{changes:[new xo(new Ne(1,2),new Ne(1,t.getLineCount()+1),[new ts(e.getFullModelRange(),t.getFullModelRange())])],identical:!1,quitEarly:!1,moves:[]};let a=JSON.stringify([e.uri.toString(),t.uri.toString()]),l=JSON.stringify([e.id,t.id,e.getAlternativeVersionId(),t.getAlternativeVersionId(),JSON.stringify(i)]),c=ng.diffCache.get(a);if(c&&c.context===l)return c.result;let d=Er.create(),h=await this.editorWorkerService.computeDiff(e.uri,t.uri,i,this.diffAlgorithm),u=d.elapsed();if(this.telemetryService.publicLog2("diffEditor.computeDiff",{timeMs:u,timedOut:(s=h?.quitEarly)!==null&&s!==void 0?s:!0,detectedMoves:i.computeMoves?(r=h?.moves.length)!==null&&r!==void 0?r:0:-1}),o.isCancellationRequested)return{changes:[],identical:!1,quitEarly:!0,moves:[]};if(!h)throw new Error("no diff result available");return ng.diffCache.size>10&&ng.diffCache.delete(ng.diffCache.keys().next().value),ng.diffCache.set(a,{result:h,context:l}),h}setOptions(e){var t;let i=!1;e.diffAlgorithm&&this.diffAlgorithm!==e.diffAlgorithm&&((t=this.diffAlgorithmOnDidChangeSubscription)===null||t===void 0||t.dispose(),this.diffAlgorithmOnDidChangeSubscription=void 0,this.diffAlgorithm=e.diffAlgorithm,typeof e.diffAlgorithm!="string"&&(this.diffAlgorithmOnDidChangeSubscription=e.diffAlgorithm.onDidChange(()=>this.onDidChangeEventEmitter.fire())),i=!0),i&&this.onDidChangeEventEmitter.fire()}};B2.diffCache=new Map;B2=ng=nK([CF(1,rc),CF(2,nr)],B2);ca();Bo();Rb();fR();xi();wt();Na();var DJ=function(n,e,t,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},EJ=function(n,e){return function(t,i){e(t,i,n)}},W2=class extends H{setActiveMovedText(e){this._activeMovedText.set(e,void 0)}constructor(e,t,i){super(),this.model=e,this._options=t,this._diffProviderFactoryService=i,this._isDiffUpToDate=ct(this,!1),this.isDiffUpToDate=this._isDiffUpToDate,this._diff=ct(this,void 0),this.diff=this._diff,this._unchangedRegions=ct(this,void 0),this.unchangedRegions=We(this,a=>{var l,c;return this._options.hideUnchangedRegions.read(a)?(c=(l=this._unchangedRegions.read(a))===null||l===void 0?void 0:l.regions)!==null&&c!==void 0?c:[]:(ri(d=>{var h;for(let u of((h=this._unchangedRegions.get())===null||h===void 0?void 0:h.regions)||[])u.collapseAll(d)}),[])}),this.movedTextToCompare=ct(this,void 0),this._activeMovedText=ct(this,void 0),this._hoveredMovedText=ct(this,void 0),this.activeMovedText=We(this,a=>{var l,c;return(c=(l=this.movedTextToCompare.read(a))!==null&&l!==void 0?l:this._hoveredMovedText.read(a))!==null&&c!==void 0?c:this._activeMovedText.read(a)}),this._cancellationTokenSource=new un,this._diffProvider=We(this,a=>{let l=this._diffProviderFactoryService.createDiffProvider({diffAlgorithm:this._options.diffAlgorithm.read(a)}),c=fo("onDidChange",l.onDidChange);return{diffProvider:l,onChangeSignal:c}}),this._register(be(()=>this._cancellationTokenSource.cancel()));let o=Kv("contentChangedSignal"),s=this._register(new di(()=>o.trigger(void 0),200));this._register(pt(a=>{let l=this._unchangedRegions.read(a);if(!l||l.regions.some(g=>g.isDragged.read(a)))return;let c=l.originalDecorationIds.map(g=>e.original.getDecorationRange(g)).map(g=>g?Ne.fromRangeInclusive(g):void 0),d=l.modifiedDecorationIds.map(g=>e.modified.getDecorationRange(g)).map(g=>g?Ne.fromRangeInclusive(g):void 0),h=l.regions.map((g,m)=>!c[m]||!d[m]?void 0:new p_(c[m].startLineNumber,d[m].startLineNumber,c[m].length,g.visibleLineCountTop.read(a),g.visibleLineCountBottom.read(a))).filter(bc),u=[],f=!1;for(let g of ag(h,(m,C)=>m.getHiddenModifiedRange(a).endLineNumberExclusive===C.getHiddenModifiedRange(a).startLineNumber))if(g.length>1){f=!0;let m=g.reduce((S,w)=>S+w.lineCount,0),C=new p_(g[0].originalLineNumber,g[0].modifiedLineNumber,m,g[0].visibleLineCountTop.get(),g[g.length-1].visibleLineCountBottom.get());u.push(C)}else u.push(g[0]);if(f){let g=e.original.deltaDecorations(l.originalDecorationIds,u.map(C=>({range:C.originalUnchangedRange.toInclusiveRange(),options:{description:"unchanged"}}))),m=e.modified.deltaDecorations(l.modifiedDecorationIds,u.map(C=>({range:C.modifiedUnchangedRange.toInclusiveRange(),options:{description:"unchanged"}})));ri(C=>{this._unchangedRegions.set({regions:u,originalDecorationIds:g,modifiedDecorationIds:m},C)})}}));let r=(a,l,c)=>{let d=p_.fromDiffs(a.changes,e.original.getLineCount(),e.modified.getLineCount(),this._options.hideUnchangedRegionsMinimumLineCount.read(c),this._options.hideUnchangedRegionsContextLineCount.read(c)),h,u=this._unchangedRegions.get();if(u){let C=u.originalDecorationIds.map(x=>e.original.getDecorationRange(x)).map(x=>x?Ne.fromRangeInclusive(x):void 0),S=u.modifiedDecorationIds.map(x=>e.modified.getDecorationRange(x)).map(x=>x?Ne.fromRangeInclusive(x):void 0),y=QU(u.regions.map((x,k)=>{if(!C[k]||!S[k])return;let T=C[k].length;return new p_(C[k].startLineNumber,S[k].startLineNumber,T,Math.min(x.visibleLineCountTop.get(),T),Math.min(x.visibleLineCountBottom.get(),T-x.visibleLineCountTop.get()))}).filter(bc),(x,k)=>!k||x.modifiedLineNumber>=k.modifiedLineNumber+k.lineCount&&x.originalLineNumber>=k.originalLineNumber+k.lineCount).map(x=>new So(x.getHiddenOriginalRange(c),x.getHiddenModifiedRange(c)));y=So.clip(y,Ne.ofLength(1,e.original.getLineCount()),Ne.ofLength(1,e.modified.getLineCount())),h=So.inverse(y,e.original.getLineCount(),e.modified.getLineCount())}let f=[];if(h)for(let C of d){let S=h.filter(w=>w.original.intersectsStrict(C.originalUnchangedRange)&&w.modified.intersectsStrict(C.modifiedUnchangedRange));f.push(...C.setVisibleRanges(S,l))}else f.push(...d);let g=e.original.deltaDecorations(u?.originalDecorationIds||[],f.map(C=>({range:C.originalUnchangedRange.toInclusiveRange(),options:{description:"unchanged"}}))),m=e.modified.deltaDecorations(u?.modifiedDecorationIds||[],f.map(C=>({range:C.modifiedUnchangedRange.toInclusiveRange(),options:{description:"unchanged"}})));this._unchangedRegions.set({regions:f,originalDecorationIds:g,modifiedDecorationIds:m},l)};this._register(e.modified.onDidChangeContent(a=>{if(this._diff.get()){let c=oa.fromModelContentChanges(a.changes),d=(this._lastDiff,e.original,e.modified,void 0);d&&(this._lastDiff=d,ri(h=>{this._diff.set(A1.fromDiffResult(this._lastDiff),h),r(d,h);let u=this.movedTextToCompare.get();this.movedTextToCompare.set(u?this._lastDiff.moves.find(f=>f.lineRangeMapping.modified.intersect(u.lineRangeMapping.modified)):void 0,h)}))}this._isDiffUpToDate.set(!1,void 0),s.schedule()})),this._register(e.original.onDidChangeContent(a=>{if(this._diff.get()){let c=oa.fromModelContentChanges(a.changes),d=(this._lastDiff,e.original,e.modified,void 0);d&&(this._lastDiff=d,ri(h=>{this._diff.set(A1.fromDiffResult(this._lastDiff),h),r(d,h);let u=this.movedTextToCompare.get();this.movedTextToCompare.set(u?this._lastDiff.moves.find(f=>f.lineRangeMapping.modified.intersect(u.lineRangeMapping.modified)):void 0,h)}))}this._isDiffUpToDate.set(!1,void 0),s.schedule()})),this._register(Jn(async(a,l)=>{var c,d;this._options.hideUnchangedRegionsMinimumLineCount.read(a),this._options.hideUnchangedRegionsContextLineCount.read(a),s.cancel(),o.read(a);let h=this._diffProvider.read(a);h.onChangeSignal.read(a),Ts(cm,a),Ts(U0,a),this._isDiffUpToDate.set(!1,void 0);let u=[];l.add(e.original.onDidChangeContent(m=>{let C=oa.fromModelContentChanges(m.changes);u=sp(u,C)}));let f=[];l.add(e.modified.onDidChangeContent(m=>{let C=oa.fromModelContentChanges(m.changes);f=sp(f,C)}));let g=await h.diffProvider.computeDiff(e.original,e.modified,{ignoreTrimWhitespace:this._options.ignoreTrimWhitespace.read(a),maxComputationTimeMs:this._options.maxComputationTimeMs.read(a),computeMoves:this._options.showMoves.read(a)},this._cancellationTokenSource.token);this._cancellationTokenSource.token.isCancellationRequested||e.original.isDisposed()||e.modified.isDisposed()||(g=IJ(g,e.original,e.modified),g=(c=(e.original,e.modified,void 0))!==null&&c!==void 0?c:g,g=(d=(e.original,e.modified,void 0))!==null&&d!==void 0?d:g,ri(m=>{r(g,m),this._lastDiff=g;let C=A1.fromDiffResult(g);this._diff.set(C,m),this._isDiffUpToDate.set(!0,m);let S=this.movedTextToCompare.get();this.movedTextToCompare.set(S?this._lastDiff.moves.find(w=>w.lineRangeMapping.modified.intersect(S.lineRangeMapping.modified)):void 0,m)}))}))}ensureModifiedLineIsVisible(e,t,i){var o,s;if(((o=this.diff.get())===null||o===void 0?void 0:o.mappings.length)===0)return;let r=((s=this._unchangedRegions.get())===null||s===void 0?void 0:s.regions)||[];for(let a of r)if(a.getHiddenModifiedRange(void 0).contains(e)){a.showModifiedLine(e,t,i);return}}ensureOriginalLineIsVisible(e,t,i){var o,s;if(((o=this.diff.get())===null||o===void 0?void 0:o.mappings.length)===0)return;let r=((s=this._unchangedRegions.get())===null||s===void 0?void 0:s.regions)||[];for(let a of r)if(a.getHiddenOriginalRange(void 0).contains(e)){a.showOriginalLine(e,t,i);return}}async waitForDiff(){await V5(this.isDiffUpToDate,e=>e)}serializeState(){let e=this._unchangedRegions.get();return{collapsedRegions:e?.regions.map(t=>({range:t.getHiddenModifiedRange(void 0).serialize()}))}}restoreSerializedState(e){var t;let i=(t=e.collapsedRegions)===null||t===void 0?void 0:t.map(s=>Ne.deserialize(s.range)),o=this._unchangedRegions.get();!o||!i||ri(s=>{for(let r of o.regions)for(let a of i)if(r.modifiedUnchangedRange.intersect(a)){r.setHiddenModifiedRange(a,s);break}})}};W2=DJ([EJ(2,yF)],W2);function IJ(n,e,t){return{changes:n.changes.map(i=>new xo(i.original,i.modified,i.innerChanges?i.innerChanges.map(o=>TJ(o,e,t)):void 0)),moves:n.moves,identical:n.identical,quitEarly:n.quitEarly}}function TJ(n,e,t){let i=n.originalRange,o=n.modifiedRange;return(i.endColumn!==1||o.endColumn!==1)&&i.endColumn===e.getLineMaxColumn(i.endLineNumber)&&o.endColumn===t.getLineMaxColumn(o.endLineNumber)&&i.endLineNumbernew M1(t)),e.moves||[],e.identical,e.quitEarly)}constructor(e,t,i,o){this.mappings=e,this.movedTexts=t,this.identical=i,this.quitEarly=o}},M1=class{constructor(e){this.lineRangeMapping=e}},p_=class n{static fromDiffs(e,t,i,o,s){let r=xo.inverse(e,t,i),a=[];for(let l of r){let c=l.original.startLineNumber,d=l.modified.startLineNumber,h=l.original.length,u=c===1&&d===1,f=c+h===t+1&&d+h===i+1;(u||f)&&h>=s+o?(u&&!f&&(h-=s),f&&!u&&(c+=s,d+=s,h-=s),a.push(new n(c,d,h,0,0))):h>=s*2+o&&(c+=s,d+=s,h-=s*2,a.push(new n(c,d,h,0,0)))}return a}get originalUnchangedRange(){return Ne.ofLength(this.originalLineNumber,this.lineCount)}get modifiedUnchangedRange(){return Ne.ofLength(this.modifiedLineNumber,this.lineCount)}constructor(e,t,i,o,s){this.originalLineNumber=e,this.modifiedLineNumber=t,this.lineCount=i,this._visibleLineCountTop=ct(this,0),this.visibleLineCountTop=this._visibleLineCountTop,this._visibleLineCountBottom=ct(this,0),this.visibleLineCountBottom=this._visibleLineCountBottom,this._shouldHideControls=We(this,l=>this.visibleLineCountTop.read(l)+this.visibleLineCountBottom.read(l)===this.lineCount&&!this.isDragged.read(l)),this.isDragged=ct(this,void 0);let r=Math.max(Math.min(o,this.lineCount),0),a=Math.max(Math.min(s,this.lineCount-o),0);fN(o===r),fN(s===a),this._visibleLineCountTop.set(r,void 0),this._visibleLineCountBottom.set(a,void 0)}setVisibleRanges(e,t){let i=[],o=new ur(e.map(l=>l.modified)).subtractFrom(this.modifiedUnchangedRange),s=this.originalLineNumber,r=this.modifiedLineNumber,a=this.modifiedLineNumber+this.lineCount;if(o.ranges.length===0)this.showAll(t),i.push(this);else{let l=0;for(let c of o.ranges){let d=l===o.ranges.length-1;l++;let h=(d?a:c.endLineNumberExclusive)-r,u=new n(s,r,h,0,0);u.setHiddenModifiedRange(c,t),i.push(u),s=u.originalUnchangedRange.endLineNumberExclusive,r=u.modifiedUnchangedRange.endLineNumberExclusive}}return i}shouldHideControls(e){return this._shouldHideControls.read(e)}getHiddenOriginalRange(e){return Ne.ofLength(this.originalLineNumber+this._visibleLineCountTop.read(e),this.lineCount-this._visibleLineCountTop.read(e)-this._visibleLineCountBottom.read(e))}getHiddenModifiedRange(e){return Ne.ofLength(this.modifiedLineNumber+this._visibleLineCountTop.read(e),this.lineCount-this._visibleLineCountTop.read(e)-this._visibleLineCountBottom.read(e))}setHiddenModifiedRange(e,t){let i=e.startLineNumber-this.modifiedLineNumber,o=this.modifiedLineNumber+this.lineCount-e.endLineNumberExclusive;this.setState(i,o,t)}getMaxVisibleLineCountTop(){return this.lineCount-this._visibleLineCountBottom.get()}getMaxVisibleLineCountBottom(){return this.lineCount-this._visibleLineCountTop.get()}showMoreAbove(e=10,t){let i=this.getMaxVisibleLineCountTop();this._visibleLineCountTop.set(Math.min(this._visibleLineCountTop.get()+e,i),t)}showMoreBelow(e=10,t){let i=this.lineCount-this._visibleLineCountTop.get();this._visibleLineCountBottom.set(Math.min(this._visibleLineCountBottom.get()+e,i),t)}showAll(e){this._visibleLineCountBottom.set(this.lineCount-this._visibleLineCountTop.get(),e)}showModifiedLine(e,t,i){let o=e+1-(this.modifiedLineNumber+this._visibleLineCountTop.get()),s=this.modifiedLineNumber-this._visibleLineCountBottom.get()+this.lineCount-e;t===0&&o{var C;this._contextMenuService.showContextMenu({domForShadowRoot:u&&(C=i.getDomNode())!==null&&C!==void 0?C:void 0,getAnchor:()=>({x:g,y:m}),getActions:()=>{let S=[],w=o.modified.isEmpty;return S.push(new Ro("diff.clipboard.copyDeletedContent",w?o.original.length>1?p("diff.clipboard.copyDeletedLinesContent.label","Copy deleted lines"):p("diff.clipboard.copyDeletedLinesContent.single.label","Copy deleted line"):o.original.length>1?p("diff.clipboard.copyChangedLinesContent.label","Copy changed lines"):p("diff.clipboard.copyChangedLinesContent.single.label","Copy changed line"),void 0,!0,async()=>{let x=this._originalTextModel.getValueInRange(o.original.toExclusiveRange());await this._clipboardService.writeText(x)})),o.original.length>1&&S.push(new Ro("diff.clipboard.copyDeletedLineContent",w?p("diff.clipboard.copyDeletedLineContent.label","Copy deleted line ({0})",o.original.startLineNumber+h):p("diff.clipboard.copyChangedLineContent.label","Copy changed line ({0})",o.original.startLineNumber+h),void 0,!0,async()=>{let x=this._originalTextModel.getLineContent(o.original.startLineNumber+h);x===""&&(x=this._originalTextModel.getEndOfLineSequence()===0?` +`:`\r +`),await this._clipboardService.writeText(x)})),i.getOption(91)||S.push(new Ro("diff.inline.revertChange",p("diff.inline.revertChange.label","Revert this change"),void 0,!0,async()=>{this._editor.revert(this._diff)})),S},autoSelectFirstItem:!0})};this._register(Ut(this._diffActions,"mousedown",g=>{if(!g.leftButton)return;let{top:m,height:C}=Sn(this._diffActions),S=Math.floor(d/3);g.preventDefault(),f(g.posx,m+C+S)})),this._register(i.onMouseMove(g=>{(g.target.type===8||g.target.type===5)&&g.target.detail.viewZoneId===this._getViewZoneId()?(h=this._updateLightBulbPosition(this._marginDomNode,g.event.browserEvent.y,d),this.visibility=!0):this.visibility=!1})),this._register(i.onMouseDown(g=>{g.event.leftButton&&(g.target.type===8||g.target.type===5)&&g.target.detail.viewZoneId===this._getViewZoneId()&&(g.event.preventDefault(),h=this._updateLightBulbPosition(this._marginDomNode,g.event.browserEvent.y,d),f(g.event.posx,g.event.posy+d))}))}_updateLightBulbPosition(e,t,i){let{top:o}=Sn(e),s=t-o,r=Math.floor(s/i),a=r*i;if(this._diffActions.style.top=`${a}px`,this._viewLineCounts){let l=0;for(let c=0;cn});function rK(n,e,t,i){Si(i,e.fontInfo);let o=t.length>0,s=new Sl(1e4),r=0,a=0,l=[];for(let u=0;u');let l=e.getLineContent(),c=Wo.isBasicASCII(l,o),d=Wo.containsRTL(l,c,s),h=eb(new qr(r.fontInfo.isMonospace&&!r.disableMonospaceOptimizations,r.fontInfo.canUseHalfwidthRightwardsArrow,l,!1,c,d,0,e,t,r.tabSize,0,r.fontInfo.spaceWidth,r.fontInfo.middotWidth,r.fontInfo.wsmiddotWidth,r.stopRenderingLineAfter,r.renderWhitespace,r.renderControlCharacters,r.fontLigatures!==Zs.OFF,null),a);return a.appendString(""),h.characterMapping.getHorizontalOffset(h.characterMapping.length)}ca();Bo();ft();var NJ=function(n,e,t,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},aK=function(n,e){return function(t,i){e(t,i,n)}},U2=class extends H{constructor(e,t,i,o,s,r,a,l,c,d){super(),this._targetWindow=e,this._editors=t,this._diffModel=i,this._options=o,this._diffEditorWidget=s,this._canIgnoreViewZoneUpdateEvent=r,this._origViewZonesToIgnore=a,this._modViewZonesToIgnore=l,this._clipboardService=c,this._contextMenuService=d,this._originalTopPadding=ct(this,0),this._originalScrollOffset=ct(this,0),this._originalScrollOffsetAnimated=iF(this._targetWindow,this._originalScrollOffset,this._store),this._modifiedTopPadding=ct(this,0),this._modifiedScrollOffset=ct(this,0),this._modifiedScrollOffsetAnimated=iF(this._targetWindow,this._modifiedScrollOffset,this._store);let h=ct("invalidateAlignmentsState",0),u=this._register(new di(()=>{h.set(h.get()+1,void 0)},0));this._register(this._editors.original.onDidChangeViewZones(y=>{this._canIgnoreViewZoneUpdateEvent()||u.schedule()})),this._register(this._editors.modified.onDidChangeViewZones(y=>{this._canIgnoreViewZoneUpdateEvent()||u.schedule()})),this._register(this._editors.original.onDidChangeConfiguration(y=>{(y.hasChanged(146)||y.hasChanged(67))&&u.schedule()})),this._register(this._editors.modified.onDidChangeConfiguration(y=>{(y.hasChanged(146)||y.hasChanged(67))&&u.schedule()}));let f=this._diffModel.map(y=>y?$t(y.model.original.onDidChangeTokens,()=>y.model.original.tokenization.backgroundTokenizationState===2):void 0).map((y,x)=>y?.read(x)),g=We(y=>{let x=this._diffModel.read(y),k=x?.diff.read(y);if(!x||!k)return null;h.read(y);let N=this._options.renderSideBySide.read(y);return lK(this._editors.original,this._editors.modified,k.mappings,this._origViewZonesToIgnore,this._modViewZonesToIgnore,N)}),m=We(y=>{var x;let k=(x=this._diffModel.read(y))===null||x===void 0?void 0:x.movedTextToCompare.read(y);if(!k)return null;h.read(y);let T=k.changes.map(N=>new M1(N));return lK(this._editors.original,this._editors.modified,T,this._origViewZonesToIgnore,this._modViewZonesToIgnore,!0)});function C(){let y=document.createElement("div");return y.className="diagonal-fill",y}let S=this._register(new ae);this.viewZones=pr(this,(y,x)=>{var k,T,N,M,W,j,G,V;S.clear();let z=g.read(y)||[],te=[],ee=[],ce=this._modifiedTopPadding.read(y);ce>0&&ee.push({afterLineNumber:0,domNode:document.createElement("div"),heightInPx:ce,showInHiddenAreas:!0,suppressMouseDown:!0});let Ce=this._originalTopPadding.read(y);Ce>0&&te.push({afterLineNumber:0,domNode:document.createElement("div"),heightInPx:Ce,showInHiddenAreas:!0,suppressMouseDown:!0});let Se=this._options.renderSideBySide.read(y),pe=Se||(k=this._editors.modified._getViewModel())===null||k===void 0?void 0:k.createLineBreaksComputer();if(pe){let Ot=this._editors.original.getModel();for(let Cn of z)if(Cn.diff)for(let Ni=Cn.originalRange.startLineNumber;NiOt.getLineCount())return{orig:te,mod:ee};pe?.addRequest(Ot.getLineContent(Ni),null,null)}}let Pe=(T=pe?.finalize())!==null&&T!==void 0?T:[],Qe=0,Te=this._editors.modified.getOption(67),de=(N=this._diffModel.read(y))===null||N===void 0?void 0:N.movedTextToCompare.read(y),Ki=(W=(M=this._editors.original.getModel())===null||M===void 0?void 0:M.mightContainNonBasicASCII())!==null&&W!==void 0?W:!1,Vn=(G=(j=this._editors.original.getModel())===null||j===void 0?void 0:j.mightContainRTL())!==null&&G!==void 0?G:!1,Gi=H2.fromEditor(this._editors.modified);for(let Ot of z)if(Ot.diff&&!Se){if(!Ot.originalRange.isEmpty){f.read(y);let Ni=document.createElement("div");Ni.classList.add("view-lines","line-delete","monaco-mouse-cursor-text");let tt=this._editors.original.getModel();if(Ot.originalRange.endLineNumberExclusive-1>tt.getLineCount())return{orig:te,mod:ee};let vr=new V2(Ot.originalRange.mapToLineArray(Hn=>tt.tokenization.getLineTokens(Hn)),Ot.originalRange.mapToLineArray(Hn=>Pe[Qe++]),Ki,Vn),Cr=[];for(let Hn of Ot.diff.innerChanges||[])Cr.push(new Oc(Hn.originalRange.delta(-(Ot.diff.original.startLineNumber-1)),N1.className,0));let cs=rK(vr,Gi,Cr,Ni),wr=document.createElement("div");if(wr.className="inline-deleted-margin-view-zone",Si(wr,Gi.fontInfo),this._options.renderIndicators.read(y))for(let Hn=0;HnG1(pc),wr,this._editors.modified,Ot.diff,this._diffEditorWidget,cs.viewLineCounts,this._editors.original.getModel(),this._contextMenuService,this._clipboardService));for(let Hn=0;Hn1&&te.push({afterLineNumber:Ot.originalRange.startLineNumber+Hn,domNode:C(),heightInPx:(ua-1)*Te,showInHiddenAreas:!0,suppressMouseDown:!0})}ee.push({afterLineNumber:Ot.modifiedRange.startLineNumber-1,domNode:Ni,heightInPx:cs.heightInLines*Te,minWidthInPx:cs.minWidthInPx,marginDomNode:wr,setZoneId(Hn){pc=Hn},showInHiddenAreas:!0,suppressMouseDown:!0})}let Cn=document.createElement("div");Cn.className="gutter-delete",te.push({afterLineNumber:Ot.originalRange.endLineNumberExclusive-1,domNode:C(),heightInPx:Ot.modifiedHeightInPx,marginDomNode:Cn,showInHiddenAreas:!0,suppressMouseDown:!0})}else{let Cn=Ot.modifiedHeightInPx-Ot.originalHeightInPx;if(Cn>0){if(de?.lineRangeMapping.original.delta(-1).deltaLength(2).contains(Ot.originalRange.endLineNumberExclusive-1))continue;te.push({afterLineNumber:Ot.originalRange.endLineNumberExclusive-1,domNode:C(),heightInPx:Cn,showInHiddenAreas:!0,suppressMouseDown:!0})}else{let Ni=function(){let vr=document.createElement("div");return vr.className="arrow-revert-change "+Xe.asClassName(ue.arrowRight),x.add($(vr,"mousedown",Cr=>Cr.stopPropagation())),x.add($(vr,"click",Cr=>{Cr.stopPropagation(),s.revert(Ot.diff)})),ve("div",{},vr)};var Ns=Ni;if(de?.lineRangeMapping.modified.delta(-1).deltaLength(2).contains(Ot.modifiedRange.endLineNumberExclusive-1))continue;let tt;Ot.diff&&Ot.diff.modified.isEmpty&&this._options.shouldRenderOldRevertArrows.read(y)&&(tt=Ni()),ee.push({afterLineNumber:Ot.modifiedRange.endLineNumberExclusive-1,domNode:C(),heightInPx:-Cn,marginDomNode:tt,showInHiddenAreas:!0,suppressMouseDown:!0})}}for(let Ot of(V=m.read(y))!==null&&V!==void 0?V:[]){if(!de?.lineRangeMapping.original.intersect(Ot.originalRange)||!de?.lineRangeMapping.modified.intersect(Ot.modifiedRange))continue;let Cn=Ot.modifiedHeightInPx-Ot.originalHeightInPx;Cn>0?te.push({afterLineNumber:Ot.originalRange.endLineNumberExclusive-1,domNode:C(),heightInPx:Cn,showInHiddenAreas:!0,suppressMouseDown:!0}):ee.push({afterLineNumber:Ot.modifiedRange.endLineNumberExclusive-1,domNode:C(),heightInPx:-Cn,showInHiddenAreas:!0,suppressMouseDown:!0})}return{orig:te,mod:ee}});let w=!1;this._register(this._editors.original.onDidScrollChange(y=>{y.scrollLeftChanged&&!w&&(w=!0,this._editors.modified.setScrollLeft(y.scrollLeft),w=!1)})),this._register(this._editors.modified.onDidScrollChange(y=>{y.scrollLeftChanged&&!w&&(w=!0,this._editors.original.setScrollLeft(y.scrollLeft),w=!1)})),this._originalScrollTop=$t(this._editors.original.onDidScrollChange,()=>this._editors.original.getScrollTop()),this._modifiedScrollTop=$t(this._editors.modified.onDidScrollChange,()=>this._editors.modified.getScrollTop()),this._register(pt(y=>{let x=this._originalScrollTop.read(y)-(this._originalScrollOffsetAnimated.get()-this._modifiedScrollOffsetAnimated.read(y))-(this._originalTopPadding.get()-this._modifiedTopPadding.read(y));x!==this._editors.modified.getScrollTop()&&this._editors.modified.setScrollTop(x,1)})),this._register(pt(y=>{let x=this._modifiedScrollTop.read(y)-(this._modifiedScrollOffsetAnimated.get()-this._originalScrollOffsetAnimated.read(y))-(this._modifiedTopPadding.get()-this._originalTopPadding.read(y));x!==this._editors.original.getScrollTop()&&this._editors.original.setScrollTop(x,1)})),this._register(pt(y=>{var x;let k=(x=this._diffModel.read(y))===null||x===void 0?void 0:x.movedTextToCompare.read(y),T=0;if(k){let N=this._editors.original.getTopForLineNumber(k.lineRangeMapping.original.startLineNumber,!0)-this._originalTopPadding.get();T=this._editors.modified.getTopForLineNumber(k.lineRangeMapping.modified.startLineNumber,!0)-this._modifiedTopPadding.get()-N}T>0?(this._modifiedTopPadding.set(0,void 0),this._originalTopPadding.set(T,void 0)):T<0?(this._modifiedTopPadding.set(-T,void 0),this._originalTopPadding.set(0,void 0)):setTimeout(()=>{this._modifiedTopPadding.set(0,void 0),this._originalTopPadding.set(0,void 0)},400),this._editors.modified.hasTextFocus()?this._originalScrollOffset.set(this._modifiedScrollOffset.get()-T,void 0,!0):this._modifiedScrollOffset.set(this._originalScrollOffset.get()+T,void 0,!0)}))}};U2=NJ([aK(8,d_),aK(9,Ds)],U2);function lK(n,e,t,i,o,s){let r=new mo(cK(n,i)),a=new mo(cK(e,o)),l=n.getOption(67),c=e.getOption(67),d=[],h=0,u=0;function f(m,C){for(;;){let S=r.peek(),w=a.peek();if(S&&S.lineNumber>=m&&(S=void 0),w&&w.lineNumber>=C&&(w=void 0),!S&&!w)break;let y=S?S.lineNumber-h:Number.MAX_VALUE,x=w?w.lineNumber-u:Number.MAX_VALUE;yx?(a.dequeue(),S={lineNumber:w.lineNumber-u+h,heightInPx:0}):(r.dequeue(),a.dequeue()),d.push({originalRange:Ne.ofLength(S.lineNumber,1),modifiedRange:Ne.ofLength(w.lineNumber,1),originalHeightInPx:l+S.heightInPx,modifiedHeightInPx:c+w.heightInPx,diff:void 0})}}for(let m of t){let x=function(k,T){var N,M,W,j;if(kee.lineNumberee+ce.heightInPx,0))!==null&&M!==void 0?M:0,te=(j=(W=a.takeWhile(ee=>ee.lineNumberee+ce.heightInPx,0))!==null&&j!==void 0?j:0;d.push({originalRange:G,modifiedRange:V,originalHeightInPx:G.length*l+z,modifiedHeightInPx:V.length*c+te,diff:m.lineRangeMapping}),y=k,w=T};var g=x;let C=m.lineRangeMapping;f(C.original.startLineNumber,C.modified.startLineNumber);let S=!0,w=C.modified.startLineNumber,y=C.original.startLineNumber;if(s)for(let k of C.innerChanges||[]){k.originalRange.startColumn>1&&k.modifiedRange.startColumn>1&&x(k.originalRange.startLineNumber,k.modifiedRange.startLineNumber);let T=n.getModel(),N=k.originalRange.endLineNumber<=T.getLineCount()?T.getLineMaxColumn(k.originalRange.endLineNumber):Number.MAX_SAFE_INTEGER;k.originalRange.endColumn1&&i.push({lineNumber:l,heightInPx:r*(c-1)})}for(let l of n.getWhitespaces()){if(e.has(l.id))continue;let c=l.afterLineNumber===0?0:s.convertViewPositionToModelPosition(new U(l.afterLineNumber,1)).lineNumber;t.push({lineNumber:c,heightInPx:l.height})}return YU(t,i,l=>l.lineNumber,(l,c)=>({lineNumber:l.lineNumber,heightInPx:l.heightInPx+c.heightInPx}))}_();v();b();ke();le();bn();ca();_();v();b();ke();le();bn();Bo();es();var K2=class extends H{constructor(e,t,i){super(),this._editor=e,this._domNode=t,this.itemProvider=i,this.scrollTop=$t(this._editor.onDidScrollChange,r=>this._editor.getScrollTop()),this.isScrollTopZero=this.scrollTop.map(r=>r===0),this.modelAttached=$t(this._editor.onDidChangeModel,r=>this._editor.hasModel()),this.editorOnDidChangeViewZones=fo("onDidChangeViewZones",this._editor.onDidChangeViewZones),this.editorOnDidContentSizeChange=fo("onDidContentSizeChange",this._editor.onDidContentSizeChange),this.domNodeSizeChanged=Kv("domNodeSizeChanged"),this.views=new Map,this._domNode.className="gutter monaco-editor";let o=this._domNode.appendChild(kt("div.scroll-decoration",{role:"presentation",ariaHidden:"true",style:{width:"100%"}}).root),s=new ResizeObserver(()=>{ri(r=>{this.domNodeSizeChanged.trigger(r)})});s.observe(this._domNode),this._register(be(()=>s.disconnect())),this._register(pt(r=>{o.className=this.isScrollTopZero.read(r)?"":"scroll-decoration"})),this._register(pt(r=>this.render(r)))}dispose(){super.dispose(),Wi(this._domNode)}render(e){if(!this.modelAttached.read(e))return;this.domNodeSizeChanged.read(e),this.editorOnDidChangeViewZones.read(e),this.editorOnDidContentSizeChange.read(e);let t=this.scrollTop.read(e),i=this._editor.getVisibleRanges(),o=new Set(this.views.keys()),s=ze.ofStartAndLength(0,this._domNode.clientHeight);if(!s.isEmpty)for(let r of i){let a=new Ne(r.startLineNumber,r.endLineNumber+1),l=this.itemProvider.getIntersectingGutterItems(a,e);ri(c=>{for(let d of l){if(!d.range.intersect(a))continue;o.delete(d.id);let h=this.views.get(d.id);if(h)h.item.set(d,c);else{let m=document.createElement("div");this._domNode.appendChild(m);let C=ct("item",d),S=this.itemProvider.createView(C,m);h=new SF(C,S,m),this.views.set(d.id,h)}let u=d.range.startLineNumber<=this._editor.getModel().getLineCount()?this._editor.getTopForLineNumber(d.range.startLineNumber,!0)-t:this._editor.getBottomForLineNumber(d.range.startLineNumber-1,!1)-t,g=(d.range.isEmpty?u:this._editor.getBottomForLineNumber(d.range.endLineNumberExclusive-1,!0)-t)-u;h.domNode.style.top=`${u}px`,h.domNode.style.height=`${g}px`,h.gutterItemView.layout(ze.ofStartAndLength(u,g),s)}})}for(let r of o){let a=this.views.get(r);a.gutterItemView.dispose(),this._domNode.removeChild(a.domNode),this.views.delete(r)}}},SF=class{constructor(e,t,i){this.item=e,this.gutterItemView=t,this.domNode=i}};_();v();b();Po();var __=class extends bs{constructor(e){super(),this._getContext=e}runAction(e,t){let i=this._getContext();return super.runAction(e,i)}};Bo();es();Ke();_();v();b();om();var R1=class extends z0{constructor(e){super(),this._textModel=e}getValueOfRange(e){return this._textModel.getValueInRange(e)}get length(){let e=this._textModel.getLineCount(),t=this._textModel.getLineLength(e);return new ws(e-1,t)}};_();v();b();ke();Qs();_();v();b();Po();$n();Ln();ye();le();Ge();var $2=class extends H{constructor(e,t,i={orientation:0}){var o;super(),this.submenuActionViewItems=[],this.hasSecondaryActions=!1,this._onDidChangeDropdownVisibility=this._register(new dC),this.onDidChangeDropdownVisibility=this._onDidChangeDropdownVisibility.event,this.disposables=this._register(new ae),i.hoverDelegate=(o=i.hoverDelegate)!==null&&o!==void 0?o:this._register(Mf()),this.options=i,this.lookupKeybindings=typeof this.options.getKeyBinding=="function",this.toggleMenuAction=this._register(new og(()=>{var s;return(s=this.toggleMenuActionViewItem)===null||s===void 0?void 0:s.show()},i.toggleMenuTitle)),this.element=document.createElement("div"),this.element.className="monaco-toolbar",e.appendChild(this.element),this.actionBar=this._register(new Eo(this.element,{orientation:i.orientation,ariaLabel:i.ariaLabel,actionRunner:i.actionRunner,allowContextMenu:i.allowContextMenu,highlightToggledItems:i.highlightToggledItems,hoverDelegate:i.hoverDelegate,actionViewItemProvider:(s,r)=>{var a;if(s.id===og.ID)return this.toggleMenuActionViewItem=new Bh(s,s.menuActions,t,{actionViewItemProvider:this.options.actionViewItemProvider,actionRunner:this.actionRunner,keybindingProvider:this.options.getKeyBinding,classNames:Xe.asClassNameArray((a=i.moreIcon)!==null&&a!==void 0?a:ue.toolBarMore),anchorAlignmentProvider:this.options.anchorAlignmentProvider,menuAsChild:!!this.options.renderDropdownAsChildElement,skipTelemetry:this.options.skipTelemetry,isMenu:!0,hoverDelegate:this.options.hoverDelegate}),this.toggleMenuActionViewItem.setActionContext(this.actionBar.context),this.disposables.add(this._onDidChangeDropdownVisibility.add(this.toggleMenuActionViewItem.onDidChangeVisibility)),this.toggleMenuActionViewItem;if(i.actionViewItemProvider){let l=i.actionViewItemProvider(s,r);if(l)return l}if(s instanceof bl){let l=new Bh(s,s.actions,t,{actionViewItemProvider:this.options.actionViewItemProvider,actionRunner:this.actionRunner,keybindingProvider:this.options.getKeyBinding,classNames:s.class,anchorAlignmentProvider:this.options.anchorAlignmentProvider,menuAsChild:!!this.options.renderDropdownAsChildElement,skipTelemetry:this.options.skipTelemetry,hoverDelegate:this.options.hoverDelegate});return l.setActionContext(this.actionBar.context),this.submenuActionViewItems.push(l),this.disposables.add(this._onDidChangeDropdownVisibility.add(l.onDidChangeVisibility)),l}}}))}set actionRunner(e){this.actionBar.actionRunner=e}get actionRunner(){return this.actionBar.actionRunner}getElement(){return this.element}getItemAction(e){return this.actionBar.getAction(e)}setActions(e,t){this.clear();let i=e?e.slice(0):[];this.hasSecondaryActions=!!(t&&t.length>0),this.hasSecondaryActions&&t&&(this.toggleMenuAction.menuActions=t.slice(0),i.push(this.toggleMenuAction)),i.forEach(o=>{this.actionBar.push(o,{icon:!0,label:!1,keybinding:this.getKeybindingLabel(o)})})}getKeybindingLabel(e){var t,i,o;let s=this.lookupKeybindings?(i=(t=this.options).getKeyBinding)===null||i===void 0?void 0:i.call(t,e):void 0;return(o=s?.getLabel())!==null&&o!==void 0?o:void 0}clear(){this.submenuActionViewItems=[],this.disposables.clear(),this.actionBar.clear()}dispose(){this.clear(),this.disposables.dispose(),super.dispose()}},og=class n extends Ro{constructor(e,t){t=t||p("moreActions","More Actions..."),super(n.ID,t,void 0,!0),this._menuActions=[],this.toggleDropdownMenu=e}async run(){this.toggleDropdownMenu()}get menuActions(){return this._menuActions}set menuActions(e){this._menuActions=e}};og.ID="toolbar.toggle.more";Po();wt();xt();ye();js();le();Ge();zr();ir();Oi();Gg();var dK=function(n,e,t,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},da=function(n,e){return function(t,i){e(t,i,n)}},xF=class extends $2{constructor(e,t,i,o,s,r,a,l){super(e,s,{getKeyBinding:d=>{var h;return(h=r.lookupKeybinding(d.id))!==null&&h!==void 0?h:void 0},...t,allowContextMenu:!0,skipTelemetry:typeof t?.telemetrySource=="string"}),this._options=t,this._menuService=i,this._contextKeyService=o,this._contextMenuService=s,this._keybindingService=r,this._commandService=a,this._sessionDisposables=this._store.add(new ae);let c=t?.telemetrySource;c&&this._store.add(this.actionBar.onDidRun(d=>l.publicLog2("workbenchActionExecuted",{id:d.action.id,from:c})))}setActions(e,t=[],i){var o,s,r;this._sessionDisposables.clear();let a=e.slice(),l=t.slice(),c=[],d=0,h=[],u=!1;if(((o=this._options)===null||o===void 0?void 0:o.hiddenItemStrategy)!==-1)for(let f=0;fC?.id)),g=this._options.overflowBehavior.maxItems-f.size,m=0;for(let C=0;C=g&&(a[C]=void 0,h[C]=S))}}mI(a),mI(h),super.setActions(a,zi.join(h,l)),(c.length>0||a.length>0)&&this._sessionDisposables.add($(this.getElement(),"contextmenu",f=>{var g,m,C,S,w;let y=new yn(ge(this.getElement()),f),x=this.getItemAction(y.target);if(!x)return;y.preventDefault(),y.stopPropagation();let k=[];if(x instanceof Br&&x.menuKeybinding?k.push(x.menuKeybinding):x instanceof wl||x instanceof og||k.push(EO(x.id,void 0,this._commandService,this._keybindingService)),c.length>0){let N=!1;if(d===1&&((g=this._options)===null||g===void 0?void 0:g.hiddenItemStrategy)===0){N=!0;for(let M=0;Mthis._menuService.resetHiddenStates(i)}))),T.length!==0&&this._contextMenuService.showContextMenu({getAnchor:()=>y,getActions:()=>T,menuId:(C=this._options)===null||C===void 0?void 0:C.contextMenu,menuActionOptions:{renderShortTitle:!0,...(S=this._options)===null||S===void 0?void 0:S.menuOptions},skipTelemetry:typeof((w=this._options)===null||w===void 0?void 0:w.telemetrySource)=="string",contextKeyService:this._contextKeyService})}))}};xF=dK([da(2,Wr),da(3,rt),da(4,Ds),da(5,fi),da(6,kn),da(7,nr)],xF);var b_=class extends xF{constructor(e,t,i,o,s,r,a,l,c){super(e,{resetMenu:t,...i},o,s,r,a,l,c),this._onDidChangeMenuItems=this._store.add(new B),this.onDidChangeMenuItems=this._onDidChangeMenuItems.event;let d=this._store.add(o.createMenu(t,s,{emitEventsForSubmenuChanges:!0})),h=()=>{var u,f,g;let m=[],C=[];HH(d,i?.menuOptions,{primary:m,secondary:C},(u=i?.toolbarOptions)===null||u===void 0?void 0:u.primaryGroup,(f=i?.toolbarOptions)===null||f===void 0?void 0:f.shouldInlineSubmenu,(g=i?.toolbarOptions)===null||g===void 0?void 0:g.useSeparatorsInPrimaryActions),e.classList.toggle("has-no-actions",m.length===0&&C.length===0),super.setActions(m,C)};this._store.add(d.onDidChange(()=>{h(),this._onDidChangeMenuItems.fire(this)})),h()}setActions(){throw new St("This toolbar is populated from a menu.")}};b_=dK([da(3,Wr),da(4,rt),da(5,Ds),da(6,fi),da(7,kn),da(8,nr)],b_);zr();Oi();qe();var uK=function(n,e,t,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},q2=function(n,e){return function(t,i){e(t,i,n)}},LF=[],hK=35,j2=class extends H{constructor(e,t,i,o,s,r){super(),this._diffModel=t,this._editors=i,this._instantiationService=o,this._contextKeyService=s,this._menuService=r,this._menu=this._register(this._menuService.createMenu(A.DiffEditorHunkToolbar,this._contextKeyService)),this._actions=$t(this._menu.onDidChange,()=>this._menu.getActions()),this._hasActions=this._actions.map(a=>a.length>0),this.width=We(this,a=>this._hasActions.read(a)?hK:0),this.elements=kt("div.gutter@gutter",{style:{position:"absolute",height:"100%",width:hK+"px"}},[]),this._currentDiff=We(this,a=>{var l;let c=this._diffModel.read(a);if(!c)return;let d=(l=c.diff.read(a))===null||l===void 0?void 0:l.mappings,h=this._editors.modifiedCursor.read(a);if(h)return d?.find(u=>u.lineRangeMapping.modified.contains(h.lineNumber))}),this._selectedDiffs=We(this,a=>{let l=this._diffModel.read(a),c=l?.diff.read(a);if(!c)return LF;let d=this._editors.modifiedSelections.read(a);if(d.every(g=>g.isEmpty()))return LF;let h=new ur(d.map(g=>Ne.fromRangeInclusive(g))),f=c.mappings.filter(g=>g.lineRangeMapping.innerChanges&&h.intersects(g.lineRangeMapping.modified)).map(g=>({mapping:g,rangeMappings:g.lineRangeMapping.innerChanges.filter(m=>d.some(C=>P.areIntersecting(m.modifiedRange,C)))}));return f.length===0||f.every(g=>g.rangeMappings.length===0)?LF:f}),this._register(XU(e,this.elements.root)),this._register($(this.elements.root,"click",()=>{this._editors.modified.focus()})),this._register(br(this.elements.root,{display:this._hasActions.map(a=>a?"block":"none")})),this._register(new K2(this._editors.modified,this.elements.root,{getIntersectingGutterItems:(a,l)=>{let c=this._diffModel.read(l);if(!c)return[];let d=c.diff.read(l);if(!d)return[];let h=this._selectedDiffs.read(l);if(h.length>0){let f=xo.fromRangeMappings(h.flatMap(g=>g.rangeMappings));return[new G2(f,!0,A.DiffEditorSelectionToolbar,void 0,c.model.original.uri,c.model.modified.uri)]}let u=this._currentDiff.read(l);return d.mappings.map(f=>new G2(f.lineRangeMapping.withInnerChangesFromLineRanges(),f.lineRangeMapping===u?.lineRangeMapping,A.DiffEditorHunkToolbar,void 0,c.model.original.uri,c.model.modified.uri))},createView:(a,l)=>this._instantiationService.createInstance(kF,a,l,this)})),this._register($(this.elements.gutter,se.MOUSE_WHEEL,a=>{this._editors.modified.getOption(103).handleMouseWheel&&this._editors.modified.delegateScrollFromMouseWheelEvent(a)},{passive:!1}))}computeStagedValue(e){var t;let i=(t=e.innerChanges)!==null&&t!==void 0?t:[],o=new R1(this._editors.modifiedModel.get()),s=new R1(this._editors.original.getModel());return new rS(i.map(l=>l.toTextEdit(o))).apply(s)}layout(e){this.elements.gutter.style.left=e+"px"}};j2=uK([q2(3,Ye),q2(4,rt),q2(5,Wr)],j2);var G2=class{constructor(e,t,i,o,s,r){this.mapping=e,this.showAlways=t,this.menuId=i,this.rangeOverride=o,this.originalUri=s,this.modifiedUri=r}get id(){return this.mapping.modified.toString()}get range(){var e;return(e=this.rangeOverride)!==null&&e!==void 0?e:this.mapping.modified}},kF=class extends H{constructor(e,t,i,o){super(),this._item=e,this._elements=kt("div.gutterItem",{style:{height:"20px",width:"34px"}},[kt("div.background@background",{},[]),kt("div.buttons@buttons",{},[])]),this._showAlways=this._item.map(this,r=>r.showAlways),this._menuId=this._item.map(this,r=>r.menuId),this._isSmall=ct(this,!1),this._lastItemRange=void 0,this._lastViewRange=void 0;let s=this._register(o.createInstance(xh,"element",!0,{position:{hoverPosition:1}}));this._register(ig(t,this._elements.root)),this._register(pt(r=>{let a=this._showAlways.read(r);this._elements.root.classList.toggle("noTransition",!0),this._elements.root.classList.toggle("showAlways",a),setTimeout(()=>{this._elements.root.classList.toggle("noTransition",!1)},0)})),this._register(Jn((r,a)=>{this._elements.buttons.replaceChildren();let l=a.add(o.createInstance(b_,this._elements.buttons,this._menuId.read(r),{orientation:1,hoverDelegate:s,toolbarOptions:{primaryGroup:c=>c.startsWith("primary")},overflowBehavior:{maxItems:this._isSmall.read(r)?1:3},hiddenItemStrategy:0,actionRunner:new __(()=>{let c=this._item.get(),d=c.mapping;return{mapping:d,originalWithModifiedChanges:i.computeStagedValue(d),originalUri:c.originalUri,modifiedUri:c.modifiedUri}}),menuOptions:{shouldForwardArgs:!0}}));a.add(l.onDidChangeMenuItems(()=>{this._lastItemRange&&this.layout(this._lastItemRange,this._lastViewRange)}))}))}layout(e,t){this._lastItemRange=e,this._lastViewRange=t;let i=this._elements.buttons.clientHeight;this._isSmall.set(this._item.get().mapping.original.startLineNumber===1&&e.length<30,void 0),i=this._elements.buttons.clientHeight,this._elements.root.style.top=e.start+"px",this._elements.root.style.height=e.length+"px";let o=e.length/2-i/2,s=i,r=e.start+o,a=ze.tryCreate(s,t.endExclusive-s-i),l=ze.tryCreate(e.start+s,e.endExclusive-i-s);l&&a&&l.start=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},PJ=function(n,e){return function(t,i){e(t,i,n)}},ha,dd=ha=class extends H{constructor(e,t,i,o,s,r,a){super(),this._editors=e,this._rootElement=t,this._diffModel=i,this._rootWidth=o,this._rootHeight=s,this._modifiedEditorLayoutInfo=r,this._themeService=a,this.width=ha.ENTIRE_DIFF_OVERVIEW_WIDTH;let l=$t(this._themeService.onDidColorThemeChange,()=>this._themeService.getColorTheme()),c=We(u=>{let f=l.read(u),g=f.getColor(tB)||(f.getColor(J8)||NS).transparent(2),m=f.getColor(iB)||(f.getColor(eB)||AS).transparent(2);return{insertColor:g,removeColor:m}}),d=$e(document.createElement("div"));d.setClassName("diffViewport"),d.setPosition("absolute");let h=kt("div.diffOverview",{style:{position:"absolute",top:"0px",width:ha.ENTIRE_DIFF_OVERVIEW_WIDTH+"px"}}).root;this._register(ig(h,d.domNode)),this._register(Ut(h,se.POINTER_DOWN,u=>{this._editors.modified.delegateVerticalScrollbarPointerDown(u)})),this._register($(h,se.MOUSE_WHEEL,u=>{this._editors.modified.delegateScrollFromMouseWheelEvent(u)},{passive:!1})),this._register(ig(this._rootElement,h)),this._register(Jn((u,f)=>{let g=this._diffModel.read(u),m=this._editors.original.createOverviewRuler("original diffOverviewRuler");m&&(f.add(m),f.add(ig(h,m.getDomNode())));let C=this._editors.modified.createOverviewRuler("modified diffOverviewRuler");if(C&&(f.add(C),f.add(ig(h,C.getDomNode()))),!m||!C)return;let S=fo("viewZoneChanged",this._editors.original.onDidChangeViewZones),w=fo("viewZoneChanged",this._editors.modified.onDidChangeViewZones),y=fo("hiddenRangesChanged",this._editors.original.onDidChangeHiddenAreas),x=fo("hiddenRangesChanged",this._editors.modified.onDidChangeHiddenAreas);f.add(pt(k=>{var T;S.read(k),w.read(k),y.read(k),x.read(k);let N=c.read(k),M=(T=g?.diff.read(k))===null||T===void 0?void 0:T.mappings;function W(V,z,te){let ee=te._getViewModel();return ee?V.filter(ce=>ce.length>0).map(ce=>{let Ce=ee.coordinatesConverter.convertModelPositionToViewPosition(new U(ce.startLineNumber,1)),Se=ee.coordinatesConverter.convertModelPositionToViewPosition(new U(ce.endLineNumberExclusive,1)),pe=Se.lineNumber-Ce.lineNumber;return new Eb(Ce.lineNumber,Se.lineNumber,pe,z.toString())}):[]}let j=W((M||[]).map(V=>V.lineRangeMapping.original),N.removeColor,this._editors.original),G=W((M||[]).map(V=>V.lineRangeMapping.modified),N.insertColor,this._editors.modified);m?.setZones(j),C?.setZones(G)})),f.add(pt(k=>{let T=this._rootHeight.read(k),N=this._rootWidth.read(k),M=this._modifiedEditorLayoutInfo.read(k);if(M){let W=ha.ENTIRE_DIFF_OVERVIEW_WIDTH-2*ha.ONE_OVERVIEW_WIDTH;m.setLayout({top:0,height:T,right:W+ha.ONE_OVERVIEW_WIDTH,width:ha.ONE_OVERVIEW_WIDTH}),C.setLayout({top:0,height:T,right:0,width:ha.ONE_OVERVIEW_WIDTH});let j=this._editors.modifiedScrollTop.read(k),G=this._editors.modifiedScrollHeight.read(k),V=this._editors.modified.getOption(103),z=new hh(V.verticalHasArrows?V.arrowSize:0,V.verticalScrollbarSize,0,M.height,G,j);d.setTop(z.getSliderPosition()),d.setHeight(z.getSliderSize())}else d.setTop(0),d.setHeight(0);h.style.height=T+"px",h.style.left=N-ha.ENTIRE_DIFF_OVERVIEW_WIDTH+"px",d.setWidth(ha.ENTIRE_DIFF_OVERVIEW_WIDTH)}))}))}};dd.ONE_OVERVIEW_WIDTH=15;dd.ENTIRE_DIFF_OVERVIEW_WIDTH=ha.ONE_OVERVIEW_WIDTH*2;dd=ha=RJ([PJ(6,an)],dd);_();v();b();ke();Ef();$n();le();bn();Bo();Ke();hr();Ge();var EF=[],Y2=class extends H{constructor(e,t,i,o){super(),this._editors=e,this._diffModel=t,this._options=i,this._widget=o,this._selectedDiffs=We(this,s=>{let r=this._diffModel.read(s),a=r?.diff.read(s);if(!a)return EF;let l=this._editors.modifiedSelections.read(s);if(l.every(u=>u.isEmpty()))return EF;let c=new ur(l.map(u=>Ne.fromRangeInclusive(u))),h=a.mappings.filter(u=>u.lineRangeMapping.innerChanges&&c.intersects(u.lineRangeMapping.modified)).map(u=>({mapping:u,rangeMappings:u.lineRangeMapping.innerChanges.filter(f=>l.some(g=>P.areIntersecting(f.modifiedRange,g)))}));return h.length===0||h.every(u=>u.rangeMappings.length===0)?EF:h}),this._register(Jn((s,r)=>{if(!this._options.shouldRenderOldRevertArrows.read(s))return;let a=this._diffModel.read(s),l=a?.diff.read(s);if(!a||!l||a.movedTextToCompare.read(s))return;let c=[],d=this._selectedDiffs.read(s),h=new Set(d.map(u=>u.mapping));if(d.length>0){let u=this._editors.modifiedSelections.read(s),f=r.add(new O1(u[u.length-1].positionLineNumber,this._widget,d.flatMap(g=>g.rangeMappings),!0));this._editors.modified.addGlyphMarginWidget(f),c.push(f)}for(let u of l.mappings)if(!h.has(u)&&!u.lineRangeMapping.modified.isEmpty&&u.lineRangeMapping.innerChanges){let f=r.add(new O1(u.lineRangeMapping.modified.startLineNumber,this._widget,u.lineRangeMapping,!1));this._editors.modified.addGlyphMarginWidget(f),c.push(f)}r.add(be(()=>{for(let u of c)this._editors.modified.removeGlyphMarginWidget(u)}))}))}},O1=class n extends H{getId(){return this._id}constructor(e,t,i,o){super(),this._lineNumber=e,this._widget=t,this._diffs=i,this._revertSelection=o,this._id=`revertButton${n.counter++}`,this._domNode=kt("div.revertButton",{title:this._revertSelection?p("revertSelectedChanges","Revert Selected Changes"):p("revertChange","Revert Change")},[wp(ue.arrowRight)]).root,this._register($(this._domNode,se.MOUSE_DOWN,s=>{s.button!==2&&(s.stopPropagation(),s.preventDefault())})),this._register($(this._domNode,se.MOUSE_UP,s=>{s.stopPropagation(),s.preventDefault()})),this._register($(this._domNode,se.CLICK,s=>{this._diffs instanceof So?this._widget.revert(this._diffs):this._widget.revertRangeMappings(this._diffs),s.stopPropagation(),s.preventDefault()}))}getDomNode(){return this._domNode}getPosition(){return{lane:dr.Right,range:{startColumn:1,startLineNumber:this._lineNumber,endColumn:1,endLineNumber:this._lineNumber},zIndex:10001}}};O1.counter=0;ca();ft();Ke();wb();Oi();qe();_();v();b();ye();le();bn();_();v();b();bn();function gK(n){return X2.get(n)}var X2=class n{static get(e){let t=n._map.get(e);if(!t){t=new n(e),n._map.set(e,t);let i=e.onDidDispose(()=>{n._map.delete(e),i.dispose()})}return t}constructor(e){this.editor=e,this.model=$t(this.editor.onDidChangeModel,()=>this.editor.getModel())}};X2._map=new Map;ft();Ge();qe();var OJ=function(n,e,t,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},mK=function(n,e){return function(t,i){e(t,i,n)}},Q2=class extends H{get onDidContentSizeChange(){return this._onDidContentSizeChange.event}constructor(e,t,i,o,s,r,a){super(),this.originalEditorElement=e,this.modifiedEditorElement=t,this._options=i,this._argCodeEditorWidgetOptions=o,this._createInnerEditor=s,this._instantiationService=r,this._keybindingService=a,this.original=this._register(this._createLeftHandSideEditor(this._options.editorOptions.get(),this._argCodeEditorWidgetOptions.originalEditor||{})),this.modified=this._register(this._createRightHandSideEditor(this._options.editorOptions.get(),this._argCodeEditorWidgetOptions.modifiedEditor||{})),this._onDidContentSizeChange=this._register(new B),this.modifiedScrollTop=$t(this.modified.onDidScrollChange,()=>this.modified.getScrollTop()),this.modifiedScrollHeight=$t(this.modified.onDidScrollChange,()=>this.modified.getScrollHeight()),this.modifiedModel=gK(this.modified).model,this.modifiedSelections=$t(this.modified.onDidChangeCursorSelection,()=>{var l;return(l=this.modified.getSelections())!==null&&l!==void 0?l:[]}),this.modifiedCursor=Vp({owner:this,equalsFn:U.equals},l=>{var c,d;return(d=(c=this.modifiedSelections.read(l)[0])===null||c===void 0?void 0:c.getPosition())!==null&&d!==void 0?d:new U(1,1)}),this.originalCursor=$t(this.original.onDidChangeCursorPosition,()=>{var l;return(l=this.original.getPosition())!==null&&l!==void 0?l:new U(1,1)}),this._argCodeEditorWidgetOptions=null,this._register(Mh({createEmptyChangeSummary:()=>({}),handleChange:(l,c)=>(l.didChange(i.editorOptions)&&Object.assign(c,l.change.changedOptions),!0)},(l,c)=>{i.editorOptions.read(l),this._options.renderSideBySide.read(l),this.modified.updateOptions(this._adjustOptionsForRightHandSide(l,c)),this.original.updateOptions(this._adjustOptionsForLeftHandSide(l,c))}))}_createLeftHandSideEditor(e,t){let i=this._adjustOptionsForLeftHandSide(void 0,e),o=this._constructInnerEditor(this._instantiationService,this.originalEditorElement,i,t);return o.setContextValue("isInDiffLeftEditor",!0),o}_createRightHandSideEditor(e,t){let i=this._adjustOptionsForRightHandSide(void 0,e),o=this._constructInnerEditor(this._instantiationService,this.modifiedEditorElement,i,t);return o.setContextValue("isInDiffRightEditor",!0),o}_constructInnerEditor(e,t,i,o){let s=this._createInnerEditor(e,t,i,o);return this._register(s.onDidContentSizeChange(r=>{let a=this.original.getContentWidth()+this.modified.getContentWidth()+dd.ENTIRE_DIFF_OVERVIEW_WIDTH,l=Math.max(this.modified.getContentHeight(),this.original.getContentHeight());this._onDidContentSizeChange.fire({contentHeight:l,contentWidth:a,contentHeightChanged:r.contentHeightChanged,contentWidthChanged:r.contentWidthChanged})})),s}_adjustOptionsForLeftHandSide(e,t){let i=this._adjustOptionsForSubEditor(t);return this._options.renderSideBySide.get()?(i.unicodeHighlight=this._options.editorOptions.get().unicodeHighlight||{},i.wordWrapOverride1=this._options.diffWordWrap.get()):(i.wordWrapOverride1="off",i.wordWrapOverride2="off",i.stickyScroll={enabled:!1},i.unicodeHighlight={nonBasicASCII:!1,ambiguousCharacters:!1,invisibleCharacters:!1}),i.glyphMargin=this._options.renderSideBySide.get(),t.originalAriaLabel&&(i.ariaLabel=t.originalAriaLabel),i.ariaLabel=this._updateAriaLabel(i.ariaLabel),i.readOnly=!this._options.originalEditable.get(),i.dropIntoEditor={enabled:!i.readOnly},i.extraEditorClassName="original-in-monaco-diff-editor",i}_adjustOptionsForRightHandSide(e,t){let i=this._adjustOptionsForSubEditor(t);return t.modifiedAriaLabel&&(i.ariaLabel=t.modifiedAriaLabel),i.ariaLabel=this._updateAriaLabel(i.ariaLabel),i.wordWrapOverride1=this._options.diffWordWrap.get(),i.revealHorizontalRightPadding=Ca.revealHorizontalRightPadding.defaultValue+dd.ENTIRE_DIFF_OVERVIEW_WIDTH,i.scrollbar.verticalHasArrows=!1,i.extraEditorClassName="modified-in-monaco-diff-editor",i}_adjustOptionsForSubEditor(e){let t={...e,dimension:{height:0,width:0}};return t.inDiffEditor=!0,t.automaticLayout=!1,t.scrollbar={...t.scrollbar||{}},t.folding=!1,t.codeLens=this._options.diffCodeLens.get(),t.fixedOverflowWidgets=!0,t.minimap={...t.minimap||{}},t.minimap.enabled=!1,this._options.hideUnchangedRegions.get()?t.stickyScroll={enabled:!1}:t.stickyScroll=this._options.editorOptions.get().stickyScroll,t}_updateAriaLabel(e){var t;e||(e="");let i=p("diff-aria-navigation-tip"," use {0} to open the accessibility help.",(t=this._keybindingService.lookupKeybinding("editor.action.accessibilityHelp"))===null||t===void 0?void 0:t.getAriaLabel());return this._options.accessibilityVerbose.get()?e+i:e?e.replaceAll(i,""):""}};Q2=OJ([mK(5,Ye),mK(6,fi)],Q2);_();v();b();ye();le();var F1=class n extends H{constructor(){super(...arguments),this._id=++n.idCounter,this._onDidDispose=this._register(new B),this.onDidDispose=this._onDidDispose.event}getId(){return this.getEditorType()+":v2:"+this._id}getVisibleColumnFromPosition(e){return this._targetEditor.getVisibleColumnFromPosition(e)}getPosition(){return this._targetEditor.getPosition()}setPosition(e,t="api"){this._targetEditor.setPosition(e,t)}revealLine(e,t=0){this._targetEditor.revealLine(e,t)}revealLineInCenter(e,t=0){this._targetEditor.revealLineInCenter(e,t)}revealLineInCenterIfOutsideViewport(e,t=0){this._targetEditor.revealLineInCenterIfOutsideViewport(e,t)}revealLineNearTop(e,t=0){this._targetEditor.revealLineNearTop(e,t)}revealPosition(e,t=0){this._targetEditor.revealPosition(e,t)}revealPositionInCenter(e,t=0){this._targetEditor.revealPositionInCenter(e,t)}revealPositionInCenterIfOutsideViewport(e,t=0){this._targetEditor.revealPositionInCenterIfOutsideViewport(e,t)}revealPositionNearTop(e,t=0){this._targetEditor.revealPositionNearTop(e,t)}getSelection(){return this._targetEditor.getSelection()}getSelections(){return this._targetEditor.getSelections()}setSelection(e,t="api"){this._targetEditor.setSelection(e,t)}setSelections(e,t="api"){this._targetEditor.setSelections(e,t)}revealLines(e,t,i=0){this._targetEditor.revealLines(e,t,i)}revealLinesInCenter(e,t,i=0){this._targetEditor.revealLinesInCenter(e,t,i)}revealLinesInCenterIfOutsideViewport(e,t,i=0){this._targetEditor.revealLinesInCenterIfOutsideViewport(e,t,i)}revealLinesNearTop(e,t,i=0){this._targetEditor.revealLinesNearTop(e,t,i)}revealRange(e,t=0,i=!1,o=!0){this._targetEditor.revealRange(e,t,i,o)}revealRangeInCenter(e,t=0){this._targetEditor.revealRangeInCenter(e,t)}revealRangeInCenterIfOutsideViewport(e,t=0){this._targetEditor.revealRangeInCenterIfOutsideViewport(e,t)}revealRangeNearTop(e,t=0){this._targetEditor.revealRangeNearTop(e,t)}revealRangeNearTopIfOutsideViewport(e,t=0){this._targetEditor.revealRangeNearTopIfOutsideViewport(e,t)}revealRangeAtTop(e,t=0){this._targetEditor.revealRangeAtTop(e,t)}getSupportedActions(){return this._targetEditor.getSupportedActions()}focus(){this._targetEditor.focus()}trigger(e,t,i){this._targetEditor.trigger(e,t,i)}createDecorationsCollection(e){return this._targetEditor.createDecorationsCollection(e)}changeDecorations(e){return this._targetEditor.changeDecorations(e)}};F1.idCounter=0;_();v();b();bn();var FJ=function(n,e,t,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},BJ=function(n,e){return function(t,i){e(t,i,n)}},J2=class{get editorOptions(){return this._options}constructor(e,t){this._accessibilityService=t,this._diffEditorWidth=ct(this,0),this._screenReaderMode=$t(this._accessibilityService.onDidChangeScreenReaderOptimized,()=>this._accessibilityService.isScreenReaderOptimized()),this.couldShowInlineViewBecauseOfSize=We(this,o=>this._options.read(o).renderSideBySide&&this._diffEditorWidth.read(o)<=this._options.read(o).renderSideBySideInlineBreakpoint),this.renderOverviewRuler=We(this,o=>this._options.read(o).renderOverviewRuler),this.renderSideBySide=We(this,o=>this._options.read(o).renderSideBySide&&!(this._options.read(o).useInlineViewWhenSpaceIsLimited&&this.couldShowInlineViewBecauseOfSize.read(o)&&!this._screenReaderMode.read(o))),this.readOnly=We(this,o=>this._options.read(o).readOnly),this.shouldRenderOldRevertArrows=We(this,o=>!(!this._options.read(o).renderMarginRevertIcon||!this.renderSideBySide.read(o)||this.readOnly.read(o)||this.shouldRenderGutterMenu.read(o))),this.shouldRenderGutterMenu=We(this,o=>this._options.read(o).renderGutterMenu),this.renderIndicators=We(this,o=>this._options.read(o).renderIndicators),this.enableSplitViewResizing=We(this,o=>this._options.read(o).enableSplitViewResizing),this.splitViewDefaultRatio=We(this,o=>this._options.read(o).splitViewDefaultRatio),this.ignoreTrimWhitespace=We(this,o=>this._options.read(o).ignoreTrimWhitespace),this.maxComputationTimeMs=We(this,o=>this._options.read(o).maxComputationTime),this.showMoves=We(this,o=>this._options.read(o).experimental.showMoves&&this.renderSideBySide.read(o)),this.isInEmbeddedEditor=We(this,o=>this._options.read(o).isInEmbeddedEditor),this.diffWordWrap=We(this,o=>this._options.read(o).diffWordWrap),this.originalEditable=We(this,o=>this._options.read(o).originalEditable),this.diffCodeLens=We(this,o=>this._options.read(o).diffCodeLens),this.accessibilityVerbose=We(this,o=>this._options.read(o).accessibilityVerbose),this.diffAlgorithm=We(this,o=>this._options.read(o).diffAlgorithm),this.showEmptyDecorations=We(this,o=>this._options.read(o).experimental.showEmptyDecorations),this.onlyShowAccessibleDiffViewer=We(this,o=>this._options.read(o).onlyShowAccessibleDiffViewer),this.hideUnchangedRegions=We(this,o=>this._options.read(o).hideUnchangedRegions.enabled),this.hideUnchangedRegionsRevealLineCount=We(this,o=>this._options.read(o).hideUnchangedRegions.revealLineCount),this.hideUnchangedRegionsContextLineCount=We(this,o=>this._options.read(o).hideUnchangedRegions.contextLineCount),this.hideUnchangedRegionsMinimumLineCount=We(this,o=>this._options.read(o).hideUnchangedRegions.minimumLineCount);let i={...e,...pK(e,Wn)};this._options=ct(this,i)}updateOptions(e){let t=pK(e,this._options.get()),i={...this._options.get(),...e,...t};this._options.set(i,void 0,{changedOptions:e})}setWidth(e){this._diffEditorWidth.set(e,void 0)}};J2=FJ([BJ(1,ao)],J2);function pK(n,e){var t,i,o,s,r,a,l,c;return{enableSplitViewResizing:we(n.enableSplitViewResizing,e.enableSplitViewResizing),splitViewDefaultRatio:S9(n.splitViewDefaultRatio,.5,.1,.9),renderSideBySide:we(n.renderSideBySide,e.renderSideBySide),renderMarginRevertIcon:we(n.renderMarginRevertIcon,e.renderMarginRevertIcon),maxComputationTime:Cd(n.maxComputationTime,e.maxComputationTime,0,1073741824),maxFileSize:Cd(n.maxFileSize,e.maxFileSize,0,1073741824),ignoreTrimWhitespace:we(n.ignoreTrimWhitespace,e.ignoreTrimWhitespace),renderIndicators:we(n.renderIndicators,e.renderIndicators),originalEditable:we(n.originalEditable,e.originalEditable),diffCodeLens:we(n.diffCodeLens,e.diffCodeLens),renderOverviewRuler:we(n.renderOverviewRuler,e.renderOverviewRuler),diffWordWrap:wi(n.diffWordWrap,e.diffWordWrap,["off","on","inherit"]),diffAlgorithm:wi(n.diffAlgorithm,e.diffAlgorithm,["legacy","advanced"],{smart:"legacy",experimental:"advanced"}),accessibilityVerbose:we(n.accessibilityVerbose,e.accessibilityVerbose),experimental:{showMoves:we((t=n.experimental)===null||t===void 0?void 0:t.showMoves,e.experimental.showMoves),showEmptyDecorations:we((i=n.experimental)===null||i===void 0?void 0:i.showEmptyDecorations,e.experimental.showEmptyDecorations)},hideUnchangedRegions:{enabled:we((s=(o=n.hideUnchangedRegions)===null||o===void 0?void 0:o.enabled)!==null&&s!==void 0?s:(r=n.experimental)===null||r===void 0?void 0:r.collapseUnchangedRegions,e.hideUnchangedRegions.enabled),contextLineCount:Cd((a=n.hideUnchangedRegions)===null||a===void 0?void 0:a.contextLineCount,e.hideUnchangedRegions.contextLineCount,0,1073741824),minimumLineCount:Cd((l=n.hideUnchangedRegions)===null||l===void 0?void 0:l.minimumLineCount,e.hideUnchangedRegions.minimumLineCount,0,1073741824),revealLineCount:Cd((c=n.hideUnchangedRegions)===null||c===void 0?void 0:c.revealLineCount,e.hideUnchangedRegions.revealLineCount,0,1073741824)},isInEmbeddedEditor:we(n.isInEmbeddedEditor,e.isInEmbeddedEditor),onlyShowAccessibleDiffViewer:we(n.onlyShowAccessibleDiffViewer,e.onlyShowAccessibleDiffViewer),renderSideBySideInlineBreakpoint:Cd(n.renderSideBySideInlineBreakpoint,e.renderSideBySideInlineBreakpoint,0,1073741824),useInlineViewWhenSpaceIsLimited:we(n.useInlineViewWhenSpaceIsLimited,e.useInlineViewWhenSpaceIsLimited),renderGutterMenu:we(n.renderGutterMenu,e.renderGutterMenu)}}var WJ=function(n,e,t,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},B1=function(n,e){return function(t,i){e(t,i,n)}},v_=class extends F1{get onDidContentSizeChange(){return this._editors.onDidContentSizeChange}constructor(e,t,i,o,s,r,a,l){var c;super(),this._domElement=e,this._parentContextKeyService=o,this._parentInstantiationService=s,this._accessibilitySignalService=a,this._editorProgressService=l,this.elements=kt("div.monaco-diff-editor.side-by-side",{style:{position:"relative",height:"100%"}},[kt("div.editor.original@original",{style:{position:"absolute",height:"100%"}}),kt("div.editor.modified@modified",{style:{position:"absolute",height:"100%"}}),kt("div.accessibleDiffViewer@accessibleDiffViewer",{style:{position:"absolute",height:"100%"}})]),this._diffModel=ct(this,void 0),this._shouldDisposeDiffModel=!1,this.onDidChangeModel=ie.fromObservableLight(this._diffModel),this._contextKeyService=this._register(this._parentContextKeyService.createScoped(this._domElement)),this._instantiationService=this._parentInstantiationService.createChild(new sa([rt,this._contextKeyService])),this._boundarySashes=ct(this,void 0),this._accessibleDiffViewerShouldBeVisible=ct(this,!1),this._accessibleDiffViewerVisible=We(this,x=>this._options.onlyShowAccessibleDiffViewer.read(x)?!0:this._accessibleDiffViewerShouldBeVisible.read(x)),this._movedBlocksLinesPart=ct(this,void 0),this._layoutInfo=We(this,x=>{var k,T,N,M,W;let j=this._rootSizeObserver.width.read(x),G=this._rootSizeObserver.height.read(x),V=this._sash.read(x),z=this._gutter.read(x),te=(k=z?.width.read(x))!==null&&k!==void 0?k:0,ee=(N=(T=this._overviewRulerPart.read(x))===null||T===void 0?void 0:T.width)!==null&&N!==void 0?N:0,ce,Ce,Se,pe,Pe;if(!!V){let Te=V.sashLeft.read(x),de=(W=(M=this._movedBlocksLinesPart.read(x))===null||M===void 0?void 0:M.width.read(x))!==null&&W!==void 0?W:0;ce=0,Ce=Te-te-de,Pe=Te-te,Se=Te,pe=j-Se-ee}else Pe=0,ce=te,Ce=Math.max(5,this._editors.original.getLayoutInfo().decorationsLeft),Se=te+Ce,pe=j-Se-ee;return this.elements.original.style.left=ce+"px",this.elements.original.style.width=Ce+"px",this._editors.original.layout({width:Ce,height:G},!0),z?.layout(Pe),this.elements.modified.style.left=Se+"px",this.elements.modified.style.width=pe+"px",this._editors.modified.layout({width:pe,height:G},!0),{modifiedEditor:this._editors.modified.getLayoutInfo(),originalEditor:this._editors.original.getLayoutInfo()}}),this._diffValue=this._diffModel.map((x,k)=>x?.diff.read(k)),this.onDidUpdateDiff=ie.fromObservableLight(this._diffValue),r.willCreateDiffEditor(),this._contextKeyService.createKey("isInDiffEditor",!0),this._domElement.appendChild(this.elements.root),this._register(be(()=>this._domElement.removeChild(this.elements.root))),this._rootSizeObserver=this._register(new u_(this.elements.root,t.dimension)),this._rootSizeObserver.setAutomaticLayout((c=t.automaticLayout)!==null&&c!==void 0?c:!1),this._options=this._instantiationService.createInstance(J2,t),this._register(pt(x=>{this._options.setWidth(this._rootSizeObserver.width.read(x))})),this._contextKeyService.createKey(_e.isEmbeddedDiffEditor.key,!1),this._register(mc(_e.isEmbeddedDiffEditor,this._contextKeyService,x=>this._options.isInEmbeddedEditor.read(x))),this._register(mc(_e.comparingMovedCode,this._contextKeyService,x=>{var k;return!!(!((k=this._diffModel.read(x))===null||k===void 0)&&k.movedTextToCompare.read(x))})),this._register(mc(_e.diffEditorRenderSideBySideInlineBreakpointReached,this._contextKeyService,x=>this._options.couldShowInlineViewBecauseOfSize.read(x))),this._register(mc(_e.diffEditorInlineMode,this._contextKeyService,x=>!this._options.renderSideBySide.read(x))),this._register(mc(_e.hasChanges,this._contextKeyService,x=>{var k,T,N;return((N=(T=(k=this._diffModel.read(x))===null||k===void 0?void 0:k.diff.read(x))===null||T===void 0?void 0:T.mappings.length)!==null&&N!==void 0?N:0)>0})),this._editors=this._register(this._instantiationService.createInstance(Q2,this.elements.original,this.elements.modified,this._options,i,(x,k,T,N)=>this._createInnerEditor(x,k,T,N))),this._register(mc(_e.diffEditorOriginalWritable,this._contextKeyService,x=>this._options.originalEditable.read(x))),this._register(mc(_e.diffEditorModifiedWritable,this._contextKeyService,x=>!this._options.readOnly.read(x))),this._register(mc(_e.diffEditorOriginalUri,this._contextKeyService,x=>{var k,T;return(T=(k=this._diffModel.read(x))===null||k===void 0?void 0:k.model.original.uri.toString())!==null&&T!==void 0?T:""})),this._register(mc(_e.diffEditorModifiedUri,this._contextKeyService,x=>{var k,T;return(T=(k=this._diffModel.read(x))===null||k===void 0?void 0:k.model.modified.uri.toString())!==null&&T!==void 0?T:""})),this._overviewRulerPart=Ja(this,x=>this._options.renderOverviewRuler.read(x)?this._instantiationService.createInstance(Ts(dd,x),this._editors,this.elements.root,this._diffModel,this._rootSizeObserver.width,this._rootSizeObserver.height,this._layoutInfo.map(k=>k.modifiedEditor)):void 0).recomputeInitiallyAndOnChange(this._store),this._sash=Ja(this,x=>{let k=this._options.renderSideBySide.read(x);return this.elements.root.classList.toggle("side-by-side",k),k?new F2(this._options,this.elements.root,{height:this._rootSizeObserver.height,width:this._rootSizeObserver.width.map((T,N)=>{var M,W;return T-((W=(M=this._overviewRulerPart.read(N))===null||M===void 0?void 0:M.width)!==null&&W!==void 0?W:0)})},this._boundarySashes):void 0}).recomputeInitiallyAndOnChange(this._store);let d=Ja(this,x=>this._instantiationService.createInstance(Ts(P1,x),this._editors,this._diffModel,this._options)).recomputeInitiallyAndOnChange(this._store);Ja(this,x=>this._instantiationService.createInstance(Ts(O2,x),this._editors,this._diffModel,this._options,this)).recomputeInitiallyAndOnChange(this._store);let h=new Set,u=new Set,f=!1,g=Ja(this,x=>this._instantiationService.createInstance(Ts(U2,x),ge(this._domElement),this._editors,this._diffModel,this._options,this,()=>f||d.get().isUpdatingHiddenAreas,h,u)).recomputeInitiallyAndOnChange(this._store),m=We(this,x=>{let k=g.read(x).viewZones.read(x).orig,T=d.read(x).viewZones.read(x).origViewZones;return k.concat(T)}),C=We(this,x=>{let k=g.read(x).viewZones.read(x).mod,T=d.read(x).viewZones.read(x).modViewZones;return k.concat(T)});this._register(m_(this._editors.original,m,x=>{f=x},h));let S;this._register(m_(this._editors.modified,C,x=>{f=x,f?S=h_.capture(this._editors.modified):(S?.restore(this._editors.modified),S=void 0)},u)),this._accessibleDiffViewer=Ja(this,x=>this._instantiationService.createInstance(Ts(ld,x),this.elements.accessibleDiffViewer,this._accessibleDiffViewerVisible,(k,T)=>this._accessibleDiffViewerShouldBeVisible.set(k,T),this._options.onlyShowAccessibleDiffViewer.map(k=>!k),this._rootSizeObserver.width,this._rootSizeObserver.height,this._diffModel.map((k,T)=>{var N;return(N=k?.diff.read(T))===null||N===void 0?void 0:N.mappings.map(M=>M.lineRangeMapping)}),new R2(this._editors))).recomputeInitiallyAndOnChange(this._store);let w=this._accessibleDiffViewerVisible.map(x=>x?"hidden":"visible");this._register(br(this.elements.modified,{visibility:w})),this._register(br(this.elements.original,{visibility:w})),this._createDiffEditorContributions(),r.addDiffEditor(this),this._gutter=Ja(this,x=>this._options.shouldRenderGutterMenu.read(x)?this._instantiationService.createInstance(Ts(j2,x),this.elements.root,this._diffModel,this._editors):void 0),this._register(Ph(this._layoutInfo)),Ja(this,x=>new(Ts(cd,x))(this.elements.root,this._diffModel,this._layoutInfo.map(k=>k.originalEditor),this._layoutInfo.map(k=>k.modifiedEditor),this._editors)).recomputeInitiallyAndOnChange(this._store,x=>{this._movedBlocksLinesPart.set(x,void 0)}),this._register(ie.runAndSubscribe(this._editors.modified.onDidChangeCursorPosition,x=>this._handleCursorPositionChange(x,!0))),this._register(ie.runAndSubscribe(this._editors.original.onDidChangeCursorPosition,x=>this._handleCursorPositionChange(x,!1)));let y=this._diffModel.map(this,(x,k)=>{if(x)return x.diff.read(k)===void 0&&!x.isDiffUpToDate.read(k)});this._register(Jn((x,k)=>{if(y.read(x)===!0){let T=this._editorProgressService.show(!0,1e3);k.add(be(()=>T.done()))}})),this._register(be(()=>{var x;this._shouldDisposeDiffModel&&((x=this._diffModel.get())===null||x===void 0||x.dispose())})),this._register(Jn((x,k)=>{k.add(new(Ts(Y2,x))(this._editors,this._diffModel,this._options,this))}))}_createInnerEditor(e,t,i,o){return e.createInstance(Df,t,i,o)}_createDiffEditorContributions(){let e=Hd.getDiffEditorContributions();for(let t of e)try{this._register(this._instantiationService.createInstance(t.ctor,this))}catch(i){ut(i)}}get _targetEditor(){return this._editors.modified}getEditorType(){return Rc.IDiffEditor}layout(e){this._rootSizeObserver.observe(e)}hasTextFocus(){return this._editors.original.hasTextFocus()||this._editors.modified.hasTextFocus()}saveViewState(){var e;let t=this._editors.original.saveViewState(),i=this._editors.modified.saveViewState();return{original:t,modified:i,modelState:(e=this._diffModel.get())===null||e===void 0?void 0:e.serializeState()}}restoreViewState(e){var t;if(e&&e.original&&e.modified){let i=e;this._editors.original.restoreViewState(i.original),this._editors.modified.restoreViewState(i.modified),i.modelState&&((t=this._diffModel.get())===null||t===void 0||t.restoreSerializedState(i.modelState))}}handleInitialized(){this._editors.original.handleInitialized(),this._editors.modified.handleInitialized()}createViewModel(e){return this._instantiationService.createInstance(W2,e,this._options)}getModel(){var e,t;return(t=(e=this._diffModel.get())===null||e===void 0?void 0:e.model)!==null&&t!==void 0?t:null}setModel(e,t){!e&&this._diffModel.get()&&this._accessibleDiffViewer.get().close();let i=e?"model"in e?{model:e,shouldDispose:!1}:{model:this.createViewModel(e),shouldDispose:!0}:void 0;this._diffModel.get()!==i?.model&&Pf(t,o=>{var s;$t.batchEventsGlobally(o,()=>{this._editors.original.setModel(i?i.model.model.original:null),this._editors.modified.setModel(i?i.model.model.modified:null)});let r=this._diffModel.get(),a=this._shouldDisposeDiffModel;this._shouldDisposeDiffModel=(s=i?.shouldDispose)!==null&&s!==void 0?s:!1,this._diffModel.set(i?.model,o),a&&r?.dispose()})}updateOptions(e){this._options.updateOptions(e)}getContainerDomNode(){return this._domElement}getOriginalEditor(){return this._editors.original}getModifiedEditor(){return this._editors.modified}getLineChanges(){var e;let t=(e=this._diffModel.get())===null||e===void 0?void 0:e.diff.get();return t?zJ(t):null}revert(e){let t=this._diffModel.get();!t||!t.isDiffUpToDate.get()||this._editors.modified.executeEdits("diffEditor",[{range:e.modified.toExclusiveRange(),text:t.model.original.getValueInRange(e.original.toExclusiveRange())}])}revertRangeMappings(e){let t=this._diffModel.get();if(!t||!t.isDiffUpToDate.get())return;let i=e.map(o=>({range:o.modifiedRange,text:t.model.original.getValueInRange(o.originalRange)}));this._editors.modified.executeEdits("diffEditor",i)}_goTo(e){this._editors.modified.setPosition(new U(e.lineRangeMapping.modified.startLineNumber,1)),this._editors.modified.revealRangeInCenter(e.lineRangeMapping.modified.toExclusiveRange())}goToDiff(e){var t,i,o,s;let r=(i=(t=this._diffModel.get())===null||t===void 0?void 0:t.diff.get())===null||i===void 0?void 0:i.mappings;if(!r||r.length===0)return;let a=this._editors.modified.getPosition().lineNumber,l;e==="next"?l=(o=r.find(c=>c.lineRangeMapping.modified.startLineNumber>a))!==null&&o!==void 0?o:r[0]:l=(s=Mu(r,c=>c.lineRangeMapping.modified.startLineNumber{var t;let i=(t=e.diff.get())===null||t===void 0?void 0:t.mappings;!i||i.length===0||this._goTo(i[0])})}accessibleDiffViewerNext(){this._accessibleDiffViewer.get().next()}accessibleDiffViewerPrev(){this._accessibleDiffViewer.get().prev()}async waitForDiff(){let e=this._diffModel.get();e&&await e.waitForDiff()}mapToOtherSide(){var e,t;let i=this._editors.modified.hasWidgetFocus(),o=i?this._editors.modified:this._editors.original,s=i?this._editors.original:this._editors.modified,r,a=o.getSelection();if(a){let l=(t=(e=this._diffModel.get())===null||e===void 0?void 0:e.diff.get())===null||t===void 0?void 0:t.mappings.map(c=>i?c.lineRangeMapping.flip():c.lineRangeMapping);if(l){let c=nF(a.getStartPosition(),l),d=nF(a.getEndPosition(),l);r=P.plusRange(c,d)}}return{destination:s,destinationSelection:r}}switchSide(){let{destination:e,destinationSelection:t}=this.mapToOtherSide();e.focus(),t&&e.setSelection(t)}exitCompareMove(){let e=this._diffModel.get();e&&e.movedTextToCompare.set(void 0,void 0)}collapseAllUnchangedRegions(){var e;let t=(e=this._diffModel.get())===null||e===void 0?void 0:e.unchangedRegions.get();t&&ri(i=>{for(let o of t)o.collapseAll(i)})}showAllUnchangedRegions(){var e;let t=(e=this._diffModel.get())===null||e===void 0?void 0:e.unchangedRegions.get();t&&ri(i=>{for(let o of t)o.showAll(i)})}_handleCursorPositionChange(e,t){var i,o;if(e?.reason===3){let s=(o=(i=this._diffModel.get())===null||i===void 0?void 0:i.diff.get())===null||o===void 0?void 0:o.mappings.find(r=>t?r.lineRangeMapping.modified.contains(e.position.lineNumber):r.lineRangeMapping.original.contains(e.position.lineNumber));s?.lineRangeMapping.modified.isEmpty?this._accessibilitySignalService.playSignal(Ve.diffLineDeleted,{source:"diffEditor.cursorPositionChanged"}):s?.lineRangeMapping.original.isEmpty?this._accessibilitySignalService.playSignal(Ve.diffLineInserted,{source:"diffEditor.cursorPositionChanged"}):s&&this._accessibilitySignalService.playSignal(Ve.diffLineModified,{source:"diffEditor.cursorPositionChanged"})}}};v_=WJ([B1(3,rt),B1(4,Ye),B1(5,Zt),B1(6,rl),B1(7,Ap)],v_);function zJ(n){return n.mappings.map(e=>{let t=e.lineRangeMapping,i,o,s,r,a=t.innerChanges;return t.original.isEmpty?(i=t.original.startLineNumber-1,o=0,a=void 0):(i=t.original.startLineNumber,o=t.original.endLineNumberExclusive-1),t.modified.isEmpty?(s=t.modified.startLineNumber-1,r=0,a=void 0):(s=t.modified.startLineNumber,r=t.modified.endLineNumberExclusive-1),{originalStartLineNumber:i,originalEndLineNumber:o,modifiedStartLineNumber:s,modifiedEndLineNumber:r,charChanges:a?.map(l=>({originalStartLineNumber:l.originalRange.startLineNumber,originalStartColumn:l.originalRange.startColumn,originalEndLineNumber:l.originalRange.endLineNumber,originalEndColumn:l.originalRange.endColumn,modifiedStartLineNumber:l.modifiedRange.startLineNumber,modifiedStartColumn:l.modifiedRange.startColumn,modifiedEndLineNumber:l.modifiedRange.endLineNumber,modifiedEndColumn:l.modifiedRange.endColumn}))}})}vo();var IF=function(n,e,t,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},Jt=function(n,e){return function(t,i){e(t,i,n)}},VJ=0,_K=!1;function HJ(n){if(!n){if(_K)return;_K=!0}A8(n||gt.document.body)}var eI=class extends Df{constructor(e,t,i,o,s,r,a,l,c,d,h,u,f){let g={...t};g.ariaLabel=g.ariaLabel||Mv.editorViewAccessibleLabel,g.ariaLabel=g.ariaLabel+";"+Mv.accessibilityHelpMessage,super(e,g,{},i,o,s,r,c,d,h,u,f),l instanceof jh?this._standaloneKeybindingService=l:this._standaloneKeybindingService=null,HJ(g.ariaContainerElement),cH((m,C)=>i.createInstance(xh,m,C,{})),hH(a)}addCommand(e,t,i){if(!this._standaloneKeybindingService)return console.warn("Cannot add command because the editor is configured with an unrecognized KeybindingService"),null;let o="DYNAMIC_"+ ++VJ,s=Dt.deserialize(i);return this._standaloneKeybindingService.addDynamicKeybinding(o,e,t,s),o}createContextKey(e,t){return this._contextKeyService.createKey(e,t)}addAction(e){if(typeof e.id!="string"||typeof e.label!="string"||typeof e.run!="function")throw new Error("Invalid action descriptor, `id`, `label` and `run` are required properties!");if(!this._standaloneKeybindingService)return console.warn("Cannot add keybinding because the editor is configured with an unrecognized KeybindingService"),H.None;let t=e.id,i=e.label,o=Dt.and(Dt.equals("editorId",this.getId()),Dt.deserialize(e.precondition)),s=e.keybindings,r=Dt.and(o,Dt.deserialize(e.keybindingContext)),a=e.contextMenuGroupId||null,l=e.contextMenuOrder||0,c=(f,...g)=>Promise.resolve(e.run(this,...g)),d=new ae,h=this.getId()+":"+t;if(d.add(Pi.registerCommand(h,c)),a){let f={command:{id:h,title:i},when:o,group:a,order:l};d.add(Fs.appendMenuItem(A.EditorContext,f))}if(Array.isArray(s))for(let f of s)d.add(this._standaloneKeybindingService.addDynamicKeybinding(h,f,c,r));let u=new ep(h,i,i,void 0,o,(...f)=>Promise.resolve(e.run(this,...f)),this._contextKeyService);return this._actions.set(t,u),d.add(be(()=>{this._actions.delete(t)})),d}_triggerCommand(e,t){if(this._codeEditorService instanceof gv)try{this._codeEditorService.setActiveCodeEditor(this),super._triggerCommand(e,t)}finally{this._codeEditorService.setActiveCodeEditor(null)}else super._triggerCommand(e,t)}};eI=IF([Jt(2,Ye),Jt(3,Zt),Jt(4,kn),Jt(5,rt),Jt(6,Lh),Jt(7,fi),Jt(8,an),Jt(9,Ko),Jt(10,ao),Jt(11,yo),Jt(12,Tt)],eI);var tI=class extends eI{constructor(e,t,i,o,s,r,a,l,c,d,h,u,f,g,m,C){let S={...t};I1(h,S,!1);let w=c.registerEditorContainer(e);typeof S.theme=="string"&&c.setTheme(S.theme),typeof S.autoDetectHighContrast<"u"&&c.setAutoDetectHighContrast(!!S.autoDetectHighContrast);let y=S.model;delete S.model,super(e,S,i,o,s,r,a,l,c,d,u,m,C),this._configurationService=h,this._standaloneThemeService=c,this._register(w);let x;if(typeof y>"u"){let k=g.getLanguageIdByMimeType(S.language)||S.language||In;x=TF(f,g,S.value||"",k,void 0),this._ownsModel=!0}else x=y,this._ownsModel=!1;if(this._attachModel(x),x){let k={oldModelUrl:null,newModelUrl:x.uri};this._onDidChangeModel.fire(k)}}dispose(){super.dispose()}updateOptions(e){I1(this._configurationService,e,!1),typeof e.theme=="string"&&this._standaloneThemeService.setTheme(e.theme),typeof e.autoDetectHighContrast<"u"&&this._standaloneThemeService.setAutoDetectHighContrast(!!e.autoDetectHighContrast),super.updateOptions(e)}_postDetachModelCleanup(e){super._postDetachModelCleanup(e),e&&this._ownsModel&&(e.dispose(),this._ownsModel=!1)}};tI=IF([Jt(2,Ye),Jt(3,Zt),Jt(4,kn),Jt(5,rt),Jt(6,Lh),Jt(7,fi),Jt(8,ls),Jt(9,Ko),Jt(10,Rt),Jt(11,ao),Jt(12,xn),Jt(13,ii),Jt(14,yo),Jt(15,Tt)],tI);var iI=class extends v_{constructor(e,t,i,o,s,r,a,l,c,d,h,u){let f={...t};I1(l,f,!0);let g=r.registerEditorContainer(e);typeof f.theme=="string"&&r.setTheme(f.theme),typeof f.autoDetectHighContrast<"u"&&r.setAutoDetectHighContrast(!!f.autoDetectHighContrast),super(e,f,{},o,i,s,u,d),this._configurationService=l,this._standaloneThemeService=r,this._register(g)}dispose(){super.dispose()}updateOptions(e){I1(this._configurationService,e,!0),typeof e.theme=="string"&&this._standaloneThemeService.setTheme(e.theme),typeof e.autoDetectHighContrast<"u"&&this._standaloneThemeService.setAutoDetectHighContrast(!!e.autoDetectHighContrast),super.updateOptions(e)}_createInnerEditor(e,t,i){return e.createInstance(eI,t,i)}getOriginalEditor(){return super.getOriginalEditor()}getModifiedEditor(){return super.getModifiedEditor()}addCommand(e,t,i){return this.getModifiedEditor().addCommand(e,t,i)}createContextKey(e,t){return this.getModifiedEditor().createContextKey(e,t)}addAction(e){return this.getModifiedEditor().addAction(e)}};iI=IF([Jt(2,Ye),Jt(3,rt),Jt(4,Zt),Jt(5,ls),Jt(6,Ko),Jt(7,Rt),Jt(8,Ds),Jt(9,Ap),Jt(10,d_),Jt(11,rl)],iI);function TF(n,e,t,i,o){if(t=t||"",!i){let s=t.indexOf(` +`),r=t;return s!==-1&&(r=t.substring(0,s)),bK(n,t,e.createByFilepathOrFirstLine(o||null,r),o)}return bK(n,t,e.createById(i),o)}function bK(n,e,t,i){return n.createModel(e,t,i)}x1();zr();ir();Oi();_();v();b();le();bn();ca();_();v();b();ke();wt();Dl();xt();le();bn();zp();ca();es();Kn();wb();Oi();qe();_();v();b();ke();$n();le();bn();zp();zr();qe();var UJ=function(n,e,t,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},KJ=function(n,e){return function(t,i){e(t,i,n)}},nI=class{constructor(e,t){this.viewModel=e,this.deltaScrollVertical=t}getId(){return this.viewModel}},C_=class extends H{constructor(e,t,i,o){super(),this._container=e,this._overflowWidgetsDomNode=t,this._workbenchUIElementFactory=i,this._instantiationService=o,this._viewModel=ct(this,void 0),this._collapsed=We(this,r=>{var a;return(a=this._viewModel.read(r))===null||a===void 0?void 0:a.collapsed.read(r)}),this._editorContentHeight=ct(this,500),this.contentHeight=We(this,r=>(this._collapsed.read(r)?0:this._editorContentHeight.read(r))+this._outerEditorHeight),this._modifiedContentWidth=ct(this,0),this._modifiedWidth=ct(this,0),this._originalContentWidth=ct(this,0),this._originalWidth=ct(this,0),this.maxScroll=We(this,r=>{let a=this._modifiedContentWidth.read(r)-this._modifiedWidth.read(r),l=this._originalContentWidth.read(r)-this._originalWidth.read(r);return a>l?{maxScroll:a,width:this._modifiedWidth.read(r)}:{maxScroll:l,width:this._originalWidth.read(r)}}),this._elements=kt("div.multiDiffEntry",[kt("div.header@header",[kt("div.header-content",[kt("div.collapse-button@collapseButton"),kt("div.file-path",[kt("div.title.modified.show-file-icons@primaryPath",[]),kt("div.status.deleted@status",["R"]),kt("div.title.original.show-file-icons@secondaryPath",[])]),kt("div.actions@actions")])]),kt("div.editorParent",[kt("div.editorContainer@editor")])]),this.editor=this._register(this._instantiationService.createInstance(v_,this._elements.editor,{overflowWidgetsDomNode:this._overflowWidgetsDomNode},{})),this.isModifedFocused=vK(this.editor.getModifiedEditor()),this.isOriginalFocused=vK(this.editor.getOriginalEditor()),this.isFocused=We(this,r=>this.isModifedFocused.read(r)||this.isOriginalFocused.read(r)),this._resourceLabel=this._workbenchUIElementFactory.createResourceLabel?this._register(this._workbenchUIElementFactory.createResourceLabel(this._elements.primaryPath)):void 0,this._resourceLabel2=this._workbenchUIElementFactory.createResourceLabel?this._register(this._workbenchUIElementFactory.createResourceLabel(this._elements.secondaryPath)):void 0,this._dataStore=new ae,this._headerHeight=40,this._lastScrollTop=-1,this._isSettingScrollTop=!1;let s=new Jf(this._elements.collapseButton,{});this._register(pt(r=>{s.element.className="",s.icon=this._collapsed.read(r)?ue.chevronRight:ue.chevronDown})),this._register(s.onDidClick(()=>{var r;(r=this._viewModel.get())===null||r===void 0||r.collapsed.set(!this._collapsed.get(),void 0)})),this._register(pt(r=>{this._elements.editor.style.display=this._collapsed.read(r)?"none":"block"})),this._register(this.editor.getModifiedEditor().onDidLayoutChange(r=>{let a=this.editor.getModifiedEditor().getLayoutInfo().contentWidth;this._modifiedWidth.set(a,void 0)})),this._register(this.editor.getOriginalEditor().onDidLayoutChange(r=>{let a=this.editor.getOriginalEditor().getLayoutInfo().contentWidth;this._originalWidth.set(a,void 0)})),this._register(this.editor.onDidContentSizeChange(r=>{Wp(a=>{this._editorContentHeight.set(r.contentHeight,a),this._modifiedContentWidth.set(this.editor.getModifiedEditor().getContentWidth(),a),this._originalContentWidth.set(this.editor.getOriginalEditor().getContentWidth(),a)})})),this._register(this.editor.getOriginalEditor().onDidScrollChange(r=>{if(this._isSettingScrollTop||!r.scrollTopChanged||!this._data)return;let a=r.scrollTop-this._lastScrollTop;this._data.deltaScrollVertical(a)})),this._register(pt(r=>{var a;let l=(a=this._viewModel.read(r))===null||a===void 0?void 0:a.isActive.read(r);this._elements.root.classList.toggle("active",l)})),this._container.appendChild(this._elements.root),this._outerEditorHeight=this._headerHeight,this._register(this._instantiationService.createInstance(b_,this._elements.actions,A.MultiDiffEditorFileToolbar,{actionRunner:this._register(new __(()=>{var r;return(r=this._viewModel.get())===null||r===void 0?void 0:r.modifiedUri})),menuOptions:{shouldForwardArgs:!0},toolbarOptions:{primaryGroup:r=>r.startsWith("navigation")},actionViewItemProvider:(r,a)=>KH(o,r,a)}))}setScrollLeft(e){this._modifiedContentWidth.get()-this._modifiedWidth.get()>this._originalContentWidth.get()-this._originalWidth.get()?this.editor.getModifiedEditor().setScrollLeft(e):this.editor.getOriginalEditor().setScrollLeft(e)}setData(e){this._data=e;function t(o){return{...o,scrollBeyondLastLine:!1,hideUnchangedRegions:{enabled:!0},scrollbar:{vertical:"hidden",horizontal:"hidden",handleMouseWheel:!1,useShadows:!1},renderOverviewRuler:!1,fixedOverflowWidgets:!0,overviewRulerBorder:!1}}let i=e.viewModel.entry.value;i.onOptionsDidChange&&this._dataStore.add(i.onOptionsDidChange(()=>{var o;this.editor.updateOptions(t((o=i.options)!==null&&o!==void 0?o:{}))})),Wp(o=>{var s,r,a,l;(s=this._resourceLabel)===null||s===void 0||s.setUri((r=e.viewModel.modifiedUri)!==null&&r!==void 0?r:e.viewModel.originalUri,{strikethrough:e.viewModel.modifiedUri===void 0});let c=!1,d=!1,h=!1,u="";e.viewModel.modifiedUri&&e.viewModel.originalUri&&e.viewModel.modifiedUri.path!==e.viewModel.originalUri.path?(u="R",c=!0):e.viewModel.modifiedUri?e.viewModel.originalUri||(u="A",h=!0):(u="D",d=!0),this._elements.status.classList.toggle("renamed",c),this._elements.status.classList.toggle("deleted",d),this._elements.status.classList.toggle("added",h),this._elements.status.innerText=u,(a=this._resourceLabel2)===null||a===void 0||a.setUri(c?e.viewModel.originalUri:void 0,{strikethrough:!0}),this._dataStore.clear(),this._viewModel.set(e.viewModel,o),this.editor.setModel(e.viewModel.diffEditorViewModel,o),this.editor.updateOptions(t((l=i.options)!==null&&l!==void 0?l:{}))})}render(e,t,i,o){this._elements.root.style.visibility="visible",this._elements.root.style.top=`${e.start}px`,this._elements.root.style.height=`${e.length}px`,this._elements.root.style.width=`${t}px`,this._elements.root.style.position="absolute";let s=e.length-this._headerHeight,r=Math.max(0,Math.min(o.start-e.start,s));this._elements.header.style.transform=`translateY(${r}px)`,Wp(a=>{this.editor.layout({width:t-2*8-2*1,height:e.length-this._outerEditorHeight})});try{this._isSettingScrollTop=!0,this._lastScrollTop=i,this.editor.getOriginalEditor().setScrollTop(i)}finally{this._isSettingScrollTop=!1}this._elements.header.classList.toggle("shadow",r>0||i>0),this._elements.header.classList.toggle("collapsed",r===s)}hide(){this._elements.root.style.top="-100000px",this._elements.root.style.visibility="hidden"}};C_=UJ([KJ(3,Ye)],C_);function vK(n){return $t(e=>{let t=new ae;return t.add(n.onDidFocusEditorWidget(()=>e(!0))),t.add(n.onDidBlurEditorWidget(()=>e(!1))),t},()=>n.hasTextFocus())}_();v();b();var oI=class{constructor(e){this._create=e,this._unused=new Set,this._used=new Set,this._itemData=new Map}getUnusedObj(e){var t;let i;if(this._unused.size===0)i=this._create(e),this._itemData.set(i,e);else{let o=[...this._unused.values()];i=(t=o.find(s=>this._itemData.get(s).getId()===e.getId()))!==null&&t!==void 0?t:o[0],this._unused.delete(i),this._itemData.set(i,e),i.setData(e)}return this._used.add(i),{object:i,dispose:()=>{this._used.delete(i),this._unused.size>5?i.dispose():this._unused.add(i)}}}dispose(){for(let e of this._used)e.dispose();for(let e of this._unused)e.dispose();this._used.clear(),this._unused.clear()}};var $J=function(n,e,t,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},CK=function(n,e){return function(t,i){e(t,i,n)}},sI=class extends H{constructor(e,t,i,o,s,r){super(),this._element=e,this._dimension=t,this._viewModel=i,this._workbenchUIElementFactory=o,this._parentContextKeyService=s,this._parentInstantiationService=r,this._elements=kt("div.monaco-component.multiDiffEditor",[kt("div@content",{style:{overflow:"hidden"}}),kt("div.monaco-editor@overflowWidgetsDomNode",{})]),this._sizeObserver=this._register(new u_(this._element,void 0)),this._objectPool=this._register(new oI(l=>{let c=this._instantiationService.createInstance(C_,this._elements.content,this._elements.overflowWidgetsDomNode,this._workbenchUIElementFactory);return c.setData(l),c})),this._scrollable=this._register(new gr({forceIntegerValues:!1,scheduleAtNextAnimationFrame:l=>rn(ge(this._element),l),smoothScrollDuration:100})),this._scrollableElement=this._register(new Bl(this._elements.root,{vertical:1,horizontal:1,useShadows:!1},this._scrollable)),this.scrollTop=$t(this._scrollableElement.onScroll,()=>this._scrollableElement.getScrollPosition().scrollTop),this.scrollLeft=$t(this._scrollableElement.onScroll,()=>this._scrollableElement.getScrollPosition().scrollLeft),this._viewItemsInfo=pr(this,(l,c)=>{let d=this._viewModel.read(l);if(!d)return{items:[],getItem:g=>{throw new St}};let h=d.items.read(l),u=new Map;return{items:h.map(g=>{var m;let C=c.add(new NF(g,this._objectPool,this.scrollLeft,w=>{this._scrollableElement.setScrollPosition({scrollTop:this._scrollableElement.getScrollPosition().scrollTop+w})})),S=(m=this._lastDocStates)===null||m===void 0?void 0:m[C.getKey()];return S&&ri(w=>{C.setViewState(S,w)}),u.set(g,C),C}),getItem:g=>u.get(g)}}),this._viewItems=this._viewItemsInfo.map(this,l=>l.items),this._spaceBetweenPx=0,this._totalHeight=this._viewItems.map(this,(l,c)=>l.reduce((d,h)=>d+h.contentHeight.read(c)+this._spaceBetweenPx,0)),this._contextKeyService=this._register(this._parentContextKeyService.createScoped(this._element)),this._instantiationService=this._parentInstantiationService.createChild(new sa([rt,this._contextKeyService])),this._lastDocStates={},this._contextKeyService.createKey(_e.inMultiDiffEditor.key,!0),this._register(Jn((l,c)=>{let d=this._viewModel.read(l);if(d&&d.contextKeys)for(let[h,u]of Object.entries(d.contextKeys)){let f=this._contextKeyService.createKey(h,void 0);f.set(u),c.add(be(()=>f.reset()))}}));let a=this._parentContextKeyService.createKey(_e.multiDiffEditorAllCollapsed.key,!1);this._register(pt(l=>{let c=this._viewModel.read(l);if(c){let d=c.items.read(l).every(h=>h.collapsed.read(l));a.set(d)}})),this._register(pt(l=>{let c=this._dimension.read(l);this._sizeObserver.observe(c)})),this._elements.content.style.position="relative",this._register(pt(l=>{let c=this._sizeObserver.height.read(l);this._elements.root.style.height=`${c}px`;let d=this._totalHeight.read(l);this._elements.content.style.height=`${d}px`;let h=this._sizeObserver.width.read(l),u=h,f=this._viewItems.read(l),g=aA(f,Io(m=>m.maxScroll.read(l).maxScroll,ma));if(g){let m=g.maxScroll.read(l);u=h+m.maxScroll}this._scrollableElement.setScrollDimensions({width:h,height:c,scrollHeight:d,scrollWidth:u})})),e.replaceChildren(this._scrollableElement.getDomNode()),this._register(be(()=>{e.replaceChildren()})),this._register(this._register(pt(l=>{Wp(c=>{this.render(l)})})))}render(e){let t=this.scrollTop.read(e),i=0,o=0,s=0,r=this._sizeObserver.height.read(e),a=ze.ofStartAndLength(t,r),l=this._sizeObserver.width.read(e);for(let c of this._viewItems.read(e)){let d=c.contentHeight.read(e),h=Math.min(d,r),u=ze.ofStartAndLength(o,h),f=ze.ofStartAndLength(s,d);if(f.isBefore(a))i-=d-h,c.hide();else if(f.isAfter(a))c.hide();else{let g=Math.max(0,Math.min(a.start-f.start,d-h));i-=g;let m=ze.ofStartAndLength(t+i,r);c.render(u,g,l,m)}o+=h+this._spaceBetweenPx,s+=d+this._spaceBetweenPx}this._elements.content.style.transform=`translateY(${-(t+i)}px)`}};sI=$J([CK(4,rt),CK(5,Ye)],sI);var NF=class extends H{constructor(e,t,i,o){super(),this.viewModel=e,this._objectPool=t,this._scrollLeft=i,this._deltaScrollVertical=o,this._templateRef=this._register(F5(this,void 0)),this.contentHeight=We(this,s=>{var r,a,l;return(l=(a=(r=this._templateRef.read(s))===null||r===void 0?void 0:r.object.contentHeight)===null||a===void 0?void 0:a.read(s))!==null&&l!==void 0?l:this.viewModel.lastTemplateData.read(s).contentHeight}),this.maxScroll=We(this,s=>{var r,a;return(a=(r=this._templateRef.read(s))===null||r===void 0?void 0:r.object.maxScroll.read(s))!==null&&a!==void 0?a:{maxScroll:0,scrollWidth:0}}),this.template=We(this,s=>{var r;return(r=this._templateRef.read(s))===null||r===void 0?void 0:r.object}),this._isHidden=ct(this,!1),this._isFocused=We(this,s=>{var r,a;return(a=(r=this.template.read(s))===null||r===void 0?void 0:r.isFocused.read(s))!==null&&a!==void 0?a:!1}),this.viewModel.setIsFocused(this._isFocused,void 0),this._register(pt(s=>{var r;let a=this._scrollLeft.read(s);(r=this._templateRef.read(s))===null||r===void 0||r.object.setScrollLeft(a)})),this._register(pt(s=>{let r=this._templateRef.read(s);!r||!this._isHidden.read(s)||r.object.isFocused.read(s)||this._clear()}))}dispose(){this._clear(),super.dispose()}toString(){var e;return`VirtualViewItem(${(e=this.viewModel.entry.value.modified)===null||e===void 0?void 0:e.uri.toString()})`}getKey(){return this.viewModel.getKey()}setViewState(e,t){var i;this.viewModel.collapsed.set(e.collapsed,t),this._updateTemplateData(t);let o=this.viewModel.lastTemplateData.get(),s=(i=e.selections)===null||i===void 0?void 0:i.map(nt.liftSelection);this.viewModel.lastTemplateData.set({...o,selections:s},t);let r=this._templateRef.get();r&&s&&r.object.editor.setSelections(s)}_updateTemplateData(e){var t;let i=this._templateRef.get();i&&this.viewModel.lastTemplateData.set({contentHeight:i.object.contentHeight.get(),selections:(t=i.object.editor.getSelections())!==null&&t!==void 0?t:void 0},e)}_clear(){let e=this._templateRef.get();e&&ri(t=>{this._updateTemplateData(t),e.object.hide(),this._templateRef.set(void 0,t)})}hide(){this._isHidden.set(!0,void 0)}render(e,t,i,o){this._isHidden.set(!1,void 0);let s=this._templateRef.get();if(!s){s=this._objectPool.getUnusedObj(new nI(this.viewModel,this._deltaScrollVertical)),this._templateRef.set(s,void 0);let r=this.viewModel.lastTemplateData.get().selections;r&&s.object.editor.setSelections(r)}s.object.render(e,i,t,o)}};qe();_();v();b();Ge();is();var zSt=F("multiDiffEditor.headerBackground",{dark:"#262626",light:"tab.inactiveBackground",hcDark:"tab.inactiveBackground",hcLight:"tab.inactiveBackground"},p("multiDiffEditor.headerBackground","The background color of the diff editor's header")),VSt=F("multiDiffEditor.background",{dark:"editorBackground",light:"editorBackground",hcDark:"editorBackground",hcLight:"editorBackground"},p("multiDiffEditor.background","The background color of the multi file diff editor")),HSt=F("multiDiffEditor.border",{dark:"sideBarSectionHeader.border",light:"#cccccc",hcDark:"sideBarSectionHeader.border",hcLight:"#cccccc"},p("multiDiffEditor.border","The border color of the multi file diff editor"));var qJ=function(n,e,t,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(s=(o<3?r(s):o>3?r(e,t,s):r(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},jJ=function(n,e){return function(t,i){e(t,i,n)}},rI=class extends H{constructor(e,t,i){super(),this._element=e,this._workbenchUIElementFactory=t,this._instantiationService=i,this._dimension=ct(this,void 0),this._viewModel=ct(this,void 0),this._widgetImpl=pr(this,(o,s)=>(Ts(C_,o),s.add(this._instantiationService.createInstance(Ts(sI,o),this._element,this._dimension,this._viewModel,this._workbenchUIElementFactory)))),this._register(Ph(this._widgetImpl))}};rI=qJ([jJ(2,Ye)],rI);function GJ(n,e,t){return Ae.initialize(t||{}).createInstance(tI,n,e)}function ZJ(n){return Ae.get(Zt).onCodeEditorAdd(t=>{n(t)})}function YJ(n){return Ae.get(Zt).onDiffEditorAdd(t=>{n(t)})}function XJ(){return Ae.get(Zt).listCodeEditors()}function QJ(){return Ae.get(Zt).listDiffEditors()}function JJ(n,e,t){return Ae.initialize(t||{}).createInstance(iI,n,e)}function eee(n,e){let t=Ae.initialize(e||{});return new rI(n,{},t)}function tee(n){if(typeof n.id!="string"||typeof n.run!="function")throw new Error("Invalid command descriptor, `id` and `run` are required properties!");return Pi.registerCommand(n.id,n.run)}function iee(n){if(typeof n.id!="string"||typeof n.label!="string"||typeof n.run!="function")throw new Error("Invalid action descriptor, `id`, `label` and `run` are required properties!");let e=Dt.deserialize(n.precondition),t=(o,...s)=>yl.runEditorCommand(o,s,e,(r,a,l)=>Promise.resolve(n.run(a,...l))),i=new ae;if(i.add(Pi.registerCommand(n.id,t)),n.contextMenuGroupId){let o={command:{id:n.id,title:n.label},when:e,group:n.contextMenuGroupId,order:n.contextMenuOrder||0};i.add(Fs.appendMenuItem(A.EditorContext,o))}if(Array.isArray(n.keybindings)){let o=Ae.get(fi);if(!(o instanceof jh))console.warn("Cannot add keybinding because the editor is configured with an unrecognized KeybindingService");else{let s=Dt.and(e,Dt.deserialize(n.keybindingContext));i.add(o.addDynamicKeybindings(n.keybindings.map(r=>({keybinding:r,command:n.id,when:s}))))}}return i}function nee(n){return wK([n])}function wK(n){let e=Ae.get(fi);return e instanceof jh?e.addDynamicKeybindings(n.map(t=>({keybinding:t.keybinding,command:t.command,commandArgs:t.commandArgs,when:Dt.deserialize(t.when)}))):(console.warn("Cannot add keybinding because the editor is configured with an unrecognized KeybindingService"),H.None)}function oee(n,e,t){let i=Ae.get(ii),o=i.getLanguageIdByMimeType(e)||e;return TF(Ae.get(xn),i,n,o,t)}function see(n,e){let t=Ae.get(ii),i=t.getLanguageIdByMimeType(e)||e||In;n.setLanguage(t.createById(i))}function ree(n,e,t){n&&Ae.get(tl).changeOne(e,n.uri,t)}function aee(n){Ae.get(tl).changeAll(n,[])}function lee(n){return Ae.get(tl).read(n)}function cee(n){return Ae.get(tl).onMarkerChanged(n)}function dee(n){return Ae.get(xn).getModel(n)}function hee(){return Ae.get(xn).getModels()}function uee(n){return Ae.get(xn).onModelAdded(n)}function fee(n){return Ae.get(xn).onModelRemoved(n)}function gee(n){return Ae.get(xn).onModelLanguageChanged(t=>{n({model:t.model,oldLanguage:t.oldLanguageId})})}function mee(n){return w8(Ae.get(xn),Ae.get(yo),n)}function pee(n,e){let t=Ae.get(ii),i=Ae.get(ls);return bm.colorizeElement(i,t,n,e).then(()=>{i.registerEditorContainer(n)})}function _ee(n,e,t){let i=Ae.get(ii);return Ae.get(ls).registerEditorContainer(gt.document.body),bm.colorize(i,n,e,t)}function bee(n,e,t=4){return Ae.get(ls).registerEditorContainer(gt.document.body),bm.colorizeModelLine(n,e,t)}function vee(n){let e=Bt.get(n);return e||{getInitialState:()=>eh,tokenize:(t,i,o)=>_S(n,o)}}function Cee(n,e){Bt.getOrCreate(e);let t=vee(e),i=Tr(n),o=[],s=t.getInitialState();for(let r=0,a=i.length;r{var s;if(!i)return null;let r=(s=t.options)===null||s===void 0?void 0:s.selection,a;return r&&typeof r.endLineNumber=="number"&&typeof r.endColumn=="number"?a=r:r&&(a={lineNumber:r.startLineNumber,column:r.startColumn}),await n.openCodeEditor(i,t.resource,a)?i:null})}function yK(){return{create:GJ,getEditors:XJ,getDiffEditors:QJ,onDidCreateEditor:ZJ,onDidCreateDiffEditor:YJ,createDiffEditor:JJ,addCommand:tee,addEditorAction:iee,addKeybindingRule:nee,addKeybindingRules:wK,createModel:oee,setModelLanguage:see,setModelMarkers:ree,getModelMarkers:lee,removeAllMarkers:aee,onDidChangeMarkers:cee,getModels:hee,getModel:dee,onDidCreateModel:uee,onWillDisposeModel:fee,onDidChangeModelLanguage:gee,createWebWorker:mee,colorizeElement:pee,colorize:_ee,colorizeModelLine:bee,tokenize:Cee,defineTheme:wee,setTheme:yee,remeasureFonts:See,registerCommand:xee,registerLinkOpener:Lee,registerEditorOpener:kee,AccessibilitySupport:yC,ContentWidgetPositionPreference:EC,CursorChangeReason:IC,DefaultEndOfLine:TC,EditorAutoIndentStrategy:AC,EditorOption:MC,EndOfLinePreference:RC,EndOfLineSequence:PC,MinimapPosition:qC,MinimapSectionHeaderStyle:jC,MouseTargetType:GC,OverlayWidgetPositionPreference:XC,OverviewRulerLane:QC,GlyphMarginLane:OC,RenderLineNumbersType:tw,RenderMinimap:iw,ScrollbarVisibility:ow,ScrollType:nw,TextEditorCursorBlinkingStyle:dw,TextEditorCursorStyle:hw,TrackedRangeStickiness:uw,WrappingIndent:fw,InjectedTextCursorStops:WC,PositionAffinity:ew,ShowLightbulbIconMode:rw,ConfigurationChangedEvent:mg,BareFontInfo:mu,FontInfo:pu,TextModelResolvedOptions:Zd,FindMatch:Ll,ApplyUpdateResult:_d,EditorZoom:Rr,createMultiFileDiffEditor:eee,EditorType:Rc,EditorOptions:Ca}}_();v();b();gn();Ke();Yo();Hr();lr();Ma();Ou();_();v();b();function Dee(n,e){if(!e||!Array.isArray(e))return!1;for(let t of e)if(!n(t))return!1;return!0}function aI(n,e){return typeof n=="boolean"?n:e}function SK(n,e){return typeof n=="string"?n:e}function Eee(n){let e={};for(let t of n)e[t]=!0;return e}function xK(n,e=!1){e&&(n=n.map(function(i){return i.toLowerCase()}));let t=Eee(n);return e?function(i){return t[i.toLowerCase()]!==void 0&&t.hasOwnProperty(i.toLowerCase())}:function(i){return t[i]!==void 0&&t.hasOwnProperty(i)}}function AF(n,e,t){e=e.replace(/@@/g,"");let i=0,o;do o=!1,e=e.replace(/@(\w+)/g,function(r,a){o=!0;let l="";if(typeof n[a]=="string")l=n[a];else if(n[a]&&n[a]instanceof RegExp)l=n[a].source;else throw n[a]===void 0?Kt(n,"language definition does not contain attribute '"+a+"', used at: "+e):Kt(n,"attribute reference '"+a+"' must be a string, used at: "+e);return th(l)?"":"(?:"+l+")"}),i++;while(o&&i<5);e=e.replace(/\x01/g,"@");let s=(n.ignoreCase?"i":"")+(n.unicode?"u":"");if(t&&e.match(/\$[sS](\d\d?)/g)){let a=null,l=null;return c=>(l&&a===c||(a=c,l=new RegExp(k8(n,e,c),s)),l)}return new RegExp(e,s)}function Iee(n,e,t,i){if(i<0)return n;if(i=100){i=i-100;let o=t.split(".");if(o.unshift(t),i=0&&(i.tokenSubst=!0),typeof t.bracket=="string")if(t.bracket==="@open")i.bracket=1;else if(t.bracket==="@close")i.bracket=-1;else throw Kt(n,"a 'bracket' attribute must be either '@open' or '@close', in rule: "+e);if(t.next){if(typeof t.next!="string")throw Kt(n,"the next state must be a string value in rule: "+e);{let o=t.next;if(!/^(@pop|@push|@popall)$/.test(o)&&(o[0]==="@"&&(o=o.substr(1)),o.indexOf("$")<0&&!D8(n,Nl(n,o,"",[],""))))throw Kt(n,"the next state '"+t.next+"' is not defined in rule: "+e);i.next=o}}return typeof t.goBack=="number"&&(i.goBack=t.goBack),typeof t.switchTo=="string"&&(i.switchTo=t.switchTo),typeof t.log=="string"&&(i.log=t.log),typeof t.nextEmbedded=="string"&&(i.nextEmbedded=t.nextEmbedded,n.usesEmbedded=!0),i}}else if(Array.isArray(t)){let i=[];for(let o=0,s=t.length;o0&&i[0]==="^",this.name=this.name+": "+i,this.regex=AF(e,"^(?:"+(this.matchOnlyAtLineStart?i.substr(1):i)+")",!0)}setAction(e,t){this.action=MF(e,this.name,t)}resolveRegex(e){return this.regex instanceof RegExp?this.regex:this.regex(e)}};function PF(n,e){if(!e||typeof e!="object")throw new Error("Monarch: expecting a language definition object");let t={};t.languageId=n,t.includeLF=aI(e.includeLF,!1),t.noThrow=!1,t.maxStack=100,t.start=typeof e.start=="string"?e.start:null,t.ignoreCase=aI(e.ignoreCase,!1),t.unicode=aI(e.unicode,!1),t.tokenPostfix=SK(e.tokenPostfix,"."+t.languageId),t.defaultToken=SK(e.defaultToken,"source"),t.usesEmbedded=!1;let i=e;i.languageId=n,i.includeLF=t.includeLF,i.ignoreCase=t.ignoreCase,i.unicode=t.unicode,i.noThrow=t.noThrow,i.usesEmbedded=t.usesEmbedded,i.stateNames=e.tokenizer,i.defaultToken=t.defaultToken;function o(r,a,l){for(let c of l){let d=c.include;if(d){if(typeof d!="string")throw Kt(t,"an 'include' attribute must be a string at: "+r);if(d[0]==="@"&&(d=d.substr(1)),!e.tokenizer[d])throw Kt(t,"include target '"+d+"' is not defined at: "+r);o(r+"."+d,a,e.tokenizer[d])}else{let h=new RF(r);if(Array.isArray(c)&&c.length>=1&&c.length<=3)if(h.setRegex(i,c[0]),c.length>=3)if(typeof c[1]=="string")h.setAction(i,{token:c[1],next:c[2]});else if(typeof c[1]=="object"){let u=c[1];u.next=c[2],h.setAction(i,u)}else throw Kt(t,"a next state as the last element of a rule can only be given if the action is either an object or a string, at: "+r);else h.setAction(i,c[1]);else{if(!c.regex)throw Kt(t,"a rule must either be an array, or an object with a 'regex' or 'include' field at: "+r);c.name&&typeof c.name=="string"&&(h.name=c.name),c.matchOnlyAtStart&&(h.matchOnlyAtLineStart=aI(c.matchOnlyAtLineStart,!1)),h.setRegex(i,c.regex),h.setAction(i,c.action)}a.push(h)}}}if(!e.tokenizer||typeof e.tokenizer!="object")throw Kt(t,"a language definition must define the 'tokenizer' attribute as an object");t.tokenizer=[];for(let r in e.tokenizer)if(e.tokenizer.hasOwnProperty(r)){t.start||(t.start=r);let a=e.tokenizer[r];t.tokenizer[r]=new Array,o("tokenizer."+r,t.tokenizer[r],a)}if(t.usesEmbedded=i.usesEmbedded,e.brackets){if(!Array.isArray(e.brackets))throw Kt(t,"the 'brackets' attribute must be defined as an array")}else e.brackets=[{open:"{",close:"}",token:"delimiter.curly"},{open:"[",close:"]",token:"delimiter.square"},{open:"(",close:")",token:"delimiter.parenthesis"},{open:"<",close:">",token:"delimiter.angle"}];let s=[];for(let r of e.brackets){let a=r;if(a&&Array.isArray(a)&&a.length===3&&(a={token:a[2],open:a[0],close:a[1]}),a.open===a.close)throw Kt(t,"open and close brackets in a 'brackets' attribute must be different: "+a.open+` + hint: use the 'bracket' attribute if matching on equal brackets is required.`);if(typeof a.open=="string"&&typeof a.token=="string"&&typeof a.close=="string")s.push({token:a.token+t.tokenPostfix,open:Pa(t,a.open),close:Pa(t,a.close)});else throw Kt(t,"every element in the 'brackets' array must be a '{open,close,token}' object or array")}return t.brackets=s,t.noThrow=!0,t}x1();Fo();function Nee(n){$d.registerLanguage(n)}function Aee(){let n=[];return n=n.concat($d.getLanguages()),n}function Mee(n){return Ae.get(ii).languageIdCodec.encodeLanguageId(n)}function Ree(n,e){return Ae.withServices(()=>{let i=Ae.get(ii).onDidRequestRichLanguageFeatures(o=>{o===n&&(i.dispose(),e())});return i})}function Pee(n,e){return Ae.withServices(()=>{let i=Ae.get(ii).onDidRequestBasicLanguageFeatures(o=>{o===n&&(i.dispose(),e())});return i})}function Oee(n,e){if(!Ae.get(ii).isRegisteredLanguageId(n))throw new Error(`Cannot set configuration for unknown language ${n}`);return Ae.get(yo).register(n,e,100)}var OF=class{constructor(e,t){this._languageId=e,this._actual=t}dispose(){}getInitialState(){return this._actual.getInitialState()}tokenize(e,t,i){if(typeof this._actual.tokenize=="function")return lI.adaptTokenize(this._languageId,this._actual,e,i);throw new Error("Not supported!")}tokenizeEncoded(e,t,i){let o=this._actual.tokenizeEncoded(e,i);return new yc(o.tokens,o.endState)}},lI=class n{constructor(e,t,i,o){this._languageId=e,this._actual=t,this._languageService=i,this._standaloneThemeService=o}dispose(){}getInitialState(){return this._actual.getInitialState()}static _toClassicTokens(e,t){let i=[],o=0;for(let s=0,r=e.length;s0&&s[r-1]===u)continue;let f=h.startIndex;c===0?f=0:f{let i=await Promise.resolve(e.create());return i?Fee(i)?kK(n,i):new Vu(Ae.get(ii),Ae.get(ls),n,PF(n,i),Ae.get(Rt)):null});return Bt.registerFactory(n,t)}function zee(n,e){if(!Ae.get(ii).isRegisteredLanguageId(n))throw new Error(`Cannot set tokens provider for unknown language ${n}`);return LK(e)?FF(n,{create:()=>e}):Bt.register(n,kK(n,e))}function Vee(n,e){let t=i=>new Vu(Ae.get(ii),Ae.get(ls),n,PF(n,i),Ae.get(Rt));return LK(e)?FF(n,{create:()=>e}):Bt.register(n,t(e))}function Hee(n,e){return Ae.get(Tt).referenceProvider.register(n,e)}function Uee(n,e){return Ae.get(Tt).renameProvider.register(n,e)}function Kee(n,e){return Ae.get(Tt).newSymbolNamesProvider.register(n,e)}function $ee(n,e){return Ae.get(Tt).signatureHelpProvider.register(n,e)}function qee(n,e){return Ae.get(Tt).hoverProvider.register(n,{provideHover:async(i,o,s,r)=>{let a=i.getWordAtPosition(o);return Promise.resolve(e.provideHover(i,o,s,r)).then(l=>{if(l)return!l.range&&a&&(l.range=new P(o.lineNumber,a.startColumn,o.lineNumber,a.endColumn)),l.range||(l.range=new P(o.lineNumber,o.column,o.lineNumber,o.column)),l})}})}function jee(n,e){return Ae.get(Tt).documentSymbolProvider.register(n,e)}function Gee(n,e){return Ae.get(Tt).documentHighlightProvider.register(n,e)}function Zee(n,e){return Ae.get(Tt).linkedEditingRangeProvider.register(n,e)}function Yee(n,e){return Ae.get(Tt).definitionProvider.register(n,e)}function Xee(n,e){return Ae.get(Tt).implementationProvider.register(n,e)}function Qee(n,e){return Ae.get(Tt).typeDefinitionProvider.register(n,e)}function Jee(n,e){return Ae.get(Tt).codeLensProvider.register(n,e)}function ete(n,e,t){return Ae.get(Tt).codeActionProvider.register(n,{providedCodeActionKinds:t?.providedCodeActionKinds,documentation:t?.documentation,provideCodeActions:(o,s,r,a)=>{let c=Ae.get(tl).read({resource:o.uri}).filter(d=>P.areIntersectingOrTouching(d,s));return e.provideCodeActions(o,s,{markers:c,only:r.only,trigger:r.trigger},a)},resolveCodeAction:e.resolveCodeAction})}function tte(n,e){return Ae.get(Tt).documentFormattingEditProvider.register(n,e)}function ite(n,e){return Ae.get(Tt).documentRangeFormattingEditProvider.register(n,e)}function nte(n,e){return Ae.get(Tt).onTypeFormattingEditProvider.register(n,e)}function ote(n,e){return Ae.get(Tt).linkProvider.register(n,e)}function ste(n,e){return Ae.get(Tt).completionProvider.register(n,e)}function rte(n,e){return Ae.get(Tt).colorProvider.register(n,e)}function ate(n,e){return Ae.get(Tt).foldingRangeProvider.register(n,e)}function lte(n,e){return Ae.get(Tt).declarationProvider.register(n,e)}function cte(n,e){return Ae.get(Tt).selectionRangeProvider.register(n,e)}function dte(n,e){return Ae.get(Tt).documentSemanticTokensProvider.register(n,e)}function hte(n,e){return Ae.get(Tt).documentRangeSemanticTokensProvider.register(n,e)}function ute(n,e){return Ae.get(Tt).inlineCompletionsProvider.register(n,e)}function fte(n,e){return Ae.get(Tt).inlineEditProvider.register(n,e)}function gte(n,e){return Ae.get(Tt).inlayHintsProvider.register(n,e)}function DK(){return{register:Nee,getLanguages:Aee,onLanguage:Ree,onLanguageEncountered:Pee,getEncodedLanguageId:Mee,setLanguageConfiguration:Oee,setColorMap:Wee,registerTokensProviderFactory:FF,setTokensProvider:zee,setMonarchTokensProvider:Vee,registerReferenceProvider:Hee,registerRenameProvider:Uee,registerNewSymbolNameProvider:Kee,registerCompletionItemProvider:ste,registerSignatureHelpProvider:$ee,registerHoverProvider:qee,registerDocumentSymbolProvider:jee,registerDocumentHighlightProvider:Gee,registerLinkedEditingRangeProvider:Zee,registerDefinitionProvider:Yee,registerImplementationProvider:Xee,registerTypeDefinitionProvider:Qee,registerCodeLensProvider:Jee,registerCodeActionProvider:ete,registerDocumentFormattingEditProvider:tte,registerDocumentRangeFormattingEditProvider:ite,registerOnTypeFormattingEditProvider:nte,registerLinkProvider:ote,registerColorProvider:rte,registerFoldingRangeProvider:ate,registerDeclarationProvider:lte,registerSelectionRangeProvider:cte,registerDocumentSemanticTokensProvider:dte,registerDocumentRangeSemanticTokensProvider:hte,registerInlineCompletionsProvider:ute,registerInlineEditProvider:fte,registerInlayHintsProvider:gte,DocumentHighlightKind:NC,CompletionItemKind:LC,CompletionItemTag:kC,CompletionItemInsertTextRule:xC,SymbolKind:lw,SymbolTag:cw,IndentAction:BC,CompletionTriggerKind:DC,SignatureHelpTriggerKind:aw,InlayHintKind:zC,InlineCompletionTriggerKind:VC,InlineEditTriggerKind:HC,CodeActionTriggerType:SC,NewSymbolNameTag:ZC,NewSymbolNameTriggerKind:YC,PartialAcceptTriggerKind:JC,HoverVerbosityAction:FC,FoldingRangeKind:fl,SelectedSuggestionInfo:vC}}_();v();b();wt();fs();xt();js();kr();xi();sn();NK();_();v();b();function hd(n){return n&&typeof n.getEditorType=="function"?n.getEditorType()===Rc.ICodeEditor:!1}function mte(n){return n&&typeof n.getEditorType=="function"?n.getEditorType()===Rc.IDiffEditor:!1}function pte(n){return!!n&&typeof n=="object"&&typeof n.onDidChangeActiveEditor=="function"}function kLt(n){return hd(n)?n:mte(n)?n.getModifiedEditor():pte(n)&&hd(n.activeCodeEditor)?n.activeCodeEditor:null}ft();Ke();Kn();dE();Jw();_();v();b();Ke();var V1=class n{static _handleEolEdits(e,t){let i,o=[];for(let s of t)typeof s.eol=="number"&&(i=s.eol),s.range&&typeof s.text=="string"&&o.push(s);return typeof i=="number"&&e.hasModel()&&e.getModel().pushEOL(i),o}static _isFullModelReplaceEdit(e,t){if(!e.hasModel())return!1;let i=e.getModel(),o=i.validateRange(t.range);return i.getFullModelRange().equalsRange(o)}static execute(e,t,i){i&&e.pushUndoStop();let o=h_.capture(e),s=n._handleEolEdits(e,t);s.length===1&&n._isFullModelReplaceEdit(e,s[0])?e.executeEdits("formatEditsCommand",s.map(r=>Af.replace(P.lift(r.range),r.text))):e.executeEdits("formatEditsCommand",s.map(r=>Af.replaceMove(P.lift(r.range),r.text))),i&&e.pushUndoStop(),o.restoreRelativeVerticalPositionOfCursor(e)}};ir();_();v();b();var dI=class{constructor(e){this.value=e,this._lower=e.toLowerCase()}static toKey(e){return typeof e=="string"?e.toLowerCase():e._lower}},hI=class{constructor(e){if(this._set=new Set,e)for(let t of e)this.add(t)}add(e){this._set.add(dI.toKey(e))}has(e){return this._set.has(dI.toKey(e))}};qe();Ou();Aa();function AK(n,e,t){let i=[],o=new hI,s=n.ordered(t);for(let a of s)i.push(a),a.extensionId&&o.add(a.extensionId);let r=e.ordered(t);for(let a of r){if(a.extensionId){if(o.has(a.extensionId))continue;o.add(a.extensionId)}i.push({displayName:a.displayName,extensionId:a.extensionId,provideDocumentFormattingEdits(l,c,d){return a.provideDocumentRangeFormattingEdits(l,l.getFullModelRange(),c,d)}})}return i}var sg=class n{static setFormatterSelector(e){return{dispose:n._selectors.unshift(e)}}static async select(e,t,i,o){if(e.length===0)return;let s=ht.first(n._selectors);if(s)return await s(e,t,i,o)}};sg._selectors=new Ii;async function ckt(n,e,t,i,o,s,r){let a=n.get(Ye),{documentRangeFormattingEditProvider:l}=n.get(Tt),c=hd(e)?e.getModel():e,d=l.ordered(c),h=await sg.select(d,c,i,2);h&&(o.report(h),await a.invokeFunction(_te,h,e,t,s,r))}async function _te(n,e,t,i,o,s){var r,a;let l=n.get(rc),c=n.get(En),d=n.get(rl),h,u;hd(t)?(h=t.getModel(),u=new W1(t,5,void 0,o)):(h=t,u=new z1(t,o));let f=[],g=0;for(let y of QF(i).sort(P.compareRangesUsingStarts))g>0&&P.areIntersectingOrTouching(f[g-1],y)?f[g-1]=P.fromPositions(f[g-1].getStartPosition(),y.getEndPosition()):g=f.push(y);let m=async y=>{var x,k;c.trace("[format][provideDocumentRangeFormattingEdits] (request)",(x=e.extensionId)===null||x===void 0?void 0:x.value,y);let T=await e.provideDocumentRangeFormattingEdits(h,y,h.getFormattingOptions(),u.token)||[];return c.trace("[format][provideDocumentRangeFormattingEdits] (response)",(k=e.extensionId)===null||k===void 0?void 0:k.value,T),T},C=(y,x)=>{if(!y.length||!x.length)return!1;let k=y.reduce((T,N)=>P.plusRange(T,N.range),y[0].range);if(!x.some(T=>P.intersectRanges(k,T.range)))return!1;for(let T of y)for(let N of x)if(P.intersectRanges(T.range,N.range))return!0;return!1},S=[],w=[];try{if(typeof e.provideDocumentRangesFormattingEdits=="function"){c.trace("[format][provideDocumentRangeFormattingEdits] (request)",(r=e.extensionId)===null||r===void 0?void 0:r.value,f);let y=await e.provideDocumentRangesFormattingEdits(h,f,h.getFormattingOptions(),u.token)||[];c.trace("[format][provideDocumentRangeFormattingEdits] (response)",(a=e.extensionId)===null||a===void 0?void 0:a.value,y),w.push(y)}else{for(let y of f){if(u.token.isCancellationRequested)return!0;w.push(await m(y))}for(let y=0;y({text:k.text,range:P.lift(k.range),forceMoveMarkers:!0})),k=>{for(let{range:T}of k)if(P.areIntersectingOrTouching(T,x))return[new nt(T.startLineNumber,T.startColumn,T.endLineNumber,T.endColumn)];return null})}return d.playSignal(Ve.format,{userGesture:s}),!0}async function dkt(n,e,t,i,o,s){let r=n.get(Ye),a=n.get(Tt),l=hd(e)?e.getModel():e,c=AK(a.documentFormattingEditProvider,a.documentRangeFormattingEditProvider,l),d=await sg.select(c,l,t,1);d&&(i.report(d),await r.invokeFunction(bte,d,e,t,o,s))}async function bte(n,e,t,i,o,s){let r=n.get(rc),a=n.get(rl),l,c;hd(t)?(l=t.getModel(),c=new W1(t,5,void 0,o)):(l=t,c=new z1(t,o));let d;try{let h=await e.provideDocumentFormattingEdits(l,l.getFormattingOptions(),c.token);if(d=await r.computeMoreMinimalEdits(l.uri,h),c.token.isCancellationRequested)return!0}finally{c.dispose()}if(!d||d.length===0)return!1;if(hd(t))V1.execute(t,d,i!==2),i!==2&&t.revealPositionInCenterIfOutsideViewport(t.getPosition(),1);else{let[{range:h}]=d,u=new nt(h.startLineNumber,h.startColumn,h.endLineNumber,h.endColumn);l.pushEditOperations([u],d.map(f=>({text:f.text,range:P.lift(f.range),forceMoveMarkers:!0})),f=>{for(let{range:g}of f)if(P.areIntersectingOrTouching(g,u))return[new nt(g.startLineNumber,g.startColumn,g.endLineNumber,g.endColumn)];return null})}return a.playSignal(Ve.format,{userGesture:s}),!0}async function vte(n,e,t,i,o,s){let r=e.documentRangeFormattingEditProvider.ordered(t);for(let a of r){let l=await Promise.resolve(a.provideDocumentRangeFormattingEdits(t,i,o,s)).catch(oC);if(eu(l))return await n.computeMoreMinimalEdits(t.uri,l)}}async function Cte(n,e,t,i,o){let s=AK(e.documentFormattingEditProvider,e.documentRangeFormattingEditProvider,t);for(let r of s){let a=await Promise.resolve(r.provideDocumentFormattingEdits(t,i,o)).catch(oC);if(eu(a))return await n.computeMoreMinimalEdits(t.uri,a)}}function wte(n,e,t,i,o,s,r){let a=e.onTypeFormattingEditProvider.ordered(t);return a.length===0||a[0].autoFormatTriggerCharacters.indexOf(o)<0?Promise.resolve(void 0):Promise.resolve(a[0].provideOnTypeFormattingEdits(t,i,o,s,r)).catch(oC).then(l=>n.computeMoreMinimalEdits(t.uri,l))}Pi.registerCommand("_executeFormatRangeProvider",async function(n,...e){let[t,i,o]=e;Ms(Oe.isUri(t)),Ms(P.isIRange(i));let s=n.get(Wd),r=n.get(rc),a=n.get(Tt),l=await s.createModelReference(t);try{return vte(r,a,l.object.textEditorModel,P.lift(i),o,Mo.None)}finally{l.dispose()}});Pi.registerCommand("_executeFormatDocumentProvider",async function(n,...e){let[t,i]=e;Ms(Oe.isUri(t));let o=n.get(Wd),s=n.get(rc),r=n.get(Tt),a=await o.createModelReference(t);try{return Cte(s,r,a.object.textEditorModel,i,Mo.None)}finally{a.dispose()}});Pi.registerCommand("_executeFormatOnTypeProvider",async function(n,...e){let[t,i,o,s]=e;Ms(Oe.isUri(t)),Ms(U.isIPosition(i)),Ms(typeof o=="string");let r=n.get(Wd),a=n.get(rc),l=n.get(Tt),c=await r.createModelReference(t);try{return wte(a,l,c.object.textEditorModel,U.lift(i),o,s,Mo.None)}finally{c.dispose()}});Ca.wrappingIndent.defaultValue=0;Ca.glyphMargin.defaultValue=!1;Ca.autoIndent.defaultValue=3;Ca.overviewRulerLanes.defaultValue=2;sg.setFormatterSelector((n,e,t)=>Promise.resolve(n[0]));var Go=gw();Go.editor=yK();Go.languages=DK();var yte=Go.CancellationTokenSource,Ste=Go.Emitter,xte=Go.KeyCode,Lte=Go.KeyMod,kte=Go.Position,Dte=Go.Range,Ete=Go.Selection,Ite=Go.SelectionDirection,Tte=Go.MarkerSeverity,Nte=Go.MarkerTag,Ate=Go.Uri,Mte=Go.Token,Rte=Go.editor,Pte=Go.languages,WF=globalThis.MonacoEnvironment;(WF?.globalAPI||typeof define=="function"&&define.amd)&&(globalThis.monaco=Go);typeof globalThis.require<"u"&&typeof globalThis.require.config=="function"&&globalThis.require.config({ignoreDuplicateModules:["vscode-languageserver-types","vscode-languageserver-types/main","vscode-languageserver-textdocument","vscode-languageserver-textdocument/main","vscode-nls","vscode-nls/vscode-nls","jsonc-parser","jsonc-parser/main","vscode-uri","vscode-uri/index","vs/basic-languages/typescript/typescript"]});export{Ht as a,ZF as b,$F as c,Bte as d,$1 as e,XF as f,eu as g,xr as h,QF as i,Io as j,ma as k,i9 as l,qF as m,wt as n,tn as o,dn as p,pa as q,ds as r,bc as s,Ms as t,G1 as u,cg as v,xi as w,cl as x,WK as y,hs as z,p as A,Zte as B,Ge as C,Li as D,Be as E,mi as F,md as G,hl as H,Rs as I,eie as J,po as K,p9 as L,Lt as M,ht as N,js as O,Ii as P,kr as Q,Zs as R,Cc as S,ba as T,tu as U,Ao as V,Ca as W,ut as X,oC as Y,yd as Z,Dr as _,Sd as $,St as aa,xt as ba,wa as ca,bg as da,aC as ea,li as fa,_o as ga,be as ha,ae as ia,H as ja,no as ka,k9 as la,le as ma,Er as na,vg as oa,ie as pa,B as qa,ul as ra,ye as sa,Mo as ta,un as ua,tne as va,fs as wa,N9 as xa,z_ as ya,O9 as za,xg as Aa,ya as Ba,wc as Ca,Oe as Da,sn as Ea,U as Fa,ft as Ga,P as Ha,Ke as Ia,nt as Ja,Kn as Ka,ue as La,$n as Ma,q9 as Na,j9 as Oa,G9 as Pa,vC as Qa,Z9 as Ra,Y9 as Sa,X9 as Ta,doe as Ua,hoe as Va,CC as Wa,fl as Xa,Q9 as Ya,J9 as Za,e7 as _a,t7 as $a,Bt as ab,i7 as bb,Yo as cb,gt as db,vo as eb,qn as fb,Md as gb,r7 as hb,du as ib,gs as jb,Koe as kb,$oe as lb,Tr as mb,qoe as nb,Ri as ob,jn as pb,Os as qb,G_ as rb,DT as sb,au as tb,ml as ub,Y_ as vb,X_ as wb,pi as xb,Rd as yb,Lc as zb,Ig as Ab,joe as Bb,Goe as Cb,cu as Db,ot as Eb,wn as Fb,ps as Gb,pl as Hb,Mg as Ib,bt as Jb,oo as Kb,yn as Lb,Qs as Mb,PT as Nb,zse as Ob,ka as Pb,kc as Qb,s0 as Rb,Vse as Sb,Xo as Tb,di as Ub,Og as Vb,o0 as Wb,Hse as Xb,Gt as Yb,Ze as Zb,er as _b,zw as $b,Bg as ac,ge as bc,Co as cc,$ as dc,Ut as ec,kre as fc,m0 as gc,N7 as hc,JT as ic,eN as jc,zg as kc,Ar as lc,F7 as mc,Dre as nc,Sn as oc,Vg as pc,p0 as qc,yi as rc,Ec as sc,Bi as tc,_0 as uc,jw as vc,Ere as wc,Gw as xc,Iq as yc,se as zc,He as Ac,Ic as Bc,me as Cc,Wi as Dc,ve as Ec,Ire as Fc,b0 as Gc,Zw as Hc,uu as Ic,kt as Jc,ke as Kc,Kg as Lc,Si as Mc,Rr as Nc,Ye as Oc,De as Pc,qe as Qc,Zt as Rc,Or as Sc,xn as Tc,_u as Uc,Wd as Vc,Jw as Wc,Ro as Xc,zi as Yc,bl as Zc,zd as _c,Po as $c,Xe as ad,Ln as bd,kn as cd,Pi as dd,ir as ed,Dt as fd,S0 as gd,xe as hd,rt as id,Oi as jd,$g as kd,Na as ld,Vt as md,Oo as nd,Cl as od,k0 as pd,jg as qd,A as rd,Wr as sd,Fs as td,wl as ud,Br as vd,gy as wd,ece as xd,zr as yd,nr as zd,Gg as Ad,En as Bd,Aa as Cd,D0 as Dd,yl as Ed,pN as Fd,l3 as Gd,c3 as Hd,Oce as Id,Je as Jd,Fce as Kd,Bce as Ld,Wce as Md,vy as Nd,Ud as Od,Bs as Pd,Vi as Qd,yu as Rd,Sy as Sd,A0 as Td,Sl as Ud,xu as Vd,Rt as Wd,Fo as Xd,ii as Yd,Hr as Zd,_t as _d,Ur as $d,rr as ae,M0 as be,ar as ce,Du as de,In as ee,Ma as fe,yo as ge,lr as he,Eu as ie,W3 as je,Gy as ke,Gn as le,Kr as me,Jg as ne,cr as oe,xl as pe,W0 as qe,em as re,dr as se,Nu as te,$3 as ue,hr as ve,Ac as we,eS as xe,tS as ye,Mu as ze,oS as Ae,aA as Be,$fe as Ce,Dl as De,ws as Ee,om as Fe,rS as Ge,aS as He,vt as Ie,dm as Je,Z as Ke,gn as Le,fS as Me,Tt as Ne,Ou as Oe,Z0 as Pe,eh as Qe,_S as Re,hm as Se,Y0 as Te,mn as Ue,um as Ve,Hi as We,Pc as Xe,$r as Ye,qr as Ze,eb as _e,ob as $e,Uu as af,LS as bf,wm as cf,ao as df,P8 as ef,Rl as ff,he as gf,F as hf,Ee as if,HA as jf,at as kf,ih as lf,Ct as mf,ni as nf,Nn as of,Zu as pf,Fi as qf,Sm as rf,Wa as sf,$ve as tf,An as uf,Tm as vf,Vo as wf,Nm as xf,Gve as yf,xm as zf,$A as Af,za as Bf,sh as Cf,Jve as Df,$8 as Ef,Q8 as Ff,nh as Gf,oh as Hf,n1e as If,o1e as Jf,s1e as Kf,r1e as Lf,Va as Mf,nB as Nf,M1e as Of,R1e as Pf,ab as Qf,U1e as Rf,_B as Sf,bB as Tf,vB as Uf,CB as Vf,wB as Wf,yB as Xf,RS as Yf,ICe as Zf,lb as _f,FS as $f,cb as ag,is as bg,tM as cg,Ol as dg,Qu as eg,ch as fg,x6 as gg,oi as hg,Ka as ig,It as jg,ui as kg,co as lg,ix as mg,uh as ng,et as og,T6 as pg,Hm as qg,I6 as rg,an as sg,nf as tg,Lo as ug,Qi as vg,GLe as wg,$a as xg,fi as yg,yx as zg,xM as Ag,mt as Bg,ho as Cg,uW as Dg,Sx as Eg,Ti as Fg,uo as Gg,fW as Hg,On as Ig,bb as Jg,mh as Kg,HEe as Lg,UEe as Mg,ta as Ng,_e as Og,wb as Pg,vW as Qg,CW as Rg,wW as Sg,na as Tg,tp as Ug,Fn as Vg,vi as Wg,$c as Xg,kL as Yg,op as Zg,IL as _g,rR as $g,NL as ah,RW as bh,uR as ch,WW as dh,fFe as eh,yR as fh,qc as gh,gi as hh,XW as ih,LFe as jh,qb as kh,kFe as lh,QW as mh,DFe as nh,EFe as oh,$b as ph,bf as qh,up as rh,ZL as sh,Zc as th,ek as uh,qi as vh,sv as wh,IZ as xh,TZ as yh,NZ as zh,Ci as Ah,Oz as Bh,Ko as Ch,Df as Dh,Kk as Eh,Bn as Fh,Cp as Gh,Yk as Hh,I4 as Ih,GZ as Jh,Kz as Kh,Rze as Lh,$z as Mh,V4 as Nh,Lh as Oh,xh as Ph,Qc as Qh,Ds as Rh,aD as Sh,lD as Th,oV as Uh,U4 as Vh,K4 as Wh,Jl as Xh,ra as Yh,wp as Zh,Ef as _h,mV as $h,vv as ai,_Y as bi,bY as ci,DHe as di,EHe as ei,LY as fi,Tf as gi,fD as hi,yp as ii,IHe as ji,mD as ki,pD as li,xp as mi,Cv as ni,FY as oi,ic as pi,Lp as qi,yv as ri,c5 as si,kp as ti,xv as ui,p5 as vi,WV as wi,Ip as xi,hX as yi,Af as zi,GV as Ai,ZV as Bi,y5 as Ci,Ap as Di,Av as Ei,YV as Fi,bX as Gi,_je as Hi,bje as Ii,yX as Ji,Cje as Ki,XV as Li,QV as Mi,JV as Ni,eH as Oi,tH as Pi,iH as Qi,E5 as Ri,nH as Si,OD as Ti,ji as Ui,Mf as Vi,Qn as Wi,uZe as Xi,fZe as Yi,gZe as Zi,R5 as _i,ri as $i,TZe as aj,Pf as bj,ct as cj,NZe as dj,F5 as ej,zp as fj,We as gj,Vp as hj,$X as ij,pt as jj,Uv as kj,Mh as lj,Jn as mj,Rh as nj,$t as oj,fo as pj,Kv as qj,Ph as rj,rYe as sj,xH as tj,V5 as uj,bn as vj,Do as wj,Fh as xj,SQe as yj,Vf as zj,MH as Aj,tP as Bj,iP as Cj,BH as Dj,Hf as Ej,Uf as Fj,HH as Gj,Zv as Hj,KH as Ij,Eo as Jj,rc as Kj,dE as Lj,Es as Mj,qH as Nj,tl as Oj,_P as Pj,la as Qj,gE as Rj,nd as Sj,eU as Tj,$f as Uj,iU as Vj,vE as Wj,CE as Xj,wE as Yj,yE as Zj,LE as _j,s1 as $j,oat as ak,sat as bk,hat as ck,ol as dk,Bat as ek,OQ as fk,BQ as gk,gU as hk,Uh as ik,f1 as jk,Tlt as kk,QE as lk,Jf as mk,_1 as nk,fc as ok,iut as pk,Kh as qk,S1 as rk,a_ as sk,l_ as tk,ls as uk,x1 as vk,d_ as wk,rl as xk,Ve as yk,Xgt as zk,h_ as Ak,ZU as Bk,ca as Ck,xF as Dk,P1 as Ek,fK as Fk,v_ as Gk,TK as Hk,W1 as Ik,z1 as Jk,NK as Kk,hd as Lk,mte as Mk,kLt as Nk,V1 as Ok,ckt as Pk,dkt as Qk,wte as Rk,yte as Sk,Ste as Tk,xte as Uk,Lte as Vk,kte as Wk,Dte as Xk,Ete as Yk,Ite as Zk,Tte as _k,Nte as $k,Ate as al,Mte as bl,Rte as cl,Pte as dl,Ote as el}; +/*! Bundled license information: + +monaco-editor/esm/vs/base/browser/dompurify/dompurify.js: + (*! @license DOMPurify 3.0.5 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.0.5/LICENSE *) +*/ +//# sourceMappingURL=/static/chunk-PGUQKT6S.js.map \ No newline at end of file diff --git a/rust/cymbal/tests/static/chunk-PGUQKT6S.js.map b/rust/cymbal/tests/static/chunk-PGUQKT6S.js.map new file mode 100644 index 0000000000000..5f032535950d9 --- /dev/null +++ b/rust/cymbal/tests/static/chunk-PGUQKT6S.js.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/arrays.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/types.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/objects.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/nls.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/platform.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/core/textModelDefaults.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/iterator.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/linkedList.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/core/wordHelper.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/errors.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/functional.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/lifecycle.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/stopwatch.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/event.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/cancellation.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/keyCodes.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/process.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/path.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/uri.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/core/position.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/core/range.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/core/selection.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/codiconsUtil.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/codiconsLibrary.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/codicons.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/tokenizationRegistry.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/languages.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/window.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/cache.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/lazy.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/strings.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/browser.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/canIUse.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/keybindings.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/keyboardEvent.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/iframe.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/mouseEvent.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/symbols.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/async.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/dompurify/dompurify.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/network.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/hash.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/dom.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/instantiation/common/instantiation.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/services/codeEditorService.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/services/model.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/services/resolverService.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/actions.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/themables.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/commands/common/commands.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/contextkey/common/scanner.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/contextkey/common/contextkey.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/assert.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/registry/common/platform.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/keybinding/common/keybindingsRegistry.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/actions/common/actions.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/telemetry/common/telemetry.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/log/common/log.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/editorExtensions.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/languages/languageConfiguration.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/languages/supports.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/languages/supports/characterPair.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/buffer.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/core/stringBuilder.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/languages/supports/richEditBrackets.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/languages/supports/electricCharacter.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/languages/supports/indentRules.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/languages/supports/onEnter.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/configuration/common/configuration.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/languages/language.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/instantiation/common/descriptors.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/instantiation/common/extensions.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/mime.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/jsonschemas/common/jsonContributionRegistry.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/configuration/common/configurationRegistry.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/languages/modesRegistry.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/languages/supports/languageBracketsConfiguration.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/languages/languageConfigurationRegistry.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/uint.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/core/characterClassifier.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/map.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/core/wordCharacterClassifier.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/model.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/model/textModelSearch.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/core/offsetRange.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/arraysFind.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/core/lineRange.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/core/textLength.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/color.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/services/languageFeatures.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/languages/nullTokenize.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/encodedTokenAttributes.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/tokens/lineTokens.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/config/elementSizeObserver.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/theme/common/colorUtils.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/theme/common/colors/baseColors.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/theme/common/colors/miscColors.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/theme/common/colors/editorColors.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/theme/common/colors/minimapColors.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/theme/common/colors/chartsColors.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/theme/common/colors/inputColors.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/theme/common/colors/listColors.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/theme/common/colors/menuColors.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/theme/common/colors/quickpickColors.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/theme/common/colors/searchColors.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/theme/common/colorRegistry.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/theme/common/theme.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/core/cursorColumns.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/theme/common/themeService.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/core/editorColorRegistry.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/core/indentation.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/editorContextKeys.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/model/textModelPart.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/model/utils.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/textModelGuides.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/model/guidesTextModelPart.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/textModelEvents.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/core/eolCounter.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/textModelBracketPairs.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/length.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/beforeEditPositionMapper.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/smallImmutableSet.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/ast.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/tokenizer.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/brackets.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/concat23Trees.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/nodeReader.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/parser.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/combineTextEditInfos.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/bracketPairsTree.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsImpl.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/model/bracketPairsTextModelPart/colorizedBracketPairsDecorationProvider.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/core/textChange.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/extpath.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/resources.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/model/editStack.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/model/indentationGuesser.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/model/intervalTree.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/model/pieceTreeTextBuffer/rbTreeBase.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/model/pieceTreeTextBuffer/pieceTreeBase.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/model/pieceTreeTextBuffer/pieceTreeTextBuffer.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/model/pieceTreeTextBuffer/pieceTreeTextBufferBuilder.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/model/fixedArray.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/tokens/contiguousMultilineTokens.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/tokens/contiguousMultilineTokensBuilder.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/model/textModelTokens.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/tokens/contiguousTokensEditing.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/tokens/contiguousTokensStore.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/tokens/sparseTokensStore.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/model/tokenizationTextModelPart.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/undoRedo/common/undoRedo.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/model/textModel.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/numbers.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/environment/common/environment.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/services/languageFeatureDebounce.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/ui/iconLabel/iconLabels.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/naturalLanguage/korean.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/filters.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/iconLabels.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/htmlContent.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/standaloneStrings.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/equals.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/observableInternal/debugName.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/observableInternal/logging.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/observableInternal/base.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/observableInternal/derived.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/observableInternal/autorun.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/observableInternal/utils.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/observableInternal/promise.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/observable.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/services/editorWorker.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/standalone/common/standaloneTheme.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/hotReload.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/utils.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/features/hideUnchangedRegionsFeature.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/contrib/editorState/browser/keybindingCancellation.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/contrib/editorState/browser/editorState.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/editor.api.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/config/editorOptions.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/services/editorBaseApi.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/standalone/standaloneEnums.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/standalone/browser/standaloneEditor.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/config/fontMeasurements.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/pixelRatio.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/config/charWidthReader.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/config/domFontInfo.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/fastDomNode.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/config/fontInfo.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/config/editorZoom.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/services/webWorker.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/services/editorWorkerService.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/worker/simpleWorker.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/defaultWorkerFactory.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/trustedTypes.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/services/editorSimpleWorker.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/diff/diff.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/diff/diffChange.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/model/mirrorTextModel.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/model/prefixSumComputer.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/languages/linkComputer.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/languages/supports/inplaceReplaceSupport.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/services/unicodeTextModelHighlighter.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/diff/linesDiffComputers.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/diff/legacyLinesDiffComputer.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/diff/linesDiffComputer.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/diff/rangeMapping.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/core/textEdit.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/core/positionToOffset.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/diff/defaultLinesDiffComputer/defaultLinesDiffComputer.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/diff/defaultLinesDiffComputer/algorithms/diffAlgorithm.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/diff/defaultLinesDiffComputer/algorithms/dynamicProgrammingDiffing.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/diff/defaultLinesDiffComputer/utils.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/diff/defaultLinesDiffComputer/algorithms/myersDiffAlgorithm.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/diff/defaultLinesDiffComputer/computeMovedLines.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/diff/defaultLinesDiffComputer/linesSliceCharSequence.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/diff/defaultLinesDiffComputer/heuristicSequenceOptimizations.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/diff/defaultLinesDiffComputer/lineSequence.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/languages/defaultDocumentColorsComputer.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/services/findSectionHeaders.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/services/textResourceConfiguration.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/editorCommon.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/standalone/browser/colorizer.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/viewLayout/viewLineRenderer.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/viewLayout/lineDecorations.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/viewLayout/linePart.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/viewModel.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/standalone/common/monarch/monarchLexer.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/standalone/common/monarch/monarchCommon.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/standalone/browser/standaloneCodeEditor.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/ui/aria/aria.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/widget/codeEditor/codeEditorWidget.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/services/markerDecorations.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/services/markerDecorations.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/config/editorConfiguration.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/config/migrateOptions.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/config/tabFocus.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/accessibility/common/accessibility.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/view.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/performance.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/controller/mouseTarget.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/editorDom.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/globalPointerMoveMonitor.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/view/viewPart.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/viewEventHandler.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/viewParts/lines/viewLine.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/viewParts/lines/rangeUtil.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/view/renderingContext.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/cursor/cursorAtomicMoveOperations.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/controller/pointerHandler.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/touch.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/decorators.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/controller/mouseHandler.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/scrollableElement.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/horizontalScrollbar.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/abstractScrollbar.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/scrollbarArrow.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/ui/widget.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/scrollbarVisibilityController.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/scrollbarState.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/verticalScrollbar.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/scrollable.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/controller/textAreaInput.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/event.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/controller/textAreaState.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/controller/textAreaHandler.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/viewParts/lineNumbers/lineNumbers.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/view/dynamicViewOverlay.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/viewParts/margin/margin.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/ui/mouseCursor/mouseCursor.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/ime.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/keybinding/common/keybinding.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/view/viewController.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/coreCommands.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/cursor/cursorColumnSelection.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/cursorCommon.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/cursor/cursorDeleteOperations.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/commands/replaceCommand.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/cursor/cursorMoveOperations.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/cursor/cursorMoveCommands.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/cursor/cursorWordOperations.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/cursor/cursorTypeOperations.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/commands/shiftCommand.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/languages/enterAction.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/commands/surroundSelectionCommand.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/languages/autoIndent.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/view/viewOverlays.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/view/viewLayer.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/view/viewUserInputEvents.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/viewParts/blockDecorations/blockDecorations.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/viewParts/contentWidgets/contentWidgets.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/viewParts/currentLineHighlight/currentLineHighlight.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/viewParts/decorations/decorations.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/viewParts/editorScrollbar/editorScrollbar.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/viewParts/glyphMargin/glyphMargin.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/viewParts/indentGuides/indentGuides.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/viewParts/lines/viewLines.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/viewParts/lines/domReadingContext.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/viewParts/linesDecorations/linesDecorations.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/viewParts/marginDecorations/marginDecorations.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/viewParts/minimap/minimap.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/core/rgba.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/viewModel/minimapTokensColorTracker.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/viewParts/minimap/minimapCharRendererFactory.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/viewParts/minimap/minimapCharRenderer.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/viewParts/minimap/minimapCharSheet.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/viewParts/minimap/minimapPreBaked.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/fonts.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/viewParts/overlayWidgets/overlayWidgets.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/viewParts/overviewRuler/decorationsOverviewRuler.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/viewParts/overviewRuler/overviewRuler.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/viewModel/overviewZoneManager.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/viewParts/rulers/rulers.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/viewParts/scrollDecoration/scrollDecoration.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/viewParts/selections/selections.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/viewParts/viewCursors/viewCursors.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/viewParts/viewCursors/viewCursor.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/viewParts/viewZones/viewZones.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/viewParts/whitespace/whitespace.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/viewLayout/viewLinesViewportData.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/viewModel/viewContext.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/editorTheme.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/view/domLineBreaksComputer.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/modelLineProjectionData.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/widget/codeEditor/codeEditorContributions.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/editorAction.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/viewModel/monospaceLineBreaksComputer.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/viewModel/viewModelImpl.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/cursor/cursor.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/cursor/cursorCollection.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/cursor/oneCursor.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/cursor/cursorContext.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/viewEvents.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/viewModelEventDispatcher.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/languages/textToHtmlTokenizer.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/viewLayout/viewLayout.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/viewLayout/linesLayout.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/viewModel/viewModelDecorations.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/viewModel/viewModelLines.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/viewModel/modelLineProjection.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/viewModel/glyphLanesModel.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/instantiation/common/serviceCollection.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/notification/common/notification.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/severity.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/standalone/browser/standaloneServices.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/standalone/browser/standaloneCodeEditorService.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/services/abstractCodeEditorService.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/standalone/browser/standaloneLayoutService.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/layout/browser/layoutService.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/undoRedo/common/undoRedoService.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/dialogs/common/dialogs.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/services/semanticTokensStylingService.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/services/semanticTokensProviderStyling.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/tokens/sparseMultilineTokens.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/services/semanticTokensStyling.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/services/languageFeaturesService.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/languageFeatureRegistry.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/languageSelector.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/glob.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/services/hoverService/hoverService.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/hover/browser/hover.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/contextview/browser/contextView.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/services/hoverService/hoverWidget.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/ui/hover/hoverWidget.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/opener/common/opener.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/widget/markdownRenderer/browser/markdownRenderer.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/markdownRenderer.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/formattedTextRenderer.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/idGenerator.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/marked/marked.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/marshalling.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/contextview/browser/contextViewService.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/ui/contextview/contextview.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/range.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/services/hoverService/updatableHoverWidget.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/services/bulkEditService.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/config/editorConfigurationSchema.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/config/diffEditor.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/core/editOperation.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/configuration/common/configurationModels.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/keybinding/common/abstractKeybindingService.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/keybinding/common/keybindingResolver.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/keybinding/common/resolvedKeybindingItem.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/keybinding/common/usLayoutResolvedKeybinding.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/keybinding/common/baseResolvedKeybinding.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/keybindingLabels.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/label/common/label.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/progress/common/progress.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/workspace/common/workspace.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/ternarySearchTree.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/workspace/common/workspaceTrust.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/services/languageService.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/services/languagesRegistry.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/services/languagesAssociations.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/contextview/browser/contextMenuService.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/actions/browser/menuEntryActionViewItem.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/ui/actionbar/actionViewItems.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/dnd.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/ui/hover/hoverDelegateFactory.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/ui/selectBox/selectBox.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/ui/selectBox/selectBoxCustom.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/ui/hover/hoverDelegate2.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/ui/list/listWidget.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/ui/list/splice.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/ui/list/list.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/ui/list/listView.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/ui/list/rangeMap.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/ui/list/rowCache.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/ui/selectBox/selectBoxNative.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/ui/dropdown/dropdownActionViewItem.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/ui/dropdown/dropdown.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/action/common/action.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/storage/common/storage.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/parts/storage/common/storage.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/theme/browser/defaultStyles.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/contextview/browser/contextMenuHandler.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/ui/menu/menu.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/ui/actionbar/actionbar.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/services/openerService.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/editor/common/editor.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/services/markerDecorationsService.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/markers/common/markers.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/collections.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/services/modelService.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/standalone/browser/quickInput/standaloneQuickInputService.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/quickinput/browser/quickInputService.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/quickinput/browser/quickAccess.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/quickinput/common/quickAccess.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/quickinput/common/quickInput.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/quickinput/browser/quickInput.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/ui/toggle/toggle.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/quickinput/browser/quickInputUtils.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/linkedText.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/quickinput/browser/quickInputTree.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/list/browser/listService.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/ui/list/listPaging.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/ui/table/tableWidget.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/ui/splitview/splitview.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/ui/sash/sash.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/ui/tree/abstractTree.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/ui/findinput/findInput.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/ui/findinput/findInputToggles.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/ui/inputbox/inputBox.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/history.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/navigator.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/ui/tree/indexTreeModel.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/ui/tree/tree.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/ui/tree/asyncDataTree.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/ui/tree/objectTree.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/ui/tree/compressedObjectTreeModel.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/ui/tree/objectTreeModel.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/ui/tree/dataTree.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/contextkey/common/contextkeys.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/ui/iconLabel/iconLabel.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/ui/highlightedlabel/highlightedLabel.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/ui/keybindingLabel/keybindingLabel.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/common/comparers.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/quickinput/browser/quickInputController.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/ui/button/button.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/ui/countBadge/countBadge.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/ui/progressbar/progressbar.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/quickinput/browser/quickInputBox.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/standalone/browser/standaloneThemeService.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/languages/supports/tokenization.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/standalone/common/themes.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/theme/browser/iconsStyleSheet.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/theme/common/iconRegistry.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/accessibility/browser/accessibilityService.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/actions/common/menuService.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/clipboard/browser/clipboardService.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/clipboard/common/clipboardService.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/contextkey/browser/contextKeyService.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/instantiation/common/instantiationService.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/instantiation/common/graph.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/markers/common/markerService.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/configuration/common/configurations.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/accessibilitySignal/browser/accessibilitySignalService.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/log/common/logService.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/editorFeatures.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/diffEditorWidget.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/stableEditorScroll.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/components/accessibleDiffViewer.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/components/diffEditorDecorations.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/features/movedBlocksLinesFeature.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/registrations.contribution.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/components/diffEditorSash.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/components/diffEditorViewZones/diffEditorViewZones.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/diffEditorViewModel.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/diffProviderFactoryService.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/components/diffEditorViewZones/inlineDiffDeletedCodeMargin.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/components/diffEditorViewZones/renderLines.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/features/gutterFeature.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/utils/editorGutter.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/widget/multiDiffEditor/utils.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/common/model/textModelText.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/actions/browser/toolbar.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/base/browser/ui/toolbar/toolbar.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/features/overviewRulerFeature.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/features/revertButtonsFeature.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/components/diffEditorEditors.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/observableUtilities.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/delegatingEditorImpl.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/diffEditorOptions.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/widget/multiDiffEditor/multiDiffEditorWidget.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/widget/multiDiffEditor/multiDiffEditorWidgetImpl.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/widget/multiDiffEditor/diffEditorItemTemplate.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/widget/multiDiffEditor/objectPool.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/widget/multiDiffEditor/colors.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/standalone/browser/standaloneLanguages.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/standalone/common/monarch/monarchCompile.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/contrib/format/browser/format.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/browser/editorBrowser.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/editor/contrib/format/browser/formattingEdit.js", "../../node_modules/.pnpm/monaco-editor@0.49.0/node_modules/monaco-editor/esm/vs/platform/extensions/common/extensions.js"], + "sourcesContent": ["/**\n * Returns the last element of an array.\n * @param array The array.\n * @param n Which element from the end (default is zero).\n */\nexport function tail(array, n = 0) {\n return array[array.length - (1 + n)];\n}\nexport function tail2(arr) {\n if (arr.length === 0) {\n throw new Error('Invalid tail call');\n }\n return [arr.slice(0, arr.length - 1), arr[arr.length - 1]];\n}\nexport function equals(one, other, itemEquals = (a, b) => a === b) {\n if (one === other) {\n return true;\n }\n if (!one || !other) {\n return false;\n }\n if (one.length !== other.length) {\n return false;\n }\n for (let i = 0, len = one.length; i < len; i++) {\n if (!itemEquals(one[i], other[i])) {\n return false;\n }\n }\n return true;\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(array, index) {\n const last = array.length - 1;\n if (index < last) {\n array[index] = array[last];\n }\n array.pop();\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(array, key, comparator) {\n return binarySearch2(array.length, i => comparator(array[i], key));\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, compareToKey) {\n let low = 0, high = length - 1;\n while (low <= high) {\n const mid = ((low + high) / 2) | 0;\n const comp = compareToKey(mid);\n if (comp < 0) {\n low = mid + 1;\n }\n else if (comp > 0) {\n high = mid - 1;\n }\n else {\n return mid;\n }\n }\n return -(low + 1);\n}\nexport function quickSelect(nth, data, compare) {\n nth = nth | 0;\n if (nth >= data.length) {\n throw new TypeError('invalid index');\n }\n const pivotValue = data[Math.floor(data.length * Math.random())];\n const lower = [];\n const higher = [];\n const pivots = [];\n for (const value of data) {\n const val = compare(value, pivotValue);\n if (val < 0) {\n lower.push(value);\n }\n else if (val > 0) {\n higher.push(value);\n }\n else {\n pivots.push(value);\n }\n }\n if (nth < lower.length) {\n return quickSelect(nth, lower, compare);\n }\n else if (nth < lower.length + pivots.length) {\n return pivots[0];\n }\n else {\n return quickSelect(nth - (lower.length + pivots.length), higher, compare);\n }\n}\nexport function groupBy(data, compare) {\n const result = [];\n let currentGroup = undefined;\n for (const element of data.slice(0).sort(compare)) {\n if (!currentGroup || compare(currentGroup[0], element) !== 0) {\n currentGroup = [element];\n result.push(currentGroup);\n }\n else {\n currentGroup.push(element);\n }\n }\n return result;\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(items, shouldBeGrouped) {\n let currentGroup;\n let last;\n for (const item of items) {\n if (last !== undefined && shouldBeGrouped(last, item)) {\n currentGroup.push(item);\n }\n else {\n if (currentGroup) {\n yield currentGroup;\n }\n currentGroup = [item];\n }\n last = item;\n }\n if (currentGroup) {\n yield currentGroup;\n }\n}\nexport function forEachAdjacent(arr, f) {\n for (let i = 0; i <= arr.length; i++) {\n f(i === 0 ? undefined : arr[i - 1], i === arr.length ? undefined : arr[i]);\n }\n}\nexport function forEachWithNeighbors(arr, f) {\n for (let i = 0; i < arr.length; i++) {\n f(i === 0 ? undefined : arr[i - 1], arr[i], i + 1 === arr.length ? undefined : arr[i + 1]);\n }\n}\n/**\n * @returns New array with all falsy values removed. The original array IS NOT modified.\n */\nexport function coalesce(array) {\n return array.filter(e => !!e);\n}\n/**\n * Remove all falsy values from `array`. The original array IS modified.\n */\nexport function coalesceInPlace(array) {\n let to = 0;\n for (let i = 0; i < array.length; i++) {\n if (!!array[i]) {\n array[to] = array[i];\n to += 1;\n }\n }\n array.length = to;\n}\n/**\n * @returns false if the provided object is an array and not empty.\n */\nexport function isFalsyOrEmpty(obj) {\n return !Array.isArray(obj) || obj.length === 0;\n}\nexport function isNonEmptyArray(obj) {\n return Array.isArray(obj) && obj.length > 0;\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(array, keyFn = value => value) {\n const seen = new Set();\n return array.filter(element => {\n const key = keyFn(element);\n if (seen.has(key)) {\n return false;\n }\n seen.add(key);\n return true;\n });\n}\nexport function firstOrDefault(array, notFoundValue) {\n return array.length > 0 ? array[0] : notFoundValue;\n}\nexport function range(arg, to) {\n let from = typeof to === 'number' ? arg : 0;\n if (typeof to === 'number') {\n from = arg;\n }\n else {\n from = 0;\n to = arg;\n }\n const result = [];\n if (from <= to) {\n for (let i = from; i < to; i++) {\n result.push(i);\n }\n }\n else {\n for (let i = from; i > to; i--) {\n result.push(i);\n }\n }\n return result;\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(target, insertIndex, insertArr) {\n const before = target.slice(0, insertIndex);\n const after = target.slice(insertIndex);\n return before.concat(insertArr, after);\n}\n/**\n * Pushes an element to the start of the array, if found.\n */\nexport function pushToStart(arr, value) {\n const index = arr.indexOf(value);\n if (index > -1) {\n arr.splice(index, 1);\n arr.unshift(value);\n }\n}\n/**\n * Pushes an element to the end of the array, if found.\n */\nexport function pushToEnd(arr, value) {\n const index = arr.indexOf(value);\n if (index > -1) {\n arr.splice(index, 1);\n arr.push(value);\n }\n}\nexport function pushMany(arr, items) {\n for (const item of items) {\n arr.push(item);\n }\n}\nexport function asArray(x) {\n return Array.isArray(x) ? x : [x];\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(array, start, newItems) {\n const startIdx = getActualStartIndex(array, start);\n const originalLength = array.length;\n const newItemsLength = newItems.length;\n array.length = originalLength + newItemsLength;\n // Move the items after the start index, start from the end so that we don't overwrite any value.\n for (let i = originalLength - 1; i >= startIdx; i--) {\n array[i + newItemsLength] = array[i];\n }\n for (let i = 0; i < newItemsLength; i++) {\n array[i + startIdx] = newItems[i];\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(array, start, deleteCount, newItems) {\n const index = getActualStartIndex(array, start);\n let result = array.splice(index, deleteCount);\n if (result === undefined) {\n // see https://bugs.webkit.org/show_bug.cgi?id=261140\n result = [];\n }\n insertInto(array, index, newItems);\n return result;\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(array, start) {\n return start < 0 ? Math.max(start + array.length, 0) : Math.min(start, array.length);\n}\nexport var CompareResult;\n(function (CompareResult) {\n function isLessThan(result) {\n return result < 0;\n }\n CompareResult.isLessThan = isLessThan;\n function isLessThanOrEqual(result) {\n return result <= 0;\n }\n CompareResult.isLessThanOrEqual = isLessThanOrEqual;\n function isGreaterThan(result) {\n return result > 0;\n }\n CompareResult.isGreaterThan = isGreaterThan;\n function isNeitherLessOrGreaterThan(result) {\n return result === 0;\n }\n CompareResult.isNeitherLessOrGreaterThan = isNeitherLessOrGreaterThan;\n CompareResult.greaterThan = 1;\n CompareResult.lessThan = -1;\n CompareResult.neitherLessOrGreaterThan = 0;\n})(CompareResult || (CompareResult = {}));\nexport function compareBy(selector, comparator) {\n return (a, b) => comparator(selector(a), selector(b));\n}\nexport function tieBreakComparators(...comparators) {\n return (item1, item2) => {\n for (const comparator of comparators) {\n const result = comparator(item1, item2);\n if (!CompareResult.isNeitherLessOrGreaterThan(result)) {\n return result;\n }\n }\n return CompareResult.neitherLessOrGreaterThan;\n };\n}\n/**\n * The natural order on numbers.\n*/\nexport const numberComparator = (a, b) => a - b;\nexport const booleanComparator = (a, b) => numberComparator(a ? 1 : 0, b ? 1 : 0);\nexport function reverseOrder(comparator) {\n return (a, b) => -comparator(a, b);\n}\nexport class ArrayQueue {\n /**\n * Constructs a queue that is backed by the given array. Runtime is O(1).\n */\n constructor(items) {\n this.items = items;\n this.firstIdx = 0;\n this.lastIdx = this.items.length - 1;\n }\n get length() {\n return this.lastIdx - this.firstIdx + 1;\n }\n /**\n * Consumes elements from the beginning of the queue as long as the predicate returns true.\n * If no elements were consumed, `null` is returned. Has a runtime of O(result.length).\n */\n takeWhile(predicate) {\n // P(k) := k <= this.lastIdx && predicate(this.items[k])\n // Find s := min { k | k >= this.firstIdx && !P(k) } and return this.data[this.firstIdx...s)\n let startIdx = this.firstIdx;\n while (startIdx < this.items.length && predicate(this.items[startIdx])) {\n startIdx++;\n }\n const result = startIdx === this.firstIdx ? null : this.items.slice(this.firstIdx, startIdx);\n this.firstIdx = startIdx;\n return result;\n }\n /**\n * Consumes elements from the end of the queue as long as the predicate returns true.\n * If no elements were consumed, `null` is returned.\n * The result has the same order as the underlying array!\n */\n takeFromEndWhile(predicate) {\n // P(k) := this.firstIdx >= k && predicate(this.items[k])\n // Find s := max { k | k <= this.lastIdx && !P(k) } and return this.data(s...this.lastIdx]\n let endIdx = this.lastIdx;\n while (endIdx >= 0 && predicate(this.items[endIdx])) {\n endIdx--;\n }\n const result = endIdx === this.lastIdx ? null : this.items.slice(endIdx + 1, this.lastIdx + 1);\n this.lastIdx = endIdx;\n return result;\n }\n peek() {\n if (this.length === 0) {\n return undefined;\n }\n return this.items[this.firstIdx];\n }\n dequeue() {\n const result = this.items[this.firstIdx];\n this.firstIdx++;\n return result;\n }\n takeCount(count) {\n const result = this.items.slice(this.firstIdx, this.firstIdx + count);\n this.firstIdx += count;\n return result;\n }\n}\n/**\n * This class is faster than an iterator and array for lazy computed data.\n*/\nexport class CallbackIterable {\n constructor(\n /**\n * Calls the callback for every item.\n * Stops when the callback returns false.\n */\n iterate) {\n this.iterate = iterate;\n }\n toArray() {\n const result = [];\n this.iterate(item => { result.push(item); return true; });\n return result;\n }\n filter(predicate) {\n return new CallbackIterable(cb => this.iterate(item => predicate(item) ? cb(item) : true));\n }\n map(mapFn) {\n return new CallbackIterable(cb => this.iterate(item => cb(mapFn(item))));\n }\n findLast(predicate) {\n let result;\n this.iterate(item => {\n if (predicate(item)) {\n result = item;\n }\n return true;\n });\n return result;\n }\n findLastMaxBy(comparator) {\n let result;\n let first = true;\n this.iterate(item => {\n if (first || CompareResult.isGreaterThan(comparator(item, result))) {\n first = false;\n result = item;\n }\n return true;\n });\n return result;\n }\n}\nCallbackIterable.empty = new CallbackIterable(_callback => { });\n/**\n * Represents a re-arrangement of items in an array.\n */\nexport class Permutation {\n constructor(_indexMap) {\n this._indexMap = _indexMap;\n }\n /**\n * Returns a permutation that sorts the given array according to the given compare function.\n */\n static createSortPermutation(arr, compareFn) {\n const sortIndices = Array.from(arr.keys()).sort((index1, index2) => compareFn(arr[index1], arr[index2]));\n return new Permutation(sortIndices);\n }\n /**\n * Returns a new array with the elements of the given array re-arranged according to this permutation.\n */\n apply(arr) {\n return arr.map((_, index) => arr[this._indexMap[index]]);\n }\n /**\n * Returns a new permutation that undoes the re-arrangement of this permutation.\n */\n inverse() {\n const inverseIndexMap = this._indexMap.slice();\n for (let i = 0; i < this._indexMap.length; i++) {\n inverseIndexMap[this._indexMap[i]] = i;\n }\n return new Permutation(inverseIndexMap);\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 * @returns whether the provided parameter is a JavaScript String or not.\n */\nexport function isString(str) {\n return (typeof str === 'string');\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) {\n // The method can't do a type cast since there are type (like strings) which\n // are subclasses of any put not positvely matched by the function. Hence type\n // narrowing results in wrong results.\n return typeof obj === 'object'\n && obj !== null\n && !Array.isArray(obj)\n && !(obj instanceof RegExp)\n && !(obj instanceof Date);\n}\n/**\n * @returns whether the provided parameter is of type `Buffer` or Uint8Array dervived type\n */\nexport function isTypedArray(obj) {\n const TypedArray = Object.getPrototypeOf(Uint8Array);\n return typeof obj === 'object'\n && obj instanceof TypedArray;\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) {\n return (typeof obj === 'number' && !isNaN(obj));\n}\n/**\n * @returns whether the provided parameter is an Iterable, casting to the given generic\n */\nexport function isIterable(obj) {\n return !!obj && typeof obj[Symbol.iterator] === 'function';\n}\n/**\n * @returns whether the provided parameter is a JavaScript Boolean or not.\n */\nexport function isBoolean(obj) {\n return (obj === true || obj === false);\n}\n/**\n * @returns whether the provided parameter is undefined.\n */\nexport function isUndefined(obj) {\n return (typeof obj === 'undefined');\n}\n/**\n * @returns whether the provided parameter is defined.\n */\nexport function isDefined(arg) {\n return !isUndefinedOrNull(arg);\n}\n/**\n * @returns whether the provided parameter is undefined or null.\n */\nexport function isUndefinedOrNull(obj) {\n return (isUndefined(obj) || obj === null);\n}\nexport function assertType(condition, type) {\n if (!condition) {\n throw new Error(type ? `Unexpected type, expected '${type}'` : 'Unexpected type');\n }\n}\n/**\n * Asserts that the argument passed in is neither undefined nor null.\n */\nexport function assertIsDefined(arg) {\n if (isUndefinedOrNull(arg)) {\n throw new Error('Assertion Failed: argument is undefined or null');\n }\n return arg;\n}\n/**\n * @returns whether the provided parameter is a JavaScript Function or not.\n */\nexport function isFunction(obj) {\n return (typeof obj === 'function');\n}\nexport function validateConstraints(args, constraints) {\n const len = Math.min(args.length, constraints.length);\n for (let i = 0; i < len; i++) {\n validateConstraint(args[i], constraints[i]);\n }\n}\nexport function validateConstraint(arg, constraint) {\n if (isString(constraint)) {\n if (typeof arg !== constraint) {\n throw new Error(`argument does not match constraint: typeof ${constraint}`);\n }\n }\n else if (isFunction(constraint)) {\n try {\n if (arg instanceof constraint) {\n return;\n }\n }\n catch (_a) {\n // ignore\n }\n if (!isUndefinedOrNull(arg) && arg.constructor === constraint) {\n return;\n }\n if (constraint.length === 1 && constraint.call(undefined, arg) === true) {\n return;\n }\n throw new Error(`argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true`);\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 *--------------------------------------------------------------------------------------------*/\nimport { isTypedArray, isObject, isUndefinedOrNull } from './types.js';\nexport function deepClone(obj) {\n if (!obj || typeof obj !== 'object') {\n return obj;\n }\n if (obj instanceof RegExp) {\n return obj;\n }\n const result = Array.isArray(obj) ? [] : {};\n Object.entries(obj).forEach(([key, value]) => {\n result[key] = value && typeof value === 'object' ? deepClone(value) : value;\n });\n return result;\n}\nexport function deepFreeze(obj) {\n if (!obj || typeof obj !== 'object') {\n return obj;\n }\n const stack = [obj];\n while (stack.length > 0) {\n const obj = stack.shift();\n Object.freeze(obj);\n for (const key in obj) {\n if (_hasOwnProperty.call(obj, key)) {\n const prop = obj[key];\n if (typeof prop === 'object' && !Object.isFrozen(prop) && !isTypedArray(prop)) {\n stack.push(prop);\n }\n }\n }\n }\n return obj;\n}\nconst _hasOwnProperty = Object.prototype.hasOwnProperty;\nexport function cloneAndChange(obj, changer) {\n return _cloneAndChange(obj, changer, new Set());\n}\nfunction _cloneAndChange(obj, changer, seen) {\n if (isUndefinedOrNull(obj)) {\n return obj;\n }\n const changed = changer(obj);\n if (typeof changed !== 'undefined') {\n return changed;\n }\n if (Array.isArray(obj)) {\n const r1 = [];\n for (const e of obj) {\n r1.push(_cloneAndChange(e, changer, seen));\n }\n return r1;\n }\n if (isObject(obj)) {\n if (seen.has(obj)) {\n throw new Error('Cannot clone recursive data-structure');\n }\n seen.add(obj);\n const r2 = {};\n for (const i2 in obj) {\n if (_hasOwnProperty.call(obj, i2)) {\n r2[i2] = _cloneAndChange(obj[i2], changer, seen);\n }\n }\n seen.delete(obj);\n return r2;\n }\n return obj;\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, source, overwrite = true) {\n if (!isObject(destination)) {\n return source;\n }\n if (isObject(source)) {\n Object.keys(source).forEach(key => {\n if (key in destination) {\n if (overwrite) {\n if (isObject(destination[key]) && isObject(source[key])) {\n mixin(destination[key], source[key], overwrite);\n }\n else {\n destination[key] = source[key];\n }\n }\n }\n else {\n destination[key] = source[key];\n }\n });\n }\n return destination;\n}\nexport function equals(one, other) {\n if (one === other) {\n return true;\n }\n if (one === null || one === undefined || other === null || other === undefined) {\n return false;\n }\n if (typeof one !== typeof other) {\n return false;\n }\n if (typeof one !== 'object') {\n return false;\n }\n if ((Array.isArray(one)) !== (Array.isArray(other))) {\n return false;\n }\n let i;\n let key;\n if (Array.isArray(one)) {\n if (one.length !== other.length) {\n return false;\n }\n for (i = 0; i < one.length; i++) {\n if (!equals(one[i], other[i])) {\n return false;\n }\n }\n }\n else {\n const oneKeys = [];\n for (key in one) {\n oneKeys.push(key);\n }\n oneKeys.sort();\n const otherKeys = [];\n for (key in other) {\n otherKeys.push(key);\n }\n otherKeys.sort();\n if (!equals(oneKeys, otherKeys)) {\n return false;\n }\n for (i = 0; i < oneKeys.length; i++) {\n if (!equals(one[oneKeys[i]], other[oneKeys[i]])) {\n return false;\n }\n }\n }\n return true;\n}\nexport function getAllPropertyNames(obj) {\n let res = [];\n while (Object.prototype !== obj) {\n res = res.concat(Object.getOwnPropertyNames(obj));\n obj = Object.getPrototypeOf(obj);\n }\n return res;\n}\nexport function getAllMethodNames(obj) {\n const methods = [];\n for (const prop of getAllPropertyNames(obj)) {\n if (typeof obj[prop] === 'function') {\n methods.push(prop);\n }\n }\n return methods;\n}\nexport function createProxyObject(methodNames, invoke) {\n const createProxyMethod = (method) => {\n return function () {\n const args = Array.prototype.slice.call(arguments, 0);\n return invoke(method, args);\n };\n };\n const result = {};\n for (const methodName of methodNames) {\n result[methodName] = createProxyMethod(methodName);\n }\n return 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 *--------------------------------------------------------------------------------------------*/\nlet isPseudo = (typeof document !== 'undefined' && document.location && document.location.hash.indexOf('pseudo=true') >= 0);\nconst DEFAULT_TAG = 'i-default';\nfunction _format(message, args) {\n let result;\n if (args.length === 0) {\n result = message;\n }\n else {\n result = message.replace(/\\{(\\d+)\\}/g, (match, rest) => {\n const index = rest[0];\n const arg = args[index];\n let result = match;\n if (typeof arg === 'string') {\n result = arg;\n }\n else if (typeof arg === 'number' || typeof arg === 'boolean' || arg === void 0 || arg === null) {\n result = String(arg);\n }\n return result;\n });\n }\n if (isPseudo) {\n // FF3B and FF3D is the Unicode zenkaku representation for [ and ]\n result = '\\uFF3B' + result.replace(/[aouei]/g, '$&$&') + '\\uFF3D';\n }\n return result;\n}\nfunction findLanguageForModule(config, name) {\n let result = config[name];\n if (result) {\n return result;\n }\n result = config['*'];\n if (result) {\n return result;\n }\n return null;\n}\nfunction endWithSlash(path) {\n if (path.charAt(path.length - 1) === '/') {\n return path;\n }\n return path + '/';\n}\nasync function getMessagesFromTranslationsService(translationServiceUrl, language, name) {\n const url = endWithSlash(translationServiceUrl) + endWithSlash(language) + 'vscode/' + endWithSlash(name);\n const res = await fetch(url);\n if (res.ok) {\n const messages = await res.json();\n return messages;\n }\n throw new Error(`${res.status} - ${res.statusText}`);\n}\nfunction createScopedLocalize(scope) {\n return function (idx, defaultValue) {\n const restArgs = Array.prototype.slice.call(arguments, 2);\n return _format(scope[idx], restArgs);\n };\n}\nfunction createScopedLocalize2(scope) {\n return (idx, defaultValue, ...args) => ({\n value: _format(scope[idx], args),\n original: _format(defaultValue, args)\n });\n}\n/**\n * @skipMangle\n */\nexport function localize(data, message, ...args) {\n return _format(message, args);\n}\n/**\n * @skipMangle\n */\nexport function localize2(data, message, ...args) {\n const original = _format(message, args);\n return {\n value: original,\n original\n };\n}\n/**\n * @skipMangle\n */\nexport function getConfiguredDefaultLocale(_) {\n // This returns undefined because this implementation isn't used and is overwritten by the loader\n // when loaded.\n return undefined;\n}\n/**\n * @skipMangle\n */\nexport function setPseudoTranslation(value) {\n isPseudo = value;\n}\n/**\n * Invoked in a built product at run-time\n * @skipMangle\n */\nexport function create(key, data) {\n var _a;\n return {\n localize: createScopedLocalize(data[key]),\n localize2: createScopedLocalize2(data[key]),\n getConfiguredDefaultLocale: (_a = data.getConfiguredDefaultLocale) !== null && _a !== void 0 ? _a : ((_) => undefined)\n };\n}\n/**\n * Invoked by the loader at run-time\n * @skipMangle\n */\nexport function load(name, req, load, config) {\n var _a;\n const pluginConfig = (_a = config['vs/nls']) !== null && _a !== void 0 ? _a : {};\n if (!name || name.length === 0) {\n // TODO: We need to give back the mangled names here\n return load({\n localize: localize,\n localize2: localize2,\n getConfiguredDefaultLocale: () => { var _a; return (_a = pluginConfig.availableLanguages) === null || _a === void 0 ? void 0 : _a['*']; }\n });\n }\n const language = pluginConfig.availableLanguages ? findLanguageForModule(pluginConfig.availableLanguages, name) : null;\n const useDefaultLanguage = language === null || language === DEFAULT_TAG;\n let suffix = '.nls';\n if (!useDefaultLanguage) {\n suffix = suffix + '.' + language;\n }\n const messagesLoaded = (messages) => {\n if (Array.isArray(messages)) {\n messages.localize = createScopedLocalize(messages);\n messages.localize2 = createScopedLocalize2(messages);\n }\n else {\n messages.localize = createScopedLocalize(messages[name]);\n messages.localize2 = createScopedLocalize2(messages[name]);\n }\n messages.getConfiguredDefaultLocale = () => { var _a; return (_a = pluginConfig.availableLanguages) === null || _a === void 0 ? void 0 : _a['*']; };\n load(messages);\n };\n if (typeof pluginConfig.loadBundle === 'function') {\n pluginConfig.loadBundle(name, language, (err, messages) => {\n // We have an error. Load the English default strings to not fail\n if (err) {\n req([name + '.nls'], messagesLoaded);\n }\n else {\n messagesLoaded(messages);\n }\n });\n }\n else if (pluginConfig.translationServiceUrl && !useDefaultLanguage) {\n (async () => {\n var _a;\n try {\n const messages = await getMessagesFromTranslationsService(pluginConfig.translationServiceUrl, language, name);\n return messagesLoaded(messages);\n }\n catch (err) {\n // Language is already as generic as it gets, so require default messages\n if (!language.includes('-')) {\n console.error(err);\n return req([name + '.nls'], messagesLoaded);\n }\n try {\n // Since there is a dash, the language configured is a specific sub-language of the same generic language.\n // Since we were unable to load the specific language, try to load the generic language. Ex. we failed to find a\n // Swiss German (de-CH), so try to load the generic German (de) messages instead.\n const genericLanguage = language.split('-')[0];\n const messages = await getMessagesFromTranslationsService(pluginConfig.translationServiceUrl, genericLanguage, name);\n // We got some messages, so we configure the configuration to use the generic language for this session.\n (_a = pluginConfig.availableLanguages) !== null && _a !== void 0 ? _a : (pluginConfig.availableLanguages = {});\n pluginConfig.availableLanguages['*'] = genericLanguage;\n return messagesLoaded(messages);\n }\n catch (err) {\n console.error(err);\n return req([name + '.nls'], messagesLoaded);\n }\n }\n })();\n }\n else {\n req([name + suffix], messagesLoaded, (err) => {\n if (suffix === '.nls') {\n console.error('Failed trying to load default language strings', err);\n return;\n }\n console.error(`Failed to load message bundle for language ${language}. Falling back to the default language:`, err);\n req([name + '.nls'], messagesLoaded);\n });\n }\n}\n", "var _a, _b;\n/*---------------------------------------------------------------------------------------------\n * 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 * as nls from '../../nls.js';\nexport const LANGUAGE_DEFAULT = 'en';\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 = undefined;\nlet _language = LANGUAGE_DEFAULT;\nlet _platformLocale = LANGUAGE_DEFAULT;\nlet _translationsConfigFile = undefined;\nlet _userAgent = undefined;\nconst $globalThis = globalThis;\nlet nodeProcess = undefined;\nif (typeof $globalThis.vscode !== 'undefined' && typeof $globalThis.vscode.process !== 'undefined') {\n // Native environment (sandboxed)\n nodeProcess = $globalThis.vscode.process;\n}\nelse if (typeof process !== 'undefined' && typeof ((_a = process === null || process === void 0 ? void 0 : process.versions) === null || _a === void 0 ? void 0 : _a.node) === 'string') {\n // Native environment (non-sandboxed)\n nodeProcess = process;\n}\nconst isElectronProcess = typeof ((_b = nodeProcess === null || nodeProcess === void 0 ? void 0 : nodeProcess.versions) === null || _b === void 0 ? void 0 : _b.electron) === 'string';\nconst isElectronRenderer = isElectronProcess && (nodeProcess === null || nodeProcess === void 0 ? void 0 : nodeProcess.type) === 'renderer';\n// Native environment\nif (typeof nodeProcess === 'object') {\n _isWindows = (nodeProcess.platform === 'win32');\n _isMacintosh = (nodeProcess.platform === 'darwin');\n _isLinux = (nodeProcess.platform === 'linux');\n _isLinuxSnap = _isLinux && !!nodeProcess.env['SNAP'] && !!nodeProcess.env['SNAP_REVISION'];\n _isElectron = isElectronProcess;\n _isCI = !!nodeProcess.env['CI'] || !!nodeProcess.env['BUILD_ARTIFACTSTAGINGDIRECTORY'];\n _locale = LANGUAGE_DEFAULT;\n _language = LANGUAGE_DEFAULT;\n const rawNlsConfig = nodeProcess.env['VSCODE_NLS_CONFIG'];\n if (rawNlsConfig) {\n try {\n const nlsConfig = JSON.parse(rawNlsConfig);\n const resolved = nlsConfig.availableLanguages['*'];\n _locale = nlsConfig.locale;\n _platformLocale = nlsConfig.osLocale;\n // VSCode's default language is 'en'\n _language = resolved ? resolved : LANGUAGE_DEFAULT;\n _translationsConfigFile = nlsConfig._translationsConfigFile;\n }\n catch (e) {\n }\n }\n _isNative = true;\n}\n// Web environment\nelse if (typeof navigator === 'object' && !isElectronRenderer) {\n _userAgent = navigator.userAgent;\n _isWindows = _userAgent.indexOf('Windows') >= 0;\n _isMacintosh = _userAgent.indexOf('Macintosh') >= 0;\n _isIOS = (_userAgent.indexOf('Macintosh') >= 0 || _userAgent.indexOf('iPad') >= 0 || _userAgent.indexOf('iPhone') >= 0) && !!navigator.maxTouchPoints && navigator.maxTouchPoints > 0;\n _isLinux = _userAgent.indexOf('Linux') >= 0;\n _isMobile = (_userAgent === null || _userAgent === void 0 ? void 0 : _userAgent.indexOf('Mobi')) >= 0;\n _isWeb = true;\n const configuredLocale = nls.getConfiguredDefaultLocale(\n // This call _must_ be done in the file that calls `nls.getConfiguredDefaultLocale`\n // to ensure that the NLS AMD Loader plugin has been loaded and configured.\n // This is because the loader plugin decides what the default locale is based on\n // how it's able to resolve the strings.\n nls.localize({ key: 'ensureLoaderPluginIsLoaded', comment: ['{Locked}'] }, '_'));\n _locale = configuredLocale || LANGUAGE_DEFAULT;\n _language = _locale;\n _platformLocale = navigator.language;\n}\n// Unknown environment\nelse {\n console.error('Unable to resolve platform.');\n}\nlet _platform = 0 /* Platform.Web */;\nif (_isMacintosh) {\n _platform = 1 /* Platform.Mac */;\n}\nelse if (_isWindows) {\n _platform = 3 /* Platform.Windows */;\n}\nelse if (_isLinux) {\n _platform = 2 /* Platform.Linux */;\n}\nexport const isWindows = _isWindows;\nexport const isMacintosh = _isMacintosh;\nexport const isLinux = _isLinux;\nexport const isNative = _isNative;\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;\nexport const userAgent = _userAgent;\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)\n */\nexport const language = _language;\nexport const setTimeout0IsFaster = (typeof $globalThis.postMessage === 'function' && !$globalThis.importScripts);\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 if (setTimeout0IsFaster) {\n const pending = [];\n $globalThis.addEventListener('message', (e) => {\n if (e.data && e.data.vscodeScheduleAsyncWork) {\n for (let i = 0, len = pending.length; i < len; i++) {\n const candidate = pending[i];\n if (candidate.id === e.data.vscodeScheduleAsyncWork) {\n pending.splice(i, 1);\n candidate.callback();\n return;\n }\n }\n }\n });\n let lastId = 0;\n return (callback) => {\n const myId = ++lastId;\n pending.push({\n id: myId,\n callback: callback\n });\n $globalThis.postMessage({ vscodeScheduleAsyncWork: myId }, '*');\n };\n }\n return (callback) => setTimeout(callback);\n})();\nexport const OS = (_isMacintosh || _isIOS ? 2 /* OperatingSystem.Macintosh */ : (_isWindows ? 1 /* OperatingSystem.Windows */ : 3 /* OperatingSystem.Linux */));\nlet _isLittleEndian = true;\nlet _isLittleEndianComputed = false;\nexport function isLittleEndian() {\n if (!_isLittleEndianComputed) {\n _isLittleEndianComputed = true;\n const test = new Uint8Array(2);\n test[0] = 1;\n test[1] = 2;\n const view = new Uint16Array(test.buffer);\n _isLittleEndian = (view[0] === (2 << 8) + 1);\n }\n return _isLittleEndian;\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", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nexport const EDITOR_MODEL_DEFAULTS = {\n tabSize: 4,\n indentSize: 4,\n insertSpaces: true,\n detectIndentation: true,\n trimAutoWhitespace: true,\n largeFileOptimizations: true,\n bracketPairColorizationOptions: {\n enabled: true,\n independentColorPoolPerBracketType: false,\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 *--------------------------------------------------------------------------------------------*/\nexport var Iterable;\n(function (Iterable) {\n function is(thing) {\n return thing && typeof thing === 'object' && typeof thing[Symbol.iterator] === 'function';\n }\n Iterable.is = is;\n const _empty = Object.freeze([]);\n function empty() {\n return _empty;\n }\n Iterable.empty = empty;\n function* single(element) {\n yield element;\n }\n Iterable.single = single;\n function wrap(iterableOrElement) {\n if (is(iterableOrElement)) {\n return iterableOrElement;\n }\n else {\n return single(iterableOrElement);\n }\n }\n Iterable.wrap = wrap;\n function from(iterable) {\n return iterable || _empty;\n }\n Iterable.from = from;\n function* reverse(array) {\n for (let i = array.length - 1; i >= 0; i--) {\n yield array[i];\n }\n }\n Iterable.reverse = reverse;\n function isEmpty(iterable) {\n return !iterable || iterable[Symbol.iterator]().next().done === true;\n }\n Iterable.isEmpty = isEmpty;\n function first(iterable) {\n return iterable[Symbol.iterator]().next().value;\n }\n Iterable.first = first;\n function some(iterable, predicate) {\n for (const element of iterable) {\n if (predicate(element)) {\n return true;\n }\n }\n return false;\n }\n Iterable.some = some;\n function find(iterable, predicate) {\n for (const element of iterable) {\n if (predicate(element)) {\n return element;\n }\n }\n return undefined;\n }\n Iterable.find = find;\n function* filter(iterable, predicate) {\n for (const element of iterable) {\n if (predicate(element)) {\n yield element;\n }\n }\n }\n Iterable.filter = filter;\n function* map(iterable, fn) {\n let index = 0;\n for (const element of iterable) {\n yield fn(element, index++);\n }\n }\n Iterable.map = map;\n function* concat(...iterables) {\n for (const iterable of iterables) {\n yield* iterable;\n }\n }\n Iterable.concat = concat;\n function reduce(iterable, reducer, initialValue) {\n let value = initialValue;\n for (const element of iterable) {\n value = reducer(value, element);\n }\n return value;\n }\n Iterable.reduce = reduce;\n /**\n * Returns an iterable slice of the array, with the same semantics as `array.slice()`.\n */\n function* slice(arr, from, to = arr.length) {\n if (from < 0) {\n from += arr.length;\n }\n if (to < 0) {\n to += arr.length;\n }\n else if (to > arr.length) {\n to = arr.length;\n }\n for (; from < to; from++) {\n yield arr[from];\n }\n }\n Iterable.slice = slice;\n /**\n * Consumes `atMost` elements from iterable and returns the consumed elements,\n * and an iterable for the rest of the elements.\n */\n function consume(iterable, atMost = Number.POSITIVE_INFINITY) {\n const consumed = [];\n if (atMost === 0) {\n return [consumed, iterable];\n }\n const iterator = iterable[Symbol.iterator]();\n for (let i = 0; i < atMost; i++) {\n const next = iterator.next();\n if (next.done) {\n return [consumed, Iterable.empty()];\n }\n consumed.push(next.value);\n }\n return [consumed, { [Symbol.iterator]() { return iterator; } }];\n }\n Iterable.consume = consume;\n async function asyncToArray(iterable) {\n const result = [];\n for await (const item of iterable) {\n result.push(item);\n }\n return Promise.resolve(result);\n }\n Iterable.asyncToArray = asyncToArray;\n})(Iterable || (Iterable = {}));\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nclass Node {\n constructor(element) {\n this.element = element;\n this.next = Node.Undefined;\n this.prev = Node.Undefined;\n }\n}\nNode.Undefined = new Node(undefined);\nexport class LinkedList {\n constructor() {\n this._first = Node.Undefined;\n this._last = Node.Undefined;\n this._size = 0;\n }\n get size() {\n return this._size;\n }\n isEmpty() {\n return this._first === Node.Undefined;\n }\n clear() {\n let node = this._first;\n while (node !== Node.Undefined) {\n const next = node.next;\n node.prev = Node.Undefined;\n node.next = Node.Undefined;\n node = next;\n }\n this._first = Node.Undefined;\n this._last = Node.Undefined;\n this._size = 0;\n }\n unshift(element) {\n return this._insert(element, false);\n }\n push(element) {\n return this._insert(element, true);\n }\n _insert(element, atTheEnd) {\n const newNode = new Node(element);\n if (this._first === Node.Undefined) {\n this._first = newNode;\n this._last = newNode;\n }\n else if (atTheEnd) {\n // push\n const oldLast = this._last;\n this._last = newNode;\n newNode.prev = oldLast;\n oldLast.next = newNode;\n }\n else {\n // unshift\n const oldFirst = this._first;\n this._first = newNode;\n newNode.next = oldFirst;\n oldFirst.prev = newNode;\n }\n this._size += 1;\n let didRemove = false;\n return () => {\n if (!didRemove) {\n didRemove = true;\n this._remove(newNode);\n }\n };\n }\n shift() {\n if (this._first === Node.Undefined) {\n return undefined;\n }\n else {\n const res = this._first.element;\n this._remove(this._first);\n return res;\n }\n }\n pop() {\n if (this._last === Node.Undefined) {\n return undefined;\n }\n else {\n const res = this._last.element;\n this._remove(this._last);\n return res;\n }\n }\n _remove(node) {\n if (node.prev !== Node.Undefined && node.next !== Node.Undefined) {\n // middle\n const anchor = node.prev;\n anchor.next = node.next;\n node.next.prev = anchor;\n }\n else if (node.prev === Node.Undefined && node.next === Node.Undefined) {\n // only node\n this._first = Node.Undefined;\n this._last = Node.Undefined;\n }\n else if (node.next === Node.Undefined) {\n // last\n this._last = this._last.prev;\n this._last.next = Node.Undefined;\n }\n else if (node.prev === Node.Undefined) {\n // first\n this._first = this._first.next;\n this._first.prev = Node.Undefined;\n }\n // done\n this._size -= 1;\n }\n *[Symbol.iterator]() {\n let node = this._first;\n while (node !== Node.Undefined) {\n yield node.element;\n node = node.next;\n }\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 *--------------------------------------------------------------------------------------------*/\nimport { Iterable } from '../../../base/common/iterator.js';\nimport { LinkedList } from '../../../base/common/linkedList.js';\nexport const USUAL_WORD_SEPARATORS = '`~!@#$%^&*()-=+[{]}\\\\|;:\\'\",.<>/?';\n/**\n * Create a word definition regular expression based on default word separators.\n * Optionally provide allowed separators that should be included in words.\n *\n * The default would look like this:\n * /(-?\\d*\\.\\d\\w*)|([^\\`\\~\\!\\@\\#\\$\\%\\^\\&\\*\\(\\)\\-\\=\\+\\[\\{\\]\\}\\\\\\|\\;\\:\\'\\\"\\,\\.\\<\\>\\/\\?\\s]+)/g\n */\nfunction createWordRegExp(allowInWords = '') {\n let source = '(-?\\\\d*\\\\.\\\\d\\\\w*)|([^';\n for (const sep of USUAL_WORD_SEPARATORS) {\n if (allowInWords.indexOf(sep) >= 0) {\n continue;\n }\n source += '\\\\' + sep;\n }\n source += '\\\\s]+)';\n return new RegExp(source, 'g');\n}\n// catches numbers (including floating numbers) in the first group, and alphanum in the second\nexport const DEFAULT_WORD_REGEXP = createWordRegExp();\nexport function ensureValidWordDefinition(wordDefinition) {\n let result = DEFAULT_WORD_REGEXP;\n if (wordDefinition && (wordDefinition instanceof RegExp)) {\n if (!wordDefinition.global) {\n let flags = 'g';\n if (wordDefinition.ignoreCase) {\n flags += 'i';\n }\n if (wordDefinition.multiline) {\n flags += 'm';\n }\n if (wordDefinition.unicode) {\n flags += 'u';\n }\n result = new RegExp(wordDefinition.source, flags);\n }\n else {\n result = wordDefinition;\n }\n }\n result.lastIndex = 0;\n return result;\n}\nconst _defaultConfig = new LinkedList();\n_defaultConfig.unshift({\n maxLen: 1000,\n windowSize: 15,\n timeBudget: 150\n});\nexport function getWordAtText(column, wordDefinition, text, textOffset, config) {\n // Ensure the regex has the 'g' flag, otherwise this will loop forever\n wordDefinition = ensureValidWordDefinition(wordDefinition);\n if (!config) {\n config = Iterable.first(_defaultConfig);\n }\n if (text.length > config.maxLen) {\n // don't throw strings that long at the regexp\n // but use a sub-string in which a word must occur\n let start = column - config.maxLen / 2;\n if (start < 0) {\n start = 0;\n }\n else {\n textOffset += start;\n }\n text = text.substring(start, column + config.maxLen / 2);\n return getWordAtText(column, wordDefinition, text, textOffset, config);\n }\n const t1 = Date.now();\n const pos = column - 1 - textOffset;\n let prevRegexIndex = -1;\n let match = null;\n for (let i = 1;; i++) {\n // check time budget\n if (Date.now() - t1 >= config.timeBudget) {\n break;\n }\n // reset the index at which the regexp should start matching, also know where it\n // should stop so that subsequent search don't repeat previous searches\n const regexIndex = pos - config.windowSize * i;\n wordDefinition.lastIndex = Math.max(0, regexIndex);\n const thisMatch = _findRegexMatchEnclosingPosition(wordDefinition, text, pos, prevRegexIndex);\n if (!thisMatch && match) {\n // stop: we have something\n break;\n }\n match = thisMatch;\n // stop: searched at start\n if (regexIndex <= 0) {\n break;\n }\n prevRegexIndex = regexIndex;\n }\n if (match) {\n const result = {\n word: match[0],\n startColumn: textOffset + 1 + match.index,\n endColumn: textOffset + 1 + match.index + match[0].length\n };\n wordDefinition.lastIndex = 0;\n return result;\n }\n return null;\n}\nfunction _findRegexMatchEnclosingPosition(wordDefinition, text, pos, stopPos) {\n let match;\n while (match = wordDefinition.exec(text)) {\n const matchIndex = match.index || 0;\n if (matchIndex <= pos && wordDefinition.lastIndex >= pos) {\n return match;\n }\n else if (stopPos > 0 && matchIndex > stopPos) {\n return null;\n }\n }\n return 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// Avoid circular dependency on EventEmitter by implementing a subset of the interface.\nexport class ErrorHandler {\n constructor() {\n this.listeners = [];\n this.unexpectedErrorHandler = function (e) {\n setTimeout(() => {\n if (e.stack) {\n if (ErrorNoTelemetry.isErrorNoTelemetry(e)) {\n throw new ErrorNoTelemetry(e.message + '\\n\\n' + e.stack);\n }\n throw new Error(e.message + '\\n\\n' + e.stack);\n }\n throw e;\n }, 0);\n };\n }\n emit(e) {\n this.listeners.forEach((listener) => {\n listener(e);\n });\n }\n onUnexpectedError(e) {\n this.unexpectedErrorHandler(e);\n this.emit(e);\n }\n // For external errors, we don't want the listeners to be called\n onUnexpectedExternalError(e) {\n this.unexpectedErrorHandler(e);\n }\n}\nexport const errorHandler = new ErrorHandler();\nexport function onUnexpectedError(e) {\n // ignore errors from cancelled promises\n if (!isCancellationError(e)) {\n errorHandler.onUnexpectedError(e);\n }\n return undefined;\n}\nexport function onUnexpectedExternalError(e) {\n // ignore errors from cancelled promises\n if (!isCancellationError(e)) {\n errorHandler.onUnexpectedExternalError(e);\n }\n return undefined;\n}\nexport function transformErrorForSerialization(error) {\n if (error instanceof Error) {\n const { name, message } = error;\n const stack = error.stacktrace || error.stack;\n return {\n $isError: true,\n name,\n message,\n stack,\n noTelemetry: ErrorNoTelemetry.isErrorNoTelemetry(error)\n };\n }\n // return as is\n return error;\n}\nconst canceledName = 'Canceled';\n/**\n * Checks if the given error is a promise in canceled state\n */\nexport function isCancellationError(error) {\n if (error instanceof CancellationError) {\n return true;\n }\n return error instanceof Error && error.name === canceledName && error.message === canceledName;\n}\n// !!!IMPORTANT!!!\n// Do NOT change this class because it is also used as an API-type.\nexport class CancellationError extends Error {\n constructor() {\n super(canceledName);\n this.name = this.message;\n }\n}\n/**\n * @deprecated use {@link CancellationError `new CancellationError()`} instead\n */\nexport function canceled() {\n const error = new Error(canceledName);\n error.name = error.message;\n return error;\n}\nexport function illegalArgument(name) {\n if (name) {\n return new Error(`Illegal argument: ${name}`);\n }\n else {\n return new Error('Illegal argument');\n }\n}\nexport function illegalState(name) {\n if (name) {\n return new Error(`Illegal state: ${name}`);\n }\n else {\n return new Error('Illegal state');\n }\n}\nexport class NotSupportedError extends Error {\n constructor(message) {\n super('NotSupported');\n if (message) {\n this.message = message;\n }\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 constructor(msg) {\n super(msg);\n this.name = 'CodeExpectedError';\n }\n static fromError(err) {\n if (err instanceof ErrorNoTelemetry) {\n return err;\n }\n const result = new ErrorNoTelemetry();\n result.message = err.message;\n result.stack = err.stack;\n return result;\n }\n static isErrorNoTelemetry(err) {\n return err.name === 'CodeExpectedError';\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 constructor(message) {\n super(message || 'An unexpected bug occurred.');\n Object.setPrototypeOf(this, BugIndicatingError.prototype);\n // Because we know for sure only buggy code throws this,\n // we definitely want to break here and fix the bug.\n // eslint-disable-next-line no-debugger\n // debugger;\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 * Given a function, returns a function that is only calling that function once.\n */\nexport function createSingleCallFunction(fn, fnDidRunCallback) {\n const _this = this;\n let didCall = false;\n let result;\n return function () {\n if (didCall) {\n return result;\n }\n didCall = true;\n if (fnDidRunCallback) {\n try {\n result = fn.apply(_this, arguments);\n }\n finally {\n fnDidRunCallback();\n }\n }\n else {\n result = fn.apply(_this, arguments);\n }\n return result;\n };\n}\n", "import { createSingleCallFunction } from './functional.js';\nimport { Iterable } from './iterator.js';\n// #region Disposable Tracking\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 = null;\nexport function setDisposableTracker(tracker) {\n disposableTracker = tracker;\n}\nif (TRACK_DISPOSABLES) {\n const __is_disposable_tracked__ = '__is_disposable_tracked__';\n setDisposableTracker(new class {\n trackDisposable(x) {\n const stack = new Error('Potentially leaked disposable').stack;\n setTimeout(() => {\n if (!x[__is_disposable_tracked__]) {\n console.log(stack);\n }\n }, 3000);\n }\n setParent(child, parent) {\n if (child && child !== Disposable.None) {\n try {\n child[__is_disposable_tracked__] = true;\n }\n catch (_a) {\n // noop\n }\n }\n }\n markAsDisposed(disposable) {\n if (disposable && disposable !== Disposable.None) {\n try {\n disposable[__is_disposable_tracked__] = true;\n }\n catch (_a) {\n // noop\n }\n }\n }\n markAsSingleton(disposable) { }\n });\n}\nexport function trackDisposable(x) {\n disposableTracker === null || disposableTracker === void 0 ? void 0 : disposableTracker.trackDisposable(x);\n return x;\n}\nexport function markAsDisposed(disposable) {\n disposableTracker === null || disposableTracker === void 0 ? void 0 : disposableTracker.markAsDisposed(disposable);\n}\nfunction setParentOfDisposable(child, parent) {\n disposableTracker === null || disposableTracker === void 0 ? void 0 : disposableTracker.setParent(child, parent);\n}\nfunction setParentOfDisposables(children, parent) {\n if (!disposableTracker) {\n return;\n }\n for (const child of children) {\n disposableTracker.setParent(child, parent);\n }\n}\n/**\n * Indicates that the given object is a singleton which does not need to be disposed.\n*/\nexport function markAsSingleton(singleton) {\n disposableTracker === null || disposableTracker === void 0 ? void 0 : disposableTracker.markAsSingleton(singleton);\n return singleton;\n}\n/**\n * Check if `thing` is {@link IDisposable disposable}.\n */\nexport function isDisposable(thing) {\n return typeof thing === 'object' && thing !== null && typeof thing.dispose === 'function' && thing.dispose.length === 0;\n}\nexport function dispose(arg) {\n if (Iterable.is(arg)) {\n const errors = [];\n for (const d of arg) {\n if (d) {\n try {\n d.dispose();\n }\n catch (e) {\n errors.push(e);\n }\n }\n }\n if (errors.length === 1) {\n throw errors[0];\n }\n else if (errors.length > 1) {\n throw new AggregateError(errors, 'Encountered errors while disposing of store');\n }\n return Array.isArray(arg) ? [] : arg;\n }\n else if (arg) {\n arg.dispose();\n return arg;\n }\n}\n/**\n * Combine multiple disposable values into a single {@link IDisposable}.\n */\nexport function combinedDisposable(...disposables) {\n const parent = toDisposable(() => dispose(disposables));\n setParentOfDisposables(disposables, parent);\n return parent;\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) {\n const self = trackDisposable({\n dispose: createSingleCallFunction(() => {\n markAsDisposed(self);\n fn();\n })\n });\n return self;\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 {\n constructor() {\n this._toDispose = new Set();\n this._isDisposed = false;\n trackDisposable(this);\n }\n /**\n * Dispose of all registered disposables and mark this object as disposed.\n *\n * Any future disposables added to this object will be disposed of on `add`.\n */\n dispose() {\n if (this._isDisposed) {\n return;\n }\n markAsDisposed(this);\n this._isDisposed = true;\n this.clear();\n }\n /**\n * @return `true` if this object has been disposed of.\n */\n get isDisposed() {\n return this._isDisposed;\n }\n /**\n * Dispose of all registered disposables but do not mark this object as disposed.\n */\n clear() {\n if (this._toDispose.size === 0) {\n return;\n }\n try {\n dispose(this._toDispose);\n }\n finally {\n this._toDispose.clear();\n }\n }\n /**\n * Add a new {@link IDisposable disposable} to the collection.\n */\n add(o) {\n if (!o) {\n return o;\n }\n if (o === this) {\n throw new Error('Cannot register a disposable on itself!');\n }\n setParentOfDisposable(o, this);\n if (this._isDisposed) {\n if (!DisposableStore.DISABLE_DISPOSED_WARNING) {\n console.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 }\n }\n else {\n this._toDispose.add(o);\n }\n return o;\n }\n /**\n * Deletes the value from the store, but does not dispose it.\n */\n deleteAndLeak(o) {\n if (!o) {\n return;\n }\n if (this._toDispose.has(o)) {\n this._toDispose.delete(o);\n setParentOfDisposable(o, null);\n }\n }\n}\nDisposableStore.DISABLE_DISPOSED_WARNING = false;\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 class Disposable {\n constructor() {\n this._store = new DisposableStore();\n trackDisposable(this);\n setParentOfDisposable(this._store, this);\n }\n dispose() {\n markAsDisposed(this);\n this._store.dispose();\n }\n /**\n * Adds `o` to the collection of disposables managed by this object.\n */\n _register(o) {\n if (o === this) {\n throw new Error('Cannot register a disposable on itself!');\n }\n return this._store.add(o);\n }\n}\n/**\n * A disposable that does nothing when it is disposed of.\n *\n * TODO: This should not be a static property.\n */\nDisposable.None = Object.freeze({ dispose() { } });\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 {\n constructor() {\n this._isDisposed = false;\n trackDisposable(this);\n }\n get value() {\n return this._isDisposed ? undefined : this._value;\n }\n set value(value) {\n var _a;\n if (this._isDisposed || value === this._value) {\n return;\n }\n (_a = this._value) === null || _a === void 0 ? void 0 : _a.dispose();\n if (value) {\n setParentOfDisposable(value, this);\n }\n this._value = value;\n }\n /**\n * Resets the stored value and disposed of the previously stored value.\n */\n clear() {\n this.value = undefined;\n }\n dispose() {\n var _a;\n this._isDisposed = true;\n markAsDisposed(this);\n (_a = this._value) === null || _a === void 0 ? void 0 : _a.dispose();\n this._value = undefined;\n }\n}\nexport class RefCountedDisposable {\n constructor(_disposable) {\n this._disposable = _disposable;\n this._counter = 1;\n }\n acquire() {\n this._counter++;\n return this;\n }\n release() {\n if (--this._counter === 0) {\n this._disposable.dispose();\n }\n return this;\n }\n}\nexport class ImmortalReference {\n constructor(object) {\n this.object = object;\n }\n dispose() { }\n}\n/**\n * A map the manages the lifecycle of the values that it stores.\n */\nexport class DisposableMap {\n constructor() {\n this._store = new Map();\n this._isDisposed = false;\n trackDisposable(this);\n }\n /**\n * Disposes of all stored values and mark this object as disposed.\n *\n * Trying to use this object after it has been disposed of is an error.\n */\n dispose() {\n markAsDisposed(this);\n this._isDisposed = true;\n this.clearAndDisposeAll();\n }\n /**\n * Disposes of all stored values and clear the map, but DO NOT mark this object as disposed.\n */\n clearAndDisposeAll() {\n if (!this._store.size) {\n return;\n }\n try {\n dispose(this._store.values());\n }\n finally {\n this._store.clear();\n }\n }\n get(key) {\n return this._store.get(key);\n }\n set(key, value, skipDisposeOnOverwrite = false) {\n var _a;\n if (this._isDisposed) {\n console.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 }\n if (!skipDisposeOnOverwrite) {\n (_a = this._store.get(key)) === null || _a === void 0 ? void 0 : _a.dispose();\n }\n this._store.set(key, value);\n }\n /**\n * Delete the value stored for `key` from this map and also dispose of it.\n */\n deleteAndDispose(key) {\n var _a;\n (_a = this._store.get(key)) === null || _a === void 0 ? void 0 : _a.dispose();\n this._store.delete(key);\n }\n [Symbol.iterator]() {\n return this._store[Symbol.iterator]();\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 *--------------------------------------------------------------------------------------------*/\nconst hasPerformanceNow = (globalThis.performance && typeof globalThis.performance.now === 'function');\nexport class StopWatch {\n static create(highResolution) {\n return new StopWatch(highResolution);\n }\n constructor(highResolution) {\n this._now = hasPerformanceNow && highResolution === false ? Date.now : globalThis.performance.now.bind(globalThis.performance);\n this._startTime = this._now();\n this._stopTime = -1;\n }\n stop() {\n this._stopTime = this._now();\n }\n reset() {\n this._startTime = this._now();\n this._stopTime = -1;\n }\n elapsed() {\n if (this._stopTime !== -1) {\n return this._stopTime - this._startTime;\n }\n return this._now() - this._startTime;\n }\n}\n", "import { onUnexpectedError } from './errors.js';\nimport { createSingleCallFunction } from './functional.js';\nimport { combinedDisposable, Disposable, DisposableStore, toDisposable } from './lifecycle.js';\nimport { LinkedList } from './linkedList.js';\nimport { StopWatch } from './stopwatch.js';\n// -----------------------------------------------------------------------------------------------------------------------\n// Uncomment the next line to print warnings whenever a listener is GC'ed without having been disposed. This is a LEAK.\n// -----------------------------------------------------------------------------------------------------------------------\nconst _enableListenerGCedWarning = false;\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// -----------------------------------------------------------------------------------------------------------------------\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;\nexport var Event;\n(function (Event) {\n Event.None = () => Disposable.None;\n function _addLeakageTraceLogic(options) {\n if (_enableSnapshotPotentialLeakWarning) {\n const { onDidAddListener: origListenerDidAdd } = options;\n const stack = Stacktrace.create();\n let count = 0;\n options.onDidAddListener = () => {\n if (++count === 2) {\n console.warn('snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here');\n stack.print();\n }\n origListenerDidAdd === null || origListenerDidAdd === void 0 ? void 0 : origListenerDidAdd();\n };\n }\n }\n /**\n * Given an event, returns another event which debounces calls and defers the listeners to a later task via a shared\n * `setTimeout`. The event is converted into a signal (`Event`) to avoid additional object creation as a\n * result of merging events and to try prevent race conditions that could arise when using related deferred and\n * non-deferred events.\n *\n * This is useful for deferring non-critical work (eg. general UI updates) to ensure it does not block critical work\n * (eg. latency of keypress to text rendered).\n *\n * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n * returned event causes this utility to leak a listener on the original event.\n *\n * @param event The event source for the new event.\n * @param disposable A disposable store to add the new EventEmitter to.\n */\n function defer(event, disposable) {\n return debounce(event, () => void 0, 0, undefined, true, undefined, disposable);\n }\n Event.defer = defer;\n /**\n * Given an event, returns another event which only fires once.\n *\n * @param event The event source for the new event.\n */\n function once(event) {\n return (listener, thisArgs = null, disposables) => {\n // we need this, in case the event fires during the listener call\n let didFire = false;\n let result = undefined;\n result = event(e => {\n if (didFire) {\n return;\n }\n else if (result) {\n result.dispose();\n }\n else {\n didFire = true;\n }\n return listener.call(thisArgs, e);\n }, null, disposables);\n if (didFire) {\n result.dispose();\n }\n return result;\n };\n }\n Event.once = once;\n /**\n * Maps an event of one type into an event of another type using a mapping function, similar to how\n * `Array.prototype.map` works.\n *\n * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n * returned event causes this utility to leak a listener on the original event.\n *\n * @param event The event source for the new event.\n * @param map The mapping function.\n * @param disposable A disposable store to add the new EventEmitter to.\n */\n function map(event, map, disposable) {\n return snapshot((listener, thisArgs = null, disposables) => event(i => listener.call(thisArgs, map(i)), null, disposables), disposable);\n }\n Event.map = map;\n /**\n * Wraps an event in another event that performs some function on the event object before firing.\n *\n * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n * returned event causes this utility to leak a listener on the original event.\n *\n * @param event The event source for the new event.\n * @param each The function to perform on the event object.\n * @param disposable A disposable store to add the new EventEmitter to.\n */\n function forEach(event, each, disposable) {\n return snapshot((listener, thisArgs = null, disposables) => event(i => { each(i); listener.call(thisArgs, i); }, null, disposables), disposable);\n }\n Event.forEach = forEach;\n function filter(event, filter, disposable) {\n return snapshot((listener, thisArgs = null, disposables) => event(e => filter(e) && listener.call(thisArgs, e), null, disposables), disposable);\n }\n Event.filter = filter;\n /**\n * Given an event, returns the same event but typed as `Event`.\n */\n function signal(event) {\n return event;\n }\n Event.signal = signal;\n function any(...events) {\n return (listener, thisArgs = null, disposables) => {\n const disposable = combinedDisposable(...events.map(event => event(e => listener.call(thisArgs, e))));\n return addAndReturnDisposable(disposable, disposables);\n };\n }\n Event.any = any;\n /**\n * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n * returned event causes this utility to leak a listener on the original event.\n */\n function reduce(event, merge, initial, disposable) {\n let output = initial;\n return map(event, e => {\n output = merge(output, e);\n return output;\n }, disposable);\n }\n Event.reduce = reduce;\n function snapshot(event, disposable) {\n let listener;\n const options = {\n onWillAddFirstListener() {\n listener = event(emitter.fire, emitter);\n },\n onDidRemoveLastListener() {\n listener === null || listener === void 0 ? void 0 : listener.dispose();\n }\n };\n if (!disposable) {\n _addLeakageTraceLogic(options);\n }\n const emitter = new Emitter(options);\n disposable === null || disposable === void 0 ? void 0 : disposable.add(emitter);\n return emitter.event;\n }\n /**\n * Adds the IDisposable to the store if it's set, and returns it. Useful to\n * Event function implementation.\n */\n function addAndReturnDisposable(d, store) {\n if (store instanceof Array) {\n store.push(d);\n }\n else if (store) {\n store.add(d);\n }\n return d;\n }\n function debounce(event, merge, delay = 100, leading = false, flushOnListenerRemove = false, leakWarningThreshold, disposable) {\n let subscription;\n let output = undefined;\n let handle = undefined;\n let numDebouncedCalls = 0;\n let doFire;\n const options = {\n leakWarningThreshold,\n onWillAddFirstListener() {\n subscription = event(cur => {\n numDebouncedCalls++;\n output = merge(output, cur);\n if (leading && !handle) {\n emitter.fire(output);\n output = undefined;\n }\n doFire = () => {\n const _output = output;\n output = undefined;\n handle = undefined;\n if (!leading || numDebouncedCalls > 1) {\n emitter.fire(_output);\n }\n numDebouncedCalls = 0;\n };\n if (typeof delay === 'number') {\n clearTimeout(handle);\n handle = setTimeout(doFire, delay);\n }\n else {\n if (handle === undefined) {\n handle = 0;\n queueMicrotask(doFire);\n }\n }\n });\n },\n onWillRemoveListener() {\n if (flushOnListenerRemove && numDebouncedCalls > 0) {\n doFire === null || doFire === void 0 ? void 0 : doFire();\n }\n },\n onDidRemoveLastListener() {\n doFire = undefined;\n subscription.dispose();\n }\n };\n if (!disposable) {\n _addLeakageTraceLogic(options);\n }\n const emitter = new Emitter(options);\n disposable === null || disposable === void 0 ? void 0 : disposable.add(emitter);\n return emitter.event;\n }\n Event.debounce = debounce;\n /**\n * Debounces an event, firing after some delay (default=0) with an array of all event original objects.\n *\n * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n * returned event causes this utility to leak a listener on the original event.\n */\n function accumulate(event, delay = 0, disposable) {\n return Event.debounce(event, (last, e) => {\n if (!last) {\n return [e];\n }\n last.push(e);\n return last;\n }, delay, undefined, true, undefined, disposable);\n }\n Event.accumulate = accumulate;\n /**\n * Filters an event such that some condition is _not_ met more than once in a row, effectively ensuring duplicate\n * event objects from different sources do not fire the same event object.\n *\n * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n * returned event causes this utility to leak a listener on the original event.\n *\n * @param event The event source for the new event.\n * @param equals The equality condition.\n * @param disposable A disposable store to add the new EventEmitter to.\n *\n * @example\n * ```\n * // Fire only one time when a single window is opened or focused\n * Event.latch(Event.any(onDidOpenWindow, onDidFocusWindow))\n * ```\n */\n function latch(event, equals = (a, b) => a === b, disposable) {\n let firstCall = true;\n let cache;\n return filter(event, value => {\n const shouldEmit = firstCall || !equals(value, cache);\n firstCall = false;\n cache = value;\n return shouldEmit;\n }, disposable);\n }\n Event.latch = latch;\n /**\n * Splits an event whose parameter is a union type into 2 separate events for each type in the union.\n *\n * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n * returned event causes this utility to leak a listener on the original event.\n *\n * @example\n * ```\n * const event = new EventEmitter().event;\n * const [numberEvent, undefinedEvent] = Event.split(event, isUndefined);\n * ```\n *\n * @param event The event source for the new event.\n * @param isT A function that determines what event is of the first type.\n * @param disposable A disposable store to add the new EventEmitter to.\n */\n function split(event, isT, disposable) {\n return [\n Event.filter(event, isT, disposable),\n Event.filter(event, e => !isT(e), disposable),\n ];\n }\n Event.split = split;\n /**\n * Buffers an event until it has a listener attached.\n *\n * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n * returned event causes this utility to leak a listener on the original event.\n *\n * @param event The event source for the new event.\n * @param flushAfterTimeout Determines whether to flush the buffer after a timeout immediately or after a\n * `setTimeout` when the first event listener is added.\n * @param _buffer Internal: A source event array used for tests.\n *\n * @example\n * ```\n * // Start accumulating events, when the first listener is attached, flush\n * // the event after a timeout such that multiple listeners attached before\n * // the timeout would receive the event\n * this.onInstallExtension = Event.buffer(service.onInstallExtension, true);\n * ```\n */\n function buffer(event, flushAfterTimeout = false, _buffer = [], disposable) {\n let buffer = _buffer.slice();\n let listener = event(e => {\n if (buffer) {\n buffer.push(e);\n }\n else {\n emitter.fire(e);\n }\n });\n if (disposable) {\n disposable.add(listener);\n }\n const flush = () => {\n buffer === null || buffer === void 0 ? void 0 : buffer.forEach(e => emitter.fire(e));\n buffer = null;\n };\n const emitter = new Emitter({\n onWillAddFirstListener() {\n if (!listener) {\n listener = event(e => emitter.fire(e));\n if (disposable) {\n disposable.add(listener);\n }\n }\n },\n onDidAddFirstListener() {\n if (buffer) {\n if (flushAfterTimeout) {\n setTimeout(flush);\n }\n else {\n flush();\n }\n }\n },\n onDidRemoveLastListener() {\n if (listener) {\n listener.dispose();\n }\n listener = null;\n }\n });\n if (disposable) {\n disposable.add(emitter);\n }\n return emitter.event;\n }\n Event.buffer = buffer;\n /**\n * Wraps the event in an {@link IChainableEvent}, allowing a more functional programming style.\n *\n * @example\n * ```\n * // Normal\n * const onEnterPressNormal = Event.filter(\n * Event.map(onKeyPress.event, e => new StandardKeyboardEvent(e)),\n * e.keyCode === KeyCode.Enter\n * ).event;\n *\n * // Using chain\n * const onEnterPressChain = Event.chain(onKeyPress.event, $ => $\n * .map(e => new StandardKeyboardEvent(e))\n * .filter(e => e.keyCode === KeyCode.Enter)\n * );\n * ```\n */\n function chain(event, sythensize) {\n const fn = (listener, thisArgs, disposables) => {\n const cs = sythensize(new ChainableSynthesis());\n return event(function (value) {\n const result = cs.evaluate(value);\n if (result !== HaltChainable) {\n listener.call(thisArgs, result);\n }\n }, undefined, disposables);\n };\n return fn;\n }\n Event.chain = chain;\n const HaltChainable = Symbol('HaltChainable');\n class ChainableSynthesis {\n constructor() {\n this.steps = [];\n }\n map(fn) {\n this.steps.push(fn);\n return this;\n }\n forEach(fn) {\n this.steps.push(v => {\n fn(v);\n return v;\n });\n return this;\n }\n filter(fn) {\n this.steps.push(v => fn(v) ? v : HaltChainable);\n return this;\n }\n reduce(merge, initial) {\n let last = initial;\n this.steps.push(v => {\n last = merge(last, v);\n return last;\n });\n return this;\n }\n latch(equals = (a, b) => a === b) {\n let firstCall = true;\n let cache;\n this.steps.push(value => {\n const shouldEmit = firstCall || !equals(value, cache);\n firstCall = false;\n cache = value;\n return shouldEmit ? value : HaltChainable;\n });\n return this;\n }\n evaluate(value) {\n for (const step of this.steps) {\n value = step(value);\n if (value === HaltChainable) {\n break;\n }\n }\n return value;\n }\n }\n /**\n * Creates an {@link Event} from a node event emitter.\n */\n function fromNodeEventEmitter(emitter, eventName, map = id => id) {\n const fn = (...args) => result.fire(map(...args));\n const onFirstListenerAdd = () => emitter.on(eventName, fn);\n const onLastListenerRemove = () => emitter.removeListener(eventName, fn);\n const result = new Emitter({ onWillAddFirstListener: onFirstListenerAdd, onDidRemoveLastListener: onLastListenerRemove });\n return result.event;\n }\n Event.fromNodeEventEmitter = fromNodeEventEmitter;\n /**\n * Creates an {@link Event} from a DOM event emitter.\n */\n function fromDOMEventEmitter(emitter, eventName, map = id => id) {\n const fn = (...args) => result.fire(map(...args));\n const onFirstListenerAdd = () => emitter.addEventListener(eventName, fn);\n const onLastListenerRemove = () => emitter.removeEventListener(eventName, fn);\n const result = new Emitter({ onWillAddFirstListener: onFirstListenerAdd, onDidRemoveLastListener: onLastListenerRemove });\n return result.event;\n }\n Event.fromDOMEventEmitter = fromDOMEventEmitter;\n /**\n * Creates a promise out of an event, using the {@link Event.once} helper.\n */\n function toPromise(event) {\n return new Promise(resolve => once(event)(resolve));\n }\n Event.toPromise = toPromise;\n /**\n * Creates an event out of a promise that fires once when the promise is\n * resolved with the result of the promise or `undefined`.\n */\n function fromPromise(promise) {\n const result = new Emitter();\n promise.then(res => {\n result.fire(res);\n }, () => {\n result.fire(undefined);\n }).finally(() => {\n result.dispose();\n });\n return result.event;\n }\n Event.fromPromise = fromPromise;\n function runAndSubscribe(event, handler, initial) {\n handler(initial);\n return event(e => handler(e));\n }\n Event.runAndSubscribe = runAndSubscribe;\n class EmitterObserver {\n constructor(_observable, store) {\n this._observable = _observable;\n this._counter = 0;\n this._hasChanged = false;\n const options = {\n onWillAddFirstListener: () => {\n _observable.addObserver(this);\n },\n onDidRemoveLastListener: () => {\n _observable.removeObserver(this);\n }\n };\n if (!store) {\n _addLeakageTraceLogic(options);\n }\n this.emitter = new Emitter(options);\n if (store) {\n store.add(this.emitter);\n }\n }\n beginUpdate(_observable) {\n // assert(_observable === this.obs);\n this._counter++;\n }\n handlePossibleChange(_observable) {\n // assert(_observable === this.obs);\n }\n handleChange(_observable, _change) {\n // assert(_observable === this.obs);\n this._hasChanged = true;\n }\n endUpdate(_observable) {\n // assert(_observable === this.obs);\n this._counter--;\n if (this._counter === 0) {\n this._observable.reportChanges();\n if (this._hasChanged) {\n this._hasChanged = false;\n this.emitter.fire(this._observable.get());\n }\n }\n }\n }\n /**\n * Creates an event emitter that is fired when the observable changes.\n * Each listeners subscribes to the emitter.\n */\n function fromObservable(obs, store) {\n const observer = new EmitterObserver(obs, store);\n return observer.emitter.event;\n }\n Event.fromObservable = fromObservable;\n /**\n * Each listener is attached to the observable directly.\n */\n function fromObservableLight(observable) {\n return (listener, thisArgs, disposables) => {\n let count = 0;\n let didChange = false;\n const observer = {\n beginUpdate() {\n count++;\n },\n endUpdate() {\n count--;\n if (count === 0) {\n observable.reportChanges();\n if (didChange) {\n didChange = false;\n listener.call(thisArgs);\n }\n }\n },\n handlePossibleChange() {\n // noop\n },\n handleChange() {\n didChange = true;\n }\n };\n observable.addObserver(observer);\n observable.reportChanges();\n const disposable = {\n dispose() {\n observable.removeObserver(observer);\n }\n };\n if (disposables instanceof DisposableStore) {\n disposables.add(disposable);\n }\n else if (Array.isArray(disposables)) {\n disposables.push(disposable);\n }\n return disposable;\n };\n }\n Event.fromObservableLight = fromObservableLight;\n})(Event || (Event = {}));\nexport class EventProfiling {\n constructor(name) {\n this.listenerCount = 0;\n this.invocationCount = 0;\n this.elapsedOverall = 0;\n this.durations = [];\n this.name = `${name}_${EventProfiling._idPool++}`;\n EventProfiling.all.add(this);\n }\n start(listenerCount) {\n this._stopWatch = new StopWatch();\n this.listenerCount = listenerCount;\n }\n stop() {\n if (this._stopWatch) {\n const elapsed = this._stopWatch.elapsed();\n this.durations.push(elapsed);\n this.elapsedOverall += elapsed;\n this.invocationCount += 1;\n this._stopWatch = undefined;\n }\n }\n}\nEventProfiling.all = new Set();\nEventProfiling._idPool = 0;\nlet _globalLeakWarningThreshold = -1;\nclass LeakageMonitor {\n constructor(threshold, name = Math.random().toString(18).slice(2, 5)) {\n this.threshold = threshold;\n this.name = name;\n this._warnCountdown = 0;\n }\n dispose() {\n var _a;\n (_a = this._stacks) === null || _a === void 0 ? void 0 : _a.clear();\n }\n check(stack, listenerCount) {\n const threshold = this.threshold;\n if (threshold <= 0 || listenerCount < threshold) {\n return undefined;\n }\n if (!this._stacks) {\n this._stacks = new Map();\n }\n const count = (this._stacks.get(stack.value) || 0);\n this._stacks.set(stack.value, count + 1);\n this._warnCountdown -= 1;\n if (this._warnCountdown <= 0) {\n // only warn on first exceed and then every time the limit\n // is exceeded by 50% again\n this._warnCountdown = threshold * 0.5;\n // find most frequent listener and print warning\n let topStack;\n let topCount = 0;\n for (const [stack, count] of this._stacks) {\n if (!topStack || topCount < count) {\n topStack = stack;\n topCount = count;\n }\n }\n console.warn(`[${this.name}] potential listener LEAK detected, having ${listenerCount} listeners already. MOST frequent listener (${topCount}):`);\n console.warn(topStack);\n }\n return () => {\n const count = (this._stacks.get(stack.value) || 0);\n this._stacks.set(stack.value, count - 1);\n };\n }\n}\nclass Stacktrace {\n static create() {\n var _a;\n return new Stacktrace((_a = new Error().stack) !== null && _a !== void 0 ? _a : '');\n }\n constructor(value) {\n this.value = value;\n }\n print() {\n console.warn(this.value.split('\\n').slice(2).join('\\n'));\n }\n}\nclass UniqueContainer {\n constructor(value) {\n this.value = value;\n }\n}\nconst compactionThreshold = 2;\nconst forEachListener = (listeners, fn) => {\n if (listeners instanceof UniqueContainer) {\n fn(listeners);\n }\n else {\n for (let i = 0; i < listeners.length; i++) {\n const l = listeners[i];\n if (l) {\n fn(l);\n }\n }\n }\n};\nconst _listenerFinalizers = _enableListenerGCedWarning\n ? new FinalizationRegistry(heldValue => {\n if (typeof heldValue === 'string') {\n console.warn('[LEAKING LISTENER] GC\\'ed a listener that was NOT yet disposed. This is where is was created:');\n console.warn(heldValue);\n }\n })\n : undefined;\n/**\n * The Emitter can be used to expose an Event to the public\n * to fire it from the insides.\n * Sample:\n class Document {\n\n private readonly _onDidChange = new Emitter<(value:string)=>any>();\n\n public onDidChange = this._onDidChange.event;\n\n // getter-style\n // get onDidChange(): Event<(value:string)=>any> {\n // \treturn this._onDidChange.event;\n // }\n\n private _doIt() {\n //...\n this._onDidChange.fire(value);\n }\n }\n */\nexport class Emitter {\n constructor(options) {\n var _a, _b, _c, _d, _e;\n this._size = 0;\n this._options = options;\n this._leakageMon = _globalLeakWarningThreshold > 0 || ((_a = this._options) === null || _a === void 0 ? void 0 : _a.leakWarningThreshold) ? new LeakageMonitor((_c = (_b = this._options) === null || _b === void 0 ? void 0 : _b.leakWarningThreshold) !== null && _c !== void 0 ? _c : _globalLeakWarningThreshold) : undefined;\n this._perfMon = ((_d = this._options) === null || _d === void 0 ? void 0 : _d._profName) ? new EventProfiling(this._options._profName) : undefined;\n this._deliveryQueue = (_e = this._options) === null || _e === void 0 ? void 0 : _e.deliveryQueue;\n }\n dispose() {\n var _a, _b, _c, _d;\n if (!this._disposed) {\n this._disposed = true;\n // It is bad to have listeners at the time of disposing an emitter, it is worst to have listeners keep the emitter\n // alive via the reference that's embedded in their disposables. Therefore we loop over all remaining listeners and\n // unset their subscriptions/disposables. Looping and blaming remaining listeners is done on next tick because the\n // the following programming pattern is very popular:\n //\n // const someModel = this._disposables.add(new ModelObject()); // (1) create and register model\n // this._disposables.add(someModel.onDidChange(() => { ... }); // (2) subscribe and register model-event listener\n // ...later...\n // this._disposables.dispose(); disposes (1) then (2): don't warn after (1) but after the \"overall dispose\" is done\n if (((_a = this._deliveryQueue) === null || _a === void 0 ? void 0 : _a.current) === this) {\n this._deliveryQueue.reset();\n }\n if (this._listeners) {\n if (_enableDisposeWithListenerWarning) {\n const listeners = this._listeners;\n queueMicrotask(() => {\n forEachListener(listeners, l => { var _a; return (_a = l.stack) === null || _a === void 0 ? void 0 : _a.print(); });\n });\n }\n this._listeners = undefined;\n this._size = 0;\n }\n (_c = (_b = this._options) === null || _b === void 0 ? void 0 : _b.onDidRemoveLastListener) === null || _c === void 0 ? void 0 : _c.call(_b);\n (_d = this._leakageMon) === null || _d === void 0 ? void 0 : _d.dispose();\n }\n }\n /**\n * For the public to allow to subscribe\n * to events from this Emitter\n */\n get event() {\n var _a;\n (_a = this._event) !== null && _a !== void 0 ? _a : (this._event = (callback, thisArgs, disposables) => {\n var _a, _b, _c, _d, _e;\n if (this._leakageMon && this._size > this._leakageMon.threshold * 3) {\n console.warn(`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far`);\n return Disposable.None;\n }\n if (this._disposed) {\n // todo: should we warn if a listener is added to a disposed emitter? This happens often\n return Disposable.None;\n }\n if (thisArgs) {\n callback = callback.bind(thisArgs);\n }\n const contained = new UniqueContainer(callback);\n let removeMonitor;\n let stack;\n if (this._leakageMon && this._size >= Math.ceil(this._leakageMon.threshold * 0.2)) {\n // check and record this emitter for potential leakage\n contained.stack = Stacktrace.create();\n removeMonitor = this._leakageMon.check(contained.stack, this._size + 1);\n }\n if (_enableDisposeWithListenerWarning) {\n contained.stack = stack !== null && stack !== void 0 ? stack : Stacktrace.create();\n }\n if (!this._listeners) {\n (_b = (_a = this._options) === null || _a === void 0 ? void 0 : _a.onWillAddFirstListener) === null || _b === void 0 ? void 0 : _b.call(_a, this);\n this._listeners = contained;\n (_d = (_c = this._options) === null || _c === void 0 ? void 0 : _c.onDidAddFirstListener) === null || _d === void 0 ? void 0 : _d.call(_c, this);\n }\n else if (this._listeners instanceof UniqueContainer) {\n (_e = this._deliveryQueue) !== null && _e !== void 0 ? _e : (this._deliveryQueue = new EventDeliveryQueuePrivate());\n this._listeners = [this._listeners, contained];\n }\n else {\n this._listeners.push(contained);\n }\n this._size++;\n const result = toDisposable(() => {\n _listenerFinalizers === null || _listenerFinalizers === void 0 ? void 0 : _listenerFinalizers.unregister(result);\n removeMonitor === null || removeMonitor === void 0 ? void 0 : removeMonitor();\n this._removeListener(contained);\n });\n if (disposables instanceof DisposableStore) {\n disposables.add(result);\n }\n else if (Array.isArray(disposables)) {\n disposables.push(result);\n }\n if (_listenerFinalizers) {\n const stack = new Error().stack.split('\\n').slice(2).join('\\n').trim();\n _listenerFinalizers.register(result, stack, result);\n }\n return result;\n });\n return this._event;\n }\n _removeListener(listener) {\n var _a, _b, _c, _d;\n (_b = (_a = this._options) === null || _a === void 0 ? void 0 : _a.onWillRemoveListener) === null || _b === void 0 ? void 0 : _b.call(_a, this);\n if (!this._listeners) {\n return; // expected if a listener gets disposed\n }\n if (this._size === 1) {\n this._listeners = undefined;\n (_d = (_c = this._options) === null || _c === void 0 ? void 0 : _c.onDidRemoveLastListener) === null || _d === void 0 ? void 0 : _d.call(_c, this);\n this._size = 0;\n return;\n }\n // size > 1 which requires that listeners be a list:\n const listeners = this._listeners;\n const index = listeners.indexOf(listener);\n if (index === -1) {\n console.log('disposed?', this._disposed);\n console.log('size?', this._size);\n console.log('arr?', JSON.stringify(this._listeners));\n throw new Error('Attempted to dispose unknown listener');\n }\n this._size--;\n listeners[index] = undefined;\n const adjustDeliveryQueue = this._deliveryQueue.current === this;\n if (this._size * compactionThreshold <= listeners.length) {\n let n = 0;\n for (let i = 0; i < listeners.length; i++) {\n if (listeners[i]) {\n listeners[n++] = listeners[i];\n }\n else if (adjustDeliveryQueue) {\n this._deliveryQueue.end--;\n if (n < this._deliveryQueue.i) {\n this._deliveryQueue.i--;\n }\n }\n }\n listeners.length = n;\n }\n }\n _deliver(listener, value) {\n var _a;\n if (!listener) {\n return;\n }\n const errorHandler = ((_a = this._options) === null || _a === void 0 ? void 0 : _a.onListenerError) || onUnexpectedError;\n if (!errorHandler) {\n listener.value(value);\n return;\n }\n try {\n listener.value(value);\n }\n catch (e) {\n errorHandler(e);\n }\n }\n /** Delivers items in the queue. Assumes the queue is ready to go. */\n _deliverQueue(dq) {\n const listeners = dq.current._listeners;\n while (dq.i < dq.end) {\n // important: dq.i is incremented before calling deliver() because it might reenter deliverQueue()\n this._deliver(listeners[dq.i++], dq.value);\n }\n dq.reset();\n }\n /**\n * To be kept private to fire an event to\n * subscribers\n */\n fire(event) {\n var _a, _b, _c, _d;\n if ((_a = this._deliveryQueue) === null || _a === void 0 ? void 0 : _a.current) {\n this._deliverQueue(this._deliveryQueue);\n (_b = this._perfMon) === null || _b === void 0 ? void 0 : _b.stop(); // last fire() will have starting perfmon, stop it before starting the next dispatch\n }\n (_c = this._perfMon) === null || _c === void 0 ? void 0 : _c.start(this._size);\n if (!this._listeners) {\n // no-op\n }\n else if (this._listeners instanceof UniqueContainer) {\n this._deliver(this._listeners, event);\n }\n else {\n const dq = this._deliveryQueue;\n dq.enqueue(this, event, this._listeners.length);\n this._deliverQueue(dq);\n }\n (_d = this._perfMon) === null || _d === void 0 ? void 0 : _d.stop();\n }\n hasListeners() {\n return this._size > 0;\n }\n}\nexport const createEventDeliveryQueue = () => new EventDeliveryQueuePrivate();\nclass EventDeliveryQueuePrivate {\n constructor() {\n /**\n * Index in current's listener list.\n */\n this.i = -1;\n /**\n * The last index in the listener's list to deliver.\n */\n this.end = 0;\n }\n enqueue(emitter, value, end) {\n this.i = 0;\n this.end = end;\n this.current = emitter;\n this.value = value;\n }\n reset() {\n this.i = this.end; // force any current emission loop to stop, mainly for during dispose\n this.current = undefined;\n this.value = undefined;\n }\n}\nexport class PauseableEmitter extends Emitter {\n constructor(options) {\n super(options);\n this._isPaused = 0;\n this._eventQueue = new LinkedList();\n this._mergeFn = options === null || options === void 0 ? void 0 : options.merge;\n }\n pause() {\n this._isPaused++;\n }\n resume() {\n if (this._isPaused !== 0 && --this._isPaused === 0) {\n if (this._mergeFn) {\n // use the merge function to create a single composite\n // event. make a copy in case firing pauses this emitter\n if (this._eventQueue.size > 0) {\n const events = Array.from(this._eventQueue);\n this._eventQueue.clear();\n super.fire(this._mergeFn(events));\n }\n }\n else {\n // no merging, fire each event individually and test\n // that this emitter isn't paused halfway through\n while (!this._isPaused && this._eventQueue.size !== 0) {\n super.fire(this._eventQueue.shift());\n }\n }\n }\n }\n fire(event) {\n if (this._size) {\n if (this._isPaused !== 0) {\n this._eventQueue.push(event);\n }\n else {\n super.fire(event);\n }\n }\n }\n}\nexport class DebounceEmitter extends PauseableEmitter {\n constructor(options) {\n var _a;\n super(options);\n this._delay = (_a = options.delay) !== null && _a !== void 0 ? _a : 100;\n }\n fire(event) {\n if (!this._handle) {\n this.pause();\n this._handle = setTimeout(() => {\n this._handle = undefined;\n this.resume();\n }, this._delay);\n }\n super.fire(event);\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 extends Emitter {\n constructor(options) {\n super(options);\n this._queuedEvents = [];\n this._mergeFn = options === null || options === void 0 ? void 0 : options.merge;\n }\n fire(event) {\n if (!this.hasListeners()) {\n return;\n }\n this._queuedEvents.push(event);\n if (this._queuedEvents.length === 1) {\n queueMicrotask(() => {\n if (this._mergeFn) {\n super.fire(this._mergeFn(this._queuedEvents));\n }\n else {\n this._queuedEvents.forEach(e => super.fire(e));\n }\n this._queuedEvents = [];\n });\n }\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();\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 {\n constructor() {\n this.hasListeners = false;\n this.events = [];\n this.emitter = new Emitter({\n onWillAddFirstListener: () => this.onFirstListenerAdd(),\n onDidRemoveLastListener: () => this.onLastListenerRemove()\n });\n }\n get event() {\n return this.emitter.event;\n }\n add(event) {\n const e = { event: event, listener: null };\n this.events.push(e);\n if (this.hasListeners) {\n this.hook(e);\n }\n const dispose = () => {\n if (this.hasListeners) {\n this.unhook(e);\n }\n const idx = this.events.indexOf(e);\n this.events.splice(idx, 1);\n };\n return toDisposable(createSingleCallFunction(dispose));\n }\n onFirstListenerAdd() {\n this.hasListeners = true;\n this.events.forEach(e => this.hook(e));\n }\n onLastListenerRemove() {\n this.hasListeners = false;\n this.events.forEach(e => this.unhook(e));\n }\n hook(e) {\n e.listener = e.event(r => this.emitter.fire(r));\n }\n unhook(e) {\n var _a;\n (_a = e.listener) === null || _a === void 0 ? void 0 : _a.dispose();\n e.listener = null;\n }\n dispose() {\n var _a;\n this.emitter.dispose();\n for (const e of this.events) {\n (_a = e.listener) === null || _a === void 0 ? void 0 : _a.dispose();\n }\n this.events = [];\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 constructor() {\n this.buffers = [];\n }\n wrapEvent(event) {\n return (listener, thisArgs, disposables) => {\n return event(i => {\n const buffer = this.buffers[this.buffers.length - 1];\n if (buffer) {\n buffer.push(() => listener.call(thisArgs, i));\n }\n else {\n listener.call(thisArgs, i);\n }\n }, undefined, disposables);\n };\n }\n bufferEvents(fn) {\n const buffer = [];\n this.buffers.push(buffer);\n const r = fn();\n this.buffers.pop();\n buffer.forEach(flush => flush());\n return r;\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 {\n constructor() {\n this.listening = false;\n this.inputEvent = Event.None;\n this.inputEventListener = Disposable.None;\n this.emitter = new Emitter({\n onDidAddFirstListener: () => {\n this.listening = true;\n this.inputEventListener = this.inputEvent(this.emitter.fire, this.emitter);\n },\n onDidRemoveLastListener: () => {\n this.listening = false;\n this.inputEventListener.dispose();\n }\n });\n this.event = this.emitter.event;\n }\n set input(event) {\n this.inputEvent = event;\n if (this.listening) {\n this.inputEventListener.dispose();\n this.inputEventListener = event(this.emitter.fire, this.emitter);\n }\n }\n dispose() {\n this.inputEventListener.dispose();\n this.emitter.dispose();\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 *--------------------------------------------------------------------------------------------*/\nimport { Emitter, Event } from './event.js';\nconst shortcutEvent = Object.freeze(function (callback, context) {\n const handle = setTimeout(callback.bind(context), 0);\n return { dispose() { clearTimeout(handle); } };\n});\nexport var CancellationToken;\n(function (CancellationToken) {\n function isCancellationToken(thing) {\n if (thing === CancellationToken.None || thing === CancellationToken.Cancelled) {\n return true;\n }\n if (thing instanceof MutableToken) {\n return true;\n }\n if (!thing || typeof thing !== 'object') {\n return false;\n }\n return typeof thing.isCancellationRequested === 'boolean'\n && typeof thing.onCancellationRequested === 'function';\n }\n CancellationToken.isCancellationToken = isCancellationToken;\n CancellationToken.None = Object.freeze({\n isCancellationRequested: false,\n onCancellationRequested: Event.None\n });\n CancellationToken.Cancelled = Object.freeze({\n isCancellationRequested: true,\n onCancellationRequested: shortcutEvent\n });\n})(CancellationToken || (CancellationToken = {}));\nclass MutableToken {\n constructor() {\n this._isCancelled = false;\n this._emitter = null;\n }\n cancel() {\n if (!this._isCancelled) {\n this._isCancelled = true;\n if (this._emitter) {\n this._emitter.fire(undefined);\n this.dispose();\n }\n }\n }\n get isCancellationRequested() {\n return this._isCancelled;\n }\n get onCancellationRequested() {\n if (this._isCancelled) {\n return shortcutEvent;\n }\n if (!this._emitter) {\n this._emitter = new Emitter();\n }\n return this._emitter.event;\n }\n dispose() {\n if (this._emitter) {\n this._emitter.dispose();\n this._emitter = null;\n }\n }\n}\nexport class CancellationTokenSource {\n constructor(parent) {\n this._token = undefined;\n this._parentListener = undefined;\n this._parentListener = parent && parent.onCancellationRequested(this.cancel, this);\n }\n get token() {\n if (!this._token) {\n // be lazy and create the token only when\n // actually needed\n this._token = new MutableToken();\n }\n return this._token;\n }\n cancel() {\n if (!this._token) {\n // save an object by returning the default\n // cancelled token when cancellation happens\n // before someone asks for the token\n this._token = CancellationToken.Cancelled;\n }\n else if (this._token instanceof MutableToken) {\n // actually cancel\n this._token.cancel();\n }\n }\n dispose(cancel = false) {\n var _a;\n if (cancel) {\n this.cancel();\n }\n (_a = this._parentListener) === null || _a === void 0 ? void 0 : _a.dispose();\n if (!this._token) {\n // ensure to initialize with an empty token if we had none\n this._token = CancellationToken.None;\n }\n else if (this._token instanceof MutableToken) {\n // actually dispose\n this._token.dispose();\n }\n }\n}\nexport function cancelOnDispose(store) {\n const source = new CancellationTokenSource();\n store.add({ dispose() { source.cancel(); } });\n return 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 *--------------------------------------------------------------------------------------------*/\nclass KeyCodeStrMap {\n constructor() {\n this._keyCodeToStr = [];\n this._strToKeyCode = Object.create(null);\n }\n define(keyCode, str) {\n this._keyCodeToStr[keyCode] = str;\n this._strToKeyCode[str.toLowerCase()] = keyCode;\n }\n keyCodeToStr(keyCode) {\n return this._keyCodeToStr[keyCode];\n }\n strToKeyCode(str) {\n return this._strToKeyCode[str.toLowerCase()] || 0 /* KeyCode.Unknown */;\n }\n}\nconst uiMap = new KeyCodeStrMap();\nconst userSettingsUSMap = new KeyCodeStrMap();\nconst userSettingsGeneralMap = new KeyCodeStrMap();\nexport const EVENT_KEY_CODE_MAP = new Array(230);\nexport const NATIVE_WINDOWS_KEY_CODE_TO_KEY_CODE = {};\nconst scanCodeIntToStr = [];\nconst scanCodeStrToInt = Object.create(null);\nconst scanCodeLowerCaseStrToInt = Object.create(null);\n/**\n * -1 if a ScanCode => KeyCode mapping depends on kb layout.\n */\nexport const IMMUTABLE_CODE_TO_KEY_CODE = [];\n/**\n * -1 if a KeyCode => ScanCode mapping depends on kb layout.\n */\nexport const IMMUTABLE_KEY_CODE_TO_CODE = [];\nfor (let i = 0; i <= 193 /* ScanCode.MAX_VALUE */; i++) {\n IMMUTABLE_CODE_TO_KEY_CODE[i] = -1 /* KeyCode.DependsOnKbLayout */;\n}\nfor (let i = 0; i <= 132 /* KeyCode.MAX_VALUE */; i++) {\n IMMUTABLE_KEY_CODE_TO_CODE[i] = -1 /* ScanCode.DependsOnKbLayout */;\n}\n(function () {\n // See https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx\n // See https://github.com/microsoft/node-native-keymap/blob/88c0b0e5/deps/chromium/keyboard_codes_win.h\n const empty = '';\n const mappings = [\n // immutable, scanCode, scanCodeStr, keyCode, keyCodeStr, eventKeyCode, vkey, usUserSettingsLabel, generalUserSettingsLabel\n [1, 0 /* ScanCode.None */, 'None', 0 /* KeyCode.Unknown */, 'unknown', 0, 'VK_UNKNOWN', empty, empty],\n [1, 1 /* ScanCode.Hyper */, 'Hyper', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 2 /* ScanCode.Super */, 'Super', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 3 /* ScanCode.Fn */, 'Fn', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 4 /* ScanCode.FnLock */, 'FnLock', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 5 /* ScanCode.Suspend */, 'Suspend', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 6 /* ScanCode.Resume */, 'Resume', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 7 /* ScanCode.Turbo */, 'Turbo', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 8 /* ScanCode.Sleep */, 'Sleep', 0 /* KeyCode.Unknown */, empty, 0, 'VK_SLEEP', empty, empty],\n [1, 9 /* ScanCode.WakeUp */, 'WakeUp', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [0, 10 /* ScanCode.KeyA */, 'KeyA', 31 /* KeyCode.KeyA */, 'A', 65, 'VK_A', empty, empty],\n [0, 11 /* ScanCode.KeyB */, 'KeyB', 32 /* KeyCode.KeyB */, 'B', 66, 'VK_B', empty, empty],\n [0, 12 /* ScanCode.KeyC */, 'KeyC', 33 /* KeyCode.KeyC */, 'C', 67, 'VK_C', empty, empty],\n [0, 13 /* ScanCode.KeyD */, 'KeyD', 34 /* KeyCode.KeyD */, 'D', 68, 'VK_D', empty, empty],\n [0, 14 /* ScanCode.KeyE */, 'KeyE', 35 /* KeyCode.KeyE */, 'E', 69, 'VK_E', empty, empty],\n [0, 15 /* ScanCode.KeyF */, 'KeyF', 36 /* KeyCode.KeyF */, 'F', 70, 'VK_F', empty, empty],\n [0, 16 /* ScanCode.KeyG */, 'KeyG', 37 /* KeyCode.KeyG */, 'G', 71, 'VK_G', empty, empty],\n [0, 17 /* ScanCode.KeyH */, 'KeyH', 38 /* KeyCode.KeyH */, 'H', 72, 'VK_H', empty, empty],\n [0, 18 /* ScanCode.KeyI */, 'KeyI', 39 /* KeyCode.KeyI */, 'I', 73, 'VK_I', empty, empty],\n [0, 19 /* ScanCode.KeyJ */, 'KeyJ', 40 /* KeyCode.KeyJ */, 'J', 74, 'VK_J', empty, empty],\n [0, 20 /* ScanCode.KeyK */, 'KeyK', 41 /* KeyCode.KeyK */, 'K', 75, 'VK_K', empty, empty],\n [0, 21 /* ScanCode.KeyL */, 'KeyL', 42 /* KeyCode.KeyL */, 'L', 76, 'VK_L', empty, empty],\n [0, 22 /* ScanCode.KeyM */, 'KeyM', 43 /* KeyCode.KeyM */, 'M', 77, 'VK_M', empty, empty],\n [0, 23 /* ScanCode.KeyN */, 'KeyN', 44 /* KeyCode.KeyN */, 'N', 78, 'VK_N', empty, empty],\n [0, 24 /* ScanCode.KeyO */, 'KeyO', 45 /* KeyCode.KeyO */, 'O', 79, 'VK_O', empty, empty],\n [0, 25 /* ScanCode.KeyP */, 'KeyP', 46 /* KeyCode.KeyP */, 'P', 80, 'VK_P', empty, empty],\n [0, 26 /* ScanCode.KeyQ */, 'KeyQ', 47 /* KeyCode.KeyQ */, 'Q', 81, 'VK_Q', empty, empty],\n [0, 27 /* ScanCode.KeyR */, 'KeyR', 48 /* KeyCode.KeyR */, 'R', 82, 'VK_R', empty, empty],\n [0, 28 /* ScanCode.KeyS */, 'KeyS', 49 /* KeyCode.KeyS */, 'S', 83, 'VK_S', empty, empty],\n [0, 29 /* ScanCode.KeyT */, 'KeyT', 50 /* KeyCode.KeyT */, 'T', 84, 'VK_T', empty, empty],\n [0, 30 /* ScanCode.KeyU */, 'KeyU', 51 /* KeyCode.KeyU */, 'U', 85, 'VK_U', empty, empty],\n [0, 31 /* ScanCode.KeyV */, 'KeyV', 52 /* KeyCode.KeyV */, 'V', 86, 'VK_V', empty, empty],\n [0, 32 /* ScanCode.KeyW */, 'KeyW', 53 /* KeyCode.KeyW */, 'W', 87, 'VK_W', empty, empty],\n [0, 33 /* ScanCode.KeyX */, 'KeyX', 54 /* KeyCode.KeyX */, 'X', 88, 'VK_X', empty, empty],\n [0, 34 /* ScanCode.KeyY */, 'KeyY', 55 /* KeyCode.KeyY */, 'Y', 89, 'VK_Y', empty, empty],\n [0, 35 /* ScanCode.KeyZ */, 'KeyZ', 56 /* KeyCode.KeyZ */, 'Z', 90, 'VK_Z', empty, empty],\n [0, 36 /* ScanCode.Digit1 */, 'Digit1', 22 /* KeyCode.Digit1 */, '1', 49, 'VK_1', empty, empty],\n [0, 37 /* ScanCode.Digit2 */, 'Digit2', 23 /* KeyCode.Digit2 */, '2', 50, 'VK_2', empty, empty],\n [0, 38 /* ScanCode.Digit3 */, 'Digit3', 24 /* KeyCode.Digit3 */, '3', 51, 'VK_3', empty, empty],\n [0, 39 /* ScanCode.Digit4 */, 'Digit4', 25 /* KeyCode.Digit4 */, '4', 52, 'VK_4', empty, empty],\n [0, 40 /* ScanCode.Digit5 */, 'Digit5', 26 /* KeyCode.Digit5 */, '5', 53, 'VK_5', empty, empty],\n [0, 41 /* ScanCode.Digit6 */, 'Digit6', 27 /* KeyCode.Digit6 */, '6', 54, 'VK_6', empty, empty],\n [0, 42 /* ScanCode.Digit7 */, 'Digit7', 28 /* KeyCode.Digit7 */, '7', 55, 'VK_7', empty, empty],\n [0, 43 /* ScanCode.Digit8 */, 'Digit8', 29 /* KeyCode.Digit8 */, '8', 56, 'VK_8', empty, empty],\n [0, 44 /* ScanCode.Digit9 */, 'Digit9', 30 /* KeyCode.Digit9 */, '9', 57, 'VK_9', empty, empty],\n [0, 45 /* ScanCode.Digit0 */, 'Digit0', 21 /* KeyCode.Digit0 */, '0', 48, 'VK_0', empty, empty],\n [1, 46 /* ScanCode.Enter */, 'Enter', 3 /* KeyCode.Enter */, 'Enter', 13, 'VK_RETURN', empty, empty],\n [1, 47 /* ScanCode.Escape */, 'Escape', 9 /* KeyCode.Escape */, 'Escape', 27, 'VK_ESCAPE', empty, empty],\n [1, 48 /* ScanCode.Backspace */, 'Backspace', 1 /* KeyCode.Backspace */, 'Backspace', 8, 'VK_BACK', empty, empty],\n [1, 49 /* ScanCode.Tab */, 'Tab', 2 /* KeyCode.Tab */, 'Tab', 9, 'VK_TAB', empty, empty],\n [1, 50 /* ScanCode.Space */, 'Space', 10 /* KeyCode.Space */, 'Space', 32, 'VK_SPACE', empty, empty],\n [0, 51 /* ScanCode.Minus */, 'Minus', 88 /* KeyCode.Minus */, '-', 189, 'VK_OEM_MINUS', '-', 'OEM_MINUS'],\n [0, 52 /* ScanCode.Equal */, 'Equal', 86 /* KeyCode.Equal */, '=', 187, 'VK_OEM_PLUS', '=', 'OEM_PLUS'],\n [0, 53 /* ScanCode.BracketLeft */, 'BracketLeft', 92 /* KeyCode.BracketLeft */, '[', 219, 'VK_OEM_4', '[', 'OEM_4'],\n [0, 54 /* ScanCode.BracketRight */, 'BracketRight', 94 /* KeyCode.BracketRight */, ']', 221, 'VK_OEM_6', ']', 'OEM_6'],\n [0, 55 /* ScanCode.Backslash */, 'Backslash', 93 /* KeyCode.Backslash */, '\\\\', 220, 'VK_OEM_5', '\\\\', 'OEM_5'],\n [0, 56 /* ScanCode.IntlHash */, 'IntlHash', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty], // has been dropped from the w3c spec\n [0, 57 /* ScanCode.Semicolon */, 'Semicolon', 85 /* KeyCode.Semicolon */, ';', 186, 'VK_OEM_1', ';', 'OEM_1'],\n [0, 58 /* ScanCode.Quote */, 'Quote', 95 /* KeyCode.Quote */, '\\'', 222, 'VK_OEM_7', '\\'', 'OEM_7'],\n [0, 59 /* ScanCode.Backquote */, 'Backquote', 91 /* KeyCode.Backquote */, '`', 192, 'VK_OEM_3', '`', 'OEM_3'],\n [0, 60 /* ScanCode.Comma */, 'Comma', 87 /* KeyCode.Comma */, ',', 188, 'VK_OEM_COMMA', ',', 'OEM_COMMA'],\n [0, 61 /* ScanCode.Period */, 'Period', 89 /* KeyCode.Period */, '.', 190, 'VK_OEM_PERIOD', '.', 'OEM_PERIOD'],\n [0, 62 /* ScanCode.Slash */, 'Slash', 90 /* KeyCode.Slash */, '/', 191, 'VK_OEM_2', '/', 'OEM_2'],\n [1, 63 /* ScanCode.CapsLock */, 'CapsLock', 8 /* KeyCode.CapsLock */, 'CapsLock', 20, 'VK_CAPITAL', empty, empty],\n [1, 64 /* ScanCode.F1 */, 'F1', 59 /* KeyCode.F1 */, 'F1', 112, 'VK_F1', empty, empty],\n [1, 65 /* ScanCode.F2 */, 'F2', 60 /* KeyCode.F2 */, 'F2', 113, 'VK_F2', empty, empty],\n [1, 66 /* ScanCode.F3 */, 'F3', 61 /* KeyCode.F3 */, 'F3', 114, 'VK_F3', empty, empty],\n [1, 67 /* ScanCode.F4 */, 'F4', 62 /* KeyCode.F4 */, 'F4', 115, 'VK_F4', empty, empty],\n [1, 68 /* ScanCode.F5 */, 'F5', 63 /* KeyCode.F5 */, 'F5', 116, 'VK_F5', empty, empty],\n [1, 69 /* ScanCode.F6 */, 'F6', 64 /* KeyCode.F6 */, 'F6', 117, 'VK_F6', empty, empty],\n [1, 70 /* ScanCode.F7 */, 'F7', 65 /* KeyCode.F7 */, 'F7', 118, 'VK_F7', empty, empty],\n [1, 71 /* ScanCode.F8 */, 'F8', 66 /* KeyCode.F8 */, 'F8', 119, 'VK_F8', empty, empty],\n [1, 72 /* ScanCode.F9 */, 'F9', 67 /* KeyCode.F9 */, 'F9', 120, 'VK_F9', empty, empty],\n [1, 73 /* ScanCode.F10 */, 'F10', 68 /* KeyCode.F10 */, 'F10', 121, 'VK_F10', empty, empty],\n [1, 74 /* ScanCode.F11 */, 'F11', 69 /* KeyCode.F11 */, 'F11', 122, 'VK_F11', empty, empty],\n [1, 75 /* ScanCode.F12 */, 'F12', 70 /* KeyCode.F12 */, 'F12', 123, 'VK_F12', empty, empty],\n [1, 76 /* ScanCode.PrintScreen */, 'PrintScreen', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 77 /* ScanCode.ScrollLock */, 'ScrollLock', 84 /* KeyCode.ScrollLock */, 'ScrollLock', 145, 'VK_SCROLL', empty, empty],\n [1, 78 /* ScanCode.Pause */, 'Pause', 7 /* KeyCode.PauseBreak */, 'PauseBreak', 19, 'VK_PAUSE', empty, empty],\n [1, 79 /* ScanCode.Insert */, 'Insert', 19 /* KeyCode.Insert */, 'Insert', 45, 'VK_INSERT', empty, empty],\n [1, 80 /* ScanCode.Home */, 'Home', 14 /* KeyCode.Home */, 'Home', 36, 'VK_HOME', empty, empty],\n [1, 81 /* ScanCode.PageUp */, 'PageUp', 11 /* KeyCode.PageUp */, 'PageUp', 33, 'VK_PRIOR', empty, empty],\n [1, 82 /* ScanCode.Delete */, 'Delete', 20 /* KeyCode.Delete */, 'Delete', 46, 'VK_DELETE', empty, empty],\n [1, 83 /* ScanCode.End */, 'End', 13 /* KeyCode.End */, 'End', 35, 'VK_END', empty, empty],\n [1, 84 /* ScanCode.PageDown */, 'PageDown', 12 /* KeyCode.PageDown */, 'PageDown', 34, 'VK_NEXT', empty, empty],\n [1, 85 /* ScanCode.ArrowRight */, 'ArrowRight', 17 /* KeyCode.RightArrow */, 'RightArrow', 39, 'VK_RIGHT', 'Right', empty],\n [1, 86 /* ScanCode.ArrowLeft */, 'ArrowLeft', 15 /* KeyCode.LeftArrow */, 'LeftArrow', 37, 'VK_LEFT', 'Left', empty],\n [1, 87 /* ScanCode.ArrowDown */, 'ArrowDown', 18 /* KeyCode.DownArrow */, 'DownArrow', 40, 'VK_DOWN', 'Down', empty],\n [1, 88 /* ScanCode.ArrowUp */, 'ArrowUp', 16 /* KeyCode.UpArrow */, 'UpArrow', 38, 'VK_UP', 'Up', empty],\n [1, 89 /* ScanCode.NumLock */, 'NumLock', 83 /* KeyCode.NumLock */, 'NumLock', 144, 'VK_NUMLOCK', empty, empty],\n [1, 90 /* ScanCode.NumpadDivide */, 'NumpadDivide', 113 /* KeyCode.NumpadDivide */, 'NumPad_Divide', 111, 'VK_DIVIDE', empty, empty],\n [1, 91 /* ScanCode.NumpadMultiply */, 'NumpadMultiply', 108 /* KeyCode.NumpadMultiply */, 'NumPad_Multiply', 106, 'VK_MULTIPLY', empty, empty],\n [1, 92 /* ScanCode.NumpadSubtract */, 'NumpadSubtract', 111 /* KeyCode.NumpadSubtract */, 'NumPad_Subtract', 109, 'VK_SUBTRACT', empty, empty],\n [1, 93 /* ScanCode.NumpadAdd */, 'NumpadAdd', 109 /* KeyCode.NumpadAdd */, 'NumPad_Add', 107, 'VK_ADD', empty, empty],\n [1, 94 /* ScanCode.NumpadEnter */, 'NumpadEnter', 3 /* KeyCode.Enter */, empty, 0, empty, empty, empty],\n [1, 95 /* ScanCode.Numpad1 */, 'Numpad1', 99 /* KeyCode.Numpad1 */, 'NumPad1', 97, 'VK_NUMPAD1', empty, empty],\n [1, 96 /* ScanCode.Numpad2 */, 'Numpad2', 100 /* KeyCode.Numpad2 */, 'NumPad2', 98, 'VK_NUMPAD2', empty, empty],\n [1, 97 /* ScanCode.Numpad3 */, 'Numpad3', 101 /* KeyCode.Numpad3 */, 'NumPad3', 99, 'VK_NUMPAD3', empty, empty],\n [1, 98 /* ScanCode.Numpad4 */, 'Numpad4', 102 /* KeyCode.Numpad4 */, 'NumPad4', 100, 'VK_NUMPAD4', empty, empty],\n [1, 99 /* ScanCode.Numpad5 */, 'Numpad5', 103 /* KeyCode.Numpad5 */, 'NumPad5', 101, 'VK_NUMPAD5', empty, empty],\n [1, 100 /* ScanCode.Numpad6 */, 'Numpad6', 104 /* KeyCode.Numpad6 */, 'NumPad6', 102, 'VK_NUMPAD6', empty, empty],\n [1, 101 /* ScanCode.Numpad7 */, 'Numpad7', 105 /* KeyCode.Numpad7 */, 'NumPad7', 103, 'VK_NUMPAD7', empty, empty],\n [1, 102 /* ScanCode.Numpad8 */, 'Numpad8', 106 /* KeyCode.Numpad8 */, 'NumPad8', 104, 'VK_NUMPAD8', empty, empty],\n [1, 103 /* ScanCode.Numpad9 */, 'Numpad9', 107 /* KeyCode.Numpad9 */, 'NumPad9', 105, 'VK_NUMPAD9', empty, empty],\n [1, 104 /* ScanCode.Numpad0 */, 'Numpad0', 98 /* KeyCode.Numpad0 */, 'NumPad0', 96, 'VK_NUMPAD0', empty, empty],\n [1, 105 /* ScanCode.NumpadDecimal */, 'NumpadDecimal', 112 /* KeyCode.NumpadDecimal */, 'NumPad_Decimal', 110, 'VK_DECIMAL', empty, empty],\n [0, 106 /* ScanCode.IntlBackslash */, 'IntlBackslash', 97 /* KeyCode.IntlBackslash */, 'OEM_102', 226, 'VK_OEM_102', empty, empty],\n [1, 107 /* ScanCode.ContextMenu */, 'ContextMenu', 58 /* KeyCode.ContextMenu */, 'ContextMenu', 93, empty, empty, empty],\n [1, 108 /* ScanCode.Power */, 'Power', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 109 /* ScanCode.NumpadEqual */, 'NumpadEqual', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 110 /* ScanCode.F13 */, 'F13', 71 /* KeyCode.F13 */, 'F13', 124, 'VK_F13', empty, empty],\n [1, 111 /* ScanCode.F14 */, 'F14', 72 /* KeyCode.F14 */, 'F14', 125, 'VK_F14', empty, empty],\n [1, 112 /* ScanCode.F15 */, 'F15', 73 /* KeyCode.F15 */, 'F15', 126, 'VK_F15', empty, empty],\n [1, 113 /* ScanCode.F16 */, 'F16', 74 /* KeyCode.F16 */, 'F16', 127, 'VK_F16', empty, empty],\n [1, 114 /* ScanCode.F17 */, 'F17', 75 /* KeyCode.F17 */, 'F17', 128, 'VK_F17', empty, empty],\n [1, 115 /* ScanCode.F18 */, 'F18', 76 /* KeyCode.F18 */, 'F18', 129, 'VK_F18', empty, empty],\n [1, 116 /* ScanCode.F19 */, 'F19', 77 /* KeyCode.F19 */, 'F19', 130, 'VK_F19', empty, empty],\n [1, 117 /* ScanCode.F20 */, 'F20', 78 /* KeyCode.F20 */, 'F20', 131, 'VK_F20', empty, empty],\n [1, 118 /* ScanCode.F21 */, 'F21', 79 /* KeyCode.F21 */, 'F21', 132, 'VK_F21', empty, empty],\n [1, 119 /* ScanCode.F22 */, 'F22', 80 /* KeyCode.F22 */, 'F22', 133, 'VK_F22', empty, empty],\n [1, 120 /* ScanCode.F23 */, 'F23', 81 /* KeyCode.F23 */, 'F23', 134, 'VK_F23', empty, empty],\n [1, 121 /* ScanCode.F24 */, 'F24', 82 /* KeyCode.F24 */, 'F24', 135, 'VK_F24', empty, empty],\n [1, 122 /* ScanCode.Open */, 'Open', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 123 /* ScanCode.Help */, 'Help', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 124 /* ScanCode.Select */, 'Select', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 125 /* ScanCode.Again */, 'Again', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 126 /* ScanCode.Undo */, 'Undo', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 127 /* ScanCode.Cut */, 'Cut', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 128 /* ScanCode.Copy */, 'Copy', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 129 /* ScanCode.Paste */, 'Paste', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 130 /* ScanCode.Find */, 'Find', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 131 /* ScanCode.AudioVolumeMute */, 'AudioVolumeMute', 117 /* KeyCode.AudioVolumeMute */, 'AudioVolumeMute', 173, 'VK_VOLUME_MUTE', empty, empty],\n [1, 132 /* ScanCode.AudioVolumeUp */, 'AudioVolumeUp', 118 /* KeyCode.AudioVolumeUp */, 'AudioVolumeUp', 175, 'VK_VOLUME_UP', empty, empty],\n [1, 133 /* ScanCode.AudioVolumeDown */, 'AudioVolumeDown', 119 /* KeyCode.AudioVolumeDown */, 'AudioVolumeDown', 174, 'VK_VOLUME_DOWN', empty, empty],\n [1, 134 /* ScanCode.NumpadComma */, 'NumpadComma', 110 /* KeyCode.NUMPAD_SEPARATOR */, 'NumPad_Separator', 108, 'VK_SEPARATOR', empty, empty],\n [0, 135 /* ScanCode.IntlRo */, 'IntlRo', 115 /* KeyCode.ABNT_C1 */, 'ABNT_C1', 193, 'VK_ABNT_C1', empty, empty],\n [1, 136 /* ScanCode.KanaMode */, 'KanaMode', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [0, 137 /* ScanCode.IntlYen */, 'IntlYen', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 138 /* ScanCode.Convert */, 'Convert', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 139 /* ScanCode.NonConvert */, 'NonConvert', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 140 /* ScanCode.Lang1 */, 'Lang1', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 141 /* ScanCode.Lang2 */, 'Lang2', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 142 /* ScanCode.Lang3 */, 'Lang3', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 143 /* ScanCode.Lang4 */, 'Lang4', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 144 /* ScanCode.Lang5 */, 'Lang5', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 145 /* ScanCode.Abort */, 'Abort', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 146 /* ScanCode.Props */, 'Props', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 147 /* ScanCode.NumpadParenLeft */, 'NumpadParenLeft', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 148 /* ScanCode.NumpadParenRight */, 'NumpadParenRight', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 149 /* ScanCode.NumpadBackspace */, 'NumpadBackspace', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 150 /* ScanCode.NumpadMemoryStore */, 'NumpadMemoryStore', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 151 /* ScanCode.NumpadMemoryRecall */, 'NumpadMemoryRecall', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 152 /* ScanCode.NumpadMemoryClear */, 'NumpadMemoryClear', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 153 /* ScanCode.NumpadMemoryAdd */, 'NumpadMemoryAdd', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 154 /* ScanCode.NumpadMemorySubtract */, 'NumpadMemorySubtract', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 155 /* ScanCode.NumpadClear */, 'NumpadClear', 131 /* KeyCode.Clear */, 'Clear', 12, 'VK_CLEAR', empty, empty],\n [1, 156 /* ScanCode.NumpadClearEntry */, 'NumpadClearEntry', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 0 /* ScanCode.None */, empty, 5 /* KeyCode.Ctrl */, 'Ctrl', 17, 'VK_CONTROL', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 4 /* KeyCode.Shift */, 'Shift', 16, 'VK_SHIFT', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 6 /* KeyCode.Alt */, 'Alt', 18, 'VK_MENU', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 57 /* KeyCode.Meta */, 'Meta', 91, 'VK_COMMAND', empty, empty],\n [1, 157 /* ScanCode.ControlLeft */, 'ControlLeft', 5 /* KeyCode.Ctrl */, empty, 0, 'VK_LCONTROL', empty, empty],\n [1, 158 /* ScanCode.ShiftLeft */, 'ShiftLeft', 4 /* KeyCode.Shift */, empty, 0, 'VK_LSHIFT', empty, empty],\n [1, 159 /* ScanCode.AltLeft */, 'AltLeft', 6 /* KeyCode.Alt */, empty, 0, 'VK_LMENU', empty, empty],\n [1, 160 /* ScanCode.MetaLeft */, 'MetaLeft', 57 /* KeyCode.Meta */, empty, 0, 'VK_LWIN', empty, empty],\n [1, 161 /* ScanCode.ControlRight */, 'ControlRight', 5 /* KeyCode.Ctrl */, empty, 0, 'VK_RCONTROL', empty, empty],\n [1, 162 /* ScanCode.ShiftRight */, 'ShiftRight', 4 /* KeyCode.Shift */, empty, 0, 'VK_RSHIFT', empty, empty],\n [1, 163 /* ScanCode.AltRight */, 'AltRight', 6 /* KeyCode.Alt */, empty, 0, 'VK_RMENU', empty, empty],\n [1, 164 /* ScanCode.MetaRight */, 'MetaRight', 57 /* KeyCode.Meta */, empty, 0, 'VK_RWIN', empty, empty],\n [1, 165 /* ScanCode.BrightnessUp */, 'BrightnessUp', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 166 /* ScanCode.BrightnessDown */, 'BrightnessDown', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 167 /* ScanCode.MediaPlay */, 'MediaPlay', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 168 /* ScanCode.MediaRecord */, 'MediaRecord', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 169 /* ScanCode.MediaFastForward */, 'MediaFastForward', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 170 /* ScanCode.MediaRewind */, 'MediaRewind', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 171 /* ScanCode.MediaTrackNext */, 'MediaTrackNext', 124 /* KeyCode.MediaTrackNext */, 'MediaTrackNext', 176, 'VK_MEDIA_NEXT_TRACK', empty, empty],\n [1, 172 /* ScanCode.MediaTrackPrevious */, 'MediaTrackPrevious', 125 /* KeyCode.MediaTrackPrevious */, 'MediaTrackPrevious', 177, 'VK_MEDIA_PREV_TRACK', empty, empty],\n [1, 173 /* ScanCode.MediaStop */, 'MediaStop', 126 /* KeyCode.MediaStop */, 'MediaStop', 178, 'VK_MEDIA_STOP', empty, empty],\n [1, 174 /* ScanCode.Eject */, 'Eject', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 175 /* ScanCode.MediaPlayPause */, 'MediaPlayPause', 127 /* KeyCode.MediaPlayPause */, 'MediaPlayPause', 179, 'VK_MEDIA_PLAY_PAUSE', empty, empty],\n [1, 176 /* ScanCode.MediaSelect */, 'MediaSelect', 128 /* KeyCode.LaunchMediaPlayer */, 'LaunchMediaPlayer', 181, 'VK_MEDIA_LAUNCH_MEDIA_SELECT', empty, empty],\n [1, 177 /* ScanCode.LaunchMail */, 'LaunchMail', 129 /* KeyCode.LaunchMail */, 'LaunchMail', 180, 'VK_MEDIA_LAUNCH_MAIL', empty, empty],\n [1, 178 /* ScanCode.LaunchApp2 */, 'LaunchApp2', 130 /* KeyCode.LaunchApp2 */, 'LaunchApp2', 183, 'VK_MEDIA_LAUNCH_APP2', empty, empty],\n [1, 179 /* ScanCode.LaunchApp1 */, 'LaunchApp1', 0 /* KeyCode.Unknown */, empty, 0, 'VK_MEDIA_LAUNCH_APP1', empty, empty],\n [1, 180 /* ScanCode.SelectTask */, 'SelectTask', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 181 /* ScanCode.LaunchScreenSaver */, 'LaunchScreenSaver', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 182 /* ScanCode.BrowserSearch */, 'BrowserSearch', 120 /* KeyCode.BrowserSearch */, 'BrowserSearch', 170, 'VK_BROWSER_SEARCH', empty, empty],\n [1, 183 /* ScanCode.BrowserHome */, 'BrowserHome', 121 /* KeyCode.BrowserHome */, 'BrowserHome', 172, 'VK_BROWSER_HOME', empty, empty],\n [1, 184 /* ScanCode.BrowserBack */, 'BrowserBack', 122 /* KeyCode.BrowserBack */, 'BrowserBack', 166, 'VK_BROWSER_BACK', empty, empty],\n [1, 185 /* ScanCode.BrowserForward */, 'BrowserForward', 123 /* KeyCode.BrowserForward */, 'BrowserForward', 167, 'VK_BROWSER_FORWARD', empty, empty],\n [1, 186 /* ScanCode.BrowserStop */, 'BrowserStop', 0 /* KeyCode.Unknown */, empty, 0, 'VK_BROWSER_STOP', empty, empty],\n [1, 187 /* ScanCode.BrowserRefresh */, 'BrowserRefresh', 0 /* KeyCode.Unknown */, empty, 0, 'VK_BROWSER_REFRESH', empty, empty],\n [1, 188 /* ScanCode.BrowserFavorites */, 'BrowserFavorites', 0 /* KeyCode.Unknown */, empty, 0, 'VK_BROWSER_FAVORITES', empty, empty],\n [1, 189 /* ScanCode.ZoomToggle */, 'ZoomToggle', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 190 /* ScanCode.MailReply */, 'MailReply', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 191 /* ScanCode.MailForward */, 'MailForward', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n [1, 192 /* ScanCode.MailSend */, 'MailSend', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty],\n // See https://lists.w3.org/Archives/Public/www-dom/2010JulSep/att-0182/keyCode-spec.html\n // If an Input Method Editor is processing key input and the event is keydown, return 229.\n [1, 0 /* ScanCode.None */, empty, 114 /* KeyCode.KEY_IN_COMPOSITION */, 'KeyInComposition', 229, empty, empty, empty],\n [1, 0 /* ScanCode.None */, empty, 116 /* KeyCode.ABNT_C2 */, 'ABNT_C2', 194, 'VK_ABNT_C2', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 96 /* KeyCode.OEM_8 */, 'OEM_8', 223, 'VK_OEM_8', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_KANA', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_HANGUL', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_JUNJA', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_FINAL', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_HANJA', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_KANJI', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_CONVERT', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_NONCONVERT', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_ACCEPT', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_MODECHANGE', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_SELECT', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_PRINT', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_EXECUTE', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_SNAPSHOT', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_HELP', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_APPS', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_PROCESSKEY', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_PACKET', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_DBE_SBCSCHAR', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_DBE_DBCSCHAR', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_ATTN', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_CRSEL', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_EXSEL', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_EREOF', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_PLAY', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_ZOOM', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_NONAME', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_PA1', empty, empty],\n [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_OEM_CLEAR', empty, empty],\n ];\n const seenKeyCode = [];\n const seenScanCode = [];\n for (const mapping of mappings) {\n const [immutable, scanCode, scanCodeStr, keyCode, keyCodeStr, eventKeyCode, vkey, usUserSettingsLabel, generalUserSettingsLabel] = mapping;\n if (!seenScanCode[scanCode]) {\n seenScanCode[scanCode] = true;\n scanCodeIntToStr[scanCode] = scanCodeStr;\n scanCodeStrToInt[scanCodeStr] = scanCode;\n scanCodeLowerCaseStrToInt[scanCodeStr.toLowerCase()] = scanCode;\n if (immutable) {\n IMMUTABLE_CODE_TO_KEY_CODE[scanCode] = keyCode;\n if ((keyCode !== 0 /* KeyCode.Unknown */)\n && (keyCode !== 3 /* KeyCode.Enter */)\n && (keyCode !== 5 /* KeyCode.Ctrl */)\n && (keyCode !== 4 /* KeyCode.Shift */)\n && (keyCode !== 6 /* KeyCode.Alt */)\n && (keyCode !== 57 /* KeyCode.Meta */)) {\n IMMUTABLE_KEY_CODE_TO_CODE[keyCode] = scanCode;\n }\n }\n }\n if (!seenKeyCode[keyCode]) {\n seenKeyCode[keyCode] = true;\n if (!keyCodeStr) {\n throw new Error(`String representation missing for key code ${keyCode} around scan code ${scanCodeStr}`);\n }\n uiMap.define(keyCode, keyCodeStr);\n userSettingsUSMap.define(keyCode, usUserSettingsLabel || keyCodeStr);\n userSettingsGeneralMap.define(keyCode, generalUserSettingsLabel || usUserSettingsLabel || keyCodeStr);\n }\n if (eventKeyCode) {\n EVENT_KEY_CODE_MAP[eventKeyCode] = keyCode;\n }\n if (vkey) {\n NATIVE_WINDOWS_KEY_CODE_TO_KEY_CODE[vkey] = keyCode;\n }\n }\n // Manually added due to the exclusion above (due to duplication with NumpadEnter)\n IMMUTABLE_KEY_CODE_TO_CODE[3 /* KeyCode.Enter */] = 46 /* ScanCode.Enter */;\n})();\nexport var KeyCodeUtils;\n(function (KeyCodeUtils) {\n function toString(keyCode) {\n return uiMap.keyCodeToStr(keyCode);\n }\n KeyCodeUtils.toString = toString;\n function fromString(key) {\n return uiMap.strToKeyCode(key);\n }\n KeyCodeUtils.fromString = fromString;\n function toUserSettingsUS(keyCode) {\n return userSettingsUSMap.keyCodeToStr(keyCode);\n }\n KeyCodeUtils.toUserSettingsUS = toUserSettingsUS;\n function toUserSettingsGeneral(keyCode) {\n return userSettingsGeneralMap.keyCodeToStr(keyCode);\n }\n KeyCodeUtils.toUserSettingsGeneral = toUserSettingsGeneral;\n function fromUserSettings(key) {\n return userSettingsUSMap.strToKeyCode(key) || userSettingsGeneralMap.strToKeyCode(key);\n }\n KeyCodeUtils.fromUserSettings = fromUserSettings;\n function toElectronAccelerator(keyCode) {\n if (keyCode >= 98 /* KeyCode.Numpad0 */ && keyCode <= 113 /* KeyCode.NumpadDivide */) {\n // [Electron Accelerators] Electron is able to parse numpad keys, but unfortunately it\n // renders them just as regular keys in menus. For example, num0 is rendered as \"0\",\n // numdiv is rendered as \"/\", numsub is rendered as \"-\".\n //\n // This can lead to incredible confusion, as it makes numpad based keybindings indistinguishable\n // from keybindings based on regular keys.\n //\n // We therefore need to fall back to custom rendering for numpad keys.\n return null;\n }\n switch (keyCode) {\n case 16 /* KeyCode.UpArrow */:\n return 'Up';\n case 18 /* KeyCode.DownArrow */:\n return 'Down';\n case 15 /* KeyCode.LeftArrow */:\n return 'Left';\n case 17 /* KeyCode.RightArrow */:\n return 'Right';\n }\n return uiMap.keyCodeToStr(keyCode);\n }\n KeyCodeUtils.toElectronAccelerator = toElectronAccelerator;\n})(KeyCodeUtils || (KeyCodeUtils = {}));\nexport function KeyChord(firstPart, secondPart) {\n const chordPart = ((secondPart & 0x0000FFFF) << 16) >>> 0;\n return (firstPart | chordPart) >>> 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 *--------------------------------------------------------------------------------------------*/\nimport { isMacintosh, isWindows } from './platform.js';\nlet safeProcess;\n// Native sandbox environment\nconst vscodeGlobal = globalThis.vscode;\nif (typeof vscodeGlobal !== 'undefined' && typeof vscodeGlobal.process !== 'undefined') {\n const sandboxProcess = vscodeGlobal.process;\n safeProcess = {\n get platform() { return sandboxProcess.platform; },\n get arch() { return sandboxProcess.arch; },\n get env() { return sandboxProcess.env; },\n cwd() { return sandboxProcess.cwd(); }\n };\n}\n// Native node.js environment\nelse if (typeof process !== 'undefined') {\n safeProcess = {\n get platform() { return process.platform; },\n get arch() { return process.arch; },\n get env() { return process.env; },\n cwd() { return process.env['VSCODE_CWD'] || process.cwd(); }\n };\n}\n// Web environment\nelse {\n safeProcess = {\n // Supported\n get platform() { return isWindows ? 'win32' : isMacintosh ? 'darwin' : 'linux'; },\n get arch() { return undefined; /* arch is undefined in web */ },\n // Unsupported\n get env() { return {}; },\n cwd() { return '/'; }\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 * 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 * Provides safe access to the `platform` property in node.js, sandboxed or web\n * environments.\n */\nexport const platform = safeProcess.platform;\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\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/blob/v16.14.2/lib/path.js\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 */\nimport * as process from './process.js';\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; /* ? */\nclass ErrorInvalidArgType extends Error {\n constructor(name, expected, actual) {\n // determiner: 'must be' or 'must not be'\n let determiner;\n if (typeof expected === 'string' && expected.indexOf('not ') === 0) {\n determiner = 'must not be';\n expected = expected.replace(/^not /, '');\n }\n else {\n determiner = 'must be';\n }\n const type = name.indexOf('.') !== -1 ? 'property' : 'argument';\n let msg = `The \"${name}\" ${type} ${determiner} of type ${expected}`;\n msg += `. Received type ${typeof actual}`;\n super(msg);\n this.code = 'ERR_INVALID_ARG_TYPE';\n }\n}\nfunction validateObject(pathObject, name) {\n if (pathObject === null || typeof pathObject !== 'object') {\n throw new ErrorInvalidArgType(name, 'Object', pathObject);\n }\n}\nfunction validateString(value, name) {\n if (typeof value !== 'string') {\n throw new ErrorInvalidArgType(name, 'string', value);\n }\n}\nconst platformIsWin32 = (process.platform === 'win32');\nfunction isPathSeparator(code) {\n return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;\n}\nfunction isPosixPathSeparator(code) {\n return code === CHAR_FORWARD_SLASH;\n}\nfunction isWindowsDeviceRoot(code) {\n return (code >= CHAR_UPPERCASE_A && code <= CHAR_UPPERCASE_Z) ||\n (code >= CHAR_LOWERCASE_A && code <= CHAR_LOWERCASE_Z);\n}\n// Resolves . and .. elements in a path with directory names\nfunction normalizeString(path, allowAboveRoot, separator, isPathSeparator) {\n let res = '';\n let lastSegmentLength = 0;\n let lastSlash = -1;\n let dots = 0;\n let code = 0;\n for (let i = 0; i <= path.length; ++i) {\n if (i < path.length) {\n code = path.charCodeAt(i);\n }\n else if (isPathSeparator(code)) {\n break;\n }\n else {\n code = CHAR_FORWARD_SLASH;\n }\n if (isPathSeparator(code)) {\n if (lastSlash === i - 1 || dots === 1) {\n // NOOP\n }\n else if (dots === 2) {\n if (res.length < 2 || lastSegmentLength !== 2 ||\n res.charCodeAt(res.length - 1) !== CHAR_DOT ||\n res.charCodeAt(res.length - 2) !== CHAR_DOT) {\n if (res.length > 2) {\n const lastSlashIndex = res.lastIndexOf(separator);\n if (lastSlashIndex === -1) {\n res = '';\n lastSegmentLength = 0;\n }\n else {\n res = res.slice(0, lastSlashIndex);\n lastSegmentLength = res.length - 1 - res.lastIndexOf(separator);\n }\n lastSlash = i;\n dots = 0;\n continue;\n }\n else if (res.length !== 0) {\n res = '';\n lastSegmentLength = 0;\n lastSlash = i;\n dots = 0;\n continue;\n }\n }\n if (allowAboveRoot) {\n res += res.length > 0 ? `${separator}..` : '..';\n lastSegmentLength = 2;\n }\n }\n else {\n if (res.length > 0) {\n res += `${separator}${path.slice(lastSlash + 1, i)}`;\n }\n else {\n res = path.slice(lastSlash + 1, i);\n }\n lastSegmentLength = i - lastSlash - 1;\n }\n lastSlash = i;\n dots = 0;\n }\n else if (code === CHAR_DOT && dots !== -1) {\n ++dots;\n }\n else {\n dots = -1;\n }\n }\n return res;\n}\nfunction _format(sep, pathObject) {\n validateObject(pathObject, 'pathObject');\n const dir = pathObject.dir || pathObject.root;\n const base = pathObject.base ||\n `${pathObject.name || ''}${pathObject.ext || ''}`;\n if (!dir) {\n return base;\n }\n return dir === pathObject.root ? `${dir}${base}` : `${dir}${sep}${base}`;\n}\nexport const win32 = {\n // path.resolve([from ...], to)\n resolve(...pathSegments) {\n let resolvedDevice = '';\n let resolvedTail = '';\n let resolvedAbsolute = false;\n for (let i = pathSegments.length - 1; i >= -1; i--) {\n let path;\n if (i >= 0) {\n path = pathSegments[i];\n validateString(path, 'path');\n // Skip empty entries\n if (path.length === 0) {\n continue;\n }\n }\n else if (resolvedDevice.length === 0) {\n path = process.cwd();\n }\n else {\n // Windows has the concept of drive-specific current working\n // directories. If we've resolved a drive letter but not yet an\n // absolute path, get cwd for that drive, or the process cwd if\n // the drive cwd is not available. We're sure the device is not\n // a UNC path at this points, because UNC paths are always absolute.\n path = process.env[`=${resolvedDevice}`] || process.cwd();\n // Verify that a cwd was found and that it actually points\n // to our drive. If not, default to the drive's root.\n if (path === undefined ||\n (path.slice(0, 2).toLowerCase() !== resolvedDevice.toLowerCase() &&\n path.charCodeAt(2) === CHAR_BACKWARD_SLASH)) {\n path = `${resolvedDevice}\\\\`;\n }\n }\n const len = path.length;\n let rootEnd = 0;\n let device = '';\n let isAbsolute = false;\n const code = path.charCodeAt(0);\n // Try to match a root\n if (len === 1) {\n if (isPathSeparator(code)) {\n // `path` contains just a path separator\n rootEnd = 1;\n isAbsolute = true;\n }\n }\n else if (isPathSeparator(code)) {\n // Possible UNC root\n // If we started with a separator, we know we at least have an\n // absolute path of some kind (UNC or otherwise)\n isAbsolute = true;\n if (isPathSeparator(path.charCodeAt(1))) {\n // Matched double path separator at beginning\n let j = 2;\n let last = j;\n // Match 1 or more non-path separators\n while (j < len && !isPathSeparator(path.charCodeAt(j))) {\n j++;\n }\n if (j < len && j !== last) {\n const firstPart = path.slice(last, j);\n // Matched!\n last = j;\n // Match 1 or more path separators\n while (j < len && isPathSeparator(path.charCodeAt(j))) {\n j++;\n }\n if (j < len && j !== last) {\n // Matched!\n last = j;\n // Match 1 or more non-path separators\n while (j < len && !isPathSeparator(path.charCodeAt(j))) {\n j++;\n }\n if (j === len || j !== last) {\n // We matched a UNC root\n device = `\\\\\\\\${firstPart}\\\\${path.slice(last, j)}`;\n rootEnd = j;\n }\n }\n }\n }\n else {\n rootEnd = 1;\n }\n }\n else if (isWindowsDeviceRoot(code) &&\n path.charCodeAt(1) === CHAR_COLON) {\n // Possible device root\n device = path.slice(0, 2);\n rootEnd = 2;\n if (len > 2 && isPathSeparator(path.charCodeAt(2))) {\n // Treat separator following drive name as an absolute path\n // indicator\n isAbsolute = true;\n rootEnd = 3;\n }\n }\n if (device.length > 0) {\n if (resolvedDevice.length > 0) {\n if (device.toLowerCase() !== resolvedDevice.toLowerCase()) {\n // This path points to another device so it is not applicable\n continue;\n }\n }\n else {\n resolvedDevice = device;\n }\n }\n if (resolvedAbsolute) {\n if (resolvedDevice.length > 0) {\n break;\n }\n }\n else {\n resolvedTail = `${path.slice(rootEnd)}\\\\${resolvedTail}`;\n resolvedAbsolute = isAbsolute;\n if (isAbsolute && resolvedDevice.length > 0) {\n break;\n }\n }\n }\n // At this point the path should be resolved to a full absolute path,\n // but handle relative paths to be safe (might happen when process.cwd()\n // fails)\n // Normalize the tail path\n resolvedTail = normalizeString(resolvedTail, !resolvedAbsolute, '\\\\', isPathSeparator);\n return resolvedAbsolute ?\n `${resolvedDevice}\\\\${resolvedTail}` :\n `${resolvedDevice}${resolvedTail}` || '.';\n },\n normalize(path) {\n validateString(path, 'path');\n const len = path.length;\n if (len === 0) {\n return '.';\n }\n let rootEnd = 0;\n let device;\n let isAbsolute = false;\n const code = path.charCodeAt(0);\n // Try to match a root\n if (len === 1) {\n // `path` contains just a single char, exit early to avoid\n // unnecessary work\n return isPosixPathSeparator(code) ? '\\\\' : path;\n }\n if (isPathSeparator(code)) {\n // Possible UNC root\n // If we started with a separator, we know we at least have an absolute\n // path of some kind (UNC or otherwise)\n isAbsolute = true;\n if (isPathSeparator(path.charCodeAt(1))) {\n // Matched double path separator at beginning\n let j = 2;\n let last = j;\n // Match 1 or more non-path separators\n while (j < len && !isPathSeparator(path.charCodeAt(j))) {\n j++;\n }\n if (j < len && j !== last) {\n const firstPart = path.slice(last, j);\n // Matched!\n last = j;\n // Match 1 or more path separators\n while (j < len && isPathSeparator(path.charCodeAt(j))) {\n j++;\n }\n if (j < len && j !== last) {\n // Matched!\n last = j;\n // Match 1 or more non-path separators\n while (j < len && !isPathSeparator(path.charCodeAt(j))) {\n j++;\n }\n if (j === len) {\n // We matched a UNC root only\n // Return the normalized version of the UNC root since there\n // is nothing left to process\n return `\\\\\\\\${firstPart}\\\\${path.slice(last)}\\\\`;\n }\n if (j !== last) {\n // We matched a UNC root with leftovers\n device = `\\\\\\\\${firstPart}\\\\${path.slice(last, j)}`;\n rootEnd = j;\n }\n }\n }\n }\n else {\n rootEnd = 1;\n }\n }\n else if (isWindowsDeviceRoot(code) && path.charCodeAt(1) === CHAR_COLON) {\n // Possible device root\n device = path.slice(0, 2);\n rootEnd = 2;\n if (len > 2 && isPathSeparator(path.charCodeAt(2))) {\n // Treat separator following drive name as an absolute path\n // indicator\n isAbsolute = true;\n rootEnd = 3;\n }\n }\n let tail = rootEnd < len ?\n normalizeString(path.slice(rootEnd), !isAbsolute, '\\\\', isPathSeparator) :\n '';\n if (tail.length === 0 && !isAbsolute) {\n tail = '.';\n }\n if (tail.length > 0 && isPathSeparator(path.charCodeAt(len - 1))) {\n tail += '\\\\';\n }\n if (device === undefined) {\n return isAbsolute ? `\\\\${tail}` : tail;\n }\n return isAbsolute ? `${device}\\\\${tail}` : `${device}${tail}`;\n },\n isAbsolute(path) {\n validateString(path, 'path');\n const len = path.length;\n if (len === 0) {\n return false;\n }\n const code = path.charCodeAt(0);\n return isPathSeparator(code) ||\n // Possible device root\n (len > 2 &&\n isWindowsDeviceRoot(code) &&\n path.charCodeAt(1) === CHAR_COLON &&\n isPathSeparator(path.charCodeAt(2)));\n },\n join(...paths) {\n if (paths.length === 0) {\n return '.';\n }\n let joined;\n let firstPart;\n for (let i = 0; i < paths.length; ++i) {\n const arg = paths[i];\n validateString(arg, 'path');\n if (arg.length > 0) {\n if (joined === undefined) {\n joined = firstPart = arg;\n }\n else {\n joined += `\\\\${arg}`;\n }\n }\n }\n if (joined === undefined) {\n return '.';\n }\n // Make sure that the joined path doesn't start with two slashes, because\n // normalize() will mistake it for a UNC path then.\n //\n // This step is skipped when it is very clear that the user actually\n // intended to point at a UNC path. This is assumed when the first\n // non-empty string arguments starts with exactly two slashes followed by\n // at least one more non-slash character.\n //\n // Note that for normalize() to treat a path as a UNC path it needs to\n // have at least 2 components, so we don't filter for that here.\n // This means that the user can use join to construct UNC paths from\n // a server name and a share name; for example:\n // path.join('//server', 'share') -> '\\\\\\\\server\\\\share\\\\')\n let needsReplace = true;\n let slashCount = 0;\n if (typeof firstPart === 'string' && isPathSeparator(firstPart.charCodeAt(0))) {\n ++slashCount;\n const firstLen = firstPart.length;\n if (firstLen > 1 && isPathSeparator(firstPart.charCodeAt(1))) {\n ++slashCount;\n if (firstLen > 2) {\n if (isPathSeparator(firstPart.charCodeAt(2))) {\n ++slashCount;\n }\n else {\n // We matched a UNC path in the first part\n needsReplace = false;\n }\n }\n }\n }\n if (needsReplace) {\n // Find any more consecutive slashes we need to replace\n while (slashCount < joined.length &&\n isPathSeparator(joined.charCodeAt(slashCount))) {\n slashCount++;\n }\n // Replace the slashes if needed\n if (slashCount >= 2) {\n joined = `\\\\${joined.slice(slashCount)}`;\n }\n }\n return win32.normalize(joined);\n },\n // It will solve the relative path from `from` to `to`, for instance:\n // from = 'C:\\\\orandea\\\\test\\\\aaa'\n // to = 'C:\\\\orandea\\\\impl\\\\bbb'\n // The output of the function should be: '..\\\\..\\\\impl\\\\bbb'\n relative(from, to) {\n validateString(from, 'from');\n validateString(to, 'to');\n if (from === to) {\n return '';\n }\n const fromOrig = win32.resolve(from);\n const toOrig = win32.resolve(to);\n if (fromOrig === toOrig) {\n return '';\n }\n from = fromOrig.toLowerCase();\n to = toOrig.toLowerCase();\n if (from === to) {\n return '';\n }\n // Trim any leading backslashes\n let fromStart = 0;\n while (fromStart < from.length &&\n from.charCodeAt(fromStart) === CHAR_BACKWARD_SLASH) {\n fromStart++;\n }\n // Trim trailing backslashes (applicable to UNC paths only)\n let fromEnd = from.length;\n while (fromEnd - 1 > fromStart &&\n from.charCodeAt(fromEnd - 1) === CHAR_BACKWARD_SLASH) {\n fromEnd--;\n }\n const fromLen = fromEnd - fromStart;\n // Trim any leading backslashes\n let toStart = 0;\n while (toStart < to.length &&\n to.charCodeAt(toStart) === CHAR_BACKWARD_SLASH) {\n toStart++;\n }\n // Trim trailing backslashes (applicable to UNC paths only)\n let toEnd = to.length;\n while (toEnd - 1 > toStart &&\n to.charCodeAt(toEnd - 1) === CHAR_BACKWARD_SLASH) {\n toEnd--;\n }\n const toLen = toEnd - toStart;\n // Compare paths to find the longest common path from root\n const length = fromLen < toLen ? fromLen : toLen;\n let lastCommonSep = -1;\n let i = 0;\n for (; i < length; i++) {\n const fromCode = from.charCodeAt(fromStart + i);\n if (fromCode !== to.charCodeAt(toStart + i)) {\n break;\n }\n else if (fromCode === CHAR_BACKWARD_SLASH) {\n lastCommonSep = i;\n }\n }\n // We found a mismatch before the first common path separator was seen, so\n // return the original `to`.\n if (i !== length) {\n if (lastCommonSep === -1) {\n return toOrig;\n }\n }\n else {\n if (toLen > length) {\n if (to.charCodeAt(toStart + i) === CHAR_BACKWARD_SLASH) {\n // We get here if `from` is the exact base path for `to`.\n // For example: from='C:\\\\foo\\\\bar'; to='C:\\\\foo\\\\bar\\\\baz'\n return toOrig.slice(toStart + i + 1);\n }\n if (i === 2) {\n // We get here if `from` is the device root.\n // For example: from='C:\\\\'; to='C:\\\\foo'\n return toOrig.slice(toStart + i);\n }\n }\n if (fromLen > length) {\n if (from.charCodeAt(fromStart + i) === CHAR_BACKWARD_SLASH) {\n // We get here if `to` is the exact base path for `from`.\n // For example: from='C:\\\\foo\\\\bar'; to='C:\\\\foo'\n lastCommonSep = i;\n }\n else if (i === 2) {\n // We get here if `to` is the device root.\n // For example: from='C:\\\\foo\\\\bar'; to='C:\\\\'\n lastCommonSep = 3;\n }\n }\n if (lastCommonSep === -1) {\n lastCommonSep = 0;\n }\n }\n let out = '';\n // Generate the relative path based on the path difference between `to` and\n // `from`\n for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {\n if (i === fromEnd || from.charCodeAt(i) === CHAR_BACKWARD_SLASH) {\n out += out.length === 0 ? '..' : '\\\\..';\n }\n }\n toStart += lastCommonSep;\n // Lastly, append the rest of the destination (`to`) path that comes after\n // the common path parts\n if (out.length > 0) {\n return `${out}${toOrig.slice(toStart, toEnd)}`;\n }\n if (toOrig.charCodeAt(toStart) === CHAR_BACKWARD_SLASH) {\n ++toStart;\n }\n return toOrig.slice(toStart, toEnd);\n },\n toNamespacedPath(path) {\n // Note: this will *probably* throw somewhere.\n if (typeof path !== 'string' || path.length === 0) {\n return path;\n }\n const resolvedPath = win32.resolve(path);\n if (resolvedPath.length <= 2) {\n return path;\n }\n if (resolvedPath.charCodeAt(0) === CHAR_BACKWARD_SLASH) {\n // Possible UNC root\n if (resolvedPath.charCodeAt(1) === CHAR_BACKWARD_SLASH) {\n const code = resolvedPath.charCodeAt(2);\n if (code !== CHAR_QUESTION_MARK && code !== CHAR_DOT) {\n // Matched non-long UNC root, convert the path to a long UNC path\n return `\\\\\\\\?\\\\UNC\\\\${resolvedPath.slice(2)}`;\n }\n }\n }\n else if (isWindowsDeviceRoot(resolvedPath.charCodeAt(0)) &&\n resolvedPath.charCodeAt(1) === CHAR_COLON &&\n resolvedPath.charCodeAt(2) === CHAR_BACKWARD_SLASH) {\n // Matched device root, convert the path to a long UNC path\n return `\\\\\\\\?\\\\${resolvedPath}`;\n }\n return path;\n },\n dirname(path) {\n validateString(path, 'path');\n const len = path.length;\n if (len === 0) {\n return '.';\n }\n let rootEnd = -1;\n let offset = 0;\n const code = path.charCodeAt(0);\n if (len === 1) {\n // `path` contains just a path separator, exit early to avoid\n // unnecessary work or a dot.\n return isPathSeparator(code) ? path : '.';\n }\n // Try to match a root\n if (isPathSeparator(code)) {\n // Possible UNC root\n rootEnd = offset = 1;\n if (isPathSeparator(path.charCodeAt(1))) {\n // Matched double path separator at beginning\n let j = 2;\n let last = j;\n // Match 1 or more non-path separators\n while (j < len && !isPathSeparator(path.charCodeAt(j))) {\n j++;\n }\n if (j < len && j !== last) {\n // Matched!\n last = j;\n // Match 1 or more path separators\n while (j < len && isPathSeparator(path.charCodeAt(j))) {\n j++;\n }\n if (j < len && j !== last) {\n // Matched!\n last = j;\n // Match 1 or more non-path separators\n while (j < len && !isPathSeparator(path.charCodeAt(j))) {\n j++;\n }\n if (j === len) {\n // We matched a UNC root only\n return path;\n }\n if (j !== last) {\n // We matched a UNC root with leftovers\n // Offset by 1 to include the separator after the UNC root to\n // treat it as a \"normal root\" on top of a (UNC) root\n rootEnd = offset = j + 1;\n }\n }\n }\n }\n // Possible device root\n }\n else if (isWindowsDeviceRoot(code) && path.charCodeAt(1) === CHAR_COLON) {\n rootEnd = len > 2 && isPathSeparator(path.charCodeAt(2)) ? 3 : 2;\n offset = rootEnd;\n }\n let end = -1;\n let matchedSlash = true;\n for (let i = len - 1; i >= offset; --i) {\n if (isPathSeparator(path.charCodeAt(i))) {\n if (!matchedSlash) {\n end = i;\n break;\n }\n }\n else {\n // We saw the first non-path separator\n matchedSlash = false;\n }\n }\n if (end === -1) {\n if (rootEnd === -1) {\n return '.';\n }\n end = rootEnd;\n }\n return path.slice(0, end);\n },\n basename(path, ext) {\n if (ext !== undefined) {\n validateString(ext, 'ext');\n }\n validateString(path, 'path');\n let start = 0;\n let end = -1;\n let matchedSlash = true;\n let i;\n // Check for a drive letter prefix so as not to mistake the following\n // path separator as an extra separator at the end of the path that can be\n // disregarded\n if (path.length >= 2 &&\n isWindowsDeviceRoot(path.charCodeAt(0)) &&\n path.charCodeAt(1) === CHAR_COLON) {\n start = 2;\n }\n if (ext !== undefined && ext.length > 0 && ext.length <= path.length) {\n if (ext === path) {\n return '';\n }\n let extIdx = ext.length - 1;\n let firstNonSlashEnd = -1;\n for (i = path.length - 1; i >= start; --i) {\n const code = path.charCodeAt(i);\n if (isPathSeparator(code)) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n start = i + 1;\n break;\n }\n }\n else {\n if (firstNonSlashEnd === -1) {\n // We saw the first non-path separator, remember this index in case\n // we need it if the extension ends up not matching\n matchedSlash = false;\n firstNonSlashEnd = i + 1;\n }\n if (extIdx >= 0) {\n // Try to match the explicit extension\n if (code === ext.charCodeAt(extIdx)) {\n if (--extIdx === -1) {\n // We matched the extension, so mark this as the end of our path\n // component\n end = i;\n }\n }\n else {\n // Extension does not match, so our result is the entire path\n // component\n extIdx = -1;\n end = firstNonSlashEnd;\n }\n }\n }\n }\n if (start === end) {\n end = firstNonSlashEnd;\n }\n else if (end === -1) {\n end = path.length;\n }\n return path.slice(start, end);\n }\n for (i = path.length - 1; i >= start; --i) {\n if (isPathSeparator(path.charCodeAt(i))) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n start = i + 1;\n break;\n }\n }\n else if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // path component\n matchedSlash = false;\n end = i + 1;\n }\n }\n if (end === -1) {\n return '';\n }\n return path.slice(start, end);\n },\n extname(path) {\n validateString(path, 'path');\n let start = 0;\n let startDot = -1;\n let startPart = 0;\n let end = -1;\n let matchedSlash = true;\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find\n let preDotState = 0;\n // Check for a drive letter prefix so as not to mistake the following\n // path separator as an extra separator at the end of the path that can be\n // disregarded\n if (path.length >= 2 &&\n path.charCodeAt(1) === CHAR_COLON &&\n isWindowsDeviceRoot(path.charCodeAt(0))) {\n start = startPart = 2;\n }\n for (let i = path.length - 1; i >= start; --i) {\n const code = path.charCodeAt(i);\n if (isPathSeparator(code)) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n startPart = i + 1;\n break;\n }\n continue;\n }\n if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // extension\n matchedSlash = false;\n end = i + 1;\n }\n if (code === CHAR_DOT) {\n // If this is our first dot, mark it as the start of our extension\n if (startDot === -1) {\n startDot = i;\n }\n else if (preDotState !== 1) {\n preDotState = 1;\n }\n }\n else if (startDot !== -1) {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension\n preDotState = -1;\n }\n }\n if (startDot === -1 ||\n end === -1 ||\n // We saw a non-dot character immediately before the dot\n preDotState === 0 ||\n // The (right-most) trimmed path component is exactly '..'\n (preDotState === 1 &&\n startDot === end - 1 &&\n startDot === startPart + 1)) {\n return '';\n }\n return path.slice(startDot, end);\n },\n format: _format.bind(null, '\\\\'),\n parse(path) {\n validateString(path, 'path');\n const ret = { root: '', dir: '', base: '', ext: '', name: '' };\n if (path.length === 0) {\n return ret;\n }\n const len = path.length;\n let rootEnd = 0;\n let code = path.charCodeAt(0);\n if (len === 1) {\n if (isPathSeparator(code)) {\n // `path` contains just a path separator, exit early to avoid\n // unnecessary work\n ret.root = ret.dir = path;\n return ret;\n }\n ret.base = ret.name = path;\n return ret;\n }\n // Try to match a root\n if (isPathSeparator(code)) {\n // Possible UNC root\n rootEnd = 1;\n if (isPathSeparator(path.charCodeAt(1))) {\n // Matched double path separator at beginning\n let j = 2;\n let last = j;\n // Match 1 or more non-path separators\n while (j < len && !isPathSeparator(path.charCodeAt(j))) {\n j++;\n }\n if (j < len && j !== last) {\n // Matched!\n last = j;\n // Match 1 or more path separators\n while (j < len && isPathSeparator(path.charCodeAt(j))) {\n j++;\n }\n if (j < len && j !== last) {\n // Matched!\n last = j;\n // Match 1 or more non-path separators\n while (j < len && !isPathSeparator(path.charCodeAt(j))) {\n j++;\n }\n if (j === len) {\n // We matched a UNC root only\n rootEnd = j;\n }\n else if (j !== last) {\n // We matched a UNC root with leftovers\n rootEnd = j + 1;\n }\n }\n }\n }\n }\n else if (isWindowsDeviceRoot(code) && path.charCodeAt(1) === CHAR_COLON) {\n // Possible device root\n if (len <= 2) {\n // `path` contains just a drive root, exit early to avoid\n // unnecessary work\n ret.root = ret.dir = path;\n return ret;\n }\n rootEnd = 2;\n if (isPathSeparator(path.charCodeAt(2))) {\n if (len === 3) {\n // `path` contains just a drive root, exit early to avoid\n // unnecessary work\n ret.root = ret.dir = path;\n return ret;\n }\n rootEnd = 3;\n }\n }\n if (rootEnd > 0) {\n ret.root = path.slice(0, rootEnd);\n }\n let startDot = -1;\n let startPart = rootEnd;\n let end = -1;\n let matchedSlash = true;\n let i = path.length - 1;\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find\n let preDotState = 0;\n // Get non-dir info\n for (; i >= rootEnd; --i) {\n code = path.charCodeAt(i);\n if (isPathSeparator(code)) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n startPart = i + 1;\n break;\n }\n continue;\n }\n if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // extension\n matchedSlash = false;\n end = i + 1;\n }\n if (code === CHAR_DOT) {\n // If this is our first dot, mark it as the start of our extension\n if (startDot === -1) {\n startDot = i;\n }\n else if (preDotState !== 1) {\n preDotState = 1;\n }\n }\n else if (startDot !== -1) {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension\n preDotState = -1;\n }\n }\n if (end !== -1) {\n if (startDot === -1 ||\n // We saw a non-dot character immediately before the dot\n preDotState === 0 ||\n // The (right-most) trimmed path component is exactly '..'\n (preDotState === 1 &&\n startDot === end - 1 &&\n startDot === startPart + 1)) {\n ret.base = ret.name = path.slice(startPart, end);\n }\n else {\n ret.name = path.slice(startPart, startDot);\n ret.base = path.slice(startPart, end);\n ret.ext = path.slice(startDot, end);\n }\n }\n // If the directory is the root, use the entire root as the `dir` including\n // the trailing slash if any (`C:\\abc` -> `C:\\`). Otherwise, strip out the\n // trailing slash (`C:\\abc\\def` -> `C:\\abc`).\n if (startPart > 0 && startPart !== rootEnd) {\n ret.dir = path.slice(0, startPart - 1);\n }\n else {\n ret.dir = ret.root;\n }\n return ret;\n },\n sep: '\\\\',\n delimiter: ';',\n win32: null,\n posix: null\n};\nconst posixCwd = (() => {\n if (platformIsWin32) {\n // Converts Windows' backslash path separators to POSIX forward slashes\n // and truncates any drive indicator\n const regexp = /\\\\/g;\n return () => {\n const cwd = process.cwd().replace(regexp, '/');\n return cwd.slice(cwd.indexOf('/'));\n };\n }\n // We're already on POSIX, no need for any transformations\n return () => process.cwd();\n})();\nexport const posix = {\n // path.resolve([from ...], to)\n resolve(...pathSegments) {\n let resolvedPath = '';\n let resolvedAbsolute = false;\n for (let i = pathSegments.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n const path = i >= 0 ? pathSegments[i] : posixCwd();\n validateString(path, 'path');\n // Skip empty entries\n if (path.length === 0) {\n continue;\n }\n resolvedPath = `${path}/${resolvedPath}`;\n resolvedAbsolute = path.charCodeAt(0) === CHAR_FORWARD_SLASH;\n }\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n // Normalize the path\n resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute, '/', isPosixPathSeparator);\n if (resolvedAbsolute) {\n return `/${resolvedPath}`;\n }\n return resolvedPath.length > 0 ? resolvedPath : '.';\n },\n normalize(path) {\n validateString(path, 'path');\n if (path.length === 0) {\n return '.';\n }\n const isAbsolute = path.charCodeAt(0) === CHAR_FORWARD_SLASH;\n const trailingSeparator = path.charCodeAt(path.length - 1) === CHAR_FORWARD_SLASH;\n // Normalize the path\n path = normalizeString(path, !isAbsolute, '/', isPosixPathSeparator);\n if (path.length === 0) {\n if (isAbsolute) {\n return '/';\n }\n return trailingSeparator ? './' : '.';\n }\n if (trailingSeparator) {\n path += '/';\n }\n return isAbsolute ? `/${path}` : path;\n },\n isAbsolute(path) {\n validateString(path, 'path');\n return path.length > 0 && path.charCodeAt(0) === CHAR_FORWARD_SLASH;\n },\n join(...paths) {\n if (paths.length === 0) {\n return '.';\n }\n let joined;\n for (let i = 0; i < paths.length; ++i) {\n const arg = paths[i];\n validateString(arg, 'path');\n if (arg.length > 0) {\n if (joined === undefined) {\n joined = arg;\n }\n else {\n joined += `/${arg}`;\n }\n }\n }\n if (joined === undefined) {\n return '.';\n }\n return posix.normalize(joined);\n },\n relative(from, to) {\n validateString(from, 'from');\n validateString(to, 'to');\n if (from === to) {\n return '';\n }\n // Trim leading forward slashes.\n from = posix.resolve(from);\n to = posix.resolve(to);\n if (from === to) {\n return '';\n }\n const fromStart = 1;\n const fromEnd = from.length;\n const fromLen = fromEnd - fromStart;\n const toStart = 1;\n const toLen = to.length - toStart;\n // Compare paths to find the longest common path from root\n const length = (fromLen < toLen ? fromLen : toLen);\n let lastCommonSep = -1;\n let i = 0;\n for (; i < length; i++) {\n const fromCode = from.charCodeAt(fromStart + i);\n if (fromCode !== to.charCodeAt(toStart + i)) {\n break;\n }\n else if (fromCode === CHAR_FORWARD_SLASH) {\n lastCommonSep = i;\n }\n }\n if (i === length) {\n if (toLen > length) {\n if (to.charCodeAt(toStart + i) === CHAR_FORWARD_SLASH) {\n // We get here if `from` is the exact base path for `to`.\n // For example: from='/foo/bar'; to='/foo/bar/baz'\n return to.slice(toStart + i + 1);\n }\n if (i === 0) {\n // We get here if `from` is the root\n // For example: from='/'; to='/foo'\n return to.slice(toStart + i);\n }\n }\n else if (fromLen > length) {\n if (from.charCodeAt(fromStart + i) === CHAR_FORWARD_SLASH) {\n // We get here if `to` is the exact base path for `from`.\n // For example: from='/foo/bar/baz'; to='/foo/bar'\n lastCommonSep = i;\n }\n else if (i === 0) {\n // We get here if `to` is the root.\n // For example: from='/foo/bar'; to='/'\n lastCommonSep = 0;\n }\n }\n }\n let out = '';\n // Generate the relative path based on the path difference between `to`\n // and `from`.\n for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {\n if (i === fromEnd || from.charCodeAt(i) === CHAR_FORWARD_SLASH) {\n out += out.length === 0 ? '..' : '/..';\n }\n }\n // Lastly, append the rest of the destination (`to`) path that comes after\n // the common path parts.\n return `${out}${to.slice(toStart + lastCommonSep)}`;\n },\n toNamespacedPath(path) {\n // Non-op on posix systems\n return path;\n },\n dirname(path) {\n validateString(path, 'path');\n if (path.length === 0) {\n return '.';\n }\n const hasRoot = path.charCodeAt(0) === CHAR_FORWARD_SLASH;\n let end = -1;\n let matchedSlash = true;\n for (let i = path.length - 1; i >= 1; --i) {\n if (path.charCodeAt(i) === CHAR_FORWARD_SLASH) {\n if (!matchedSlash) {\n end = i;\n break;\n }\n }\n else {\n // We saw the first non-path separator\n matchedSlash = false;\n }\n }\n if (end === -1) {\n return hasRoot ? '/' : '.';\n }\n if (hasRoot && end === 1) {\n return '//';\n }\n return path.slice(0, end);\n },\n basename(path, ext) {\n if (ext !== undefined) {\n validateString(ext, 'ext');\n }\n validateString(path, 'path');\n let start = 0;\n let end = -1;\n let matchedSlash = true;\n let i;\n if (ext !== undefined && ext.length > 0 && ext.length <= path.length) {\n if (ext === path) {\n return '';\n }\n let extIdx = ext.length - 1;\n let firstNonSlashEnd = -1;\n for (i = path.length - 1; i >= 0; --i) {\n const code = path.charCodeAt(i);\n if (code === CHAR_FORWARD_SLASH) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n start = i + 1;\n break;\n }\n }\n else {\n if (firstNonSlashEnd === -1) {\n // We saw the first non-path separator, remember this index in case\n // we need it if the extension ends up not matching\n matchedSlash = false;\n firstNonSlashEnd = i + 1;\n }\n if (extIdx >= 0) {\n // Try to match the explicit extension\n if (code === ext.charCodeAt(extIdx)) {\n if (--extIdx === -1) {\n // We matched the extension, so mark this as the end of our path\n // component\n end = i;\n }\n }\n else {\n // Extension does not match, so our result is the entire path\n // component\n extIdx = -1;\n end = firstNonSlashEnd;\n }\n }\n }\n }\n if (start === end) {\n end = firstNonSlashEnd;\n }\n else if (end === -1) {\n end = path.length;\n }\n return path.slice(start, end);\n }\n for (i = path.length - 1; i >= 0; --i) {\n if (path.charCodeAt(i) === CHAR_FORWARD_SLASH) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n start = i + 1;\n break;\n }\n }\n else if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // path component\n matchedSlash = false;\n end = i + 1;\n }\n }\n if (end === -1) {\n return '';\n }\n return path.slice(start, end);\n },\n extname(path) {\n validateString(path, 'path');\n let startDot = -1;\n let startPart = 0;\n let end = -1;\n let matchedSlash = true;\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find\n let preDotState = 0;\n for (let i = path.length - 1; i >= 0; --i) {\n const code = path.charCodeAt(i);\n if (code === CHAR_FORWARD_SLASH) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n startPart = i + 1;\n break;\n }\n continue;\n }\n if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // extension\n matchedSlash = false;\n end = i + 1;\n }\n if (code === CHAR_DOT) {\n // If this is our first dot, mark it as the start of our extension\n if (startDot === -1) {\n startDot = i;\n }\n else if (preDotState !== 1) {\n preDotState = 1;\n }\n }\n else if (startDot !== -1) {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension\n preDotState = -1;\n }\n }\n if (startDot === -1 ||\n end === -1 ||\n // We saw a non-dot character immediately before the dot\n preDotState === 0 ||\n // The (right-most) trimmed path component is exactly '..'\n (preDotState === 1 &&\n startDot === end - 1 &&\n startDot === startPart + 1)) {\n return '';\n }\n return path.slice(startDot, end);\n },\n format: _format.bind(null, '/'),\n parse(path) {\n validateString(path, 'path');\n const ret = { root: '', dir: '', base: '', ext: '', name: '' };\n if (path.length === 0) {\n return ret;\n }\n const isAbsolute = path.charCodeAt(0) === CHAR_FORWARD_SLASH;\n let start;\n if (isAbsolute) {\n ret.root = '/';\n start = 1;\n }\n else {\n start = 0;\n }\n let startDot = -1;\n let startPart = 0;\n let end = -1;\n let matchedSlash = true;\n let i = path.length - 1;\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find\n let preDotState = 0;\n // Get non-dir info\n for (; i >= start; --i) {\n const code = path.charCodeAt(i);\n if (code === CHAR_FORWARD_SLASH) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n startPart = i + 1;\n break;\n }\n continue;\n }\n if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // extension\n matchedSlash = false;\n end = i + 1;\n }\n if (code === CHAR_DOT) {\n // If this is our first dot, mark it as the start of our extension\n if (startDot === -1) {\n startDot = i;\n }\n else if (preDotState !== 1) {\n preDotState = 1;\n }\n }\n else if (startDot !== -1) {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension\n preDotState = -1;\n }\n }\n if (end !== -1) {\n const start = startPart === 0 && isAbsolute ? 1 : startPart;\n if (startDot === -1 ||\n // We saw a non-dot character immediately before the dot\n preDotState === 0 ||\n // The (right-most) trimmed path component is exactly '..'\n (preDotState === 1 &&\n startDot === end - 1 &&\n startDot === startPart + 1)) {\n ret.base = ret.name = path.slice(start, end);\n }\n else {\n ret.name = path.slice(start, startDot);\n ret.base = path.slice(start, end);\n ret.ext = path.slice(startDot, end);\n }\n }\n if (startPart > 0) {\n ret.dir = path.slice(0, startPart - 1);\n }\n else if (isAbsolute) {\n ret.dir = '/';\n }\n return ret;\n },\n sep: '/',\n delimiter: ':',\n win32: null,\n posix: null\n};\nposix.win32 = win32.win32 = win32;\nposix.posix = win32.posix = posix;\nexport const normalize = (platformIsWin32 ? win32.normalize : posix.normalize);\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 sep = (platformIsWin32 ? win32.sep : posix.sep);\n", "/*---------------------------------------------------------------------------------------------\n * 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 * as paths from './path.js';\nimport { isWindows } from './platform.js';\nconst _schemePattern = /^\\w[\\w\\d+.-]*$/;\nconst _singleSlashStart = /^\\//;\nconst _doubleSlashStart = /^\\/\\//;\nfunction _validateUri(ret, _strict) {\n // scheme, must be set\n if (!ret.scheme && _strict) {\n throw new Error(`[UriError]: Scheme is missing: {scheme: \"\", authority: \"${ret.authority}\", path: \"${ret.path}\", query: \"${ret.query}\", fragment: \"${ret.fragment}\"}`);\n }\n // scheme, https://tools.ietf.org/html/rfc3986#section-3.1\n // ALPHA *( ALPHA / DIGIT / \"+\" / \"-\" / \".\" )\n if (ret.scheme && !_schemePattern.test(ret.scheme)) {\n throw new Error('[UriError]: Scheme contains illegal characters.');\n }\n // path, http://tools.ietf.org/html/rfc3986#section-3.3\n // If a URI contains an authority component, then the path component\n // must either be empty or begin with a slash (\"/\") character. If a URI\n // does not contain an authority component, then the path cannot begin\n // with two slash characters (\"//\").\n if (ret.path) {\n if (ret.authority) {\n if (!_singleSlashStart.test(ret.path)) {\n throw 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 }\n }\n else {\n if (_doubleSlashStart.test(ret.path)) {\n throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters (\"//\")');\n }\n }\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, _strict) {\n if (!scheme && !_strict) {\n return 'file';\n }\n return scheme;\n}\n// implements a bit of https://tools.ietf.org/html/rfc3986#section-5\nfunction _referenceResolution(scheme, path) {\n // the slash-character is our 'default base' as we don't\n // support constructing URIs relative to other URIs. This\n // also means that we alter and potentially break paths.\n // see https://tools.ietf.org/html/rfc3986#section-5.1.4\n switch (scheme) {\n case 'https':\n case 'http':\n case 'file':\n if (!path) {\n path = _slash;\n }\n else if (path[0] !== _slash) {\n path = _slash + path;\n }\n break;\n }\n return path;\n}\nconst _empty = '';\nconst _slash = '/';\nconst _regexp = /^(([^:/?#]+?):)?(\\/\\/([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?/;\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 {\n static isUri(thing) {\n if (thing instanceof URI) {\n return true;\n }\n if (!thing) {\n return false;\n }\n return typeof thing.authority === 'string'\n && typeof thing.fragment === 'string'\n && typeof thing.path === 'string'\n && typeof thing.query === 'string'\n && typeof thing.scheme === 'string'\n && typeof thing.fsPath === 'string'\n && typeof thing.with === 'function'\n && typeof thing.toString === 'function';\n }\n /**\n * @internal\n */\n constructor(schemeOrData, authority, path, query, fragment, _strict = false) {\n if (typeof schemeOrData === 'object') {\n this.scheme = schemeOrData.scheme || _empty;\n this.authority = schemeOrData.authority || _empty;\n this.path = schemeOrData.path || _empty;\n this.query = schemeOrData.query || _empty;\n this.fragment = schemeOrData.fragment || _empty;\n // no validation because it's this URI\n // that creates uri components.\n // _validateUri(this);\n }\n else {\n this.scheme = _schemeFix(schemeOrData, _strict);\n this.authority = authority || _empty;\n this.path = _referenceResolution(this.scheme, path || _empty);\n this.query = query || _empty;\n this.fragment = fragment || _empty;\n _validateUri(this, _strict);\n }\n }\n // ---- filesystem path -----------------------\n /**\n * Returns a string representing the corresponding file system path of this URI.\n * Will handle UNC paths, normalizes windows drive letters to lower-case, and uses the\n * platform specific path separator.\n *\n * * Will *not* validate the path for invalid characters and semantics.\n * * Will *not* look at the scheme of this URI.\n * * The result shall *not* be used for display purposes but for accessing a file on disk.\n *\n *\n * The *difference* to `URI#path` is the use of the platform specific separator and the handling\n * of UNC paths. See the below sample of a file-uri with an authority (UNC path).\n *\n * ```ts\n const u = URI.parse('file://server/c$/folder/file.txt')\n u.authority === 'server'\n u.path === '/shares/c$/file.txt'\n u.fsPath === '\\\\server\\c$\\folder\\file.txt'\n ```\n *\n * Using `URI#path` to read a file (using fs-apis) would not be enough because parts of the path,\n * namely the server name, would be missing. Therefore `URI#fsPath` exists - it's sugar to ease working\n * with URIs that represent files on disk (`file` scheme).\n */\n get fsPath() {\n // if (this.scheme !== 'file') {\n // \tconsole.warn(`[UriError] calling fsPath with scheme ${this.scheme}`);\n // }\n return uriToFsPath(this, false);\n }\n // ---- modify to new -------------------------\n with(change) {\n if (!change) {\n return this;\n }\n let { scheme, authority, path, query, fragment } = change;\n if (scheme === undefined) {\n scheme = this.scheme;\n }\n else if (scheme === null) {\n scheme = _empty;\n }\n if (authority === undefined) {\n authority = this.authority;\n }\n else if (authority === null) {\n authority = _empty;\n }\n if (path === undefined) {\n path = this.path;\n }\n else if (path === null) {\n path = _empty;\n }\n if (query === undefined) {\n query = this.query;\n }\n else if (query === null) {\n query = _empty;\n }\n if (fragment === undefined) {\n fragment = this.fragment;\n }\n else if (fragment === null) {\n fragment = _empty;\n }\n if (scheme === this.scheme\n && authority === this.authority\n && path === this.path\n && query === this.query\n && fragment === this.fragment) {\n return this;\n }\n return new Uri(scheme, authority, path, query, fragment);\n }\n // ---- parse & validate ------------------------\n /**\n * Creates a new URI from a string, e.g. `http://www.example.com/some/path`,\n * `file:///usr/home`, or `scheme:with/path`.\n *\n * @param value A string which represents an URI (see `URI#toString`).\n */\n static parse(value, _strict = false) {\n const match = _regexp.exec(value);\n if (!match) {\n return new Uri(_empty, _empty, _empty, _empty, _empty);\n }\n return new Uri(match[2] || _empty, percentDecode(match[4] || _empty), percentDecode(match[5] || _empty), percentDecode(match[7] || _empty), percentDecode(match[9] || _empty), _strict);\n }\n /**\n * Creates a new URI from a file system path, e.g. `c:\\my\\files`,\n * `/usr/home`, or `\\\\server\\share\\some\\path`.\n *\n * The *difference* between `URI#parse` and `URI#file` is that the latter treats the argument\n * as path, not as stringified-uri. E.g. `URI.file(path)` is **not the same as**\n * `URI.parse('file://' + path)` because the path might contain characters that are\n * interpreted (# and ?). See the following sample:\n * ```ts\n const good = URI.file('/coding/c#/project1');\n good.scheme === 'file';\n good.path === '/coding/c#/project1';\n good.fragment === '';\n const bad = URI.parse('file://' + '/coding/c#/project1');\n bad.scheme === 'file';\n bad.path === '/coding/c'; // path is now broken\n bad.fragment === '/project1';\n ```\n *\n * @param path A file system path (see `URI#fsPath`)\n */\n static file(path) {\n let authority = _empty;\n // normalize to fwd-slashes on windows,\n // on other systems bwd-slashes are valid\n // filename character, eg /f\\oo/ba\\r.txt\n if (isWindows) {\n path = path.replace(/\\\\/g, _slash);\n }\n // check for authority as used in UNC shares\n // or use the path as given\n if (path[0] === _slash && path[1] === _slash) {\n const idx = path.indexOf(_slash, 2);\n if (idx === -1) {\n authority = path.substring(2);\n path = _slash;\n }\n else {\n authority = path.substring(2, idx);\n path = path.substring(idx) || _slash;\n }\n }\n return new Uri('file', authority, path, _empty, _empty);\n }\n /**\n * Creates new URI from uri components.\n *\n * Unless `strict` is `true` the scheme is defaults to be `file`. This function performs\n * validation and should be used for untrusted uri components retrieved from storage,\n * user input, command arguments etc\n */\n static from(components, strict) {\n const result = new Uri(components.scheme, components.authority, components.path, components.query, components.fragment, strict);\n return result;\n }\n /**\n * Join a URI path with path fragments and normalizes the resulting path.\n *\n * @param uri The input URI.\n * @param pathFragment The path fragment to add to the URI path.\n * @returns The resulting URI.\n */\n static joinPath(uri, ...pathFragment) {\n if (!uri.path) {\n throw new Error(`[UriError]: cannot call joinPath on URI without path`);\n }\n let newPath;\n if (isWindows && uri.scheme === 'file') {\n newPath = URI.file(paths.win32.join(uriToFsPath(uri, true), ...pathFragment)).path;\n }\n else {\n newPath = paths.posix.join(uri.path, ...pathFragment);\n }\n return uri.with({ path: newPath });\n }\n // ---- printing/externalize ---------------------------\n /**\n * Creates a string representation for this URI. It's guaranteed that calling\n * `URI.parse` with the result of this function creates an URI which is equal\n * to this URI.\n *\n * * The result shall *not* be used for display purposes but for externalization or transport.\n * * The result will be encoded using the percentage encoding and encoding happens mostly\n * ignore the scheme-specific encoding rules.\n *\n * @param skipEncoding Do not encode the result, default is `false`\n */\n toString(skipEncoding = false) {\n return _asFormatted(this, skipEncoding);\n }\n toJSON() {\n return this;\n }\n static revive(data) {\n var _a, _b;\n if (!data) {\n return data;\n }\n else if (data instanceof URI) {\n return data;\n }\n else {\n const result = new Uri(data);\n result._formatted = (_a = data.external) !== null && _a !== void 0 ? _a : null;\n result._fsPath = data._sep === _pathSepMarker ? (_b = data.fsPath) !== null && _b !== void 0 ? _b : null : null;\n return result;\n }\n }\n}\nconst _pathSepMarker = isWindows ? 1 : undefined;\n// This class exists so that URI is compatible with vscode.Uri (API).\nclass Uri extends URI {\n constructor() {\n super(...arguments);\n this._formatted = null;\n this._fsPath = null;\n }\n get fsPath() {\n if (!this._fsPath) {\n this._fsPath = uriToFsPath(this, false);\n }\n return this._fsPath;\n }\n toString(skipEncoding = false) {\n if (!skipEncoding) {\n if (!this._formatted) {\n this._formatted = _asFormatted(this, false);\n }\n return this._formatted;\n }\n else {\n // we don't cache that\n return _asFormatted(this, true);\n }\n }\n toJSON() {\n const res = {\n $mid: 1 /* MarshalledId.Uri */\n };\n // cached state\n if (this._fsPath) {\n res.fsPath = this._fsPath;\n res._sep = _pathSepMarker;\n }\n if (this._formatted) {\n res.external = this._formatted;\n }\n //--- uri components\n if (this.path) {\n res.path = this.path;\n }\n // TODO\n // this isn't correct and can violate the UriComponents contract but\n // this is part of the vscode.Uri API and we shouldn't change how that\n // works anymore\n if (this.scheme) {\n res.scheme = this.scheme;\n }\n if (this.authority) {\n res.authority = this.authority;\n }\n if (this.query) {\n res.query = this.query;\n }\n if (this.fragment) {\n res.fragment = this.fragment;\n }\n return res;\n }\n}\n// reserved characters: https://tools.ietf.org/html/rfc3986#section-2.2\nconst encodeTable = {\n [58 /* CharCode.Colon */]: '%3A', // gen-delims\n [47 /* CharCode.Slash */]: '%2F',\n [63 /* CharCode.QuestionMark */]: '%3F',\n [35 /* CharCode.Hash */]: '%23',\n [91 /* CharCode.OpenSquareBracket */]: '%5B',\n [93 /* CharCode.CloseSquareBracket */]: '%5D',\n [64 /* CharCode.AtSign */]: '%40',\n [33 /* CharCode.ExclamationMark */]: '%21', // sub-delims\n [36 /* CharCode.DollarSign */]: '%24',\n [38 /* CharCode.Ampersand */]: '%26',\n [39 /* CharCode.SingleQuote */]: '%27',\n [40 /* CharCode.OpenParen */]: '%28',\n [41 /* CharCode.CloseParen */]: '%29',\n [42 /* CharCode.Asterisk */]: '%2A',\n [43 /* CharCode.Plus */]: '%2B',\n [44 /* CharCode.Comma */]: '%2C',\n [59 /* CharCode.Semicolon */]: '%3B',\n [61 /* CharCode.Equals */]: '%3D',\n [32 /* CharCode.Space */]: '%20',\n};\nfunction encodeURIComponentFast(uriComponent, isPath, isAuthority) {\n let res = undefined;\n let nativeEncodePos = -1;\n for (let pos = 0; pos < uriComponent.length; pos++) {\n const code = uriComponent.charCodeAt(pos);\n // unreserved characters: https://tools.ietf.org/html/rfc3986#section-2.3\n if ((code >= 97 /* CharCode.a */ && code <= 122 /* CharCode.z */)\n || (code >= 65 /* CharCode.A */ && code <= 90 /* CharCode.Z */)\n || (code >= 48 /* CharCode.Digit0 */ && code <= 57 /* CharCode.Digit9 */)\n || code === 45 /* CharCode.Dash */\n || code === 46 /* CharCode.Period */\n || code === 95 /* CharCode.Underline */\n || code === 126 /* CharCode.Tilde */\n || (isPath && code === 47 /* CharCode.Slash */)\n || (isAuthority && code === 91 /* CharCode.OpenSquareBracket */)\n || (isAuthority && code === 93 /* CharCode.CloseSquareBracket */)\n || (isAuthority && code === 58 /* CharCode.Colon */)) {\n // check if we are delaying native encode\n if (nativeEncodePos !== -1) {\n res += encodeURIComponent(uriComponent.substring(nativeEncodePos, pos));\n nativeEncodePos = -1;\n }\n // check if we write into a new string (by default we try to return the param)\n if (res !== undefined) {\n res += uriComponent.charAt(pos);\n }\n }\n else {\n // encoding needed, we need to allocate a new string\n if (res === undefined) {\n res = uriComponent.substr(0, pos);\n }\n // check with default table first\n const escaped = encodeTable[code];\n if (escaped !== undefined) {\n // check if we are delaying native encode\n if (nativeEncodePos !== -1) {\n res += encodeURIComponent(uriComponent.substring(nativeEncodePos, pos));\n nativeEncodePos = -1;\n }\n // append escaped variant to result\n res += escaped;\n }\n else if (nativeEncodePos === -1) {\n // use native encode only when needed\n nativeEncodePos = pos;\n }\n }\n }\n if (nativeEncodePos !== -1) {\n res += encodeURIComponent(uriComponent.substring(nativeEncodePos));\n }\n return res !== undefined ? res : uriComponent;\n}\nfunction encodeURIComponentMinimal(path) {\n let res = undefined;\n for (let pos = 0; pos < path.length; pos++) {\n const code = path.charCodeAt(pos);\n if (code === 35 /* CharCode.Hash */ || code === 63 /* CharCode.QuestionMark */) {\n if (res === undefined) {\n res = path.substr(0, pos);\n }\n res += encodeTable[code];\n }\n else {\n if (res !== undefined) {\n res += path[pos];\n }\n }\n }\n return res !== undefined ? res : path;\n}\n/**\n * Compute `fsPath` for the given uri\n */\nexport function uriToFsPath(uri, keepDriveLetterCasing) {\n let value;\n if (uri.authority && uri.path.length > 1 && uri.scheme === 'file') {\n // unc path: file://shares/c$/far/boo\n value = `//${uri.authority}${uri.path}`;\n }\n else if (uri.path.charCodeAt(0) === 47 /* CharCode.Slash */\n && (uri.path.charCodeAt(1) >= 65 /* CharCode.A */ && uri.path.charCodeAt(1) <= 90 /* CharCode.Z */ || uri.path.charCodeAt(1) >= 97 /* CharCode.a */ && uri.path.charCodeAt(1) <= 122 /* CharCode.z */)\n && uri.path.charCodeAt(2) === 58 /* CharCode.Colon */) {\n if (!keepDriveLetterCasing) {\n // windows drive letter: file:///c:/far/boo\n value = uri.path[1].toLowerCase() + uri.path.substr(2);\n }\n else {\n value = uri.path.substr(1);\n }\n }\n else {\n // other path\n value = uri.path;\n }\n if (isWindows) {\n value = value.replace(/\\//g, '\\\\');\n }\n return value;\n}\n/**\n * Create the external version of a uri\n */\nfunction _asFormatted(uri, skipEncoding) {\n const encoder = !skipEncoding\n ? encodeURIComponentFast\n : encodeURIComponentMinimal;\n let res = '';\n let { scheme, authority, path, query, fragment } = uri;\n if (scheme) {\n res += scheme;\n res += ':';\n }\n if (authority || scheme === 'file') {\n res += _slash;\n res += _slash;\n }\n if (authority) {\n let idx = authority.indexOf('@');\n if (idx !== -1) {\n // @\n const userinfo = authority.substr(0, idx);\n authority = authority.substr(idx + 1);\n idx = userinfo.lastIndexOf(':');\n if (idx === -1) {\n res += encoder(userinfo, false, false);\n }\n else {\n // :@\n res += encoder(userinfo.substr(0, idx), false, false);\n res += ':';\n res += encoder(userinfo.substr(idx + 1), false, true);\n }\n res += '@';\n }\n authority = authority.toLowerCase();\n idx = authority.lastIndexOf(':');\n if (idx === -1) {\n res += encoder(authority, false, true);\n }\n else {\n // :\n res += encoder(authority.substr(0, idx), false, true);\n res += authority.substr(idx);\n }\n }\n if (path) {\n // lower-case windows drive letters in /C:/fff or C:/fff\n if (path.length >= 3 && path.charCodeAt(0) === 47 /* CharCode.Slash */ && path.charCodeAt(2) === 58 /* CharCode.Colon */) {\n const code = path.charCodeAt(1);\n if (code >= 65 /* CharCode.A */ && code <= 90 /* CharCode.Z */) {\n path = `/${String.fromCharCode(code + 32)}:${path.substr(3)}`; // \"/c:\".length === 3\n }\n }\n else if (path.length >= 2 && path.charCodeAt(1) === 58 /* CharCode.Colon */) {\n const code = path.charCodeAt(0);\n if (code >= 65 /* CharCode.A */ && code <= 90 /* CharCode.Z */) {\n path = `${String.fromCharCode(code + 32)}:${path.substr(2)}`; // \"/c:\".length === 3\n }\n }\n // encode the rest of the path\n res += encoder(path, true, false);\n }\n if (query) {\n res += '?';\n res += encoder(query, false, false);\n }\n if (fragment) {\n res += '#';\n res += !skipEncoding ? encodeURIComponentFast(fragment, false, false) : fragment;\n }\n return res;\n}\n// --- decode\nfunction decodeURIComponentGraceful(str) {\n try {\n return decodeURIComponent(str);\n }\n catch (_a) {\n if (str.length > 3) {\n return str.substr(0, 3) + decodeURIComponentGraceful(str.substr(3));\n }\n else {\n return str;\n }\n }\n}\nconst _rEncodedAsHex = /(%[0-9A-Za-z][0-9A-Za-z])+/g;\nfunction percentDecode(str) {\n if (!str.match(_rEncodedAsHex)) {\n return str;\n }\n return str.replace(_rEncodedAsHex, (match) => decodeURIComponentGraceful(match));\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 * A position in the editor.\n */\nexport class Position {\n constructor(lineNumber, column) {\n this.lineNumber = lineNumber;\n this.column = column;\n }\n /**\n * Create a new position from this position.\n *\n * @param newLineNumber new line number\n * @param newColumn new column\n */\n with(newLineNumber = this.lineNumber, newColumn = this.column) {\n if (newLineNumber === this.lineNumber && newColumn === this.column) {\n return this;\n }\n else {\n return new Position(newLineNumber, newColumn);\n }\n }\n /**\n * Derive a new position from this position.\n *\n * @param deltaLineNumber line number delta\n * @param deltaColumn column delta\n */\n delta(deltaLineNumber = 0, deltaColumn = 0) {\n return this.with(this.lineNumber + deltaLineNumber, this.column + deltaColumn);\n }\n /**\n * Test if this position equals other position\n */\n equals(other) {\n return Position.equals(this, other);\n }\n /**\n * Test if position `a` equals position `b`\n */\n static equals(a, b) {\n if (!a && !b) {\n return true;\n }\n return (!!a &&\n !!b &&\n a.lineNumber === b.lineNumber &&\n a.column === b.column);\n }\n /**\n * Test if this position is before other position.\n * If the two positions are equal, the result will be false.\n */\n isBefore(other) {\n return Position.isBefore(this, other);\n }\n /**\n * Test if position `a` is before position `b`.\n * If the two positions are equal, the result will be false.\n */\n static isBefore(a, b) {\n if (a.lineNumber < b.lineNumber) {\n return true;\n }\n if (b.lineNumber < a.lineNumber) {\n return false;\n }\n return a.column < b.column;\n }\n /**\n * Test if this position is before other position.\n * If the two positions are equal, the result will be true.\n */\n isBeforeOrEqual(other) {\n return Position.isBeforeOrEqual(this, other);\n }\n /**\n * Test if position `a` is before position `b`.\n * If the two positions are equal, the result will be true.\n */\n static isBeforeOrEqual(a, b) {\n if (a.lineNumber < b.lineNumber) {\n return true;\n }\n if (b.lineNumber < a.lineNumber) {\n return false;\n }\n return a.column <= b.column;\n }\n /**\n * A function that compares positions, useful for sorting\n */\n static compare(a, b) {\n const aLineNumber = a.lineNumber | 0;\n const bLineNumber = b.lineNumber | 0;\n if (aLineNumber === bLineNumber) {\n const aColumn = a.column | 0;\n const bColumn = b.column | 0;\n return aColumn - bColumn;\n }\n return aLineNumber - bLineNumber;\n }\n /**\n * Clone this position.\n */\n clone() {\n return new Position(this.lineNumber, this.column);\n }\n /**\n * Convert to a human-readable representation.\n */\n toString() {\n return '(' + this.lineNumber + ',' + this.column + ')';\n }\n // ---\n /**\n * Create a `Position` from an `IPosition`.\n */\n static lift(pos) {\n return new Position(pos.lineNumber, pos.column);\n }\n /**\n * Test if `obj` is an `IPosition`.\n */\n static isIPosition(obj) {\n return (obj\n && (typeof obj.lineNumber === 'number')\n && (typeof obj.column === 'number'));\n }\n toJSON() {\n return {\n lineNumber: this.lineNumber,\n column: this.column\n };\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 *--------------------------------------------------------------------------------------------*/\nimport { Position } from './position.js';\n/**\n * A range in the editor. (startLineNumber,startColumn) is <= (endLineNumber,endColumn)\n */\nexport class Range {\n constructor(startLineNumber, startColumn, endLineNumber, endColumn) {\n if ((startLineNumber > endLineNumber) || (startLineNumber === endLineNumber && startColumn > endColumn)) {\n this.startLineNumber = endLineNumber;\n this.startColumn = endColumn;\n this.endLineNumber = startLineNumber;\n this.endColumn = startColumn;\n }\n else {\n this.startLineNumber = startLineNumber;\n this.startColumn = startColumn;\n this.endLineNumber = endLineNumber;\n this.endColumn = endColumn;\n }\n }\n /**\n * Test if this range is empty.\n */\n isEmpty() {\n return Range.isEmpty(this);\n }\n /**\n * Test if `range` is empty.\n */\n static isEmpty(range) {\n return (range.startLineNumber === range.endLineNumber && range.startColumn === range.endColumn);\n }\n /**\n * Test if position is in this range. If the position is at the edges, will return true.\n */\n containsPosition(position) {\n return Range.containsPosition(this, position);\n }\n /**\n * Test if `position` is in `range`. If the position is at the edges, will return true.\n */\n static containsPosition(range, position) {\n if (position.lineNumber < range.startLineNumber || position.lineNumber > range.endLineNumber) {\n return false;\n }\n if (position.lineNumber === range.startLineNumber && position.column < range.startColumn) {\n return false;\n }\n if (position.lineNumber === range.endLineNumber && position.column > range.endColumn) {\n return false;\n }\n return true;\n }\n /**\n * Test if `position` is in `range`. If the position is at the edges, will return false.\n * @internal\n */\n static strictContainsPosition(range, position) {\n if (position.lineNumber < range.startLineNumber || position.lineNumber > range.endLineNumber) {\n return false;\n }\n if (position.lineNumber === range.startLineNumber && position.column <= range.startColumn) {\n return false;\n }\n if (position.lineNumber === range.endLineNumber && position.column >= range.endColumn) {\n return false;\n }\n return true;\n }\n /**\n * Test if range is in this range. If the range is equal to this range, will return true.\n */\n containsRange(range) {\n return Range.containsRange(this, range);\n }\n /**\n * Test if `otherRange` is in `range`. If the ranges are equal, will return true.\n */\n static containsRange(range, otherRange) {\n if (otherRange.startLineNumber < range.startLineNumber || otherRange.endLineNumber < range.startLineNumber) {\n return false;\n }\n if (otherRange.startLineNumber > range.endLineNumber || otherRange.endLineNumber > range.endLineNumber) {\n return false;\n }\n if (otherRange.startLineNumber === range.startLineNumber && otherRange.startColumn < range.startColumn) {\n return false;\n }\n if (otherRange.endLineNumber === range.endLineNumber && otherRange.endColumn > range.endColumn) {\n return false;\n }\n return true;\n }\n /**\n * Test if `range` is strictly in this range. `range` must start after and end before this range for the result to be true.\n */\n strictContainsRange(range) {\n return Range.strictContainsRange(this, range);\n }\n /**\n * Test if `otherRange` is strictly in `range` (must start after, and end before). If the ranges are equal, will return false.\n */\n static strictContainsRange(range, otherRange) {\n if (otherRange.startLineNumber < range.startLineNumber || otherRange.endLineNumber < range.startLineNumber) {\n return false;\n }\n if (otherRange.startLineNumber > range.endLineNumber || otherRange.endLineNumber > range.endLineNumber) {\n return false;\n }\n if (otherRange.startLineNumber === range.startLineNumber && otherRange.startColumn <= range.startColumn) {\n return false;\n }\n if (otherRange.endLineNumber === range.endLineNumber && otherRange.endColumn >= range.endColumn) {\n return false;\n }\n return true;\n }\n /**\n * A reunion of the two ranges.\n * The smallest position will be used as the start point, and the largest one as the end point.\n */\n plusRange(range) {\n return Range.plusRange(this, range);\n }\n /**\n * A reunion of the two ranges.\n * The smallest position will be used as the start point, and the largest one as the end point.\n */\n static plusRange(a, b) {\n let startLineNumber;\n let startColumn;\n let endLineNumber;\n let endColumn;\n if (b.startLineNumber < a.startLineNumber) {\n startLineNumber = b.startLineNumber;\n startColumn = b.startColumn;\n }\n else if (b.startLineNumber === a.startLineNumber) {\n startLineNumber = b.startLineNumber;\n startColumn = Math.min(b.startColumn, a.startColumn);\n }\n else {\n startLineNumber = a.startLineNumber;\n startColumn = a.startColumn;\n }\n if (b.endLineNumber > a.endLineNumber) {\n endLineNumber = b.endLineNumber;\n endColumn = b.endColumn;\n }\n else if (b.endLineNumber === a.endLineNumber) {\n endLineNumber = b.endLineNumber;\n endColumn = Math.max(b.endColumn, a.endColumn);\n }\n else {\n endLineNumber = a.endLineNumber;\n endColumn = a.endColumn;\n }\n return new Range(startLineNumber, startColumn, endLineNumber, endColumn);\n }\n /**\n * A intersection of the two ranges.\n */\n intersectRanges(range) {\n return Range.intersectRanges(this, range);\n }\n /**\n * A intersection of the two ranges.\n */\n static intersectRanges(a, b) {\n let resultStartLineNumber = a.startLineNumber;\n let resultStartColumn = a.startColumn;\n let resultEndLineNumber = a.endLineNumber;\n let resultEndColumn = a.endColumn;\n const otherStartLineNumber = b.startLineNumber;\n const otherStartColumn = b.startColumn;\n const otherEndLineNumber = b.endLineNumber;\n const otherEndColumn = b.endColumn;\n if (resultStartLineNumber < otherStartLineNumber) {\n resultStartLineNumber = otherStartLineNumber;\n resultStartColumn = otherStartColumn;\n }\n else if (resultStartLineNumber === otherStartLineNumber) {\n resultStartColumn = Math.max(resultStartColumn, otherStartColumn);\n }\n if (resultEndLineNumber > otherEndLineNumber) {\n resultEndLineNumber = otherEndLineNumber;\n resultEndColumn = otherEndColumn;\n }\n else if (resultEndLineNumber === otherEndLineNumber) {\n resultEndColumn = Math.min(resultEndColumn, otherEndColumn);\n }\n // Check if selection is now empty\n if (resultStartLineNumber > resultEndLineNumber) {\n return null;\n }\n if (resultStartLineNumber === resultEndLineNumber && resultStartColumn > resultEndColumn) {\n return null;\n }\n return new Range(resultStartLineNumber, resultStartColumn, resultEndLineNumber, resultEndColumn);\n }\n /**\n * Test if this range equals other.\n */\n equalsRange(other) {\n return Range.equalsRange(this, other);\n }\n /**\n * Test if range `a` equals `b`.\n */\n static equalsRange(a, b) {\n if (!a && !b) {\n return true;\n }\n return (!!a &&\n !!b &&\n a.startLineNumber === b.startLineNumber &&\n a.startColumn === b.startColumn &&\n a.endLineNumber === b.endLineNumber &&\n a.endColumn === b.endColumn);\n }\n /**\n * Return the end position (which will be after or equal to the start position)\n */\n getEndPosition() {\n return Range.getEndPosition(this);\n }\n /**\n * Return the end position (which will be after or equal to the start position)\n */\n static getEndPosition(range) {\n return new Position(range.endLineNumber, range.endColumn);\n }\n /**\n * Return the start position (which will be before or equal to the end position)\n */\n getStartPosition() {\n return Range.getStartPosition(this);\n }\n /**\n * Return the start position (which will be before or equal to the end position)\n */\n static getStartPosition(range) {\n return new Position(range.startLineNumber, range.startColumn);\n }\n /**\n * Transform to a user presentable string representation.\n */\n toString() {\n return '[' + this.startLineNumber + ',' + this.startColumn + ' -> ' + this.endLineNumber + ',' + this.endColumn + ']';\n }\n /**\n * Create a new range using this range's start position, and using endLineNumber and endColumn as the end position.\n */\n setEndPosition(endLineNumber, endColumn) {\n return new Range(this.startLineNumber, this.startColumn, endLineNumber, endColumn);\n }\n /**\n * Create a new range using this range's end position, and using startLineNumber and startColumn as the start position.\n */\n setStartPosition(startLineNumber, startColumn) {\n return new Range(startLineNumber, startColumn, this.endLineNumber, this.endColumn);\n }\n /**\n * Create a new empty range using this range's start position.\n */\n collapseToStart() {\n return Range.collapseToStart(this);\n }\n /**\n * Create a new empty range using this range's start position.\n */\n static collapseToStart(range) {\n return new Range(range.startLineNumber, range.startColumn, range.startLineNumber, range.startColumn);\n }\n /**\n * Create a new empty range using this range's end position.\n */\n collapseToEnd() {\n return Range.collapseToEnd(this);\n }\n /**\n * Create a new empty range using this range's end position.\n */\n static collapseToEnd(range) {\n return new Range(range.endLineNumber, range.endColumn, range.endLineNumber, range.endColumn);\n }\n /**\n * Moves the range by the given amount of lines.\n */\n delta(lineCount) {\n return new Range(this.startLineNumber + lineCount, this.startColumn, this.endLineNumber + lineCount, this.endColumn);\n }\n // ---\n static fromPositions(start, end = start) {\n return new Range(start.lineNumber, start.column, end.lineNumber, end.column);\n }\n static lift(range) {\n if (!range) {\n return null;\n }\n return new Range(range.startLineNumber, range.startColumn, range.endLineNumber, range.endColumn);\n }\n /**\n * Test if `obj` is an `IRange`.\n */\n static isIRange(obj) {\n return (obj\n && (typeof obj.startLineNumber === 'number')\n && (typeof obj.startColumn === 'number')\n && (typeof obj.endLineNumber === 'number')\n && (typeof obj.endColumn === 'number'));\n }\n /**\n * Test if the two ranges are touching in any way.\n */\n static areIntersectingOrTouching(a, b) {\n // Check if `a` is before `b`\n if (a.endLineNumber < b.startLineNumber || (a.endLineNumber === b.startLineNumber && a.endColumn < b.startColumn)) {\n return false;\n }\n // Check if `b` is before `a`\n if (b.endLineNumber < a.startLineNumber || (b.endLineNumber === a.startLineNumber && b.endColumn < a.startColumn)) {\n return false;\n }\n // These ranges must intersect\n return true;\n }\n /**\n * Test if the two ranges are intersecting. If the ranges are touching it returns true.\n */\n static areIntersecting(a, b) {\n // Check if `a` is before `b`\n if (a.endLineNumber < b.startLineNumber || (a.endLineNumber === b.startLineNumber && a.endColumn <= b.startColumn)) {\n return false;\n }\n // Check if `b` is before `a`\n if (b.endLineNumber < a.startLineNumber || (b.endLineNumber === a.startLineNumber && b.endColumn <= a.startColumn)) {\n return false;\n }\n // These ranges must intersect\n return true;\n }\n /**\n * A function that compares ranges, useful for sorting ranges\n * It will first compare ranges on the startPosition and then on the endPosition\n */\n static compareRangesUsingStarts(a, b) {\n if (a && b) {\n const aStartLineNumber = a.startLineNumber | 0;\n const bStartLineNumber = b.startLineNumber | 0;\n if (aStartLineNumber === bStartLineNumber) {\n const aStartColumn = a.startColumn | 0;\n const bStartColumn = b.startColumn | 0;\n if (aStartColumn === bStartColumn) {\n const aEndLineNumber = a.endLineNumber | 0;\n const bEndLineNumber = b.endLineNumber | 0;\n if (aEndLineNumber === bEndLineNumber) {\n const aEndColumn = a.endColumn | 0;\n const bEndColumn = b.endColumn | 0;\n return aEndColumn - bEndColumn;\n }\n return aEndLineNumber - bEndLineNumber;\n }\n return aStartColumn - bStartColumn;\n }\n return aStartLineNumber - bStartLineNumber;\n }\n const aExists = (a ? 1 : 0);\n const bExists = (b ? 1 : 0);\n return aExists - bExists;\n }\n /**\n * A function that compares ranges, useful for sorting ranges\n * It will first compare ranges on the endPosition and then on the startPosition\n */\n static compareRangesUsingEnds(a, b) {\n if (a.endLineNumber === b.endLineNumber) {\n if (a.endColumn === b.endColumn) {\n if (a.startLineNumber === b.startLineNumber) {\n return a.startColumn - b.startColumn;\n }\n return a.startLineNumber - b.startLineNumber;\n }\n return a.endColumn - b.endColumn;\n }\n return a.endLineNumber - b.endLineNumber;\n }\n /**\n * Test if the range spans multiple lines.\n */\n static spansMultipleLines(range) {\n return range.endLineNumber > range.startLineNumber;\n }\n toJSON() {\n return this;\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 *--------------------------------------------------------------------------------------------*/\nimport { Position } from './position.js';\nimport { Range } from './range.js';\n/**\n * A selection in the editor.\n * The selection is a range that has an orientation.\n */\nexport class Selection extends Range {\n constructor(selectionStartLineNumber, selectionStartColumn, positionLineNumber, positionColumn) {\n super(selectionStartLineNumber, selectionStartColumn, positionLineNumber, positionColumn);\n this.selectionStartLineNumber = selectionStartLineNumber;\n this.selectionStartColumn = selectionStartColumn;\n this.positionLineNumber = positionLineNumber;\n this.positionColumn = positionColumn;\n }\n /**\n * Transform to a human-readable representation.\n */\n toString() {\n return '[' + this.selectionStartLineNumber + ',' + this.selectionStartColumn + ' -> ' + this.positionLineNumber + ',' + this.positionColumn + ']';\n }\n /**\n * Test if equals other selection.\n */\n equalsSelection(other) {\n return (Selection.selectionsEqual(this, other));\n }\n /**\n * Test if the two selections are equal.\n */\n static selectionsEqual(a, b) {\n return (a.selectionStartLineNumber === b.selectionStartLineNumber &&\n a.selectionStartColumn === b.selectionStartColumn &&\n a.positionLineNumber === b.positionLineNumber &&\n a.positionColumn === b.positionColumn);\n }\n /**\n * Get directions (LTR or RTL).\n */\n getDirection() {\n if (this.selectionStartLineNumber === this.startLineNumber && this.selectionStartColumn === this.startColumn) {\n return 0 /* SelectionDirection.LTR */;\n }\n return 1 /* SelectionDirection.RTL */;\n }\n /**\n * Create a new selection with a different `positionLineNumber` and `positionColumn`.\n */\n setEndPosition(endLineNumber, endColumn) {\n if (this.getDirection() === 0 /* SelectionDirection.LTR */) {\n return new Selection(this.startLineNumber, this.startColumn, endLineNumber, endColumn);\n }\n return new Selection(endLineNumber, endColumn, this.startLineNumber, this.startColumn);\n }\n /**\n * Get the position at `positionLineNumber` and `positionColumn`.\n */\n getPosition() {\n return new Position(this.positionLineNumber, this.positionColumn);\n }\n /**\n * Get the position at the start of the selection.\n */\n getSelectionStart() {\n return new Position(this.selectionStartLineNumber, this.selectionStartColumn);\n }\n /**\n * Create a new selection with a different `selectionStartLineNumber` and `selectionStartColumn`.\n */\n setStartPosition(startLineNumber, startColumn) {\n if (this.getDirection() === 0 /* SelectionDirection.LTR */) {\n return new Selection(startLineNumber, startColumn, this.endLineNumber, this.endColumn);\n }\n return new Selection(this.endLineNumber, this.endColumn, startLineNumber, startColumn);\n }\n // ----\n /**\n * Create a `Selection` from one or two positions\n */\n static fromPositions(start, end = start) {\n return new Selection(start.lineNumber, start.column, end.lineNumber, end.column);\n }\n /**\n * Creates a `Selection` from a range, given a direction.\n */\n static fromRange(range, direction) {\n if (direction === 0 /* SelectionDirection.LTR */) {\n return new Selection(range.startLineNumber, range.startColumn, range.endLineNumber, range.endColumn);\n }\n else {\n return new Selection(range.endLineNumber, range.endColumn, range.startLineNumber, range.startColumn);\n }\n }\n /**\n * Create a `Selection` from an `ISelection`.\n */\n static liftSelection(sel) {\n return new Selection(sel.selectionStartLineNumber, sel.selectionStartColumn, sel.positionLineNumber, sel.positionColumn);\n }\n /**\n * `a` equals `b`.\n */\n static selectionsArrEqual(a, b) {\n if (a && !b || !a && b) {\n return false;\n }\n if (!a && !b) {\n return true;\n }\n if (a.length !== b.length) {\n return false;\n }\n for (let i = 0, len = a.length; i < len; i++) {\n if (!this.selectionsEqual(a[i], b[i])) {\n return false;\n }\n }\n return true;\n }\n /**\n * Test if `obj` is an `ISelection`.\n */\n static isISelection(obj) {\n return (obj\n && (typeof obj.selectionStartLineNumber === 'number')\n && (typeof obj.selectionStartColumn === 'number')\n && (typeof obj.positionLineNumber === 'number')\n && (typeof obj.positionColumn === 'number'));\n }\n /**\n * Create with a direction.\n */\n static createWithDirection(startLineNumber, startColumn, endLineNumber, endColumn, direction) {\n if (direction === 0 /* SelectionDirection.LTR */) {\n return new Selection(startLineNumber, startColumn, endLineNumber, endColumn);\n }\n return new Selection(endLineNumber, endColumn, startLineNumber, startColumn);\n }\n}\n", "import { isString } from './types.js';\nconst _codiconFontCharacters = Object.create(null);\nexport function register(id, fontCharacter) {\n if (isString(fontCharacter)) {\n const val = _codiconFontCharacters[fontCharacter];\n if (val === undefined) {\n throw new Error(`${id} references an unknown codicon: ${fontCharacter}`);\n }\n fontCharacter = val;\n }\n _codiconFontCharacters[id] = fontCharacter;\n return { id };\n}\n/**\n * Only to be used by the iconRegistry.\n */\nexport function getCodiconFontCharacters() {\n return _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// 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 add: register('add', 0xea60),\n plus: register('plus', 0xea60),\n gistNew: register('gist-new', 0xea60),\n repoCreate: register('repo-create', 0xea60),\n lightbulb: register('lightbulb', 0xea61),\n lightBulb: register('light-bulb', 0xea61),\n repo: register('repo', 0xea62),\n repoDelete: register('repo-delete', 0xea62),\n gistFork: register('gist-fork', 0xea63),\n repoForked: register('repo-forked', 0xea63),\n gitPullRequest: register('git-pull-request', 0xea64),\n gitPullRequestAbandoned: register('git-pull-request-abandoned', 0xea64),\n recordKeys: register('record-keys', 0xea65),\n keyboard: register('keyboard', 0xea65),\n tag: register('tag', 0xea66),\n gitPullRequestLabel: register('git-pull-request-label', 0xea66),\n tagAdd: register('tag-add', 0xea66),\n tagRemove: register('tag-remove', 0xea66),\n person: register('person', 0xea67),\n personFollow: register('person-follow', 0xea67),\n personOutline: register('person-outline', 0xea67),\n personFilled: register('person-filled', 0xea67),\n gitBranch: register('git-branch', 0xea68),\n gitBranchCreate: register('git-branch-create', 0xea68),\n gitBranchDelete: register('git-branch-delete', 0xea68),\n sourceControl: register('source-control', 0xea68),\n mirror: register('mirror', 0xea69),\n mirrorPublic: register('mirror-public', 0xea69),\n star: register('star', 0xea6a),\n starAdd: register('star-add', 0xea6a),\n starDelete: register('star-delete', 0xea6a),\n starEmpty: register('star-empty', 0xea6a),\n comment: register('comment', 0xea6b),\n commentAdd: register('comment-add', 0xea6b),\n alert: register('alert', 0xea6c),\n warning: register('warning', 0xea6c),\n search: register('search', 0xea6d),\n searchSave: register('search-save', 0xea6d),\n logOut: register('log-out', 0xea6e),\n signOut: register('sign-out', 0xea6e),\n logIn: register('log-in', 0xea6f),\n signIn: register('sign-in', 0xea6f),\n eye: register('eye', 0xea70),\n eyeUnwatch: register('eye-unwatch', 0xea70),\n eyeWatch: register('eye-watch', 0xea70),\n circleFilled: register('circle-filled', 0xea71),\n primitiveDot: register('primitive-dot', 0xea71),\n closeDirty: register('close-dirty', 0xea71),\n debugBreakpoint: register('debug-breakpoint', 0xea71),\n debugBreakpointDisabled: register('debug-breakpoint-disabled', 0xea71),\n debugHint: register('debug-hint', 0xea71),\n terminalDecorationSuccess: register('terminal-decoration-success', 0xea71),\n primitiveSquare: register('primitive-square', 0xea72),\n edit: register('edit', 0xea73),\n pencil: register('pencil', 0xea73),\n info: register('info', 0xea74),\n issueOpened: register('issue-opened', 0xea74),\n gistPrivate: register('gist-private', 0xea75),\n gitForkPrivate: register('git-fork-private', 0xea75),\n lock: register('lock', 0xea75),\n mirrorPrivate: register('mirror-private', 0xea75),\n close: register('close', 0xea76),\n removeClose: register('remove-close', 0xea76),\n x: register('x', 0xea76),\n repoSync: register('repo-sync', 0xea77),\n sync: register('sync', 0xea77),\n clone: register('clone', 0xea78),\n desktopDownload: register('desktop-download', 0xea78),\n beaker: register('beaker', 0xea79),\n microscope: register('microscope', 0xea79),\n vm: register('vm', 0xea7a),\n deviceDesktop: register('device-desktop', 0xea7a),\n file: register('file', 0xea7b),\n fileText: register('file-text', 0xea7b),\n more: register('more', 0xea7c),\n ellipsis: register('ellipsis', 0xea7c),\n kebabHorizontal: register('kebab-horizontal', 0xea7c),\n mailReply: register('mail-reply', 0xea7d),\n reply: register('reply', 0xea7d),\n organization: register('organization', 0xea7e),\n organizationFilled: register('organization-filled', 0xea7e),\n organizationOutline: register('organization-outline', 0xea7e),\n newFile: register('new-file', 0xea7f),\n fileAdd: register('file-add', 0xea7f),\n newFolder: register('new-folder', 0xea80),\n fileDirectoryCreate: register('file-directory-create', 0xea80),\n trash: register('trash', 0xea81),\n trashcan: register('trashcan', 0xea81),\n history: register('history', 0xea82),\n clock: register('clock', 0xea82),\n folder: register('folder', 0xea83),\n fileDirectory: register('file-directory', 0xea83),\n symbolFolder: register('symbol-folder', 0xea83),\n logoGithub: register('logo-github', 0xea84),\n markGithub: register('mark-github', 0xea84),\n github: register('github', 0xea84),\n terminal: register('terminal', 0xea85),\n console: register('console', 0xea85),\n repl: register('repl', 0xea85),\n zap: register('zap', 0xea86),\n symbolEvent: register('symbol-event', 0xea86),\n error: register('error', 0xea87),\n stop: register('stop', 0xea87),\n variable: register('variable', 0xea88),\n symbolVariable: register('symbol-variable', 0xea88),\n array: register('array', 0xea8a),\n symbolArray: register('symbol-array', 0xea8a),\n symbolModule: register('symbol-module', 0xea8b),\n symbolPackage: register('symbol-package', 0xea8b),\n symbolNamespace: register('symbol-namespace', 0xea8b),\n symbolObject: register('symbol-object', 0xea8b),\n symbolMethod: register('symbol-method', 0xea8c),\n symbolFunction: register('symbol-function', 0xea8c),\n symbolConstructor: register('symbol-constructor', 0xea8c),\n symbolBoolean: register('symbol-boolean', 0xea8f),\n symbolNull: register('symbol-null', 0xea8f),\n symbolNumeric: register('symbol-numeric', 0xea90),\n symbolNumber: register('symbol-number', 0xea90),\n symbolStructure: register('symbol-structure', 0xea91),\n symbolStruct: register('symbol-struct', 0xea91),\n symbolParameter: register('symbol-parameter', 0xea92),\n symbolTypeParameter: register('symbol-type-parameter', 0xea92),\n symbolKey: register('symbol-key', 0xea93),\n symbolText: register('symbol-text', 0xea93),\n symbolReference: register('symbol-reference', 0xea94),\n goToFile: register('go-to-file', 0xea94),\n symbolEnum: register('symbol-enum', 0xea95),\n symbolValue: register('symbol-value', 0xea95),\n symbolRuler: register('symbol-ruler', 0xea96),\n symbolUnit: register('symbol-unit', 0xea96),\n activateBreakpoints: register('activate-breakpoints', 0xea97),\n archive: register('archive', 0xea98),\n arrowBoth: register('arrow-both', 0xea99),\n arrowDown: register('arrow-down', 0xea9a),\n arrowLeft: register('arrow-left', 0xea9b),\n arrowRight: register('arrow-right', 0xea9c),\n arrowSmallDown: register('arrow-small-down', 0xea9d),\n arrowSmallLeft: register('arrow-small-left', 0xea9e),\n arrowSmallRight: register('arrow-small-right', 0xea9f),\n arrowSmallUp: register('arrow-small-up', 0xeaa0),\n arrowUp: register('arrow-up', 0xeaa1),\n bell: register('bell', 0xeaa2),\n bold: register('bold', 0xeaa3),\n book: register('book', 0xeaa4),\n bookmark: register('bookmark', 0xeaa5),\n debugBreakpointConditionalUnverified: register('debug-breakpoint-conditional-unverified', 0xeaa6),\n debugBreakpointConditional: register('debug-breakpoint-conditional', 0xeaa7),\n debugBreakpointConditionalDisabled: register('debug-breakpoint-conditional-disabled', 0xeaa7),\n debugBreakpointDataUnverified: register('debug-breakpoint-data-unverified', 0xeaa8),\n debugBreakpointData: register('debug-breakpoint-data', 0xeaa9),\n debugBreakpointDataDisabled: register('debug-breakpoint-data-disabled', 0xeaa9),\n debugBreakpointLogUnverified: register('debug-breakpoint-log-unverified', 0xeaaa),\n debugBreakpointLog: register('debug-breakpoint-log', 0xeaab),\n debugBreakpointLogDisabled: register('debug-breakpoint-log-disabled', 0xeaab),\n briefcase: register('briefcase', 0xeaac),\n broadcast: register('broadcast', 0xeaad),\n browser: register('browser', 0xeaae),\n bug: register('bug', 0xeaaf),\n calendar: register('calendar', 0xeab0),\n caseSensitive: register('case-sensitive', 0xeab1),\n check: register('check', 0xeab2),\n checklist: register('checklist', 0xeab3),\n chevronDown: register('chevron-down', 0xeab4),\n chevronLeft: register('chevron-left', 0xeab5),\n chevronRight: register('chevron-right', 0xeab6),\n chevronUp: register('chevron-up', 0xeab7),\n chromeClose: register('chrome-close', 0xeab8),\n chromeMaximize: register('chrome-maximize', 0xeab9),\n chromeMinimize: register('chrome-minimize', 0xeaba),\n chromeRestore: register('chrome-restore', 0xeabb),\n circleOutline: register('circle-outline', 0xeabc),\n circle: register('circle', 0xeabc),\n debugBreakpointUnverified: register('debug-breakpoint-unverified', 0xeabc),\n terminalDecorationIncomplete: register('terminal-decoration-incomplete', 0xeabc),\n circleSlash: register('circle-slash', 0xeabd),\n circuitBoard: register('circuit-board', 0xeabe),\n clearAll: register('clear-all', 0xeabf),\n clippy: register('clippy', 0xeac0),\n closeAll: register('close-all', 0xeac1),\n cloudDownload: register('cloud-download', 0xeac2),\n cloudUpload: register('cloud-upload', 0xeac3),\n code: register('code', 0xeac4),\n collapseAll: register('collapse-all', 0xeac5),\n colorMode: register('color-mode', 0xeac6),\n commentDiscussion: register('comment-discussion', 0xeac7),\n creditCard: register('credit-card', 0xeac9),\n dash: register('dash', 0xeacc),\n dashboard: register('dashboard', 0xeacd),\n database: register('database', 0xeace),\n debugContinue: register('debug-continue', 0xeacf),\n debugDisconnect: register('debug-disconnect', 0xead0),\n debugPause: register('debug-pause', 0xead1),\n debugRestart: register('debug-restart', 0xead2),\n debugStart: register('debug-start', 0xead3),\n debugStepInto: register('debug-step-into', 0xead4),\n debugStepOut: register('debug-step-out', 0xead5),\n debugStepOver: register('debug-step-over', 0xead6),\n debugStop: register('debug-stop', 0xead7),\n debug: register('debug', 0xead8),\n deviceCameraVideo: register('device-camera-video', 0xead9),\n deviceCamera: register('device-camera', 0xeada),\n deviceMobile: register('device-mobile', 0xeadb),\n diffAdded: register('diff-added', 0xeadc),\n diffIgnored: register('diff-ignored', 0xeadd),\n diffModified: register('diff-modified', 0xeade),\n diffRemoved: register('diff-removed', 0xeadf),\n diffRenamed: register('diff-renamed', 0xeae0),\n diff: register('diff', 0xeae1),\n diffSidebyside: register('diff-sidebyside', 0xeae1),\n discard: register('discard', 0xeae2),\n editorLayout: register('editor-layout', 0xeae3),\n emptyWindow: register('empty-window', 0xeae4),\n exclude: register('exclude', 0xeae5),\n extensions: register('extensions', 0xeae6),\n eyeClosed: register('eye-closed', 0xeae7),\n fileBinary: register('file-binary', 0xeae8),\n fileCode: register('file-code', 0xeae9),\n fileMedia: register('file-media', 0xeaea),\n filePdf: register('file-pdf', 0xeaeb),\n fileSubmodule: register('file-submodule', 0xeaec),\n fileSymlinkDirectory: register('file-symlink-directory', 0xeaed),\n fileSymlinkFile: register('file-symlink-file', 0xeaee),\n fileZip: register('file-zip', 0xeaef),\n files: register('files', 0xeaf0),\n filter: register('filter', 0xeaf1),\n flame: register('flame', 0xeaf2),\n foldDown: register('fold-down', 0xeaf3),\n foldUp: register('fold-up', 0xeaf4),\n fold: register('fold', 0xeaf5),\n folderActive: register('folder-active', 0xeaf6),\n folderOpened: register('folder-opened', 0xeaf7),\n gear: register('gear', 0xeaf8),\n gift: register('gift', 0xeaf9),\n gistSecret: register('gist-secret', 0xeafa),\n gist: register('gist', 0xeafb),\n gitCommit: register('git-commit', 0xeafc),\n gitCompare: register('git-compare', 0xeafd),\n compareChanges: register('compare-changes', 0xeafd),\n gitMerge: register('git-merge', 0xeafe),\n githubAction: register('github-action', 0xeaff),\n githubAlt: register('github-alt', 0xeb00),\n globe: register('globe', 0xeb01),\n grabber: register('grabber', 0xeb02),\n graph: register('graph', 0xeb03),\n gripper: register('gripper', 0xeb04),\n heart: register('heart', 0xeb05),\n home: register('home', 0xeb06),\n horizontalRule: register('horizontal-rule', 0xeb07),\n hubot: register('hubot', 0xeb08),\n inbox: register('inbox', 0xeb09),\n issueReopened: register('issue-reopened', 0xeb0b),\n issues: register('issues', 0xeb0c),\n italic: register('italic', 0xeb0d),\n jersey: register('jersey', 0xeb0e),\n json: register('json', 0xeb0f),\n kebabVertical: register('kebab-vertical', 0xeb10),\n key: register('key', 0xeb11),\n law: register('law', 0xeb12),\n lightbulbAutofix: register('lightbulb-autofix', 0xeb13),\n linkExternal: register('link-external', 0xeb14),\n link: register('link', 0xeb15),\n listOrdered: register('list-ordered', 0xeb16),\n listUnordered: register('list-unordered', 0xeb17),\n liveShare: register('live-share', 0xeb18),\n loading: register('loading', 0xeb19),\n location: register('location', 0xeb1a),\n mailRead: register('mail-read', 0xeb1b),\n mail: register('mail', 0xeb1c),\n markdown: register('markdown', 0xeb1d),\n megaphone: register('megaphone', 0xeb1e),\n mention: register('mention', 0xeb1f),\n milestone: register('milestone', 0xeb20),\n gitPullRequestMilestone: register('git-pull-request-milestone', 0xeb20),\n mortarBoard: register('mortar-board', 0xeb21),\n move: register('move', 0xeb22),\n multipleWindows: register('multiple-windows', 0xeb23),\n mute: register('mute', 0xeb24),\n noNewline: register('no-newline', 0xeb25),\n note: register('note', 0xeb26),\n octoface: register('octoface', 0xeb27),\n openPreview: register('open-preview', 0xeb28),\n package: register('package', 0xeb29),\n paintcan: register('paintcan', 0xeb2a),\n pin: register('pin', 0xeb2b),\n play: register('play', 0xeb2c),\n run: register('run', 0xeb2c),\n plug: register('plug', 0xeb2d),\n preserveCase: register('preserve-case', 0xeb2e),\n preview: register('preview', 0xeb2f),\n project: register('project', 0xeb30),\n pulse: register('pulse', 0xeb31),\n question: register('question', 0xeb32),\n quote: register('quote', 0xeb33),\n radioTower: register('radio-tower', 0xeb34),\n reactions: register('reactions', 0xeb35),\n references: register('references', 0xeb36),\n refresh: register('refresh', 0xeb37),\n regex: register('regex', 0xeb38),\n remoteExplorer: register('remote-explorer', 0xeb39),\n remote: register('remote', 0xeb3a),\n remove: register('remove', 0xeb3b),\n replaceAll: register('replace-all', 0xeb3c),\n replace: register('replace', 0xeb3d),\n repoClone: register('repo-clone', 0xeb3e),\n repoForcePush: register('repo-force-push', 0xeb3f),\n repoPull: register('repo-pull', 0xeb40),\n repoPush: register('repo-push', 0xeb41),\n report: register('report', 0xeb42),\n requestChanges: register('request-changes', 0xeb43),\n rocket: register('rocket', 0xeb44),\n rootFolderOpened: register('root-folder-opened', 0xeb45),\n rootFolder: register('root-folder', 0xeb46),\n rss: register('rss', 0xeb47),\n ruby: register('ruby', 0xeb48),\n saveAll: register('save-all', 0xeb49),\n saveAs: register('save-as', 0xeb4a),\n save: register('save', 0xeb4b),\n screenFull: register('screen-full', 0xeb4c),\n screenNormal: register('screen-normal', 0xeb4d),\n searchStop: register('search-stop', 0xeb4e),\n server: register('server', 0xeb50),\n settingsGear: register('settings-gear', 0xeb51),\n settings: register('settings', 0xeb52),\n shield: register('shield', 0xeb53),\n smiley: register('smiley', 0xeb54),\n sortPrecedence: register('sort-precedence', 0xeb55),\n splitHorizontal: register('split-horizontal', 0xeb56),\n splitVertical: register('split-vertical', 0xeb57),\n squirrel: register('squirrel', 0xeb58),\n starFull: register('star-full', 0xeb59),\n starHalf: register('star-half', 0xeb5a),\n symbolClass: register('symbol-class', 0xeb5b),\n symbolColor: register('symbol-color', 0xeb5c),\n symbolConstant: register('symbol-constant', 0xeb5d),\n symbolEnumMember: register('symbol-enum-member', 0xeb5e),\n symbolField: register('symbol-field', 0xeb5f),\n symbolFile: register('symbol-file', 0xeb60),\n symbolInterface: register('symbol-interface', 0xeb61),\n symbolKeyword: register('symbol-keyword', 0xeb62),\n symbolMisc: register('symbol-misc', 0xeb63),\n symbolOperator: register('symbol-operator', 0xeb64),\n symbolProperty: register('symbol-property', 0xeb65),\n wrench: register('wrench', 0xeb65),\n wrenchSubaction: register('wrench-subaction', 0xeb65),\n symbolSnippet: register('symbol-snippet', 0xeb66),\n tasklist: register('tasklist', 0xeb67),\n telescope: register('telescope', 0xeb68),\n textSize: register('text-size', 0xeb69),\n threeBars: register('three-bars', 0xeb6a),\n thumbsdown: register('thumbsdown', 0xeb6b),\n thumbsup: register('thumbsup', 0xeb6c),\n tools: register('tools', 0xeb6d),\n triangleDown: register('triangle-down', 0xeb6e),\n triangleLeft: register('triangle-left', 0xeb6f),\n triangleRight: register('triangle-right', 0xeb70),\n triangleUp: register('triangle-up', 0xeb71),\n twitter: register('twitter', 0xeb72),\n unfold: register('unfold', 0xeb73),\n unlock: register('unlock', 0xeb74),\n unmute: register('unmute', 0xeb75),\n unverified: register('unverified', 0xeb76),\n verified: register('verified', 0xeb77),\n versions: register('versions', 0xeb78),\n vmActive: register('vm-active', 0xeb79),\n vmOutline: register('vm-outline', 0xeb7a),\n vmRunning: register('vm-running', 0xeb7b),\n watch: register('watch', 0xeb7c),\n whitespace: register('whitespace', 0xeb7d),\n wholeWord: register('whole-word', 0xeb7e),\n window: register('window', 0xeb7f),\n wordWrap: register('word-wrap', 0xeb80),\n zoomIn: register('zoom-in', 0xeb81),\n zoomOut: register('zoom-out', 0xeb82),\n listFilter: register('list-filter', 0xeb83),\n listFlat: register('list-flat', 0xeb84),\n listSelection: register('list-selection', 0xeb85),\n selection: register('selection', 0xeb85),\n listTree: register('list-tree', 0xeb86),\n debugBreakpointFunctionUnverified: register('debug-breakpoint-function-unverified', 0xeb87),\n debugBreakpointFunction: register('debug-breakpoint-function', 0xeb88),\n debugBreakpointFunctionDisabled: register('debug-breakpoint-function-disabled', 0xeb88),\n debugStackframeActive: register('debug-stackframe-active', 0xeb89),\n circleSmallFilled: register('circle-small-filled', 0xeb8a),\n debugStackframeDot: register('debug-stackframe-dot', 0xeb8a),\n terminalDecorationMark: register('terminal-decoration-mark', 0xeb8a),\n debugStackframe: register('debug-stackframe', 0xeb8b),\n debugStackframeFocused: register('debug-stackframe-focused', 0xeb8b),\n debugBreakpointUnsupported: register('debug-breakpoint-unsupported', 0xeb8c),\n symbolString: register('symbol-string', 0xeb8d),\n debugReverseContinue: register('debug-reverse-continue', 0xeb8e),\n debugStepBack: register('debug-step-back', 0xeb8f),\n debugRestartFrame: register('debug-restart-frame', 0xeb90),\n debugAlt: register('debug-alt', 0xeb91),\n callIncoming: register('call-incoming', 0xeb92),\n callOutgoing: register('call-outgoing', 0xeb93),\n menu: register('menu', 0xeb94),\n expandAll: register('expand-all', 0xeb95),\n feedback: register('feedback', 0xeb96),\n gitPullRequestReviewer: register('git-pull-request-reviewer', 0xeb96),\n groupByRefType: register('group-by-ref-type', 0xeb97),\n ungroupByRefType: register('ungroup-by-ref-type', 0xeb98),\n account: register('account', 0xeb99),\n gitPullRequestAssignee: register('git-pull-request-assignee', 0xeb99),\n bellDot: register('bell-dot', 0xeb9a),\n debugConsole: register('debug-console', 0xeb9b),\n library: register('library', 0xeb9c),\n output: register('output', 0xeb9d),\n runAll: register('run-all', 0xeb9e),\n syncIgnored: register('sync-ignored', 0xeb9f),\n pinned: register('pinned', 0xeba0),\n githubInverted: register('github-inverted', 0xeba1),\n serverProcess: register('server-process', 0xeba2),\n serverEnvironment: register('server-environment', 0xeba3),\n pass: register('pass', 0xeba4),\n issueClosed: register('issue-closed', 0xeba4),\n stopCircle: register('stop-circle', 0xeba5),\n playCircle: register('play-circle', 0xeba6),\n record: register('record', 0xeba7),\n debugAltSmall: register('debug-alt-small', 0xeba8),\n vmConnect: register('vm-connect', 0xeba9),\n cloud: register('cloud', 0xebaa),\n merge: register('merge', 0xebab),\n export: register('export', 0xebac),\n graphLeft: register('graph-left', 0xebad),\n magnet: register('magnet', 0xebae),\n notebook: register('notebook', 0xebaf),\n redo: register('redo', 0xebb0),\n checkAll: register('check-all', 0xebb1),\n pinnedDirty: register('pinned-dirty', 0xebb2),\n passFilled: register('pass-filled', 0xebb3),\n circleLargeFilled: register('circle-large-filled', 0xebb4),\n circleLarge: register('circle-large', 0xebb5),\n circleLargeOutline: register('circle-large-outline', 0xebb5),\n combine: register('combine', 0xebb6),\n gather: register('gather', 0xebb6),\n table: register('table', 0xebb7),\n variableGroup: register('variable-group', 0xebb8),\n typeHierarchy: register('type-hierarchy', 0xebb9),\n typeHierarchySub: register('type-hierarchy-sub', 0xebba),\n typeHierarchySuper: register('type-hierarchy-super', 0xebbb),\n gitPullRequestCreate: register('git-pull-request-create', 0xebbc),\n runAbove: register('run-above', 0xebbd),\n runBelow: register('run-below', 0xebbe),\n notebookTemplate: register('notebook-template', 0xebbf),\n debugRerun: register('debug-rerun', 0xebc0),\n workspaceTrusted: register('workspace-trusted', 0xebc1),\n workspaceUntrusted: register('workspace-untrusted', 0xebc2),\n workspaceUnknown: register('workspace-unknown', 0xebc3),\n terminalCmd: register('terminal-cmd', 0xebc4),\n terminalDebian: register('terminal-debian', 0xebc5),\n terminalLinux: register('terminal-linux', 0xebc6),\n terminalPowershell: register('terminal-powershell', 0xebc7),\n terminalTmux: register('terminal-tmux', 0xebc8),\n terminalUbuntu: register('terminal-ubuntu', 0xebc9),\n terminalBash: register('terminal-bash', 0xebca),\n arrowSwap: register('arrow-swap', 0xebcb),\n copy: register('copy', 0xebcc),\n personAdd: register('person-add', 0xebcd),\n filterFilled: register('filter-filled', 0xebce),\n wand: register('wand', 0xebcf),\n debugLineByLine: register('debug-line-by-line', 0xebd0),\n inspect: register('inspect', 0xebd1),\n layers: register('layers', 0xebd2),\n layersDot: register('layers-dot', 0xebd3),\n layersActive: register('layers-active', 0xebd4),\n compass: register('compass', 0xebd5),\n compassDot: register('compass-dot', 0xebd6),\n compassActive: register('compass-active', 0xebd7),\n azure: register('azure', 0xebd8),\n issueDraft: register('issue-draft', 0xebd9),\n gitPullRequestClosed: register('git-pull-request-closed', 0xebda),\n gitPullRequestDraft: register('git-pull-request-draft', 0xebdb),\n debugAll: register('debug-all', 0xebdc),\n debugCoverage: register('debug-coverage', 0xebdd),\n runErrors: register('run-errors', 0xebde),\n folderLibrary: register('folder-library', 0xebdf),\n debugContinueSmall: register('debug-continue-small', 0xebe0),\n beakerStop: register('beaker-stop', 0xebe1),\n graphLine: register('graph-line', 0xebe2),\n graphScatter: register('graph-scatter', 0xebe3),\n pieChart: register('pie-chart', 0xebe4),\n bracket: register('bracket', 0xeb0f),\n bracketDot: register('bracket-dot', 0xebe5),\n bracketError: register('bracket-error', 0xebe6),\n lockSmall: register('lock-small', 0xebe7),\n azureDevops: register('azure-devops', 0xebe8),\n verifiedFilled: register('verified-filled', 0xebe9),\n newline: register('newline', 0xebea),\n layout: register('layout', 0xebeb),\n layoutActivitybarLeft: register('layout-activitybar-left', 0xebec),\n layoutActivitybarRight: register('layout-activitybar-right', 0xebed),\n layoutPanelLeft: register('layout-panel-left', 0xebee),\n layoutPanelCenter: register('layout-panel-center', 0xebef),\n layoutPanelJustify: register('layout-panel-justify', 0xebf0),\n layoutPanelRight: register('layout-panel-right', 0xebf1),\n layoutPanel: register('layout-panel', 0xebf2),\n layoutSidebarLeft: register('layout-sidebar-left', 0xebf3),\n layoutSidebarRight: register('layout-sidebar-right', 0xebf4),\n layoutStatusbar: register('layout-statusbar', 0xebf5),\n layoutMenubar: register('layout-menubar', 0xebf6),\n layoutCentered: register('layout-centered', 0xebf7),\n target: register('target', 0xebf8),\n indent: register('indent', 0xebf9),\n recordSmall: register('record-small', 0xebfa),\n errorSmall: register('error-small', 0xebfb),\n terminalDecorationError: register('terminal-decoration-error', 0xebfb),\n arrowCircleDown: register('arrow-circle-down', 0xebfc),\n arrowCircleLeft: register('arrow-circle-left', 0xebfd),\n arrowCircleRight: register('arrow-circle-right', 0xebfe),\n arrowCircleUp: register('arrow-circle-up', 0xebff),\n layoutSidebarRightOff: register('layout-sidebar-right-off', 0xec00),\n layoutPanelOff: register('layout-panel-off', 0xec01),\n layoutSidebarLeftOff: register('layout-sidebar-left-off', 0xec02),\n blank: register('blank', 0xec03),\n heartFilled: register('heart-filled', 0xec04),\n map: register('map', 0xec05),\n mapHorizontal: register('map-horizontal', 0xec05),\n foldHorizontal: register('fold-horizontal', 0xec05),\n mapFilled: register('map-filled', 0xec06),\n mapHorizontalFilled: register('map-horizontal-filled', 0xec06),\n foldHorizontalFilled: register('fold-horizontal-filled', 0xec06),\n circleSmall: register('circle-small', 0xec07),\n bellSlash: register('bell-slash', 0xec08),\n bellSlashDot: register('bell-slash-dot', 0xec09),\n commentUnresolved: register('comment-unresolved', 0xec0a),\n gitPullRequestGoToChanges: register('git-pull-request-go-to-changes', 0xec0b),\n gitPullRequestNewChanges: register('git-pull-request-new-changes', 0xec0c),\n searchFuzzy: register('search-fuzzy', 0xec0d),\n commentDraft: register('comment-draft', 0xec0e),\n send: register('send', 0xec0f),\n sparkle: register('sparkle', 0xec10),\n insert: register('insert', 0xec11),\n mic: register('mic', 0xec12),\n thumbsdownFilled: register('thumbsdown-filled', 0xec13),\n thumbsupFilled: register('thumbsup-filled', 0xec14),\n coffee: register('coffee', 0xec15),\n snake: register('snake', 0xec16),\n game: register('game', 0xec17),\n vr: register('vr', 0xec18),\n chip: register('chip', 0xec19),\n piano: register('piano', 0xec1a),\n music: register('music', 0xec1b),\n micFilled: register('mic-filled', 0xec1c),\n repoFetch: register('repo-fetch', 0xec1d),\n copilot: register('copilot', 0xec1e),\n lightbulbSparkle: register('lightbulb-sparkle', 0xec1f),\n robot: register('robot', 0xec20),\n sparkleFilled: register('sparkle-filled', 0xec21),\n diffSingle: register('diff-single', 0xec22),\n diffMultiple: register('diff-multiple', 0xec23),\n surroundWith: register('surround-with', 0xec24),\n share: register('share', 0xec25),\n gitStash: register('git-stash', 0xec26),\n gitStashApply: register('git-stash-apply', 0xec27),\n gitStashPop: register('git-stash-pop', 0xec28),\n vscode: register('vscode', 0xec29),\n vscodeInsiders: register('vscode-insiders', 0xec2a),\n codeOss: register('code-oss', 0xec2b),\n runCoverage: register('run-coverage', 0xec2c),\n runAllCoverage: register('run-all-coverage', 0xec2d),\n coverage: register('coverage', 0xec2e),\n githubProject: register('github-project', 0xec2f),\n mapVertical: register('map-vertical', 0xec30),\n foldVertical: register('fold-vertical', 0xec30),\n mapVerticalFilled: register('map-vertical-filled', 0xec31),\n foldVerticalFilled: register('fold-vertical-filled', 0xec31),\n goToSearch: register('go-to-search', 0xec32),\n percentage: register('percentage', 0xec33),\n sortPercentage: register('sort-percentage', 0xec33),\n};\n", "import { register } from './codiconsUtil.js';\nimport { codiconsLibrary } from './codiconsLibrary.js';\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 dialogError: register('dialog-error', 'error'),\n dialogWarning: register('dialog-warning', 'warning'),\n dialogInfo: register('dialog-info', 'info'),\n dialogClose: register('dialog-close', 'close'),\n treeItemExpanded: register('tree-item-expanded', 'chevron-down'), // collapsed is done with rotation\n treeFilterOnTypeOn: register('tree-filter-on-type-on', 'list-filter'),\n treeFilterOnTypeOff: register('tree-filter-on-type-off', 'list-selection'),\n treeFilterClear: register('tree-filter-clear', 'close'),\n treeItemLoading: register('tree-item-loading', 'loading'),\n menuSelection: register('menu-selection', 'check'),\n menuSubmenu: register('menu-submenu', 'chevron-right'),\n menuBarMore: register('menubar-more', 'more'),\n scrollbarButtonLeft: register('scrollbar-button-left', 'triangle-left'),\n scrollbarButtonRight: register('scrollbar-button-right', 'triangle-right'),\n scrollbarButtonUp: register('scrollbar-button-up', 'triangle-up'),\n scrollbarButtonDown: register('scrollbar-button-down', 'triangle-down'),\n toolBarMore: register('toolbar-more', 'more'),\n quickInputBack: register('quick-input-back', 'arrow-left'),\n dropDownButton: register('drop-down-button', 0xeab4),\n symbolCustomColor: register('symbol-customcolor', 0xeb5c),\n exportIcon: register('export', 0xebac),\n workspaceUnspecified: register('workspace-unspecified', 0xebc3),\n newLine: register('newline', 0xebea),\n thumbsDownFilled: register('thumbsdown-filled', 0xec13),\n thumbsUpFilled: register('thumbsup-filled', 0xec14),\n gitFetch: register('git-fetch', 0xec1d),\n lightbulbSparkleAutofix: register('lightbulb-sparkle-autofix', 0xec1f),\n debugBreakpointPending: register('debug-breakpoint-pending', 0xebd9),\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 ...codiconsLibrary,\n ...codiconsDerived\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 { Emitter } from '../../base/common/event.js';\nimport { Disposable, toDisposable } from '../../base/common/lifecycle.js';\nexport class TokenizationRegistry {\n constructor() {\n this._tokenizationSupports = new Map();\n this._factories = new Map();\n this._onDidChange = new Emitter();\n this.onDidChange = this._onDidChange.event;\n this._colorMap = null;\n }\n handleChange(languageIds) {\n this._onDidChange.fire({\n changedLanguages: languageIds,\n changedColorMap: false\n });\n }\n register(languageId, support) {\n this._tokenizationSupports.set(languageId, support);\n this.handleChange([languageId]);\n return toDisposable(() => {\n if (this._tokenizationSupports.get(languageId) !== support) {\n return;\n }\n this._tokenizationSupports.delete(languageId);\n this.handleChange([languageId]);\n });\n }\n get(languageId) {\n return this._tokenizationSupports.get(languageId) || null;\n }\n registerFactory(languageId, factory) {\n var _a;\n (_a = this._factories.get(languageId)) === null || _a === void 0 ? void 0 : _a.dispose();\n const myData = new TokenizationSupportFactoryData(this, languageId, factory);\n this._factories.set(languageId, myData);\n return toDisposable(() => {\n const v = this._factories.get(languageId);\n if (!v || v !== myData) {\n return;\n }\n this._factories.delete(languageId);\n v.dispose();\n });\n }\n async getOrCreate(languageId) {\n // check first if the support is already set\n const tokenizationSupport = this.get(languageId);\n if (tokenizationSupport) {\n return tokenizationSupport;\n }\n const factory = this._factories.get(languageId);\n if (!factory || factory.isResolved) {\n // no factory or factory.resolve already finished\n return null;\n }\n await factory.resolve();\n return this.get(languageId);\n }\n isResolved(languageId) {\n const tokenizationSupport = this.get(languageId);\n if (tokenizationSupport) {\n return true;\n }\n const factory = this._factories.get(languageId);\n if (!factory || factory.isResolved) {\n return true;\n }\n return false;\n }\n setColorMap(colorMap) {\n this._colorMap = colorMap;\n this._onDidChange.fire({\n changedLanguages: Array.from(this._tokenizationSupports.keys()),\n changedColorMap: true\n });\n }\n getColorMap() {\n return this._colorMap;\n }\n getDefaultBackground() {\n if (this._colorMap && this._colorMap.length > 2 /* ColorId.DefaultBackground */) {\n return this._colorMap[2 /* ColorId.DefaultBackground */];\n }\n return null;\n }\n}\nclass TokenizationSupportFactoryData extends Disposable {\n get isResolved() {\n return this._isResolved;\n }\n constructor(_registry, _languageId, _factory) {\n super();\n this._registry = _registry;\n this._languageId = _languageId;\n this._factory = _factory;\n this._isDisposed = false;\n this._resolvePromise = null;\n this._isResolved = false;\n }\n dispose() {\n this._isDisposed = true;\n super.dispose();\n }\n async resolve() {\n if (!this._resolvePromise) {\n this._resolvePromise = this._create();\n }\n return this._resolvePromise;\n }\n async _create() {\n const value = await this._factory.tokenizationSupport;\n this._isResolved = true;\n if (value && !this._isDisposed) {\n this._register(this._registry.register(this._languageId, value));\n }\n }\n}\n", "import { Codicon } from '../../base/common/codicons.js';\nimport { URI } from '../../base/common/uri.js';\nimport { Range } from './core/range.js';\nimport { TokenizationRegistry as TokenizationRegistryImpl } from './tokenizationRegistry.js';\nimport { localize } from '../../nls.js';\nexport class Token {\n constructor(offset, type, language) {\n this.offset = offset;\n this.type = type;\n this.language = language;\n this._tokenBrand = undefined;\n }\n toString() {\n return '(' + this.offset + ', ' + this.type + ')';\n }\n}\n/**\n * @internal\n */\nexport class TokenizationResult {\n constructor(tokens, endState) {\n this.tokens = tokens;\n this.endState = endState;\n this._tokenizationResultBrand = undefined;\n }\n}\n/**\n * @internal\n */\nexport class EncodedTokenizationResult {\n constructor(\n /**\n * The tokens in binary format. Each token occupies two array indices. For token i:\n * - at offset 2*i => startIndex\n * - at offset 2*i + 1 => metadata\n *\n */\n tokens, endState) {\n this.tokens = tokens;\n this.endState = endState;\n this._encodedTokenizationResultBrand = undefined;\n }\n}\nexport var HoverVerbosityAction;\n(function (HoverVerbosityAction) {\n /**\n * Increase the verbosity of the hover\n */\n HoverVerbosityAction[HoverVerbosityAction[\"Increase\"] = 0] = \"Increase\";\n /**\n * Decrease the verbosity of the hover\n */\n HoverVerbosityAction[HoverVerbosityAction[\"Decrease\"] = 1] = \"Decrease\";\n})(HoverVerbosityAction || (HoverVerbosityAction = {}));\n/**\n * @internal\n */\nexport var CompletionItemKinds;\n(function (CompletionItemKinds) {\n const byKind = new Map();\n byKind.set(0 /* CompletionItemKind.Method */, Codicon.symbolMethod);\n byKind.set(1 /* CompletionItemKind.Function */, Codicon.symbolFunction);\n byKind.set(2 /* CompletionItemKind.Constructor */, Codicon.symbolConstructor);\n byKind.set(3 /* CompletionItemKind.Field */, Codicon.symbolField);\n byKind.set(4 /* CompletionItemKind.Variable */, Codicon.symbolVariable);\n byKind.set(5 /* CompletionItemKind.Class */, Codicon.symbolClass);\n byKind.set(6 /* CompletionItemKind.Struct */, Codicon.symbolStruct);\n byKind.set(7 /* CompletionItemKind.Interface */, Codicon.symbolInterface);\n byKind.set(8 /* CompletionItemKind.Module */, Codicon.symbolModule);\n byKind.set(9 /* CompletionItemKind.Property */, Codicon.symbolProperty);\n byKind.set(10 /* CompletionItemKind.Event */, Codicon.symbolEvent);\n byKind.set(11 /* CompletionItemKind.Operator */, Codicon.symbolOperator);\n byKind.set(12 /* CompletionItemKind.Unit */, Codicon.symbolUnit);\n byKind.set(13 /* CompletionItemKind.Value */, Codicon.symbolValue);\n byKind.set(15 /* CompletionItemKind.Enum */, Codicon.symbolEnum);\n byKind.set(14 /* CompletionItemKind.Constant */, Codicon.symbolConstant);\n byKind.set(15 /* CompletionItemKind.Enum */, Codicon.symbolEnum);\n byKind.set(16 /* CompletionItemKind.EnumMember */, Codicon.symbolEnumMember);\n byKind.set(17 /* CompletionItemKind.Keyword */, Codicon.symbolKeyword);\n byKind.set(27 /* CompletionItemKind.Snippet */, Codicon.symbolSnippet);\n byKind.set(18 /* CompletionItemKind.Text */, Codicon.symbolText);\n byKind.set(19 /* CompletionItemKind.Color */, Codicon.symbolColor);\n byKind.set(20 /* CompletionItemKind.File */, Codicon.symbolFile);\n byKind.set(21 /* CompletionItemKind.Reference */, Codicon.symbolReference);\n byKind.set(22 /* CompletionItemKind.Customcolor */, Codicon.symbolCustomColor);\n byKind.set(23 /* CompletionItemKind.Folder */, Codicon.symbolFolder);\n byKind.set(24 /* CompletionItemKind.TypeParameter */, Codicon.symbolTypeParameter);\n byKind.set(25 /* CompletionItemKind.User */, Codicon.account);\n byKind.set(26 /* CompletionItemKind.Issue */, Codicon.issues);\n /**\n * @internal\n */\n function toIcon(kind) {\n let codicon = byKind.get(kind);\n if (!codicon) {\n console.info('No codicon found for CompletionItemKind ' + kind);\n codicon = Codicon.symbolProperty;\n }\n return codicon;\n }\n CompletionItemKinds.toIcon = toIcon;\n const data = new Map();\n data.set('method', 0 /* CompletionItemKind.Method */);\n data.set('function', 1 /* CompletionItemKind.Function */);\n data.set('constructor', 2 /* CompletionItemKind.Constructor */);\n data.set('field', 3 /* CompletionItemKind.Field */);\n data.set('variable', 4 /* CompletionItemKind.Variable */);\n data.set('class', 5 /* CompletionItemKind.Class */);\n data.set('struct', 6 /* CompletionItemKind.Struct */);\n data.set('interface', 7 /* CompletionItemKind.Interface */);\n data.set('module', 8 /* CompletionItemKind.Module */);\n data.set('property', 9 /* CompletionItemKind.Property */);\n data.set('event', 10 /* CompletionItemKind.Event */);\n data.set('operator', 11 /* CompletionItemKind.Operator */);\n data.set('unit', 12 /* CompletionItemKind.Unit */);\n data.set('value', 13 /* CompletionItemKind.Value */);\n data.set('constant', 14 /* CompletionItemKind.Constant */);\n data.set('enum', 15 /* CompletionItemKind.Enum */);\n data.set('enum-member', 16 /* CompletionItemKind.EnumMember */);\n data.set('enumMember', 16 /* CompletionItemKind.EnumMember */);\n data.set('keyword', 17 /* CompletionItemKind.Keyword */);\n data.set('snippet', 27 /* CompletionItemKind.Snippet */);\n data.set('text', 18 /* CompletionItemKind.Text */);\n data.set('color', 19 /* CompletionItemKind.Color */);\n data.set('file', 20 /* CompletionItemKind.File */);\n data.set('reference', 21 /* CompletionItemKind.Reference */);\n data.set('customcolor', 22 /* CompletionItemKind.Customcolor */);\n data.set('folder', 23 /* CompletionItemKind.Folder */);\n data.set('type-parameter', 24 /* CompletionItemKind.TypeParameter */);\n data.set('typeParameter', 24 /* CompletionItemKind.TypeParameter */);\n data.set('account', 25 /* CompletionItemKind.User */);\n data.set('issue', 26 /* CompletionItemKind.Issue */);\n /**\n * @internal\n */\n function fromString(value, strict) {\n let res = data.get(value);\n if (typeof res === 'undefined' && !strict) {\n res = 9 /* CompletionItemKind.Property */;\n }\n return res;\n }\n CompletionItemKinds.fromString = fromString;\n})(CompletionItemKinds || (CompletionItemKinds = {}));\n/**\n * How an {@link InlineCompletionsProvider inline completion provider} was triggered.\n */\nexport var InlineCompletionTriggerKind;\n(function (InlineCompletionTriggerKind) {\n /**\n * Completion was triggered automatically while editing.\n * It is sufficient to return a single completion item in this case.\n */\n InlineCompletionTriggerKind[InlineCompletionTriggerKind[\"Automatic\"] = 0] = \"Automatic\";\n /**\n * Completion was triggered explicitly by a user gesture.\n * Return multiple completion items to enable cycling through them.\n */\n InlineCompletionTriggerKind[InlineCompletionTriggerKind[\"Explicit\"] = 1] = \"Explicit\";\n})(InlineCompletionTriggerKind || (InlineCompletionTriggerKind = {}));\nexport class SelectedSuggestionInfo {\n constructor(range, text, completionKind, isSnippetText) {\n this.range = range;\n this.text = text;\n this.completionKind = completionKind;\n this.isSnippetText = isSnippetText;\n }\n equals(other) {\n return Range.lift(this.range).equalsRange(other.range)\n && this.text === other.text\n && this.completionKind === other.completionKind\n && this.isSnippetText === other.isSnippetText;\n }\n}\n/**\n * @internal\n */\nexport var DocumentPasteTriggerKind;\n(function (DocumentPasteTriggerKind) {\n DocumentPasteTriggerKind[DocumentPasteTriggerKind[\"Automatic\"] = 0] = \"Automatic\";\n DocumentPasteTriggerKind[DocumentPasteTriggerKind[\"PasteAs\"] = 1] = \"PasteAs\";\n})(DocumentPasteTriggerKind || (DocumentPasteTriggerKind = {}));\nexport var SignatureHelpTriggerKind;\n(function (SignatureHelpTriggerKind) {\n SignatureHelpTriggerKind[SignatureHelpTriggerKind[\"Invoke\"] = 1] = \"Invoke\";\n SignatureHelpTriggerKind[SignatureHelpTriggerKind[\"TriggerCharacter\"] = 2] = \"TriggerCharacter\";\n SignatureHelpTriggerKind[SignatureHelpTriggerKind[\"ContentChange\"] = 3] = \"ContentChange\";\n})(SignatureHelpTriggerKind || (SignatureHelpTriggerKind = {}));\n/**\n * A document highlight kind.\n */\nexport var DocumentHighlightKind;\n(function (DocumentHighlightKind) {\n /**\n * A textual occurrence.\n */\n DocumentHighlightKind[DocumentHighlightKind[\"Text\"] = 0] = \"Text\";\n /**\n * Read-access of a symbol, like reading a variable.\n */\n DocumentHighlightKind[DocumentHighlightKind[\"Read\"] = 1] = \"Read\";\n /**\n * Write-access of a symbol, like writing to a variable.\n */\n DocumentHighlightKind[DocumentHighlightKind[\"Write\"] = 2] = \"Write\";\n})(DocumentHighlightKind || (DocumentHighlightKind = {}));\n/**\n * @internal\n */\nexport function isLocationLink(thing) {\n return thing\n && URI.isUri(thing.uri)\n && Range.isIRange(thing.range)\n && (Range.isIRange(thing.originSelectionRange) || Range.isIRange(thing.targetSelectionRange));\n}\n/**\n * @internal\n */\nexport const symbolKindNames = {\n [17 /* SymbolKind.Array */]: localize('Array', \"array\"),\n [16 /* SymbolKind.Boolean */]: localize('Boolean', \"boolean\"),\n [4 /* SymbolKind.Class */]: localize('Class', \"class\"),\n [13 /* SymbolKind.Constant */]: localize('Constant', \"constant\"),\n [8 /* SymbolKind.Constructor */]: localize('Constructor', \"constructor\"),\n [9 /* SymbolKind.Enum */]: localize('Enum', \"enumeration\"),\n [21 /* SymbolKind.EnumMember */]: localize('EnumMember', \"enumeration member\"),\n [23 /* SymbolKind.Event */]: localize('Event', \"event\"),\n [7 /* SymbolKind.Field */]: localize('Field', \"field\"),\n [0 /* SymbolKind.File */]: localize('File', \"file\"),\n [11 /* SymbolKind.Function */]: localize('Function', \"function\"),\n [10 /* SymbolKind.Interface */]: localize('Interface', \"interface\"),\n [19 /* SymbolKind.Key */]: localize('Key', \"key\"),\n [5 /* SymbolKind.Method */]: localize('Method', \"method\"),\n [1 /* SymbolKind.Module */]: localize('Module', \"module\"),\n [2 /* SymbolKind.Namespace */]: localize('Namespace', \"namespace\"),\n [20 /* SymbolKind.Null */]: localize('Null', \"null\"),\n [15 /* SymbolKind.Number */]: localize('Number', \"number\"),\n [18 /* SymbolKind.Object */]: localize('Object', \"object\"),\n [24 /* SymbolKind.Operator */]: localize('Operator', \"operator\"),\n [3 /* SymbolKind.Package */]: localize('Package', \"package\"),\n [6 /* SymbolKind.Property */]: localize('Property', \"property\"),\n [14 /* SymbolKind.String */]: localize('String', \"string\"),\n [22 /* SymbolKind.Struct */]: localize('Struct', \"struct\"),\n [25 /* SymbolKind.TypeParameter */]: localize('TypeParameter', \"type parameter\"),\n [12 /* SymbolKind.Variable */]: localize('Variable', \"variable\"),\n};\n/**\n * @internal\n */\nexport function getAriaLabelForSymbol(symbolName, kind) {\n return localize('symbolAriaLabel', '{0} ({1})', symbolName, symbolKindNames[kind]);\n}\n/**\n * @internal\n */\nexport var SymbolKinds;\n(function (SymbolKinds) {\n const byKind = new Map();\n byKind.set(0 /* SymbolKind.File */, Codicon.symbolFile);\n byKind.set(1 /* SymbolKind.Module */, Codicon.symbolModule);\n byKind.set(2 /* SymbolKind.Namespace */, Codicon.symbolNamespace);\n byKind.set(3 /* SymbolKind.Package */, Codicon.symbolPackage);\n byKind.set(4 /* SymbolKind.Class */, Codicon.symbolClass);\n byKind.set(5 /* SymbolKind.Method */, Codicon.symbolMethod);\n byKind.set(6 /* SymbolKind.Property */, Codicon.symbolProperty);\n byKind.set(7 /* SymbolKind.Field */, Codicon.symbolField);\n byKind.set(8 /* SymbolKind.Constructor */, Codicon.symbolConstructor);\n byKind.set(9 /* SymbolKind.Enum */, Codicon.symbolEnum);\n byKind.set(10 /* SymbolKind.Interface */, Codicon.symbolInterface);\n byKind.set(11 /* SymbolKind.Function */, Codicon.symbolFunction);\n byKind.set(12 /* SymbolKind.Variable */, Codicon.symbolVariable);\n byKind.set(13 /* SymbolKind.Constant */, Codicon.symbolConstant);\n byKind.set(14 /* SymbolKind.String */, Codicon.symbolString);\n byKind.set(15 /* SymbolKind.Number */, Codicon.symbolNumber);\n byKind.set(16 /* SymbolKind.Boolean */, Codicon.symbolBoolean);\n byKind.set(17 /* SymbolKind.Array */, Codicon.symbolArray);\n byKind.set(18 /* SymbolKind.Object */, Codicon.symbolObject);\n byKind.set(19 /* SymbolKind.Key */, Codicon.symbolKey);\n byKind.set(20 /* SymbolKind.Null */, Codicon.symbolNull);\n byKind.set(21 /* SymbolKind.EnumMember */, Codicon.symbolEnumMember);\n byKind.set(22 /* SymbolKind.Struct */, Codicon.symbolStruct);\n byKind.set(23 /* SymbolKind.Event */, Codicon.symbolEvent);\n byKind.set(24 /* SymbolKind.Operator */, Codicon.symbolOperator);\n byKind.set(25 /* SymbolKind.TypeParameter */, Codicon.symbolTypeParameter);\n /**\n * @internal\n */\n function toIcon(kind) {\n let icon = byKind.get(kind);\n if (!icon) {\n console.info('No codicon found for SymbolKind ' + kind);\n icon = Codicon.symbolProperty;\n }\n return icon;\n }\n SymbolKinds.toIcon = toIcon;\n})(SymbolKinds || (SymbolKinds = {}));\n/** @internal */\nexport class TextEdit {\n}\nexport class FoldingRangeKind {\n /**\n * Returns a {@link FoldingRangeKind} for the given value.\n *\n * @param value of the kind.\n */\n static fromValue(value) {\n switch (value) {\n case 'comment': return FoldingRangeKind.Comment;\n case 'imports': return FoldingRangeKind.Imports;\n case 'region': return FoldingRangeKind.Region;\n }\n return new FoldingRangeKind(value);\n }\n /**\n * Creates a new {@link FoldingRangeKind}.\n *\n * @param value of the kind.\n */\n constructor(value) {\n this.value = value;\n }\n}\n/**\n * Kind for folding range representing a comment. The value of the kind is 'comment'.\n */\nFoldingRangeKind.Comment = new FoldingRangeKind('comment');\n/**\n * Kind for folding range representing a import. The value of the kind is 'imports'.\n */\nFoldingRangeKind.Imports = new FoldingRangeKind('imports');\n/**\n * Kind for folding range representing regions (for example marked by `#region`, `#endregion`).\n * The value of the kind is 'region'.\n */\nFoldingRangeKind.Region = new FoldingRangeKind('region');\nexport var NewSymbolNameTag;\n(function (NewSymbolNameTag) {\n NewSymbolNameTag[NewSymbolNameTag[\"AIGenerated\"] = 1] = \"AIGenerated\";\n})(NewSymbolNameTag || (NewSymbolNameTag = {}));\nexport var NewSymbolNameTriggerKind;\n(function (NewSymbolNameTriggerKind) {\n NewSymbolNameTriggerKind[NewSymbolNameTriggerKind[\"Invoke\"] = 0] = \"Invoke\";\n NewSymbolNameTriggerKind[NewSymbolNameTriggerKind[\"Automatic\"] = 1] = \"Automatic\";\n})(NewSymbolNameTriggerKind || (NewSymbolNameTriggerKind = {}));\n/**\n * @internal\n */\nexport var Command;\n(function (Command) {\n /**\n * @internal\n */\n function is(obj) {\n if (!obj || typeof obj !== 'object') {\n return false;\n }\n return typeof obj.id === 'string' &&\n typeof obj.title === 'string';\n }\n Command.is = is;\n})(Command || (Command = {}));\nexport var InlayHintKind;\n(function (InlayHintKind) {\n InlayHintKind[InlayHintKind[\"Type\"] = 1] = \"Type\";\n InlayHintKind[InlayHintKind[\"Parameter\"] = 2] = \"Parameter\";\n})(InlayHintKind || (InlayHintKind = {}));\n/**\n * @internal\n */\nexport class LazyTokenizationSupport {\n constructor(createSupport) {\n this.createSupport = createSupport;\n this._tokenizationSupport = null;\n }\n dispose() {\n if (this._tokenizationSupport) {\n this._tokenizationSupport.then((support) => {\n if (support) {\n support.dispose();\n }\n });\n }\n }\n get tokenizationSupport() {\n if (!this._tokenizationSupport) {\n this._tokenizationSupport = this.createSupport();\n }\n return this._tokenizationSupport;\n }\n}\n/**\n * @internal\n */\nexport const TokenizationRegistry = new TokenizationRegistryImpl();\nexport var InlineEditTriggerKind;\n(function (InlineEditTriggerKind) {\n InlineEditTriggerKind[InlineEditTriggerKind[\"Invoke\"] = 0] = \"Invoke\";\n InlineEditTriggerKind[InlineEditTriggerKind[\"Automatic\"] = 1] = \"Automatic\";\n})(InlineEditTriggerKind || (InlineEditTriggerKind = {}));\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nexport function ensureCodeWindow(targetWindow, fallbackWindowId) {\n const codeWindow = targetWindow;\n if (typeof codeWindow.vscodeWindowId !== 'number') {\n Object.defineProperty(codeWindow, 'vscodeWindowId', {\n get: () => fallbackWindowId\n });\n }\n}\n// eslint-disable-next-line no-restricted-globals\nexport const mainWindow = window;\n", "export function identity(t) {\n return t;\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 {\n constructor(arg1, arg2) {\n this.lastCache = undefined;\n this.lastArgKey = undefined;\n if (typeof arg1 === 'function') {\n this._fn = arg1;\n this._computeKey = identity;\n }\n else {\n this._fn = arg2;\n this._computeKey = arg1.getCacheKey;\n }\n }\n get(arg) {\n const key = this._computeKey(arg);\n if (this.lastArgKey !== key) {\n this.lastArgKey = key;\n this.lastCache = this._fn(arg);\n }\n return this.lastCache;\n }\n}\n/**\n * Uses an unbounded cache to memoize the results of the given function.\n*/\nexport class CachedFunction {\n get cachedValues() {\n return this._map;\n }\n constructor(arg1, arg2) {\n this._map = new Map();\n this._map2 = new Map();\n if (typeof arg1 === 'function') {\n this._fn = arg1;\n this._computeKey = identity;\n }\n else {\n this._fn = arg2;\n this._computeKey = arg1.getCacheKey;\n }\n }\n get(arg) {\n const key = this._computeKey(arg);\n if (this._map2.has(key)) {\n return this._map2.get(key);\n }\n const value = this._fn(arg);\n this._map.set(arg, value);\n this._map2.set(key, value);\n return value;\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 *--------------------------------------------------------------------------------------------*/\nexport class Lazy {\n constructor(executor) {\n this.executor = executor;\n this._didRun = false;\n }\n /**\n * Get the wrapped value.\n *\n * This will force evaluation of the lazy value if it has not been resolved yet. Lazy values are only\n * resolved once. `getValue` will re-throw exceptions that are hit while resolving the value\n */\n get value() {\n if (!this._didRun) {\n try {\n this._value = this.executor();\n }\n catch (err) {\n this._error = err;\n }\n finally {\n this._didRun = true;\n }\n }\n if (this._error) {\n throw this._error;\n }\n return this._value;\n }\n /**\n * Get the wrapped value without forcing evaluation.\n */\n get rawValue() { 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 *--------------------------------------------------------------------------------------------*/\nvar _a;\nimport { LRUCachedFunction } from './cache.js';\nimport { Lazy } from './lazy.js';\nexport function isFalsyOrWhitespace(str) {\n if (!str || typeof str !== 'string') {\n return true;\n }\n return str.trim().length === 0;\n}\nconst _formatRegexp = /{(\\d+)}/g;\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, ...args) {\n if (args.length === 0) {\n return value;\n }\n return value.replace(_formatRegexp, function (match, group) {\n const idx = parseInt(group, 10);\n return isNaN(idx) || idx < 0 || idx >= args.length ?\n match :\n args[idx];\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 `
    ` has the runtime value `value`.\n * This prevents XSS injection.\n */\nexport function htmlAttributeEncodeValue(value) {\n return value.replace(/[<>\"'&]/g, ch => {\n switch (ch) {\n case '<': return '<';\n case '>': return '>';\n case '\"': return '"';\n case '\\'': return ''';\n case '&': return '&';\n }\n return ch;\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) {\n return html.replace(/[<>&]/g, function (match) {\n switch (match) {\n case '<': return '<';\n case '>': return '>';\n case '&': return '&';\n default: return match;\n }\n });\n}\n/**\n * Escapes regular expression characters in a given string\n */\nexport function escapeRegExpCharacters(value) {\n return value.replace(/[\\\\\\{\\}\\*\\+\\?\\|\\^\\$\\.\\[\\]\\(\\)]/g, '\\\\$&');\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, needle = ' ') {\n const trimmed = ltrim(haystack, needle);\n return rtrim(trimmed, needle);\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, needle) {\n if (!haystack || !needle) {\n return haystack;\n }\n const needleLen = needle.length;\n if (needleLen === 0 || haystack.length === 0) {\n return haystack;\n }\n let offset = 0;\n while (haystack.indexOf(needle, offset) === offset) {\n offset = offset + needleLen;\n }\n return haystack.substring(offset);\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, needle) {\n if (!haystack || !needle) {\n return haystack;\n }\n const needleLen = needle.length, haystackLen = haystack.length;\n if (needleLen === 0 || haystackLen === 0) {\n return haystack;\n }\n let offset = haystackLen, idx = -1;\n while (true) {\n idx = haystack.lastIndexOf(needle, offset - 1);\n if (idx === -1 || idx + needleLen !== offset) {\n break;\n }\n if (idx === 0) {\n return '';\n }\n offset = idx;\n }\n return haystack.substring(0, offset);\n}\nexport function convertSimple2RegExpPattern(pattern) {\n return pattern.replace(/[\\-\\\\\\{\\}\\+\\?\\|\\^\\$\\.\\,\\[\\]\\(\\)\\#\\s]/g, '\\\\$&').replace(/[\\*]/g, '.*');\n}\nexport function stripWildcards(pattern) {\n return pattern.replace(/\\*/g, '');\n}\nexport function createRegExp(searchString, isRegex, options = {}) {\n if (!searchString) {\n throw new Error('Cannot create regex from empty string');\n }\n if (!isRegex) {\n searchString = escapeRegExpCharacters(searchString);\n }\n if (options.wholeWord) {\n if (!/\\B/.test(searchString.charAt(0))) {\n searchString = '\\\\b' + searchString;\n }\n if (!/\\B/.test(searchString.charAt(searchString.length - 1))) {\n searchString = searchString + '\\\\b';\n }\n }\n let modifiers = '';\n if (options.global) {\n modifiers += 'g';\n }\n if (!options.matchCase) {\n modifiers += 'i';\n }\n if (options.multiline) {\n modifiers += 'm';\n }\n if (options.unicode) {\n modifiers += 'u';\n }\n return new RegExp(searchString, modifiers);\n}\nexport function regExpLeadsToEndlessLoop(regexp) {\n // Exit early if it's one of these special cases which are meant to match\n // against an empty string\n if (regexp.source === '^' || regexp.source === '^$' || regexp.source === '$' || regexp.source === '^\\\\s*$') {\n return false;\n }\n // We check against an empty string. If the regular expression doesn't advance\n // (e.g. ends in an endless loop) it will match an empty string.\n const match = regexp.exec('');\n return !!(match && regexp.lastIndex === 0);\n}\nexport function splitLines(str) {\n return str.split(/\\r\\n|\\r|\\n/);\n}\nexport function splitLinesIncludeSeparators(str) {\n var _b;\n const linesWithSeparators = [];\n const splitLinesAndSeparators = str.split(/(\\r\\n|\\r|\\n)/);\n for (let i = 0; i < Math.ceil(splitLinesAndSeparators.length / 2); i++) {\n linesWithSeparators.push(splitLinesAndSeparators[2 * i] + ((_b = splitLinesAndSeparators[2 * i + 1]) !== null && _b !== void 0 ? _b : ''));\n }\n return linesWithSeparators;\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) {\n for (let i = 0, len = str.length; i < len; i++) {\n const chCode = str.charCodeAt(i);\n if (chCode !== 32 /* CharCode.Space */ && chCode !== 9 /* CharCode.Tab */) {\n return i;\n }\n }\n return -1;\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, start = 0, end = str.length) {\n for (let i = start; i < end; i++) {\n const chCode = str.charCodeAt(i);\n if (chCode !== 32 /* CharCode.Space */ && chCode !== 9 /* CharCode.Tab */) {\n return str.substring(start, i);\n }\n }\n return str.substring(start, end);\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, startIndex = str.length - 1) {\n for (let i = startIndex; i >= 0; i--) {\n const chCode = str.charCodeAt(i);\n if (chCode !== 32 /* CharCode.Space */ && chCode !== 9 /* CharCode.Tab */) {\n return i;\n }\n }\n return -1;\n}\nexport function compare(a, b) {\n if (a < b) {\n return -1;\n }\n else if (a > b) {\n return 1;\n }\n else {\n return 0;\n }\n}\nexport function compareSubstring(a, b, aStart = 0, aEnd = a.length, bStart = 0, bEnd = b.length) {\n for (; aStart < aEnd && bStart < bEnd; aStart++, bStart++) {\n const codeA = a.charCodeAt(aStart);\n const codeB = b.charCodeAt(bStart);\n if (codeA < codeB) {\n return -1;\n }\n else if (codeA > codeB) {\n return 1;\n }\n }\n const aLen = aEnd - aStart;\n const bLen = bEnd - bStart;\n if (aLen < bLen) {\n return -1;\n }\n else if (aLen > bLen) {\n return 1;\n }\n return 0;\n}\nexport function compareIgnoreCase(a, b) {\n return compareSubstringIgnoreCase(a, b, 0, a.length, 0, b.length);\n}\nexport function compareSubstringIgnoreCase(a, b, aStart = 0, aEnd = a.length, bStart = 0, bEnd = b.length) {\n for (; aStart < aEnd && bStart < bEnd; aStart++, bStart++) {\n let codeA = a.charCodeAt(aStart);\n let codeB = b.charCodeAt(bStart);\n if (codeA === codeB) {\n // equal\n continue;\n }\n if (codeA >= 128 || codeB >= 128) {\n // not ASCII letters -> fallback to lower-casing strings\n return compareSubstring(a.toLowerCase(), b.toLowerCase(), aStart, aEnd, bStart, bEnd);\n }\n // mapper lower-case ascii letter onto upper-case varinats\n // [97-122] (lower ascii) --> [65-90] (upper ascii)\n if (isLowerAsciiLetter(codeA)) {\n codeA -= 32;\n }\n if (isLowerAsciiLetter(codeB)) {\n codeB -= 32;\n }\n // compare both code points\n const diff = codeA - codeB;\n if (diff === 0) {\n continue;\n }\n return diff;\n }\n const aLen = aEnd - aStart;\n const bLen = bEnd - bStart;\n if (aLen < bLen) {\n return -1;\n }\n else if (aLen > bLen) {\n return 1;\n }\n return 0;\n}\nexport function isAsciiDigit(code) {\n return code >= 48 /* CharCode.Digit0 */ && code <= 57 /* CharCode.Digit9 */;\n}\nexport function isLowerAsciiLetter(code) {\n return code >= 97 /* CharCode.a */ && code <= 122 /* CharCode.z */;\n}\nexport function isUpperAsciiLetter(code) {\n return code >= 65 /* CharCode.A */ && code <= 90 /* CharCode.Z */;\n}\nexport function equalsIgnoreCase(a, b) {\n return a.length === b.length && compareSubstringIgnoreCase(a, b) === 0;\n}\nexport function startsWithIgnoreCase(str, candidate) {\n const candidateLength = candidate.length;\n if (candidate.length > str.length) {\n return false;\n }\n return compareSubstringIgnoreCase(str, candidate, 0, candidateLength) === 0;\n}\n/**\n * @returns the length of the common prefix of the two strings.\n */\nexport function commonPrefixLength(a, b) {\n const len = Math.min(a.length, b.length);\n let i;\n for (i = 0; i < len; i++) {\n if (a.charCodeAt(i) !== b.charCodeAt(i)) {\n return i;\n }\n }\n return len;\n}\n/**\n * @returns the length of the common suffix of the two strings.\n */\nexport function commonSuffixLength(a, b) {\n const len = Math.min(a.length, b.length);\n let i;\n const aLastIndex = a.length - 1;\n const bLastIndex = b.length - 1;\n for (i = 0; i < len; i++) {\n if (a.charCodeAt(aLastIndex - i) !== b.charCodeAt(bLastIndex - i)) {\n return i;\n }\n }\n return len;\n}\n/**\n * See http://en.wikipedia.org/wiki/Surrogate_pair\n */\nexport function isHighSurrogate(charCode) {\n return (0xD800 <= charCode && charCode <= 0xDBFF);\n}\n/**\n * See http://en.wikipedia.org/wiki/Surrogate_pair\n */\nexport function isLowSurrogate(charCode) {\n return (0xDC00 <= charCode && charCode <= 0xDFFF);\n}\n/**\n * See http://en.wikipedia.org/wiki/Surrogate_pair\n */\nexport function computeCodePoint(highSurrogate, lowSurrogate) {\n return ((highSurrogate - 0xD800) << 10) + (lowSurrogate - 0xDC00) + 0x10000;\n}\n/**\n * get the code point that begins at offset `offset`\n */\nexport function getNextCodePoint(str, len, offset) {\n const charCode = str.charCodeAt(offset);\n if (isHighSurrogate(charCode) && offset + 1 < len) {\n const nextCharCode = str.charCodeAt(offset + 1);\n if (isLowSurrogate(nextCharCode)) {\n return computeCodePoint(charCode, nextCharCode);\n }\n }\n return charCode;\n}\n/**\n * get the code point that ends right before offset `offset`\n */\nfunction getPrevCodePoint(str, offset) {\n const charCode = str.charCodeAt(offset - 1);\n if (isLowSurrogate(charCode) && offset > 1) {\n const prevCharCode = str.charCodeAt(offset - 2);\n if (isHighSurrogate(prevCharCode)) {\n return computeCodePoint(prevCharCode, charCode);\n }\n }\n return charCode;\n}\nexport class CodePointIterator {\n get offset() {\n return this._offset;\n }\n constructor(str, offset = 0) {\n this._str = str;\n this._len = str.length;\n this._offset = offset;\n }\n setOffset(offset) {\n this._offset = offset;\n }\n prevCodePoint() {\n const codePoint = getPrevCodePoint(this._str, this._offset);\n this._offset -= (codePoint >= 65536 /* Constants.UNICODE_SUPPLEMENTARY_PLANE_BEGIN */ ? 2 : 1);\n return codePoint;\n }\n nextCodePoint() {\n const codePoint = getNextCodePoint(this._str, this._len, this._offset);\n this._offset += (codePoint >= 65536 /* Constants.UNICODE_SUPPLEMENTARY_PLANE_BEGIN */ ? 2 : 1);\n return codePoint;\n }\n eol() {\n return (this._offset >= this._len);\n }\n}\nexport class GraphemeIterator {\n get offset() {\n return this._iterator.offset;\n }\n constructor(str, offset = 0) {\n this._iterator = new CodePointIterator(str, offset);\n }\n nextGraphemeLength() {\n const graphemeBreakTree = GraphemeBreakTree.getInstance();\n const iterator = this._iterator;\n const initialOffset = iterator.offset;\n let graphemeBreakType = graphemeBreakTree.getGraphemeBreakType(iterator.nextCodePoint());\n while (!iterator.eol()) {\n const offset = iterator.offset;\n const nextGraphemeBreakType = graphemeBreakTree.getGraphemeBreakType(iterator.nextCodePoint());\n if (breakBetweenGraphemeBreakType(graphemeBreakType, nextGraphemeBreakType)) {\n // move iterator back\n iterator.setOffset(offset);\n break;\n }\n graphemeBreakType = nextGraphemeBreakType;\n }\n return (iterator.offset - initialOffset);\n }\n prevGraphemeLength() {\n const graphemeBreakTree = GraphemeBreakTree.getInstance();\n const iterator = this._iterator;\n const initialOffset = iterator.offset;\n let graphemeBreakType = graphemeBreakTree.getGraphemeBreakType(iterator.prevCodePoint());\n while (iterator.offset > 0) {\n const offset = iterator.offset;\n const prevGraphemeBreakType = graphemeBreakTree.getGraphemeBreakType(iterator.prevCodePoint());\n if (breakBetweenGraphemeBreakType(prevGraphemeBreakType, graphemeBreakType)) {\n // move iterator back\n iterator.setOffset(offset);\n break;\n }\n graphemeBreakType = prevGraphemeBreakType;\n }\n return (initialOffset - iterator.offset);\n }\n eol() {\n return this._iterator.eol();\n }\n}\nexport function nextCharLength(str, initialOffset) {\n const iterator = new GraphemeIterator(str, initialOffset);\n return iterator.nextGraphemeLength();\n}\nexport function prevCharLength(str, initialOffset) {\n const iterator = new GraphemeIterator(str, initialOffset);\n return iterator.prevGraphemeLength();\n}\nexport function getCharContainingOffset(str, offset) {\n if (offset > 0 && isLowSurrogate(str.charCodeAt(offset))) {\n offset--;\n }\n const endOffset = offset + nextCharLength(str, offset);\n const startOffset = endOffset - prevCharLength(str, endOffset);\n return [startOffset, endOffset];\n}\nlet CONTAINS_RTL = undefined;\nfunction makeContainsRtl() {\n // Generated using https://github.com/alexdima/unicode-utils/blob/main/rtl-test.js\n return /(?:[\\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 * Returns true if `str` contains any Unicode character that is classified as \"R\" or \"AL\".\n */\nexport function containsRTL(str) {\n if (!CONTAINS_RTL) {\n CONTAINS_RTL = makeContainsRtl();\n }\n return CONTAINS_RTL.test(str);\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) {\n return IS_BASIC_ASCII.test(str);\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) {\n return UNUSUAL_LINE_TERMINATORS.test(str);\n}\nexport function isFullWidthCharacter(charCode) {\n // Do a cheap trick to better support wrapping of wide characters, treat them as 2 columns\n // http://jrgraphix.net/research/unicode_blocks.php\n // 2E80 - 2EFF CJK Radicals Supplement\n // 2F00 - 2FDF Kangxi Radicals\n // 2FF0 - 2FFF Ideographic Description Characters\n // 3000 - 303F CJK Symbols and Punctuation\n // 3040 - 309F Hiragana\n // 30A0 - 30FF Katakana\n // 3100 - 312F Bopomofo\n // 3130 - 318F Hangul Compatibility Jamo\n // 3190 - 319F Kanbun\n // 31A0 - 31BF Bopomofo Extended\n // 31F0 - 31FF Katakana Phonetic Extensions\n // 3200 - 32FF Enclosed CJK Letters and Months\n // 3300 - 33FF CJK Compatibility\n // 3400 - 4DBF CJK Unified Ideographs Extension A\n // 4DC0 - 4DFF Yijing Hexagram Symbols\n // 4E00 - 9FFF CJK Unified Ideographs\n // A000 - A48F Yi Syllables\n // A490 - A4CF Yi Radicals\n // AC00 - D7AF Hangul Syllables\n // [IGNORE] D800 - DB7F High Surrogates\n // [IGNORE] DB80 - DBFF High Private Use Surrogates\n // [IGNORE] DC00 - DFFF Low Surrogates\n // [IGNORE] E000 - F8FF Private Use Area\n // F900 - FAFF CJK Compatibility Ideographs\n // [IGNORE] FB00 - FB4F Alphabetic Presentation Forms\n // [IGNORE] FB50 - FDFF Arabic Presentation Forms-A\n // [IGNORE] FE00 - FE0F Variation Selectors\n // [IGNORE] FE20 - FE2F Combining Half Marks\n // [IGNORE] FE30 - FE4F CJK Compatibility Forms\n // [IGNORE] FE50 - FE6F Small Form Variants\n // [IGNORE] FE70 - FEFF Arabic Presentation Forms-B\n // FF00 - FFEF Halfwidth and Fullwidth Forms\n // [https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms]\n // of which FF01 - FF5E fullwidth ASCII of 21 to 7E\n // [IGNORE] and FF65 - FFDC halfwidth of Katakana and Hangul\n // [IGNORE] FFF0 - FFFF Specials\n return ((charCode >= 0x2E80 && charCode <= 0xD7AF)\n || (charCode >= 0xF900 && charCode <= 0xFAFF)\n || (charCode >= 0xFF01 && charCode <= 0xFF5E));\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) {\n return ((x >= 0x1F1E6 && x <= 0x1F1FF) || (x === 8986) || (x === 8987) || (x === 9200)\n || (x === 9203) || (x >= 9728 && x <= 10175) || (x === 11088) || (x === 11093)\n || (x >= 127744 && x <= 128591) || (x >= 128640 && x <= 128764)\n || (x >= 128992 && x <= 129008) || (x >= 129280 && x <= 129535)\n || (x >= 129648 && x <= 129782));\n}\n// -- UTF-8 BOM\nexport const UTF8_BOM_CHARACTER = String.fromCharCode(65279 /* CharCode.UTF8_BOM */);\nexport function startsWithUTF8BOM(str) {\n return !!(str && str.length > 0 && str.charCodeAt(0) === 65279 /* CharCode.UTF8_BOM */);\n}\nexport function containsUppercaseCharacter(target, ignoreEscapedChars = false) {\n if (!target) {\n return false;\n }\n if (ignoreEscapedChars) {\n target = target.replace(/\\\\./g, '');\n }\n return target.toLowerCase() !== target;\n}\n/**\n * Produces 'a'-'z', followed by 'A'-'Z'... followed by 'a'-'z', etc.\n */\nexport function singleLetterHash(n) {\n const LETTERS_CNT = (90 /* CharCode.Z */ - 65 /* CharCode.A */ + 1);\n n = n % (2 * LETTERS_CNT);\n if (n < LETTERS_CNT) {\n return String.fromCharCode(97 /* CharCode.a */ + n);\n }\n return String.fromCharCode(65 /* CharCode.A */ + n - LETTERS_CNT);\n}\nfunction breakBetweenGraphemeBreakType(breakTypeA, breakTypeB) {\n // http://www.unicode.org/reports/tr29/#Grapheme_Cluster_Boundary_Rules\n // !!! Let's make the common case a bit faster\n if (breakTypeA === 0 /* GraphemeBreakType.Other */) {\n // see https://www.unicode.org/Public/13.0.0/ucd/auxiliary/GraphemeBreakTest-13.0.0d10.html#table\n return (breakTypeB !== 5 /* GraphemeBreakType.Extend */ && breakTypeB !== 7 /* GraphemeBreakType.SpacingMark */);\n }\n // Do not break between a CR and LF. Otherwise, break before and after controls.\n // GB3 CR \u00D7 LF\n // GB4 (Control | CR | LF) \u00F7\n // GB5 \u00F7 (Control | CR | LF)\n if (breakTypeA === 2 /* GraphemeBreakType.CR */) {\n if (breakTypeB === 3 /* GraphemeBreakType.LF */) {\n return false; // GB3\n }\n }\n if (breakTypeA === 4 /* GraphemeBreakType.Control */ || breakTypeA === 2 /* GraphemeBreakType.CR */ || breakTypeA === 3 /* GraphemeBreakType.LF */) {\n return true; // GB4\n }\n if (breakTypeB === 4 /* GraphemeBreakType.Control */ || breakTypeB === 2 /* GraphemeBreakType.CR */ || breakTypeB === 3 /* GraphemeBreakType.LF */) {\n return true; // GB5\n }\n // Do not break Hangul syllable sequences.\n // GB6 L \u00D7 (L | V | LV | LVT)\n // GB7 (LV | V) \u00D7 (V | T)\n // GB8 (LVT | T) \u00D7 T\n if (breakTypeA === 8 /* GraphemeBreakType.L */) {\n if (breakTypeB === 8 /* GraphemeBreakType.L */ || breakTypeB === 9 /* GraphemeBreakType.V */ || breakTypeB === 11 /* GraphemeBreakType.LV */ || breakTypeB === 12 /* GraphemeBreakType.LVT */) {\n return false; // GB6\n }\n }\n if (breakTypeA === 11 /* GraphemeBreakType.LV */ || breakTypeA === 9 /* GraphemeBreakType.V */) {\n if (breakTypeB === 9 /* GraphemeBreakType.V */ || breakTypeB === 10 /* GraphemeBreakType.T */) {\n return false; // GB7\n }\n }\n if (breakTypeA === 12 /* GraphemeBreakType.LVT */ || breakTypeA === 10 /* GraphemeBreakType.T */) {\n if (breakTypeB === 10 /* GraphemeBreakType.T */) {\n return false; // GB8\n }\n }\n // Do not break before extending characters or ZWJ.\n // GB9 \u00D7 (Extend | ZWJ)\n if (breakTypeB === 5 /* GraphemeBreakType.Extend */ || breakTypeB === 13 /* GraphemeBreakType.ZWJ */) {\n return false; // GB9\n }\n // The GB9a and GB9b rules only apply to extended grapheme clusters:\n // Do not break before SpacingMarks, or after Prepend characters.\n // GB9a \u00D7 SpacingMark\n // GB9b Prepend \u00D7\n if (breakTypeB === 7 /* GraphemeBreakType.SpacingMark */) {\n return false; // GB9a\n }\n if (breakTypeA === 1 /* GraphemeBreakType.Prepend */) {\n return false; // GB9b\n }\n // Do not break within emoji modifier sequences or emoji zwj sequences.\n // GB11 \\p{Extended_Pictographic} Extend* ZWJ \u00D7 \\p{Extended_Pictographic}\n if (breakTypeA === 13 /* GraphemeBreakType.ZWJ */ && breakTypeB === 14 /* GraphemeBreakType.Extended_Pictographic */) {\n // Note: we are not implementing the rule entirely here to avoid introducing states\n return false; // GB11\n }\n // GB12 sot (RI RI)* RI \u00D7 RI\n // GB13 [^RI] (RI RI)* RI \u00D7 RI\n if (breakTypeA === 6 /* GraphemeBreakType.Regional_Indicator */ && breakTypeB === 6 /* GraphemeBreakType.Regional_Indicator */) {\n // Note: we are not implementing the rule entirely here to avoid introducing states\n return false; // GB12 & GB13\n }\n // GB999 Any \u00F7 Any\n return true;\n}\nclass GraphemeBreakTree {\n static getInstance() {\n if (!GraphemeBreakTree._INSTANCE) {\n GraphemeBreakTree._INSTANCE = new GraphemeBreakTree();\n }\n return GraphemeBreakTree._INSTANCE;\n }\n constructor() {\n this._data = getGraphemeBreakRawData();\n }\n getGraphemeBreakType(codePoint) {\n // !!! Let's make 7bit ASCII a bit faster: 0..31\n if (codePoint < 32) {\n if (codePoint === 10 /* CharCode.LineFeed */) {\n return 3 /* GraphemeBreakType.LF */;\n }\n if (codePoint === 13 /* CharCode.CarriageReturn */) {\n return 2 /* GraphemeBreakType.CR */;\n }\n return 4 /* GraphemeBreakType.Control */;\n }\n // !!! Let's make 7bit ASCII a bit faster: 32..126\n if (codePoint < 127) {\n return 0 /* GraphemeBreakType.Other */;\n }\n const data = this._data;\n const nodeCount = data.length / 3;\n let nodeIndex = 1;\n while (nodeIndex <= nodeCount) {\n if (codePoint < data[3 * nodeIndex]) {\n // go left\n nodeIndex = 2 * nodeIndex;\n }\n else if (codePoint > data[3 * nodeIndex + 1]) {\n // go right\n nodeIndex = 2 * nodeIndex + 1;\n }\n else {\n // hit\n return data[3 * nodeIndex + 2];\n }\n }\n return 0 /* GraphemeBreakType.Other */;\n }\n}\nGraphemeBreakTree._INSTANCE = null;\nfunction getGraphemeBreakRawData() {\n // generated using https://github.com/alexdima/unicode-utils/blob/main/grapheme-break.js\n return 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//#endregion\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, str) {\n if (offset === 0) {\n return 0;\n }\n // Try to delete emoji part.\n const emojiOffset = getOffsetBeforeLastEmojiComponent(offset, str);\n if (emojiOffset !== undefined) {\n return emojiOffset;\n }\n // Otherwise, just skip a single code point.\n const iterator = new CodePointIterator(str, offset);\n iterator.prevCodePoint();\n return iterator.offset;\n}\nfunction getOffsetBeforeLastEmojiComponent(initialOffset, str) {\n // See https://www.unicode.org/reports/tr51/tr51-14.html#EBNF_and_Regex for the\n // structure of emojis.\n const iterator = new CodePointIterator(str, initialOffset);\n let codePoint = iterator.prevCodePoint();\n // Skip modifiers\n while ((isEmojiModifier(codePoint) || codePoint === 65039 /* CodePoint.emojiVariantSelector */ || codePoint === 8419 /* CodePoint.enclosingKeyCap */)) {\n if (iterator.offset === 0) {\n // Cannot skip modifier, no preceding emoji base.\n return undefined;\n }\n codePoint = iterator.prevCodePoint();\n }\n // Expect base emoji\n if (!isEmojiImprecise(codePoint)) {\n // Unexpected code point, not a valid emoji.\n return undefined;\n }\n let resultOffset = iterator.offset;\n if (resultOffset > 0) {\n // Skip optional ZWJ code points that combine multiple emojis.\n // In theory, we should check if that ZWJ actually combines multiple emojis\n // to prevent deleting ZWJs in situations we didn't account for.\n const optionalZwjCodePoint = iterator.prevCodePoint();\n if (optionalZwjCodePoint === 8205 /* CodePoint.zwj */) {\n resultOffset = iterator.offset;\n }\n }\n return resultOffset;\n}\nfunction isEmojiModifier(codePoint) {\n return 0x1F3FB <= codePoint && codePoint <= 0x1F3FF;\n}\nexport const noBreakWhitespace = '\\xa0';\nexport class AmbiguousCharacters {\n static getInstance(locales) {\n return _a.cache.get(Array.from(locales));\n }\n static getLocales() {\n return _a._locales.value;\n }\n constructor(confusableDictionary) {\n this.confusableDictionary = confusableDictionary;\n }\n isAmbiguous(codePoint) {\n return this.confusableDictionary.has(codePoint);\n }\n /**\n * Returns the non basic ASCII code point that the given code point can be confused,\n * or undefined if such code point does note exist.\n */\n getPrimaryConfusable(codePoint) {\n return this.confusableDictionary.get(codePoint);\n }\n getConfusableCodePoints() {\n return new Set(this.confusableDictionary.keys());\n }\n}\n_a = AmbiguousCharacters;\nAmbiguousCharacters.ambiguousCharacterData = new Lazy(() => {\n // Generated using https://github.com/hediet/vscode-unicode-data\n // Stored as key1, value1, key2, value2, ...\n return JSON.parse('{\\\"_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,8218,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,8242,96,1370,96,1523,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,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,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,120786,52,120796,52,120806,52,120816,52,120826,52,130036,52,5070,52,71855,52,120787,53,120797,53,120807,53,120817,53,120827,53,130037,53,444,53,71867,53,120788,54,120798,54,120808,54,120818,54,120828,54,130038,54,11474,54,5102,54,71893,54,119314,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,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,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,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,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,71922,67,71913,67,65315,67,8557,67,8450,67,8493,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,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,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,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,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,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,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,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,120783,73,120793,73,120803,73,120813,73,120823,73,130033,73,65321,73,8544,73,8464,73,8465,73,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,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,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,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,120782,79,120792,79,120802,79,120812,79,120822,79,130032,79,65327,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,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,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,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,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,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,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,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,71919,87,71910,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,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,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,66293,90,71909,90,65338,90,8484,90,8488,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,65284,36,65285,37,65286,38,65290,42,65291,43,65294,46,65295,47,65296,48,65297,49,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,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,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],\\\"cs\\\":[65374,126,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,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],\\\"de\\\":[65374,126,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,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],\\\"es\\\":[8211,45,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,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,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],\\\"fr\\\":[65374,126,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,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],\\\"it\\\":[160,32,8211,45,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,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],\\\"ja\\\":[8211,45,65306,58,65281,33,8216,96,8217,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,65283,35,65292,44,65307,59],\\\"ko\\\":[8211,45,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,215,120,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],\\\"pl\\\":[65374,126,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,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],\\\"pt-BR\\\":[65374,126,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,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],\\\"qps-ploc\\\":[160,32,8211,45,65374,126,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,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],\\\"ru\\\":[65374,126,65306,58,65281,33,8216,96,8217,96,8245,96,180,96,12494,47,305,105,921,73,1009,112,215,120,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],\\\"tr\\\":[160,32,8211,45,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,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,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],\\\"zh-hans\\\":[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,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41],\\\"zh-hant\\\":[8211,45,65374,126,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,65283,35,65307,59]}');\n});\nAmbiguousCharacters.cache = new LRUCachedFunction({ getCacheKey: JSON.stringify }, (locales) => {\n function arrayToMap(arr) {\n const result = new Map();\n for (let i = 0; i < arr.length; i += 2) {\n result.set(arr[i], arr[i + 1]);\n }\n return result;\n }\n function mergeMaps(map1, map2) {\n const result = new Map(map1);\n for (const [key, value] of map2) {\n result.set(key, value);\n }\n return result;\n }\n function intersectMaps(map1, map2) {\n if (!map1) {\n return map2;\n }\n const result = new Map();\n for (const [key, value] of map1) {\n if (map2.has(key)) {\n result.set(key, value);\n }\n }\n return result;\n }\n const data = _a.ambiguousCharacterData.value;\n let filteredLocales = locales.filter((l) => !l.startsWith('_') && l in data);\n if (filteredLocales.length === 0) {\n filteredLocales = ['_default'];\n }\n let languageSpecificMap = undefined;\n for (const locale of filteredLocales) {\n const map = arrayToMap(data[locale]);\n languageSpecificMap = intersectMaps(languageSpecificMap, map);\n }\n const commonMap = arrayToMap(data['_common']);\n const map = mergeMaps(commonMap, languageSpecificMap);\n return new _a(map);\n});\nAmbiguousCharacters._locales = new Lazy(() => Object.keys(_a.ambiguousCharacterData.value).filter((k) => !k.startsWith('_')));\nexport class InvisibleCharacters {\n static getRawData() {\n // Generated using https://github.com/hediet/vscode-unicode-data\n return JSON.parse('[9,10,11,12,13,32,127,160,173,847,1564,4447,4448,6068,6069,6155,6156,6157,6158,7355,7356,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8203,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,12288,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]');\n }\n static getData() {\n if (!this._data) {\n this._data = new Set(InvisibleCharacters.getRawData());\n }\n return this._data;\n }\n static isInvisibleCharacter(codePoint) {\n return InvisibleCharacters.getData().has(codePoint);\n }\n static get codePoints() {\n return InvisibleCharacters.getData();\n }\n}\nInvisibleCharacters._data = 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 *--------------------------------------------------------------------------------------------*/\nimport { mainWindow } from './window.js';\nclass WindowManager {\n constructor() {\n // --- Zoom Factor\n this.mapWindowIdToZoomFactor = new Map();\n }\n getZoomFactor(targetWindow) {\n var _a;\n return (_a = this.mapWindowIdToZoomFactor.get(this.getWindowId(targetWindow))) !== null && _a !== void 0 ? _a : 1;\n }\n getWindowId(targetWindow) {\n return targetWindow.vscodeWindowId;\n }\n}\nWindowManager.INSTANCE = new WindowManager();\nexport function addMatchMediaChangeListener(targetWindow, query, callback) {\n if (typeof query === 'string') {\n query = targetWindow.matchMedia(query);\n }\n query.addEventListener('change', callback);\n}\n/** The zoom scale for an index, e.g. 1, 1.2, 1.4 */\nexport function getZoomFactor(targetWindow) {\n return WindowManager.INSTANCE.getZoomFactor(targetWindow);\n}\nconst userAgent = navigator.userAgent;\nexport const isFirefox = (userAgent.indexOf('Firefox') >= 0);\nexport const isWebKit = (userAgent.indexOf('AppleWebKit') >= 0);\nexport const isChrome = (userAgent.indexOf('Chrome') >= 0);\nexport const isSafari = (!isChrome && (userAgent.indexOf('Safari') >= 0));\nexport const isWebkitWebView = (!isChrome && !isSafari && isWebKit);\nexport const isElectron = (userAgent.indexOf('Electron/') >= 0);\nexport const isAndroid = (userAgent.indexOf('Android') >= 0);\nlet standalone = false;\nif (typeof mainWindow.matchMedia === 'function') {\n const standaloneMatchMedia = mainWindow.matchMedia('(display-mode: standalone) or (display-mode: window-controls-overlay)');\n const fullScreenMatchMedia = mainWindow.matchMedia('(display-mode: fullscreen)');\n standalone = standaloneMatchMedia.matches;\n addMatchMediaChangeListener(mainWindow, standaloneMatchMedia, ({ matches }) => {\n // entering fullscreen would change standaloneMatchMedia.matches to false\n // if standalone is true (running as PWA) and entering fullscreen, skip this change\n if (standalone && fullScreenMatchMedia.matches) {\n return;\n }\n // otherwise update standalone (browser to PWA or PWA to browser)\n standalone = matches;\n });\n}\nexport function isStandalone() {\n return standalone;\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 * as browser from './browser.js';\nimport { mainWindow } from './window.js';\nimport * as platform from '../common/platform.js';\n/**\n * Browser feature we can support in current platform, browser and environment.\n */\nexport const BrowserFeatures = {\n clipboard: {\n writeText: (platform.isNative\n || (document.queryCommandSupported && document.queryCommandSupported('copy'))\n || !!(navigator && navigator.clipboard && navigator.clipboard.writeText)),\n readText: (platform.isNative\n || !!(navigator && navigator.clipboard && navigator.clipboard.readText))\n },\n keyboard: (() => {\n if (platform.isNative || browser.isStandalone()) {\n return 0 /* KeyboardSupport.Always */;\n }\n if (navigator.keyboard || browser.isSafari) {\n return 1 /* KeyboardSupport.FullScreen */;\n }\n return 2 /* KeyboardSupport.None */;\n })(),\n // 'ontouchstart' in window always evaluates to true with typescript's modern typings. This causes `window` to be\n // `never` later in `window.navigator`. That's why we need the explicit `window as Window` cast\n touch: 'ontouchstart' in mainWindow || navigator.maxTouchPoints > 0,\n pointerEvents: mainWindow.PointerEvent && ('ontouchstart' in mainWindow || navigator.maxTouchPoints > 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 *--------------------------------------------------------------------------------------------*/\nimport { illegalArgument } from './errors.js';\nexport function decodeKeybinding(keybinding, OS) {\n if (typeof keybinding === 'number') {\n if (keybinding === 0) {\n return null;\n }\n const firstChord = (keybinding & 0x0000FFFF) >>> 0;\n const secondChord = (keybinding & 0xFFFF0000) >>> 16;\n if (secondChord !== 0) {\n return new Keybinding([\n createSimpleKeybinding(firstChord, OS),\n createSimpleKeybinding(secondChord, OS)\n ]);\n }\n return new Keybinding([createSimpleKeybinding(firstChord, OS)]);\n }\n else {\n const chords = [];\n for (let i = 0; i < keybinding.length; i++) {\n chords.push(createSimpleKeybinding(keybinding[i], OS));\n }\n return new Keybinding(chords);\n }\n}\nexport function createSimpleKeybinding(keybinding, OS) {\n const ctrlCmd = (keybinding & 2048 /* BinaryKeybindingsMask.CtrlCmd */ ? true : false);\n const winCtrl = (keybinding & 256 /* BinaryKeybindingsMask.WinCtrl */ ? true : false);\n const ctrlKey = (OS === 2 /* OperatingSystem.Macintosh */ ? winCtrl : ctrlCmd);\n const shiftKey = (keybinding & 1024 /* BinaryKeybindingsMask.Shift */ ? true : false);\n const altKey = (keybinding & 512 /* BinaryKeybindingsMask.Alt */ ? true : false);\n const metaKey = (OS === 2 /* OperatingSystem.Macintosh */ ? ctrlCmd : winCtrl);\n const keyCode = (keybinding & 255 /* BinaryKeybindingsMask.KeyCode */);\n return new KeyCodeChord(ctrlKey, shiftKey, altKey, metaKey, keyCode);\n}\n/**\n * Represents a chord which uses the `keyCode` field of keyboard events.\n * A chord is a combination of keys pressed simultaneously.\n */\nexport class KeyCodeChord {\n constructor(ctrlKey, shiftKey, altKey, metaKey, keyCode) {\n this.ctrlKey = ctrlKey;\n this.shiftKey = shiftKey;\n this.altKey = altKey;\n this.metaKey = metaKey;\n this.keyCode = keyCode;\n }\n equals(other) {\n return (other instanceof KeyCodeChord\n && this.ctrlKey === other.ctrlKey\n && this.shiftKey === other.shiftKey\n && this.altKey === other.altKey\n && this.metaKey === other.metaKey\n && this.keyCode === other.keyCode);\n }\n isModifierKey() {\n return (this.keyCode === 0 /* KeyCode.Unknown */\n || this.keyCode === 5 /* KeyCode.Ctrl */\n || this.keyCode === 57 /* KeyCode.Meta */\n || this.keyCode === 6 /* KeyCode.Alt */\n || this.keyCode === 4 /* KeyCode.Shift */);\n }\n /**\n * Does this keybinding refer to the key code of a modifier and it also has the modifier flag?\n */\n isDuplicateModifierCase() {\n return ((this.ctrlKey && this.keyCode === 5 /* KeyCode.Ctrl */)\n || (this.shiftKey && this.keyCode === 4 /* KeyCode.Shift */)\n || (this.altKey && this.keyCode === 6 /* KeyCode.Alt */)\n || (this.metaKey && this.keyCode === 57 /* KeyCode.Meta */));\n }\n}\n/**\n * Represents a chord which uses the `code` field of keyboard events.\n * A chord is a combination of keys pressed simultaneously.\n */\nexport class ScanCodeChord {\n constructor(ctrlKey, shiftKey, altKey, metaKey, scanCode) {\n this.ctrlKey = ctrlKey;\n this.shiftKey = shiftKey;\n this.altKey = altKey;\n this.metaKey = metaKey;\n this.scanCode = scanCode;\n }\n /**\n * Does this keybinding refer to the key code of a modifier and it also has the modifier flag?\n */\n isDuplicateModifierCase() {\n return ((this.ctrlKey && (this.scanCode === 157 /* ScanCode.ControlLeft */ || this.scanCode === 161 /* ScanCode.ControlRight */))\n || (this.shiftKey && (this.scanCode === 158 /* ScanCode.ShiftLeft */ || this.scanCode === 162 /* ScanCode.ShiftRight */))\n || (this.altKey && (this.scanCode === 159 /* ScanCode.AltLeft */ || this.scanCode === 163 /* ScanCode.AltRight */))\n || (this.metaKey && (this.scanCode === 160 /* ScanCode.MetaLeft */ || this.scanCode === 164 /* ScanCode.MetaRight */)));\n }\n}\n/**\n * A keybinding is a sequence of chords.\n */\nexport class Keybinding {\n constructor(chords) {\n if (chords.length === 0) {\n throw illegalArgument(`chords`);\n }\n this.chords = chords;\n }\n}\nexport class ResolvedChord {\n constructor(ctrlKey, shiftKey, altKey, metaKey, keyLabel, keyAriaLabel) {\n this.ctrlKey = ctrlKey;\n this.shiftKey = shiftKey;\n this.altKey = altKey;\n this.metaKey = metaKey;\n this.keyLabel = keyLabel;\n this.keyAriaLabel = keyAriaLabel;\n }\n}\n/**\n * A resolved keybinding. Consists of one or multiple chords.\n */\nexport class ResolvedKeybinding {\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 * as browser from './browser.js';\nimport { EVENT_KEY_CODE_MAP, KeyCodeUtils } from '../common/keyCodes.js';\nimport { KeyCodeChord } from '../common/keybindings.js';\nimport * as platform from '../common/platform.js';\nfunction extractKeyCode(e) {\n if (e.charCode) {\n // \"keypress\" events mostly\n const char = String.fromCharCode(e.charCode).toUpperCase();\n return KeyCodeUtils.fromString(char);\n }\n const keyCode = e.keyCode;\n // browser quirks\n if (keyCode === 3) {\n return 7 /* KeyCode.PauseBreak */;\n }\n else if (browser.isFirefox) {\n switch (keyCode) {\n case 59: return 85 /* KeyCode.Semicolon */;\n case 60:\n if (platform.isLinux) {\n return 97 /* KeyCode.IntlBackslash */;\n }\n break;\n case 61: return 86 /* KeyCode.Equal */;\n // based on: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode#numpad_keys\n case 107: return 109 /* KeyCode.NumpadAdd */;\n case 109: return 111 /* KeyCode.NumpadSubtract */;\n case 173: return 88 /* KeyCode.Minus */;\n case 224:\n if (platform.isMacintosh) {\n return 57 /* KeyCode.Meta */;\n }\n break;\n }\n }\n else if (browser.isWebKit) {\n if (platform.isMacintosh && keyCode === 93) {\n // the two meta keys in the Mac have different key codes (91 and 93)\n return 57 /* KeyCode.Meta */;\n }\n else if (!platform.isMacintosh && keyCode === 92) {\n return 57 /* KeyCode.Meta */;\n }\n }\n // cross browser keycodes:\n return EVENT_KEY_CODE_MAP[keyCode] || 0 /* KeyCode.Unknown */;\n}\nconst ctrlKeyMod = (platform.isMacintosh ? 256 /* KeyMod.WinCtrl */ : 2048 /* KeyMod.CtrlCmd */);\nconst altKeyMod = 512 /* KeyMod.Alt */;\nconst shiftKeyMod = 1024 /* KeyMod.Shift */;\nconst metaKeyMod = (platform.isMacintosh ? 2048 /* KeyMod.CtrlCmd */ : 256 /* KeyMod.WinCtrl */);\nexport class StandardKeyboardEvent {\n constructor(source) {\n var _a;\n this._standardKeyboardEventBrand = true;\n const e = source;\n this.browserEvent = e;\n this.target = e.target;\n this.ctrlKey = e.ctrlKey;\n this.shiftKey = e.shiftKey;\n this.altKey = e.altKey;\n this.metaKey = e.metaKey;\n this.altGraphKey = (_a = e.getModifierState) === null || _a === void 0 ? void 0 : _a.call(e, 'AltGraph');\n this.keyCode = extractKeyCode(e);\n this.code = e.code;\n // console.info(e.type + \": keyCode: \" + e.keyCode + \", which: \" + e.which + \", charCode: \" + e.charCode + \", detail: \" + e.detail + \" ====> \" + this.keyCode + ' -- ' + KeyCode[this.keyCode]);\n this.ctrlKey = this.ctrlKey || this.keyCode === 5 /* KeyCode.Ctrl */;\n this.altKey = this.altKey || this.keyCode === 6 /* KeyCode.Alt */;\n this.shiftKey = this.shiftKey || this.keyCode === 4 /* KeyCode.Shift */;\n this.metaKey = this.metaKey || this.keyCode === 57 /* KeyCode.Meta */;\n this._asKeybinding = this._computeKeybinding();\n this._asKeyCodeChord = this._computeKeyCodeChord();\n // console.log(`code: ${e.code}, keyCode: ${e.keyCode}, key: ${e.key}`);\n }\n preventDefault() {\n if (this.browserEvent && this.browserEvent.preventDefault) {\n this.browserEvent.preventDefault();\n }\n }\n stopPropagation() {\n if (this.browserEvent && this.browserEvent.stopPropagation) {\n this.browserEvent.stopPropagation();\n }\n }\n toKeyCodeChord() {\n return this._asKeyCodeChord;\n }\n equals(other) {\n return this._asKeybinding === other;\n }\n _computeKeybinding() {\n let key = 0 /* KeyCode.Unknown */;\n if (this.keyCode !== 5 /* KeyCode.Ctrl */ && this.keyCode !== 4 /* KeyCode.Shift */ && this.keyCode !== 6 /* KeyCode.Alt */ && this.keyCode !== 57 /* KeyCode.Meta */) {\n key = this.keyCode;\n }\n let result = 0;\n if (this.ctrlKey) {\n result |= ctrlKeyMod;\n }\n if (this.altKey) {\n result |= altKeyMod;\n }\n if (this.shiftKey) {\n result |= shiftKeyMod;\n }\n if (this.metaKey) {\n result |= metaKeyMod;\n }\n result |= key;\n return result;\n }\n _computeKeyCodeChord() {\n let key = 0 /* KeyCode.Unknown */;\n if (this.keyCode !== 5 /* KeyCode.Ctrl */ && this.keyCode !== 4 /* KeyCode.Shift */ && this.keyCode !== 6 /* KeyCode.Alt */ && this.keyCode !== 57 /* KeyCode.Meta */) {\n key = this.keyCode;\n }\n return new KeyCodeChord(this.ctrlKey, this.shiftKey, this.altKey, this.metaKey, key);\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 *--------------------------------------------------------------------------------------------*/\nconst sameOriginWindowChainCache = new WeakMap();\nfunction getParentWindowIfSameOrigin(w) {\n if (!w.parent || w.parent === w) {\n return null;\n }\n // Cannot really tell if we have access to the parent window unless we try to access something in it\n try {\n const location = w.location;\n const parentLocation = w.parent.location;\n if (location.origin !== 'null' && parentLocation.origin !== 'null' && location.origin !== parentLocation.origin) {\n return null;\n }\n }\n catch (e) {\n return null;\n }\n return w.parent;\n}\nexport class IframeUtils {\n /**\n * Returns a chain of embedded windows with the same origin (which can be accessed programmatically).\n * Having a chain of length 1 might mean that the current execution environment is running outside of an iframe or inside an iframe embedded in a window with a different origin.\n */\n static getSameOriginWindowChain(targetWindow) {\n let windowChainCache = sameOriginWindowChainCache.get(targetWindow);\n if (!windowChainCache) {\n windowChainCache = [];\n sameOriginWindowChainCache.set(targetWindow, windowChainCache);\n let w = targetWindow;\n let parent;\n do {\n parent = getParentWindowIfSameOrigin(w);\n if (parent) {\n windowChainCache.push({\n window: new WeakRef(w),\n iframeElement: w.frameElement || null\n });\n }\n else {\n windowChainCache.push({\n window: new WeakRef(w),\n iframeElement: null\n });\n }\n w = parent;\n } while (w);\n }\n return windowChainCache.slice(0);\n }\n /**\n * Returns the position of `childWindow` relative to `ancestorWindow`\n */\n static getPositionOfChildWindowRelativeToAncestorWindow(childWindow, ancestorWindow) {\n var _a, _b;\n if (!ancestorWindow || childWindow === ancestorWindow) {\n return {\n top: 0,\n left: 0\n };\n }\n let top = 0, left = 0;\n const windowChain = this.getSameOriginWindowChain(childWindow);\n for (const windowChainEl of windowChain) {\n const windowInChain = windowChainEl.window.deref();\n top += (_a = windowInChain === null || windowInChain === void 0 ? void 0 : windowInChain.scrollY) !== null && _a !== void 0 ? _a : 0;\n left += (_b = windowInChain === null || windowInChain === void 0 ? void 0 : windowInChain.scrollX) !== null && _b !== void 0 ? _b : 0;\n if (windowInChain === ancestorWindow) {\n break;\n }\n if (!windowChainEl.iframeElement) {\n break;\n }\n const boundingRect = windowChainEl.iframeElement.getBoundingClientRect();\n top += boundingRect.top;\n left += boundingRect.left;\n }\n return {\n top: top,\n left: left\n };\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 *--------------------------------------------------------------------------------------------*/\nimport * as browser from './browser.js';\nimport { IframeUtils } from './iframe.js';\nimport * as platform from '../common/platform.js';\nexport class StandardMouseEvent {\n constructor(targetWindow, e) {\n this.timestamp = Date.now();\n this.browserEvent = e;\n this.leftButton = e.button === 0;\n this.middleButton = e.button === 1;\n this.rightButton = e.button === 2;\n this.buttons = e.buttons;\n this.target = e.target;\n this.detail = e.detail || 1;\n if (e.type === 'dblclick') {\n this.detail = 2;\n }\n this.ctrlKey = e.ctrlKey;\n this.shiftKey = e.shiftKey;\n this.altKey = e.altKey;\n this.metaKey = e.metaKey;\n if (typeof e.pageX === 'number') {\n this.posx = e.pageX;\n this.posy = e.pageY;\n }\n else {\n // Probably hit by MSGestureEvent\n this.posx = e.clientX + this.target.ownerDocument.body.scrollLeft + this.target.ownerDocument.documentElement.scrollLeft;\n this.posy = e.clientY + this.target.ownerDocument.body.scrollTop + this.target.ownerDocument.documentElement.scrollTop;\n }\n // Find the position of the iframe this code is executing in relative to the iframe where the event was captured.\n const iframeOffsets = IframeUtils.getPositionOfChildWindowRelativeToAncestorWindow(targetWindow, e.view);\n this.posx -= iframeOffsets.left;\n this.posy -= iframeOffsets.top;\n }\n preventDefault() {\n this.browserEvent.preventDefault();\n }\n stopPropagation() {\n this.browserEvent.stopPropagation();\n }\n}\nexport class StandardWheelEvent {\n constructor(e, deltaX = 0, deltaY = 0) {\n var _a;\n this.browserEvent = e || null;\n this.target = e ? (e.target || e.targetNode || e.srcElement) : null;\n this.deltaY = deltaY;\n this.deltaX = deltaX;\n let shouldFactorDPR = false;\n if (browser.isChrome) {\n // Chrome version >= 123 contains the fix to factor devicePixelRatio into the wheel event.\n // See https://chromium.googlesource.com/chromium/src.git/+/be51b448441ff0c9d1f17e0f25c4bf1ab3f11f61\n const chromeVersionMatch = navigator.userAgent.match(/Chrome\\/(\\d+)/);\n const chromeMajorVersion = chromeVersionMatch ? parseInt(chromeVersionMatch[1]) : 123;\n shouldFactorDPR = chromeMajorVersion <= 122;\n }\n if (e) {\n // Old (deprecated) wheel events\n const e1 = e;\n const e2 = e;\n const devicePixelRatio = ((_a = e.view) === null || _a === void 0 ? void 0 : _a.devicePixelRatio) || 1;\n // vertical delta scroll\n if (typeof e1.wheelDeltaY !== 'undefined') {\n if (shouldFactorDPR) {\n // Refs https://github.com/microsoft/vscode/issues/146403#issuecomment-1854538928\n this.deltaY = e1.wheelDeltaY / (120 * devicePixelRatio);\n }\n else {\n this.deltaY = e1.wheelDeltaY / 120;\n }\n }\n else if (typeof e2.VERTICAL_AXIS !== 'undefined' && e2.axis === e2.VERTICAL_AXIS) {\n this.deltaY = -e2.detail / 3;\n }\n else if (e.type === 'wheel') {\n // Modern wheel event\n // https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent\n const ev = e;\n if (ev.deltaMode === ev.DOM_DELTA_LINE) {\n // the deltas are expressed in lines\n if (browser.isFirefox && !platform.isMacintosh) {\n this.deltaY = -e.deltaY / 3;\n }\n else {\n this.deltaY = -e.deltaY;\n }\n }\n else {\n this.deltaY = -e.deltaY / 40;\n }\n }\n // horizontal delta scroll\n if (typeof e1.wheelDeltaX !== 'undefined') {\n if (browser.isSafari && platform.isWindows) {\n this.deltaX = -(e1.wheelDeltaX / 120);\n }\n else if (shouldFactorDPR) {\n // Refs https://github.com/microsoft/vscode/issues/146403#issuecomment-1854538928\n this.deltaX = e1.wheelDeltaX / (120 * devicePixelRatio);\n }\n else {\n this.deltaX = e1.wheelDeltaX / 120;\n }\n }\n else if (typeof e2.HORIZONTAL_AXIS !== 'undefined' && e2.axis === e2.HORIZONTAL_AXIS) {\n this.deltaX = -e.detail / 3;\n }\n else if (e.type === 'wheel') {\n // Modern wheel event\n // https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent\n const ev = e;\n if (ev.deltaMode === ev.DOM_DELTA_LINE) {\n // the deltas are expressed in lines\n if (browser.isFirefox && !platform.isMacintosh) {\n this.deltaX = -e.deltaX / 3;\n }\n else {\n this.deltaX = -e.deltaX;\n }\n }\n else {\n this.deltaX = -e.deltaX / 40;\n }\n }\n // Assume a vertical scroll if nothing else worked\n if (this.deltaY === 0 && this.deltaX === 0 && e.wheelDelta) {\n if (shouldFactorDPR) {\n // Refs https://github.com/microsoft/vscode/issues/146403#issuecomment-1854538928\n this.deltaY = e.wheelDelta / (120 * devicePixelRatio);\n }\n else {\n this.deltaY = e.wheelDelta / 120;\n }\n }\n }\n }\n preventDefault() {\n var _a;\n (_a = this.browserEvent) === null || _a === void 0 ? void 0 : _a.preventDefault();\n }\n stopPropagation() {\n var _a;\n (_a = this.browserEvent) === null || _a === void 0 ? void 0 : _a.stopPropagation();\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 * 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 *--------------------------------------------------------------------------------------------*/\nimport { CancellationTokenSource } from './cancellation.js';\nimport { CancellationError } from './errors.js';\nimport { Emitter, Event } from './event.js';\nimport { toDisposable } from './lifecycle.js';\nimport { setTimeout0 } from './platform.js';\nimport { MicrotaskDelay } from './symbols.js';\nexport function isThenable(obj) {\n return !!obj && typeof obj.then === 'function';\n}\nexport function createCancelablePromise(callback) {\n const source = new CancellationTokenSource();\n const thenable = callback(source.token);\n const promise = new Promise((resolve, reject) => {\n const subscription = source.token.onCancellationRequested(() => {\n subscription.dispose();\n reject(new CancellationError());\n });\n Promise.resolve(thenable).then(value => {\n subscription.dispose();\n source.dispose();\n resolve(value);\n }, err => {\n subscription.dispose();\n source.dispose();\n reject(err);\n });\n });\n return new class {\n cancel() {\n source.cancel();\n source.dispose();\n }\n then(resolve, reject) {\n return promise.then(resolve, reject);\n }\n catch(reject) {\n return this.then(undefined, reject);\n }\n finally(onfinally) {\n return promise.finally(onfinally);\n }\n };\n}\nexport function raceCancellation(promise, token, defaultValue) {\n return new Promise((resolve, reject) => {\n const ref = token.onCancellationRequested(() => {\n ref.dispose();\n resolve(defaultValue);\n });\n promise.then(resolve, reject).finally(() => ref.dispose());\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 {\n constructor() {\n this.isDisposed = false;\n this.activePromise = null;\n this.queuedPromise = null;\n this.queuedPromiseFactory = null;\n }\n queue(promiseFactory) {\n if (this.isDisposed) {\n return Promise.reject(new Error('Throttler is disposed'));\n }\n if (this.activePromise) {\n this.queuedPromiseFactory = promiseFactory;\n if (!this.queuedPromise) {\n const onComplete = () => {\n this.queuedPromise = null;\n if (this.isDisposed) {\n return;\n }\n const result = this.queue(this.queuedPromiseFactory);\n this.queuedPromiseFactory = null;\n return result;\n };\n this.queuedPromise = new Promise(resolve => {\n this.activePromise.then(onComplete, onComplete).then(resolve);\n });\n }\n return new Promise((resolve, reject) => {\n this.queuedPromise.then(resolve, reject);\n });\n }\n this.activePromise = promiseFactory();\n return new Promise((resolve, reject) => {\n this.activePromise.then((result) => {\n this.activePromise = null;\n resolve(result);\n }, (err) => {\n this.activePromise = null;\n reject(err);\n });\n });\n }\n dispose() {\n this.isDisposed = true;\n }\n}\nconst timeoutDeferred = (timeout, fn) => {\n let scheduled = true;\n const handle = setTimeout(() => {\n scheduled = false;\n fn();\n }, timeout);\n return {\n isTriggered: () => scheduled,\n dispose: () => {\n clearTimeout(handle);\n scheduled = false;\n },\n };\n};\nconst microtaskDeferred = (fn) => {\n let scheduled = true;\n queueMicrotask(() => {\n if (scheduled) {\n scheduled = false;\n fn();\n }\n });\n return {\n isTriggered: () => scheduled,\n dispose: () => { scheduled = false; },\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 {\n constructor(defaultDelay) {\n this.defaultDelay = defaultDelay;\n this.deferred = null;\n this.completionPromise = null;\n this.doResolve = null;\n this.doReject = null;\n this.task = null;\n }\n trigger(task, delay = this.defaultDelay) {\n this.task = task;\n this.cancelTimeout();\n if (!this.completionPromise) {\n this.completionPromise = new Promise((resolve, reject) => {\n this.doResolve = resolve;\n this.doReject = reject;\n }).then(() => {\n this.completionPromise = null;\n this.doResolve = null;\n if (this.task) {\n const task = this.task;\n this.task = null;\n return task();\n }\n return undefined;\n });\n }\n const fn = () => {\n var _a;\n this.deferred = null;\n (_a = this.doResolve) === null || _a === void 0 ? void 0 : _a.call(this, null);\n };\n this.deferred = delay === MicrotaskDelay ? microtaskDeferred(fn) : timeoutDeferred(delay, fn);\n return this.completionPromise;\n }\n isTriggered() {\n var _a;\n return !!((_a = this.deferred) === null || _a === void 0 ? void 0 : _a.isTriggered());\n }\n cancel() {\n var _a;\n this.cancelTimeout();\n if (this.completionPromise) {\n (_a = this.doReject) === null || _a === void 0 ? void 0 : _a.call(this, new CancellationError());\n this.completionPromise = null;\n }\n }\n cancelTimeout() {\n var _a;\n (_a = this.deferred) === null || _a === void 0 ? void 0 : _a.dispose();\n this.deferred = null;\n }\n dispose() {\n this.cancel();\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 {\n constructor(defaultDelay) {\n this.delayer = new Delayer(defaultDelay);\n this.throttler = new Throttler();\n }\n trigger(promiseFactory, delay) {\n return this.delayer.trigger(() => this.throttler.queue(promiseFactory), delay);\n }\n cancel() {\n this.delayer.cancel();\n }\n dispose() {\n this.delayer.dispose();\n this.throttler.dispose();\n }\n}\nexport function timeout(millis, token) {\n if (!token) {\n return createCancelablePromise(token => timeout(millis, token));\n }\n return new Promise((resolve, reject) => {\n const handle = setTimeout(() => {\n disposable.dispose();\n resolve();\n }, millis);\n const disposable = token.onCancellationRequested(() => {\n clearTimeout(handle);\n disposable.dispose();\n reject(new CancellationError());\n });\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, timeout = 0, store) {\n const timer = setTimeout(() => {\n handler();\n if (store) {\n disposable.dispose();\n }\n }, timeout);\n const disposable = toDisposable(() => {\n clearTimeout(timer);\n store === null || store === void 0 ? void 0 : store.deleteAndLeak(disposable);\n });\n store === null || store === void 0 ? void 0 : store.add(disposable);\n return disposable;\n}\nexport function first(promiseFactories, shouldStop = t => !!t, defaultValue = null) {\n let index = 0;\n const len = promiseFactories.length;\n const loop = () => {\n if (index >= len) {\n return Promise.resolve(defaultValue);\n }\n const factory = promiseFactories[index++];\n const promise = Promise.resolve(factory());\n return promise.then(result => {\n if (shouldStop(result)) {\n return Promise.resolve(result);\n }\n return loop();\n });\n };\n return loop();\n}\nexport class TimeoutTimer {\n constructor(runner, timeout) {\n this._token = -1;\n if (typeof runner === 'function' && typeof timeout === 'number') {\n this.setIfNotSet(runner, timeout);\n }\n }\n dispose() {\n this.cancel();\n }\n cancel() {\n if (this._token !== -1) {\n clearTimeout(this._token);\n this._token = -1;\n }\n }\n cancelAndSet(runner, timeout) {\n this.cancel();\n this._token = setTimeout(() => {\n this._token = -1;\n runner();\n }, timeout);\n }\n setIfNotSet(runner, timeout) {\n if (this._token !== -1) {\n // timer is already set\n return;\n }\n this._token = setTimeout(() => {\n this._token = -1;\n runner();\n }, timeout);\n }\n}\nexport class IntervalTimer {\n constructor() {\n this.disposable = undefined;\n }\n cancel() {\n var _a;\n (_a = this.disposable) === null || _a === void 0 ? void 0 : _a.dispose();\n this.disposable = undefined;\n }\n cancelAndSet(runner, interval, context = globalThis) {\n this.cancel();\n const handle = context.setInterval(() => {\n runner();\n }, interval);\n this.disposable = toDisposable(() => {\n context.clearInterval(handle);\n this.disposable = undefined;\n });\n }\n dispose() {\n this.cancel();\n }\n}\nexport class RunOnceScheduler {\n constructor(runner, delay) {\n this.timeoutToken = -1;\n this.runner = runner;\n this.timeout = delay;\n this.timeoutHandler = this.onTimeout.bind(this);\n }\n /**\n * Dispose RunOnceScheduler\n */\n dispose() {\n this.cancel();\n this.runner = null;\n }\n /**\n * Cancel current scheduled runner (if any).\n */\n cancel() {\n if (this.isScheduled()) {\n clearTimeout(this.timeoutToken);\n this.timeoutToken = -1;\n }\n }\n /**\n * Cancel previous runner (if any) & schedule a new runner.\n */\n schedule(delay = this.timeout) {\n this.cancel();\n this.timeoutToken = setTimeout(this.timeoutHandler, delay);\n }\n get delay() {\n return this.timeout;\n }\n set delay(value) {\n this.timeout = value;\n }\n /**\n * Returns true if scheduled.\n */\n isScheduled() {\n return this.timeoutToken !== -1;\n }\n onTimeout() {\n this.timeoutToken = -1;\n if (this.runner) {\n this.doRun();\n }\n }\n doRun() {\n var _a;\n (_a = this.runner) === null || _a === void 0 ? void 0 : _a.call(this);\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;\nexport let _runWhenIdle;\n(function () {\n if (typeof globalThis.requestIdleCallback !== 'function' || typeof globalThis.cancelIdleCallback !== 'function') {\n _runWhenIdle = (_targetWindow, runner) => {\n setTimeout0(() => {\n if (disposed) {\n return;\n }\n const end = Date.now() + 15; // one frame at 64fps\n const deadline = {\n didTimeout: true,\n timeRemaining() {\n return Math.max(0, end - Date.now());\n }\n };\n runner(Object.freeze(deadline));\n });\n let disposed = false;\n return {\n dispose() {\n if (disposed) {\n return;\n }\n disposed = true;\n }\n };\n };\n }\n else {\n _runWhenIdle = (targetWindow, runner, timeout) => {\n const handle = targetWindow.requestIdleCallback(runner, typeof timeout === 'number' ? { timeout } : undefined);\n let disposed = false;\n return {\n dispose() {\n if (disposed) {\n return;\n }\n disposed = true;\n targetWindow.cancelIdleCallback(handle);\n }\n };\n };\n }\n runWhenGlobalIdle = (runner) => _runWhenIdle(globalThis, runner);\n})();\nexport class AbstractIdleValue {\n constructor(targetWindow, executor) {\n this._didRun = false;\n this._executor = () => {\n try {\n this._value = executor();\n }\n catch (err) {\n this._error = err;\n }\n finally {\n this._didRun = true;\n }\n };\n this._handle = _runWhenIdle(targetWindow, () => this._executor());\n }\n dispose() {\n this._handle.dispose();\n }\n get value() {\n if (!this._didRun) {\n this._handle.dispose();\n this._executor();\n }\n if (this._error) {\n throw this._error;\n }\n return this._value;\n }\n get isInitialized() {\n return this._didRun;\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 extends AbstractIdleValue {\n constructor(executor) {\n super(globalThis, executor);\n }\n}\n/**\n * Creates a promise whose resolution or rejection can be controlled imperatively.\n */\nexport class DeferredPromise {\n get isRejected() {\n var _a;\n return ((_a = this.outcome) === null || _a === void 0 ? void 0 : _a.outcome) === 1 /* DeferredOutcome.Rejected */;\n }\n get isSettled() {\n return !!this.outcome;\n }\n constructor() {\n this.p = new Promise((c, e) => {\n this.completeCallback = c;\n this.errorCallback = e;\n });\n }\n complete(value) {\n return new Promise(resolve => {\n this.completeCallback(value);\n this.outcome = { outcome: 0 /* DeferredOutcome.Resolved */, value };\n resolve();\n });\n }\n error(err) {\n return new Promise(resolve => {\n this.errorCallback(err);\n this.outcome = { outcome: 1 /* DeferredOutcome.Rejected */, value: err };\n resolve();\n });\n }\n cancel() {\n return this.error(new CancellationError());\n }\n}\n//#endregion\n//#region Promises\nexport var Promises;\n(function (Promises) {\n /**\n * A drop-in replacement for `Promise.all` with the only difference\n * that the method awaits every promise to either fulfill or reject.\n *\n * Similar to `Promise.all`, only the first error will be returned\n * if any.\n */\n async function settled(promises) {\n let firstError = undefined;\n const result = await Promise.all(promises.map(promise => promise.then(value => value, error => {\n if (!firstError) {\n firstError = error;\n }\n return undefined; // do not rethrow so that other promises can settle\n })));\n if (typeof firstError !== 'undefined') {\n throw firstError;\n }\n return result; // cast is needed and protected by the `throw` above\n }\n Promises.settled = settled;\n /**\n * A helper to create a new `Promise` with a body that is a promise\n * itself. By default, an error that raises from the async body will\n * end up as a unhandled rejection, so this utility properly awaits the\n * body and rejects the promise as a normal promise does without async\n * body.\n *\n * This method should only be used in rare cases where otherwise `async`\n * cannot be used (e.g. when callbacks are involved that require this).\n */\n function withAsyncBody(bodyFn) {\n // eslint-disable-next-line no-async-promise-executor\n return new Promise(async (resolve, reject) => {\n try {\n await bodyFn(resolve, reject);\n }\n catch (error) {\n reject(error);\n }\n });\n }\n Promises.withAsyncBody = withAsyncBody;\n})(Promises || (Promises = {}));\n/**\n * A rich implementation for an `AsyncIterable`.\n */\nexport class AsyncIterableObject {\n static fromArray(items) {\n return new AsyncIterableObject((writer) => {\n writer.emitMany(items);\n });\n }\n static fromPromise(promise) {\n return new AsyncIterableObject(async (emitter) => {\n emitter.emitMany(await promise);\n });\n }\n static fromPromises(promises) {\n return new AsyncIterableObject(async (emitter) => {\n await Promise.all(promises.map(async (p) => emitter.emitOne(await p)));\n });\n }\n static merge(iterables) {\n return new AsyncIterableObject(async (emitter) => {\n await Promise.all(iterables.map(async (iterable) => {\n for await (const item of iterable) {\n emitter.emitOne(item);\n }\n }));\n });\n }\n constructor(executor, onReturn) {\n this._state = 0 /* AsyncIterableSourceState.Initial */;\n this._results = [];\n this._error = null;\n this._onReturn = onReturn;\n this._onStateChanged = new Emitter();\n queueMicrotask(async () => {\n const writer = {\n emitOne: (item) => this.emitOne(item),\n emitMany: (items) => this.emitMany(items),\n reject: (error) => this.reject(error)\n };\n try {\n await Promise.resolve(executor(writer));\n this.resolve();\n }\n catch (err) {\n this.reject(err);\n }\n finally {\n writer.emitOne = undefined;\n writer.emitMany = undefined;\n writer.reject = undefined;\n }\n });\n }\n [Symbol.asyncIterator]() {\n let i = 0;\n return {\n next: async () => {\n do {\n if (this._state === 2 /* AsyncIterableSourceState.DoneError */) {\n throw this._error;\n }\n if (i < this._results.length) {\n return { done: false, value: this._results[i++] };\n }\n if (this._state === 1 /* AsyncIterableSourceState.DoneOK */) {\n return { done: true, value: undefined };\n }\n await Event.toPromise(this._onStateChanged.event);\n } while (true);\n },\n return: async () => {\n var _a;\n (_a = this._onReturn) === null || _a === void 0 ? void 0 : _a.call(this);\n return { done: true, value: undefined };\n }\n };\n }\n static map(iterable, mapFn) {\n return new AsyncIterableObject(async (emitter) => {\n for await (const item of iterable) {\n emitter.emitOne(mapFn(item));\n }\n });\n }\n map(mapFn) {\n return AsyncIterableObject.map(this, mapFn);\n }\n static filter(iterable, filterFn) {\n return new AsyncIterableObject(async (emitter) => {\n for await (const item of iterable) {\n if (filterFn(item)) {\n emitter.emitOne(item);\n }\n }\n });\n }\n filter(filterFn) {\n return AsyncIterableObject.filter(this, filterFn);\n }\n static coalesce(iterable) {\n return AsyncIterableObject.filter(iterable, item => !!item);\n }\n coalesce() {\n return AsyncIterableObject.coalesce(this);\n }\n static async toPromise(iterable) {\n const result = [];\n for await (const item of iterable) {\n result.push(item);\n }\n return result;\n }\n toPromise() {\n return AsyncIterableObject.toPromise(this);\n }\n /**\n * The value will be appended at the end.\n *\n * **NOTE** If `resolve()` or `reject()` have already been called, this method has no effect.\n */\n emitOne(value) {\n if (this._state !== 0 /* AsyncIterableSourceState.Initial */) {\n return;\n }\n // it is important to add new values at the end,\n // as we may have iterators already running on the array\n this._results.push(value);\n this._onStateChanged.fire();\n }\n /**\n * The values will be appended at the end.\n *\n * **NOTE** If `resolve()` or `reject()` have already been called, this method has no effect.\n */\n emitMany(values) {\n if (this._state !== 0 /* AsyncIterableSourceState.Initial */) {\n return;\n }\n // it is important to add new values at the end,\n // as we may have iterators already running on the array\n this._results = this._results.concat(values);\n this._onStateChanged.fire();\n }\n /**\n * Calling `resolve()` will mark the result array as complete.\n *\n * **NOTE** `resolve()` must be called, otherwise all consumers of this iterable will hang indefinitely, similar to a non-resolved promise.\n * **NOTE** If `resolve()` or `reject()` have already been called, this method has no effect.\n */\n resolve() {\n if (this._state !== 0 /* AsyncIterableSourceState.Initial */) {\n return;\n }\n this._state = 1 /* AsyncIterableSourceState.DoneOK */;\n this._onStateChanged.fire();\n }\n /**\n * Writing an error will permanently invalidate this iterable.\n * The current users will receive an error thrown, as will all future users.\n *\n * **NOTE** If `resolve()` or `reject()` have already been called, this method has no effect.\n */\n reject(error) {\n if (this._state !== 0 /* AsyncIterableSourceState.Initial */) {\n return;\n }\n this._state = 2 /* AsyncIterableSourceState.DoneError */;\n this._error = error;\n this._onStateChanged.fire();\n }\n}\nAsyncIterableObject.EMPTY = AsyncIterableObject.fromArray([]);\nexport class CancelableAsyncIterableObject extends AsyncIterableObject {\n constructor(_source, executor) {\n super(executor);\n this._source = _source;\n }\n cancel() {\n this._source.cancel();\n }\n}\nexport function createCancelableAsyncIterable(callback) {\n const source = new CancellationTokenSource();\n const innerIterable = callback(source.token);\n return new CancelableAsyncIterableObject(source, async (emitter) => {\n const subscription = source.token.onCancellationRequested(() => {\n subscription.dispose();\n source.dispose();\n emitter.reject(new CancellationError());\n });\n try {\n for await (const item of innerIterable) {\n if (source.token.isCancellationRequested) {\n // canceled in the meantime\n return;\n }\n emitter.emitOne(item);\n }\n subscription.dispose();\n source.dispose();\n }\n catch (err) {\n subscription.dispose();\n source.dispose();\n emitter.reject(err);\n }\n });\n}\n//#endregion\n", "/*! @license DOMPurify 3.0.5 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.0.5/LICENSE */\n\nconst {\n\tentries,\n\tsetPrototypeOf,\n\tisFrozen,\n\tgetPrototypeOf,\n\tgetOwnPropertyDescriptor\n} = Object;\nlet {\n\tfreeze,\n\tseal,\n\tcreate\n} = Object; // eslint-disable-line import/no-mutable-exports\n\nlet {\n\tapply,\n\tconstruct\n} = typeof Reflect !== 'undefined' && Reflect;\n\nif (!apply) {\n\tapply = function apply(fun, thisValue, args) {\n\t\treturn fun.apply(thisValue, args);\n\t};\n}\n\nif (!freeze) {\n\tfreeze = function freeze(x) {\n\t\treturn x;\n\t};\n}\n\nif (!seal) {\n\tseal = function seal(x) {\n\t\treturn x;\n\t};\n}\n\nif (!construct) {\n\tconstruct = function construct(Func, args) {\n\t\treturn new Func(...args);\n\t};\n}\n\nconst arrayForEach = unapply(Array.prototype.forEach);\nconst arrayPop = unapply(Array.prototype.pop);\nconst arrayPush = unapply(Array.prototype.push);\nconst stringToLowerCase = unapply(String.prototype.toLowerCase);\nconst stringToString = unapply(String.prototype.toString);\nconst stringMatch = unapply(String.prototype.match);\nconst stringReplace = unapply(String.prototype.replace);\nconst stringIndexOf = unapply(String.prototype.indexOf);\nconst stringTrim = unapply(String.prototype.trim);\nconst regExpTest = unapply(RegExp.prototype.test);\nconst typeErrorCreate = unconstruct(TypeError);\nfunction unapply(func) {\n\treturn function (thisArg) {\n\t\tfor (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n\t\t\targs[_key - 1] = arguments[_key];\n\t\t}\n\n\t\treturn apply(func, thisArg, args);\n\t};\n}\nfunction unconstruct(func) {\n\treturn function () {\n\t\tfor (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n\t\t\targs[_key2] = arguments[_key2];\n\t\t}\n\n\t\treturn construct(func, args);\n\t};\n}\n/* Add properties to a lookup table */\n\nfunction addToSet(set, array, transformCaseFunc) {\n\tvar _transformCaseFunc;\n\n\ttransformCaseFunc = (_transformCaseFunc = transformCaseFunc) !== null && _transformCaseFunc !== void 0 ? _transformCaseFunc : stringToLowerCase;\n\n\tif (setPrototypeOf) {\n\t\t// Make 'in' and truthy checks like Boolean(set.constructor)\n\t\t// independent of any properties defined on Object.prototype.\n\t\t// Prevent prototype setters from intercepting set as a this value.\n\t\tsetPrototypeOf(set, null);\n\t}\n\n\tlet l = array.length;\n\n\twhile (l--) {\n\t\tlet element = array[l];\n\n\t\tif (typeof element === 'string') {\n\t\t\tconst lcElement = transformCaseFunc(element);\n\n\t\t\tif (lcElement !== element) {\n\t\t\t\t// Config presets (e.g. tags.js, attrs.js) are immutable.\n\t\t\t\tif (!isFrozen(array)) {\n\t\t\t\t\tarray[l] = lcElement;\n\t\t\t\t}\n\n\t\t\t\telement = lcElement;\n\t\t\t}\n\t\t}\n\n\t\tset[element] = true;\n\t}\n\n\treturn set;\n}\n/* Shallow clone an object */\n\nfunction clone(object) {\n\tconst newObject = create(null);\n\n\tfor (const [property, value] of entries(object)) {\n\t\tnewObject[property] = value;\n\t}\n\n\treturn newObject;\n}\n/* This method automatically checks if the prop is function\n * or getter and behaves accordingly. */\n\nfunction lookupGetter(object, prop) {\n\twhile (object !== null) {\n\t\tconst desc = getOwnPropertyDescriptor(object, prop);\n\n\t\tif (desc) {\n\t\t\tif (desc.get) {\n\t\t\t\treturn unapply(desc.get);\n\t\t\t}\n\n\t\t\tif (typeof desc.value === 'function') {\n\t\t\t\treturn unapply(desc.value);\n\t\t\t}\n\t\t}\n\n\t\tobject = getPrototypeOf(object);\n\t}\n\n\tfunction fallbackValue(element) {\n\t\tconsole.warn('fallback value for', element);\n\t\treturn null;\n\t}\n\n\treturn fallbackValue;\n}\n\nconst html$1 = freeze(['a', 'abbr', 'acronym', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'big', 'blink', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'content', 'data', 'datalist', 'dd', 'decorator', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'element', 'em', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meter', 'nav', 'nobr', 'ol', 'optgroup', 'option', 'output', 'p', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'section', 'select', 'shadow', 'small', 'source', 'spacer', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr']); // SVG\n\nconst svg$1 = freeze(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'circle', 'clippath', 'defs', 'desc', 'ellipse', 'filter', 'font', 'g', 'glyph', 'glyphref', 'hkern', 'image', 'line', 'lineargradient', 'marker', 'mask', 'metadata', 'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialgradient', 'rect', 'stop', 'style', 'switch', 'symbol', 'text', 'textpath', 'title', 'tref', 'tspan', 'view', 'vkern']);\nconst svgFilters = freeze(['feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feDropShadow', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence']); // List of SVG elements that are disallowed by default.\n// We still need to know them so that we can do namespace\n// checks properly in case one wants to add them to\n// allow-list.\n\nconst svgDisallowed = freeze(['animate', 'color-profile', 'cursor', 'discard', 'font-face', 'font-face-format', 'font-face-name', 'font-face-src', 'font-face-uri', 'foreignobject', 'hatch', 'hatchpath', 'mesh', 'meshgradient', 'meshpatch', 'meshrow', 'missing-glyph', 'script', 'set', 'solidcolor', 'unknown', 'use']);\nconst mathMl$1 = freeze(['math', 'menclose', 'merror', 'mfenced', 'mfrac', 'mglyph', 'mi', 'mlabeledtr', 'mmultiscripts', 'mn', 'mo', 'mover', 'mpadded', 'mphantom', 'mroot', 'mrow', 'ms', 'mspace', 'msqrt', 'mstyle', 'msub', 'msup', 'msubsup', 'mtable', 'mtd', 'mtext', 'mtr', 'munder', 'munderover', 'mprescripts']); // Similarly to SVG, we want to know all MathML elements,\n// even those that we disallow by default.\n\nconst mathMlDisallowed = freeze(['maction', 'maligngroup', 'malignmark', 'mlongdiv', 'mscarries', 'mscarry', 'msgroup', 'mstack', 'msline', 'msrow', 'semantics', 'annotation', 'annotation-xml', 'mprescripts', 'none']);\nconst text = freeze(['#text']);\n\nconst html = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'nonce', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'pattern', 'placeholder', 'playsinline', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'xmlns', 'slot']);\nconst svg = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'targetx', 'targety', 'transform', 'transform-origin', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']);\nconst mathMl = freeze(['accent', 'accentunder', 'align', 'bevelled', 'close', 'columnsalign', 'columnlines', 'columnspan', 'denomalign', 'depth', 'dir', 'display', 'displaystyle', 'encoding', 'fence', 'frame', 'height', 'href', 'id', 'largeop', 'length', 'linethickness', 'lspace', 'lquote', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant', 'maxsize', 'minsize', 'movablelimits', 'notation', 'numalign', 'open', 'rowalign', 'rowlines', 'rowspacing', 'rowspan', 'rspace', 'rquote', 'scriptlevel', 'scriptminsize', 'scriptsizemultiplier', 'selection', 'separator', 'separators', 'stretchy', 'subscriptshift', 'supscriptshift', 'symmetric', 'voffset', 'width', 'xmlns']);\nconst xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']);\n\nconst MUSTACHE_EXPR = seal(/\\{\\{[\\w\\W]*|[\\w\\W]*\\}\\}/gm); // Specify template detection regex for SAFE_FOR_TEMPLATES mode\n\nconst ERB_EXPR = seal(/<%[\\w\\W]*|[\\w\\W]*%>/gm);\nconst TMPLIT_EXPR = seal(/\\${[\\w\\W]*}/gm);\nconst DATA_ATTR = seal(/^data-[\\-\\w.\\u00B7-\\uFFFF]/); // eslint-disable-line no-useless-escape\n\nconst ARIA_ATTR = seal(/^aria-[\\-\\w]+$/); // eslint-disable-line no-useless-escape\n\nconst IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\\-]+(?:[^a-z+.\\-:]|$))/i // eslint-disable-line no-useless-escape\n);\nconst IS_SCRIPT_OR_DATA = seal(/^(?:\\w+script|data):/i);\nconst ATTR_WHITESPACE = seal(/[\\u0000-\\u0020\\u00A0\\u1680\\u180E\\u2000-\\u2029\\u205F\\u3000]/g // eslint-disable-line no-control-regex\n);\nconst DOCTYPE_NAME = seal(/^html$/i);\n\nvar EXPRESSIONS = /*#__PURE__*/Object.freeze({\n\t__proto__: null,\n\tMUSTACHE_EXPR: MUSTACHE_EXPR,\n\tERB_EXPR: ERB_EXPR,\n\tTMPLIT_EXPR: TMPLIT_EXPR,\n\tDATA_ATTR: DATA_ATTR,\n\tARIA_ATTR: ARIA_ATTR,\n\tIS_ALLOWED_URI: IS_ALLOWED_URI,\n\tIS_SCRIPT_OR_DATA: IS_SCRIPT_OR_DATA,\n\tATTR_WHITESPACE: ATTR_WHITESPACE,\n\tDOCTYPE_NAME: DOCTYPE_NAME\n});\n\nconst getGlobal = () => typeof window === 'undefined' ? null : window;\n/**\n * Creates a no-op policy for internal use only.\n * Don't export this function outside this module!\n * @param {?TrustedTypePolicyFactory} trustedTypes The policy factory.\n * @param {HTMLScriptElement} purifyHostElement The Script element used to load DOMPurify (to determine policy name suffix).\n * @return {?TrustedTypePolicy} The policy created (or null, if Trusted Types\n * are not supported or creating the policy failed).\n */\n\n\nconst _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, purifyHostElement) {\n\tif (typeof trustedTypes !== 'object' || typeof trustedTypes.createPolicy !== 'function') {\n\t\treturn null;\n\t} // Allow the callers to control the unique policy name\n\t// by adding a data-tt-policy-suffix to the script element with the DOMPurify.\n\t// Policy creation with duplicate names throws in Trusted Types.\n\n\n\tlet suffix = null;\n\tconst ATTR_NAME = 'data-tt-policy-suffix';\n\n\tif (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) {\n\t\tsuffix = purifyHostElement.getAttribute(ATTR_NAME);\n\t}\n\n\tconst policyName = 'dompurify' + (suffix ? '#' + suffix : '');\n\n\ttry {\n\t\treturn trustedTypes.createPolicy(policyName, {\n\t\t\tcreateHTML(html) {\n\t\t\t\treturn html;\n\t\t\t},\n\n\t\t\tcreateScriptURL(scriptUrl) {\n\t\t\t\treturn scriptUrl;\n\t\t\t}\n\n\t\t});\n\t} catch (_) {\n\t\t// Policy creation failed (most likely another DOMPurify script has\n\t\t// already run). Skip creating the policy, as this will only cause errors\n\t\t// if TT are enforced.\n\t\tconsole.warn('TrustedTypes policy ' + policyName + ' could not be created.');\n\t\treturn null;\n\t}\n};\n\nfunction createDOMPurify() {\n\tlet window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();\n\n\tconst DOMPurify = root => createDOMPurify(root);\n\t/**\n\t * Version label, exposed for easier checks\n\t * if DOMPurify is up to date or not\n\t */\n\n\n\tDOMPurify.version = '3.0.5';\n\t/**\n\t * Array of elements that DOMPurify removed during sanitation.\n\t * Empty if nothing was removed.\n\t */\n\n\tDOMPurify.removed = [];\n\n\tif (!window || !window.document || window.document.nodeType !== 9) {\n\t\t// Not running in a browser, provide a factory function\n\t\t// so that you can pass your own Window\n\t\tDOMPurify.isSupported = false;\n\t\treturn DOMPurify;\n\t}\n\n\tconst originalDocument = window.document;\n\tconst currentScript = originalDocument.currentScript;\n\tlet {\n\t\tdocument\n\t} = window;\n\tconst {\n\t\tDocumentFragment,\n\t\tHTMLTemplateElement,\n\t\tNode,\n\t\tElement,\n\t\tNodeFilter,\n\t\tNamedNodeMap = window.NamedNodeMap || window.MozNamedAttrMap,\n\t\tHTMLFormElement,\n\t\tDOMParser,\n\t\ttrustedTypes\n\t} = window;\n\tconst ElementPrototype = Element.prototype;\n\tconst cloneNode = lookupGetter(ElementPrototype, 'cloneNode');\n\tconst getNextSibling = lookupGetter(ElementPrototype, 'nextSibling');\n\tconst getChildNodes = lookupGetter(ElementPrototype, 'childNodes');\n\tconst getParentNode = lookupGetter(ElementPrototype, 'parentNode'); // As per issue #47, the web-components registry is inherited by a\n\t// new document created via createHTMLDocument. As per the spec\n\t// (http://w3c.github.io/webcomponents/spec/custom/#creating-and-passing-registries)\n\t// a new empty registry is used when creating a template contents owner\n\t// document, so we use that as our parent document to ensure nothing\n\t// is inherited.\n\n\tif (typeof HTMLTemplateElement === 'function') {\n\t\tconst template = document.createElement('template');\n\n\t\tif (template.content && template.content.ownerDocument) {\n\t\t\tdocument = template.content.ownerDocument;\n\t\t}\n\t}\n\n\tlet trustedTypesPolicy;\n\tlet emptyHTML = '';\n\tconst {\n\t\timplementation,\n\t\tcreateNodeIterator,\n\t\tcreateDocumentFragment,\n\t\tgetElementsByTagName\n\t} = document;\n\tconst {\n\t\timportNode\n\t} = originalDocument;\n\tlet hooks = {};\n\t/**\n\t * Expose whether this browser supports running the full DOMPurify.\n\t */\n\n\tDOMPurify.isSupported = typeof entries === 'function' && typeof getParentNode === 'function' && implementation && implementation.createHTMLDocument !== undefined;\n\tconst {\n\t\tMUSTACHE_EXPR,\n\t\tERB_EXPR,\n\t\tTMPLIT_EXPR,\n\t\tDATA_ATTR,\n\t\tARIA_ATTR,\n\t\tIS_SCRIPT_OR_DATA,\n\t\tATTR_WHITESPACE\n\t} = EXPRESSIONS;\n\tlet {\n\t\tIS_ALLOWED_URI: IS_ALLOWED_URI$1\n\t} = EXPRESSIONS;\n\t/**\n\t * We consider the elements and attributes below to be safe. Ideally\n\t * don't add any new ones but feel free to remove unwanted ones.\n\t */\n\n\t/* allowed element names */\n\n\tlet ALLOWED_TAGS = null;\n\tconst DEFAULT_ALLOWED_TAGS = addToSet({}, [...html$1, ...svg$1, ...svgFilters, ...mathMl$1, ...text]);\n\t/* Allowed attribute names */\n\n\tlet ALLOWED_ATTR = null;\n\tconst DEFAULT_ALLOWED_ATTR = addToSet({}, [...html, ...svg, ...mathMl, ...xml]);\n\t/*\n\t * Configure how DOMPUrify should handle custom elements and their attributes as well as customized built-in elements.\n\t * @property {RegExp|Function|null} tagNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any custom elements)\n\t * @property {RegExp|Function|null} attributeNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any attributes not on the allow list)\n\t * @property {boolean} allowCustomizedBuiltInElements allow custom elements derived from built-ins if they pass CUSTOM_ELEMENT_HANDLING.tagNameCheck. Default: `false`.\n\t */\n\n\tlet CUSTOM_ELEMENT_HANDLING = Object.seal(Object.create(null, {\n\t\ttagNameCheck: {\n\t\t\twritable: true,\n\t\t\tconfigurable: false,\n\t\t\tenumerable: true,\n\t\t\tvalue: null\n\t\t},\n\t\tattributeNameCheck: {\n\t\t\twritable: true,\n\t\t\tconfigurable: false,\n\t\t\tenumerable: true,\n\t\t\tvalue: null\n\t\t},\n\t\tallowCustomizedBuiltInElements: {\n\t\t\twritable: true,\n\t\t\tconfigurable: false,\n\t\t\tenumerable: true,\n\t\t\tvalue: false\n\t\t}\n\t}));\n\t/* Explicitly forbidden tags (overrides ALLOWED_TAGS/ADD_TAGS) */\n\n\tlet FORBID_TAGS = null;\n\t/* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */\n\n\tlet FORBID_ATTR = null;\n\t/* Decide if ARIA attributes are okay */\n\n\tlet ALLOW_ARIA_ATTR = true;\n\t/* Decide if custom data attributes are okay */\n\n\tlet ALLOW_DATA_ATTR = true;\n\t/* Decide if unknown protocols are okay */\n\n\tlet ALLOW_UNKNOWN_PROTOCOLS = false;\n\t/* Decide if self-closing tags in attributes are allowed.\n\t * Usually removed due to a mXSS issue in jQuery 3.0 */\n\n\tlet ALLOW_SELF_CLOSE_IN_ATTR = true;\n\t/* Output should be safe for common template engines.\n\t * This means, DOMPurify removes data attributes, mustaches and ERB\n\t */\n\n\tlet SAFE_FOR_TEMPLATES = false;\n\t/* Decide if document with ... should be returned */\n\n\tlet WHOLE_DOCUMENT = false;\n\t/* Track whether config is already set on this instance of DOMPurify. */\n\n\tlet SET_CONFIG = false;\n\t/* Decide if all elements (e.g. style, script) must be children of\n\t * document.body. By default, browsers might move them to document.head */\n\n\tlet FORCE_BODY = false;\n\t/* Decide if a DOM `HTMLBodyElement` should be returned, instead of a html\n\t * string (or a TrustedHTML object if Trusted Types are supported).\n\t * If `WHOLE_DOCUMENT` is enabled a `HTMLHtmlElement` will be returned instead\n\t */\n\n\tlet RETURN_DOM = false;\n\t/* Decide if a DOM `DocumentFragment` should be returned, instead of a html\n\t * string (or a TrustedHTML object if Trusted Types are supported) */\n\n\tlet RETURN_DOM_FRAGMENT = false;\n\t/* Try to return a Trusted Type object instead of a string, return a string in\n\t * case Trusted Types are not supported */\n\n\tlet RETURN_TRUSTED_TYPE = false;\n\t/* Output should be free from DOM clobbering attacks?\n\t * This sanitizes markups named with colliding, clobberable built-in DOM APIs.\n\t */\n\n\tlet SANITIZE_DOM = true;\n\t/* Achieve full DOM Clobbering protection by isolating the namespace of named\n\t * properties and JS variables, mitigating attacks that abuse the HTML/DOM spec rules.\n\t *\n\t * HTML/DOM spec rules that enable DOM Clobbering:\n\t * - Named Access on Window (\u00A77.3.3)\n\t * - DOM Tree Accessors (\u00A73.1.5)\n\t * - Form Element Parent-Child Relations (\u00A74.10.3)\n\t * - Iframe srcdoc / Nested WindowProxies (\u00A74.8.5)\n\t * - HTMLCollection (\u00A74.2.10.2)\n\t *\n\t * Namespace isolation is implemented by prefixing `id` and `name` attributes\n\t * with a constant string, i.e., `user-content-`\n\t */\n\n\tlet SANITIZE_NAMED_PROPS = false;\n\tconst SANITIZE_NAMED_PROPS_PREFIX = 'user-content-';\n\t/* Keep element content when removing element? */\n\n\tlet KEEP_CONTENT = true;\n\t/* If a `Node` is passed to sanitize(), then performs sanitization in-place instead\n\t * of importing it into a new Document and returning a sanitized copy */\n\n\tlet IN_PLACE = false;\n\t/* Allow usage of profiles like html, svg and mathMl */\n\n\tlet USE_PROFILES = {};\n\t/* Tags to ignore content of when KEEP_CONTENT is true */\n\n\tlet FORBID_CONTENTS = null;\n\tconst DEFAULT_FORBID_CONTENTS = addToSet({}, ['annotation-xml', 'audio', 'colgroup', 'desc', 'foreignobject', 'head', 'iframe', 'math', 'mi', 'mn', 'mo', 'ms', 'mtext', 'noembed', 'noframes', 'noscript', 'plaintext', 'script', 'style', 'svg', 'template', 'thead', 'title', 'video', 'xmp']);\n\t/* Tags that are safe for data: URIs */\n\n\tlet DATA_URI_TAGS = null;\n\tconst DEFAULT_DATA_URI_TAGS = addToSet({}, ['audio', 'video', 'img', 'source', 'image', 'track']);\n\t/* Attributes safe for values like \"javascript:\" */\n\n\tlet URI_SAFE_ATTRIBUTES = null;\n\tconst DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ['alt', 'class', 'for', 'id', 'label', 'name', 'pattern', 'placeholder', 'role', 'summary', 'title', 'value', 'style', 'xmlns']);\n\tconst MATHML_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';\n\tconst SVG_NAMESPACE = 'http://www.w3.org/2000/svg';\n\tconst HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';\n\t/* Document namespace */\n\n\tlet NAMESPACE = HTML_NAMESPACE;\n\tlet IS_EMPTY_INPUT = false;\n\t/* Allowed XHTML+XML namespaces */\n\n\tlet ALLOWED_NAMESPACES = null;\n\tconst DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString);\n\t/* Parsing of strict XHTML documents */\n\n\tlet PARSER_MEDIA_TYPE;\n\tconst SUPPORTED_PARSER_MEDIA_TYPES = ['application/xhtml+xml', 'text/html'];\n\tconst DEFAULT_PARSER_MEDIA_TYPE = 'text/html';\n\tlet transformCaseFunc;\n\t/* Keep a reference to config to pass to hooks */\n\n\tlet CONFIG = null;\n\t/* Ideally, do not touch anything below this line */\n\n\t/* ______________________________________________ */\n\n\tconst formElement = document.createElement('form');\n\n\tconst isRegexOrFunction = function isRegexOrFunction(testValue) {\n\t\treturn testValue instanceof RegExp || testValue instanceof Function;\n\t};\n\t/**\n\t * _parseConfig\n\t *\n\t * @param {Object} cfg optional config literal\n\t */\n\t// eslint-disable-next-line complexity\n\n\n\tconst _parseConfig = function _parseConfig(cfg) {\n\t\tif (CONFIG && CONFIG === cfg) {\n\t\t\treturn;\n\t\t}\n\t\t/* Shield configuration object from tampering */\n\n\n\t\tif (!cfg || typeof cfg !== 'object') {\n\t\t\tcfg = {};\n\t\t}\n\t\t/* Shield configuration object from prototype pollution */\n\n\n\t\tcfg = clone(cfg);\n\t\tPARSER_MEDIA_TYPE = // eslint-disable-next-line unicorn/prefer-includes\n\t\t\tSUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? PARSER_MEDIA_TYPE = DEFAULT_PARSER_MEDIA_TYPE : PARSER_MEDIA_TYPE = cfg.PARSER_MEDIA_TYPE; // HTML tags and attributes are not case-sensitive, converting to lowercase. Keeping XHTML as is.\n\n\t\ttransformCaseFunc = PARSER_MEDIA_TYPE === 'application/xhtml+xml' ? stringToString : stringToLowerCase;\n\t\t/* Set configuration parameters */\n\n\t\tALLOWED_TAGS = 'ALLOWED_TAGS' in cfg ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;\n\t\tALLOWED_ATTR = 'ALLOWED_ATTR' in cfg ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;\n\t\tALLOWED_NAMESPACES = 'ALLOWED_NAMESPACES' in cfg ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;\n\t\tURI_SAFE_ATTRIBUTES = 'ADD_URI_SAFE_ATTR' in cfg ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), // eslint-disable-line indent\n\t\t\tcfg.ADD_URI_SAFE_ATTR, // eslint-disable-line indent\n\t\t\ttransformCaseFunc // eslint-disable-line indent\n\t\t) // eslint-disable-line indent\n\t\t\t: DEFAULT_URI_SAFE_ATTRIBUTES;\n\t\tDATA_URI_TAGS = 'ADD_DATA_URI_TAGS' in cfg ? addToSet(clone(DEFAULT_DATA_URI_TAGS), // eslint-disable-line indent\n\t\t\tcfg.ADD_DATA_URI_TAGS, // eslint-disable-line indent\n\t\t\ttransformCaseFunc // eslint-disable-line indent\n\t\t) // eslint-disable-line indent\n\t\t\t: DEFAULT_DATA_URI_TAGS;\n\t\tFORBID_CONTENTS = 'FORBID_CONTENTS' in cfg ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;\n\t\tFORBID_TAGS = 'FORBID_TAGS' in cfg ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : {};\n\t\tFORBID_ATTR = 'FORBID_ATTR' in cfg ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : {};\n\t\tUSE_PROFILES = 'USE_PROFILES' in cfg ? cfg.USE_PROFILES : false;\n\t\tALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; // Default true\n\n\t\tALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; // Default true\n\n\t\tALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; // Default false\n\n\t\tALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false; // Default true\n\n\t\tSAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false; // Default false\n\n\t\tWHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false; // Default false\n\n\t\tRETURN_DOM = cfg.RETURN_DOM || false; // Default false\n\n\t\tRETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false; // Default false\n\n\t\tRETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false; // Default false\n\n\t\tFORCE_BODY = cfg.FORCE_BODY || false; // Default false\n\n\t\tSANITIZE_DOM = cfg.SANITIZE_DOM !== false; // Default true\n\n\t\tSANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false; // Default false\n\n\t\tKEEP_CONTENT = cfg.KEEP_CONTENT !== false; // Default true\n\n\t\tIN_PLACE = cfg.IN_PLACE || false; // Default false\n\n\t\tIS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI;\n\t\tNAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE;\n\t\tCUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING || {};\n\n\t\tif (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) {\n\t\t\tCUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck;\n\t\t}\n\n\t\tif (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)) {\n\t\t\tCUSTOM_ELEMENT_HANDLING.attributeNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck;\n\t\t}\n\n\t\tif (cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements === 'boolean') {\n\t\t\tCUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements;\n\t\t}\n\n\t\tif (SAFE_FOR_TEMPLATES) {\n\t\t\tALLOW_DATA_ATTR = false;\n\t\t}\n\n\t\tif (RETURN_DOM_FRAGMENT) {\n\t\t\tRETURN_DOM = true;\n\t\t}\n\t\t/* Parse profile info */\n\n\n\t\tif (USE_PROFILES) {\n\t\t\tALLOWED_TAGS = addToSet({}, [...text]);\n\t\t\tALLOWED_ATTR = [];\n\n\t\t\tif (USE_PROFILES.html === true) {\n\t\t\t\taddToSet(ALLOWED_TAGS, html$1);\n\t\t\t\taddToSet(ALLOWED_ATTR, html);\n\t\t\t}\n\n\t\t\tif (USE_PROFILES.svg === true) {\n\t\t\t\taddToSet(ALLOWED_TAGS, svg$1);\n\t\t\t\taddToSet(ALLOWED_ATTR, svg);\n\t\t\t\taddToSet(ALLOWED_ATTR, xml);\n\t\t\t}\n\n\t\t\tif (USE_PROFILES.svgFilters === true) {\n\t\t\t\taddToSet(ALLOWED_TAGS, svgFilters);\n\t\t\t\taddToSet(ALLOWED_ATTR, svg);\n\t\t\t\taddToSet(ALLOWED_ATTR, xml);\n\t\t\t}\n\n\t\t\tif (USE_PROFILES.mathMl === true) {\n\t\t\t\taddToSet(ALLOWED_TAGS, mathMl$1);\n\t\t\t\taddToSet(ALLOWED_ATTR, mathMl);\n\t\t\t\taddToSet(ALLOWED_ATTR, xml);\n\t\t\t}\n\t\t}\n\t\t/* Merge configuration parameters */\n\n\n\t\tif (cfg.ADD_TAGS) {\n\t\t\tif (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {\n\t\t\t\tALLOWED_TAGS = clone(ALLOWED_TAGS);\n\t\t\t}\n\n\t\t\taddToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);\n\t\t}\n\n\t\tif (cfg.ADD_ATTR) {\n\t\t\tif (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {\n\t\t\t\tALLOWED_ATTR = clone(ALLOWED_ATTR);\n\t\t\t}\n\n\t\t\taddToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);\n\t\t}\n\n\t\tif (cfg.ADD_URI_SAFE_ATTR) {\n\t\t\taddToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);\n\t\t}\n\n\t\tif (cfg.FORBID_CONTENTS) {\n\t\t\tif (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {\n\t\t\t\tFORBID_CONTENTS = clone(FORBID_CONTENTS);\n\t\t\t}\n\n\t\t\taddToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);\n\t\t}\n\t\t/* Add #text in case KEEP_CONTENT is set to true */\n\n\n\t\tif (KEEP_CONTENT) {\n\t\t\tALLOWED_TAGS['#text'] = true;\n\t\t}\n\t\t/* Add html, head and body to ALLOWED_TAGS in case WHOLE_DOCUMENT is true */\n\n\n\t\tif (WHOLE_DOCUMENT) {\n\t\t\taddToSet(ALLOWED_TAGS, ['html', 'head', 'body']);\n\t\t}\n\t\t/* Add tbody to ALLOWED_TAGS in case tables are permitted, see #286, #365 */\n\n\n\t\tif (ALLOWED_TAGS.table) {\n\t\t\taddToSet(ALLOWED_TAGS, ['tbody']);\n\t\t\tdelete FORBID_TAGS.tbody;\n\t\t}\n\n\t\tif (cfg.TRUSTED_TYPES_POLICY) {\n\t\t\tif (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== 'function') {\n\t\t\t\tthrow typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a \"createHTML\" hook.');\n\t\t\t}\n\n\t\t\tif (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== 'function') {\n\t\t\t\tthrow typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a \"createScriptURL\" hook.');\n\t\t\t} // Overwrite existing TrustedTypes policy.\n\n\n\t\t\ttrustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY; // Sign local variables required by `sanitize`.\n\n\t\t\temptyHTML = trustedTypesPolicy.createHTML('');\n\t\t} else {\n\t\t\t// Uninitialized policy, attempt to initialize the internal dompurify policy.\n\t\t\tif (trustedTypesPolicy === undefined) {\n\t\t\t\ttrustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);\n\t\t\t} // If creating the internal policy succeeded sign internal variables.\n\n\n\t\t\tif (trustedTypesPolicy !== null && typeof emptyHTML === 'string') {\n\t\t\t\temptyHTML = trustedTypesPolicy.createHTML('');\n\t\t\t}\n\t\t} // Prevent further manipulation of configuration.\n\t\t// Not available in IE8, Safari 5, etc.\n\n\n\t\tif (freeze) {\n\t\t\tfreeze(cfg);\n\t\t}\n\n\t\tCONFIG = cfg;\n\t};\n\n\tconst MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ['mi', 'mo', 'mn', 'ms', 'mtext']);\n\tconst HTML_INTEGRATION_POINTS = addToSet({}, ['foreignobject', 'desc', 'title', 'annotation-xml']); // Certain elements are allowed in both SVG and HTML\n\t// namespace. We need to specify them explicitly\n\t// so that they don't get erroneously deleted from\n\t// HTML namespace.\n\n\tconst COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ['title', 'style', 'font', 'a', 'script']);\n\t/* Keep track of all possible SVG and MathML tags\n\t * so that we can perform the namespace checks\n\t * correctly. */\n\n\tconst ALL_SVG_TAGS = addToSet({}, svg$1);\n\taddToSet(ALL_SVG_TAGS, svgFilters);\n\taddToSet(ALL_SVG_TAGS, svgDisallowed);\n\tconst ALL_MATHML_TAGS = addToSet({}, mathMl$1);\n\taddToSet(ALL_MATHML_TAGS, mathMlDisallowed);\n\t/**\n\t *\n\t *\n\t * @param {Element} element a DOM element whose namespace is being checked\n\t * @returns {boolean} Return false if the element has a\n\t * namespace that a spec-compliant parser would never\n\t * return. Return true otherwise.\n\t */\n\n\tconst _checkValidNamespace = function _checkValidNamespace(element) {\n\t\tlet parent = getParentNode(element); // In JSDOM, if we're inside shadow DOM, then parentNode\n\t\t// can be null. We just simulate parent in this case.\n\n\t\tif (!parent || !parent.tagName) {\n\t\t\tparent = {\n\t\t\t\tnamespaceURI: NAMESPACE,\n\t\t\t\ttagName: 'template'\n\t\t\t};\n\t\t}\n\n\t\tconst tagName = stringToLowerCase(element.tagName);\n\t\tconst parentTagName = stringToLowerCase(parent.tagName);\n\n\t\tif (!ALLOWED_NAMESPACES[element.namespaceURI]) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (element.namespaceURI === SVG_NAMESPACE) {\n\t\t\t// The only way to switch from HTML namespace to SVG\n\t\t\t// is via . If it happens via any other tag, then\n\t\t\t// it should be killed.\n\t\t\tif (parent.namespaceURI === HTML_NAMESPACE) {\n\t\t\t\treturn tagName === 'svg';\n\t\t\t} // The only way to switch from MathML to SVG is via`\n\t\t\t// svg if parent is either or MathML\n\t\t\t// text integration points.\n\n\n\t\t\tif (parent.namespaceURI === MATHML_NAMESPACE) {\n\t\t\t\treturn tagName === 'svg' && (parentTagName === 'annotation-xml' || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);\n\t\t\t} // We only allow elements that are defined in SVG\n\t\t\t// spec. All others are disallowed in SVG namespace.\n\n\n\t\t\treturn Boolean(ALL_SVG_TAGS[tagName]);\n\t\t}\n\n\t\tif (element.namespaceURI === MATHML_NAMESPACE) {\n\t\t\t// The only way to switch from HTML namespace to MathML\n\t\t\t// is via . If it happens via any other tag, then\n\t\t\t// it should be killed.\n\t\t\tif (parent.namespaceURI === HTML_NAMESPACE) {\n\t\t\t\treturn tagName === 'math';\n\t\t\t} // The only way to switch from SVG to MathML is via\n\t\t\t// and HTML integration points\n\n\n\t\t\tif (parent.namespaceURI === SVG_NAMESPACE) {\n\t\t\t\treturn tagName === 'math' && HTML_INTEGRATION_POINTS[parentTagName];\n\t\t\t} // We only allow elements that are defined in MathML\n\t\t\t// spec. All others are disallowed in MathML namespace.\n\n\n\t\t\treturn Boolean(ALL_MATHML_TAGS[tagName]);\n\t\t}\n\n\t\tif (element.namespaceURI === HTML_NAMESPACE) {\n\t\t\t// The only way to switch from SVG to HTML is via\n\t\t\t// HTML integration points, and from MathML to HTML\n\t\t\t// is via MathML text integration points\n\t\t\tif (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {\n\t\t\t\treturn false;\n\t\t\t} // We disallow tags that are specific for MathML\n\t\t\t// or SVG and should never appear in HTML namespace\n\n\n\t\t\treturn !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);\n\t\t} // For XHTML and XML documents that support custom namespaces\n\n\n\t\tif (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && ALLOWED_NAMESPACES[element.namespaceURI]) {\n\t\t\treturn true;\n\t\t} // The code should never reach this place (this means\n\t\t// that the element somehow got namespace that is not\n\t\t// HTML, SVG, MathML or allowed via ALLOWED_NAMESPACES).\n\t\t// Return false just in case.\n\n\n\t\treturn false;\n\t};\n\t/**\n\t * _forceRemove\n\t *\n\t * @param {Node} node a DOM node\n\t */\n\n\n\tconst _forceRemove = function _forceRemove(node) {\n\t\tarrayPush(DOMPurify.removed, {\n\t\t\telement: node\n\t\t});\n\n\t\ttry {\n\t\t\t// eslint-disable-next-line unicorn/prefer-dom-node-remove\n\t\t\tnode.parentNode.removeChild(node);\n\t\t} catch (_) {\n\t\t\tnode.remove();\n\t\t}\n\t};\n\t/**\n\t * _removeAttribute\n\t *\n\t * @param {String} name an Attribute name\n\t * @param {Node} node a DOM node\n\t */\n\n\n\tconst _removeAttribute = function _removeAttribute(name, node) {\n\t\ttry {\n\t\t\tarrayPush(DOMPurify.removed, {\n\t\t\t\tattribute: node.getAttributeNode(name),\n\t\t\t\tfrom: node\n\t\t\t});\n\t\t} catch (_) {\n\t\t\tarrayPush(DOMPurify.removed, {\n\t\t\t\tattribute: null,\n\t\t\t\tfrom: node\n\t\t\t});\n\t\t}\n\n\t\tnode.removeAttribute(name); // We void attribute values for unremovable \"is\"\" attributes\n\n\t\tif (name === 'is' && !ALLOWED_ATTR[name]) {\n\t\t\tif (RETURN_DOM || RETURN_DOM_FRAGMENT) {\n\t\t\t\ttry {\n\t\t\t\t\t_forceRemove(node);\n\t\t\t\t} catch (_) { }\n\t\t\t} else {\n\t\t\t\ttry {\n\t\t\t\t\tnode.setAttribute(name, '');\n\t\t\t\t} catch (_) { }\n\t\t\t}\n\t\t}\n\t};\n\t/**\n\t * _initDocument\n\t *\n\t * @param {String} dirty a string of dirty markup\n\t * @return {Document} a DOM, filled with the dirty markup\n\t */\n\n\n\tconst _initDocument = function _initDocument(dirty) {\n\t\t/* Create a HTML document */\n\t\tlet doc;\n\t\tlet leadingWhitespace;\n\n\t\tif (FORCE_BODY) {\n\t\t\tdirty = '' + dirty;\n\t\t} else {\n\t\t\t/* If FORCE_BODY isn't used, leading whitespace needs to be preserved manually */\n\t\t\tconst matches = stringMatch(dirty, /^[\\r\\n\\t ]+/);\n\t\t\tleadingWhitespace = matches && matches[0];\n\t\t}\n\n\t\tif (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && NAMESPACE === HTML_NAMESPACE) {\n\t\t\t// Root of XHTML doc must contain xmlns declaration (see https://www.w3.org/TR/xhtml1/normative.html#strict)\n\t\t\tdirty = '' + dirty + '';\n\t\t}\n\n\t\tconst dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;\n\t\t/*\n\t\t * Use the DOMParser API by default, fallback later if needs be\n\t\t * DOMParser not work for svg when has multiple root element.\n\t\t */\n\n\t\tif (NAMESPACE === HTML_NAMESPACE) {\n\t\t\ttry {\n\t\t\t\tdoc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);\n\t\t\t} catch (_) { }\n\t\t}\n\t\t/* Use createHTMLDocument in case DOMParser is not available */\n\n\n\t\tif (!doc || !doc.documentElement) {\n\t\t\tdoc = implementation.createDocument(NAMESPACE, 'template', null);\n\n\t\t\ttry {\n\t\t\t\tdoc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload;\n\t\t\t} catch (_) {// Syntax error if dirtyPayload is invalid xml\n\t\t\t}\n\t\t}\n\n\t\tconst body = doc.body || doc.documentElement;\n\n\t\tif (dirty && leadingWhitespace) {\n\t\t\tbody.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null);\n\t\t}\n\t\t/* Work on whole document or just its body */\n\n\n\t\tif (NAMESPACE === HTML_NAMESPACE) {\n\t\t\treturn getElementsByTagName.call(doc, WHOLE_DOCUMENT ? 'html' : 'body')[0];\n\t\t}\n\n\t\treturn WHOLE_DOCUMENT ? doc.documentElement : body;\n\t};\n\t/**\n\t * _createIterator\n\t *\n\t * @param {Document} root document/fragment to create iterator for\n\t * @return {Iterator} iterator instance\n\t */\n\n\n\tconst _createIterator = function _createIterator(root) {\n\t\treturn createNodeIterator.call(root.ownerDocument || root, root, // eslint-disable-next-line no-bitwise\n\t\t\tNodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT, null, false);\n\t};\n\t/**\n\t * _isClobbered\n\t *\n\t * @param {Node} elm element to check for clobbering attacks\n\t * @return {Boolean} true if clobbered, false if safe\n\t */\n\n\n\tconst _isClobbered = function _isClobbered(elm) {\n\t\treturn elm instanceof HTMLFormElement && (typeof elm.nodeName !== 'string' || typeof elm.textContent !== 'string' || typeof elm.removeChild !== 'function' || !(elm.attributes instanceof NamedNodeMap) || typeof elm.removeAttribute !== 'function' || typeof elm.setAttribute !== 'function' || typeof elm.namespaceURI !== 'string' || typeof elm.insertBefore !== 'function' || typeof elm.hasChildNodes !== 'function');\n\t};\n\t/**\n\t * _isNode\n\t *\n\t * @param {Node} obj object to check whether it's a DOM node\n\t * @return {Boolean} true is object is a DOM node\n\t */\n\n\n\tconst _isNode = function _isNode(object) {\n\t\treturn typeof Node === 'object' ? object instanceof Node : object && typeof object === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string';\n\t};\n\t/**\n\t * _executeHook\n\t * Execute user configurable hooks\n\t *\n\t * @param {String} entryPoint Name of the hook's entry point\n\t * @param {Node} currentNode node to work on with the hook\n\t * @param {Object} data additional hook parameters\n\t */\n\n\n\tconst _executeHook = function _executeHook(entryPoint, currentNode, data) {\n\t\tif (!hooks[entryPoint]) {\n\t\t\treturn;\n\t\t}\n\n\t\tarrayForEach(hooks[entryPoint], hook => {\n\t\t\thook.call(DOMPurify, currentNode, data, CONFIG);\n\t\t});\n\t};\n\t/**\n\t * _sanitizeElements\n\t *\n\t * @protect nodeName\n\t * @protect textContent\n\t * @protect removeChild\n\t *\n\t * @param {Node} currentNode to check for permission to exist\n\t * @return {Boolean} true if node was killed, false if left alive\n\t */\n\n\n\tconst _sanitizeElements = function _sanitizeElements(currentNode) {\n\t\tlet content;\n\t\t/* Execute a hook if present */\n\n\t\t_executeHook('beforeSanitizeElements', currentNode, null);\n\t\t/* Check if element is clobbered or can clobber */\n\n\n\t\tif (_isClobbered(currentNode)) {\n\t\t\t_forceRemove(currentNode);\n\n\t\t\treturn true;\n\t\t}\n\t\t/* Now let's check the element's type and name */\n\n\n\t\tconst tagName = transformCaseFunc(currentNode.nodeName);\n\t\t/* Execute a hook if present */\n\n\t\t_executeHook('uponSanitizeElement', currentNode, {\n\t\t\ttagName,\n\t\t\tallowedTags: ALLOWED_TAGS\n\t\t});\n\t\t/* Detect mXSS attempts abusing namespace confusion */\n\n\n\t\tif (currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && (!_isNode(currentNode.content) || !_isNode(currentNode.content.firstElementChild)) && regExpTest(/<[/\\w]/g, currentNode.innerHTML) && regExpTest(/<[/\\w]/g, currentNode.textContent)) {\n\t\t\t_forceRemove(currentNode);\n\n\t\t\treturn true;\n\t\t}\n\t\t/* Remove element if anything forbids its presence */\n\n\n\t\tif (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {\n\t\t\t/* Check if we have a custom element to handle */\n\t\t\tif (!FORBID_TAGS[tagName] && _basicCustomElementTest(tagName)) {\n\t\t\t\tif (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) return false;\n\t\t\t\tif (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) return false;\n\t\t\t}\n\t\t\t/* Keep content except for bad-listed elements */\n\n\n\t\t\tif (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {\n\t\t\t\tconst parentNode = getParentNode(currentNode) || currentNode.parentNode;\n\t\t\t\tconst childNodes = getChildNodes(currentNode) || currentNode.childNodes;\n\n\t\t\t\tif (childNodes && parentNode) {\n\t\t\t\t\tconst childCount = childNodes.length;\n\n\t\t\t\t\tfor (let i = childCount - 1; i >= 0; --i) {\n\t\t\t\t\t\tparentNode.insertBefore(cloneNode(childNodes[i], true), getNextSibling(currentNode));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t_forceRemove(currentNode);\n\n\t\t\treturn true;\n\t\t}\n\t\t/* Check whether element has a valid namespace */\n\n\n\t\tif (currentNode instanceof Element && !_checkValidNamespace(currentNode)) {\n\t\t\t_forceRemove(currentNode);\n\n\t\t\treturn true;\n\t\t}\n\t\t/* Make sure that older browsers don't get fallback-tag mXSS */\n\n\n\t\tif ((tagName === 'noscript' || tagName === 'noembed' || tagName === 'noframes') && regExpTest(/<\\/no(script|embed|frames)/i, currentNode.innerHTML)) {\n\t\t\t_forceRemove(currentNode);\n\n\t\t\treturn true;\n\t\t}\n\t\t/* Sanitize element content to be template-safe */\n\n\n\t\tif (SAFE_FOR_TEMPLATES && currentNode.nodeType === 3) {\n\t\t\t/* Get the element's text content */\n\t\t\tcontent = currentNode.textContent;\n\t\t\tcontent = stringReplace(content, MUSTACHE_EXPR, ' ');\n\t\t\tcontent = stringReplace(content, ERB_EXPR, ' ');\n\t\t\tcontent = stringReplace(content, TMPLIT_EXPR, ' ');\n\n\t\t\tif (currentNode.textContent !== content) {\n\t\t\t\tarrayPush(DOMPurify.removed, {\n\t\t\t\t\telement: currentNode.cloneNode()\n\t\t\t\t});\n\t\t\t\tcurrentNode.textContent = content;\n\t\t\t}\n\t\t}\n\t\t/* Execute a hook if present */\n\n\n\t\t_executeHook('afterSanitizeElements', currentNode, null);\n\n\t\treturn false;\n\t};\n\t/**\n\t * _isValidAttribute\n\t *\n\t * @param {string} lcTag Lowercase tag name of containing element.\n\t * @param {string} lcName Lowercase attribute name.\n\t * @param {string} value Attribute value.\n\t * @return {Boolean} Returns true if `value` is valid, otherwise false.\n\t */\n\t// eslint-disable-next-line complexity\n\n\n\tconst _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {\n\t\t/* Make sure attribute cannot clobber */\n\t\tif (SANITIZE_DOM && (lcName === 'id' || lcName === 'name') && (value in document || value in formElement)) {\n\t\t\treturn false;\n\t\t}\n\t\t/* Allow valid data-* attributes: At least one character after \"-\"\n\t\t\t\t(https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes)\n\t\t\t\tXML-compatible (https://html.spec.whatwg.org/multipage/infrastructure.html#xml-compatible and http://www.w3.org/TR/xml/#d0e804)\n\t\t\t\tWe don't need to check the value; it's always URI safe. */\n\n\n\t\tif (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR, lcName)); else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR, lcName)); else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {\n\t\t\tif ( // First condition does a very basic check if a) it's basically a valid custom element tagname AND\n\t\t\t\t// b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck\n\t\t\t\t// and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck\n\t\t\t\t_basicCustomElementTest(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName)) || // Alternative, second condition checks if it's an `is`-attribute, AND\n\t\t\t\t// the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck\n\t\t\t\tlcName === 'is' && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(value))); else {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t/* Check value is safe. First, is attr inert? If so, is safe */\n\n\t\t} else if (URI_SAFE_ATTRIBUTES[lcName]); else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE, ''))); else if ((lcName === 'src' || lcName === 'xlink:href' || lcName === 'href') && lcTag !== 'script' && stringIndexOf(value, 'data:') === 0 && DATA_URI_TAGS[lcTag]); else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA, stringReplace(value, ATTR_WHITESPACE, ''))); else if (value) {\n\t\t\treturn false;\n\t\t} else;\n\n\t\treturn true;\n\t};\n\t/**\n\t * _basicCustomElementCheck\n\t * checks if at least one dash is included in tagName, and it's not the first char\n\t * for more sophisticated checking see https://github.com/sindresorhus/validate-element-name\n\t * @param {string} tagName name of the tag of the node to sanitize\n\t */\n\n\n\tconst _basicCustomElementTest = function _basicCustomElementTest(tagName) {\n\t\treturn tagName.indexOf('-') > 0;\n\t};\n\t/**\n\t * _sanitizeAttributes\n\t *\n\t * @protect attributes\n\t * @protect nodeName\n\t * @protect removeAttribute\n\t * @protect setAttribute\n\t *\n\t * @param {Node} currentNode to sanitize\n\t */\n\n\n\tconst _sanitizeAttributes = function _sanitizeAttributes(currentNode) {\n\t\tlet attr;\n\t\tlet value;\n\t\tlet lcName;\n\t\tlet l;\n\t\t/* Execute a hook if present */\n\n\t\t_executeHook('beforeSanitizeAttributes', currentNode, null);\n\n\t\tconst {\n\t\t\tattributes\n\t\t} = currentNode;\n\t\t/* Check if we have attributes; if not we might have a text node */\n\n\t\tif (!attributes) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst hookEvent = {\n\t\t\tattrName: '',\n\t\t\tattrValue: '',\n\t\t\tkeepAttr: true,\n\t\t\tallowedAttributes: ALLOWED_ATTR\n\t\t};\n\t\tl = attributes.length;\n\t\t/* Go backwards over all attributes; safely remove bad ones */\n\n\t\twhile (l--) {\n\t\t\tattr = attributes[l];\n\t\t\tconst {\n\t\t\t\tname,\n\t\t\t\tnamespaceURI\n\t\t\t} = attr;\n\t\t\tvalue = name === 'value' ? attr.value : stringTrim(attr.value);\n\t\t\tlcName = transformCaseFunc(name);\n\t\t\t/* Execute a hook if present */\n\n\t\t\thookEvent.attrName = lcName;\n\t\t\thookEvent.attrValue = value;\n\t\t\thookEvent.keepAttr = true;\n\t\t\thookEvent.forceKeepAttr = undefined; // Allows developers to see this is a property they can set\n\n\t\t\t_executeHook('uponSanitizeAttribute', currentNode, hookEvent);\n\n\t\t\tvalue = hookEvent.attrValue;\n\t\t\t/* Did the hooks approve of the attribute? */\n\n\t\t\tif (hookEvent.forceKeepAttr) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t/* Remove attribute */\n\n\n\t\t\t_removeAttribute(name, currentNode);\n\t\t\t/* Did the hooks approve of the attribute? */\n\n\n\t\t\tif (!hookEvent.keepAttr) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t/* Work around a security issue in jQuery 3.0 */\n\n\n\t\t\tif (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\\/>/i, value)) {\n\t\t\t\t_removeAttribute(name, currentNode);\n\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t/* Sanitize attribute content to be template-safe */\n\n\n\t\t\tif (SAFE_FOR_TEMPLATES) {\n\t\t\t\tvalue = stringReplace(value, MUSTACHE_EXPR, ' ');\n\t\t\t\tvalue = stringReplace(value, ERB_EXPR, ' ');\n\t\t\t\tvalue = stringReplace(value, TMPLIT_EXPR, ' ');\n\t\t\t}\n\t\t\t/* Is `value` valid for this attribute? */\n\n\n\t\t\tconst lcTag = transformCaseFunc(currentNode.nodeName);\n\n\t\t\tif (!_isValidAttribute(lcTag, lcName, value)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t/* Full DOM Clobbering protection via namespace isolation,\n\t\t\t * Prefix id and name attributes with `user-content-`\n\t\t\t */\n\n\n\t\t\tif (SANITIZE_NAMED_PROPS && (lcName === 'id' || lcName === 'name')) {\n\t\t\t\t// Remove the attribute with this value\n\t\t\t\t_removeAttribute(name, currentNode); // Prefix the value and later re-create the attribute with the sanitized value\n\n\n\t\t\t\tvalue = SANITIZE_NAMED_PROPS_PREFIX + value;\n\t\t\t}\n\t\t\t/* Handle attributes that require Trusted Types */\n\n\n\t\t\tif (trustedTypesPolicy && typeof trustedTypes === 'object' && typeof trustedTypes.getAttributeType === 'function') {\n\t\t\t\tif (namespaceURI); else {\n\t\t\t\t\tswitch (trustedTypes.getAttributeType(lcTag, lcName)) {\n\t\t\t\t\t\tcase 'TrustedHTML':\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tvalue = trustedTypesPolicy.createHTML(value);\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\tcase 'TrustedScriptURL':\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tvalue = trustedTypesPolicy.createScriptURL(value);\n\t\t\t\t\t\t\t\tbreak;\n\t\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/* Handle invalid data-* attribute set by try-catching it */\n\n\n\t\t\ttry {\n\t\t\t\tif (namespaceURI) {\n\t\t\t\t\tcurrentNode.setAttributeNS(namespaceURI, name, value);\n\t\t\t\t} else {\n\t\t\t\t\t/* Fallback to setAttribute() for browser-unrecognized namespaces e.g. \"x-schema\". */\n\t\t\t\t\tcurrentNode.setAttribute(name, value);\n\t\t\t\t}\n\n\t\t\t\tarrayPop(DOMPurify.removed);\n\t\t\t} catch (_) { }\n\t\t}\n\t\t/* Execute a hook if present */\n\n\n\t\t_executeHook('afterSanitizeAttributes', currentNode, null);\n\t};\n\t/**\n\t * _sanitizeShadowDOM\n\t *\n\t * @param {DocumentFragment} fragment to iterate over recursively\n\t */\n\n\n\tconst _sanitizeShadowDOM = function _sanitizeShadowDOM(fragment) {\n\t\tlet shadowNode;\n\n\t\tconst shadowIterator = _createIterator(fragment);\n\t\t/* Execute a hook if present */\n\n\n\t\t_executeHook('beforeSanitizeShadowDOM', fragment, null);\n\n\t\twhile (shadowNode = shadowIterator.nextNode()) {\n\t\t\t/* Execute a hook if present */\n\t\t\t_executeHook('uponSanitizeShadowNode', shadowNode, null);\n\t\t\t/* Sanitize tags and elements */\n\n\n\t\t\tif (_sanitizeElements(shadowNode)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t/* Deep shadow DOM detected */\n\n\n\t\t\tif (shadowNode.content instanceof DocumentFragment) {\n\t\t\t\t_sanitizeShadowDOM(shadowNode.content);\n\t\t\t}\n\t\t\t/* Check attributes, sanitize if necessary */\n\n\n\t\t\t_sanitizeAttributes(shadowNode);\n\t\t}\n\t\t/* Execute a hook if present */\n\n\n\t\t_executeHook('afterSanitizeShadowDOM', fragment, null);\n\t};\n\t/**\n\t * Sanitize\n\t * Public method providing core sanitation functionality\n\t *\n\t * @param {String|Node} dirty string or DOM node\n\t * @param {Object} configuration object\n\t */\n\t// eslint-disable-next-line complexity\n\n\n\tDOMPurify.sanitize = function (dirty) {\n\t\tlet cfg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\t\tlet body;\n\t\tlet importedNode;\n\t\tlet currentNode;\n\t\tlet returnNode;\n\t\t/* Make sure we have a string to sanitize.\n\t\t\tDO NOT return early, as this will return the wrong type if\n\t\t\tthe user has requested a DOM object rather than a string */\n\n\t\tIS_EMPTY_INPUT = !dirty;\n\n\t\tif (IS_EMPTY_INPUT) {\n\t\t\tdirty = '';\n\t\t}\n\t\t/* Stringify, in case dirty is an object */\n\n\n\t\tif (typeof dirty !== 'string' && !_isNode(dirty)) {\n\t\t\tif (typeof dirty.toString === 'function') {\n\t\t\t\tdirty = dirty.toString();\n\n\t\t\t\tif (typeof dirty !== 'string') {\n\t\t\t\t\tthrow typeErrorCreate('dirty is not a string, aborting');\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthrow typeErrorCreate('toString is not a function');\n\t\t\t}\n\t\t}\n\t\t/* Return dirty HTML if DOMPurify cannot run */\n\n\n\t\tif (!DOMPurify.isSupported) {\n\t\t\treturn dirty;\n\t\t}\n\t\t/* Assign config vars */\n\n\n\t\tif (!SET_CONFIG) {\n\t\t\t_parseConfig(cfg);\n\t\t}\n\t\t/* Clean up removed elements */\n\n\n\t\tDOMPurify.removed = [];\n\t\t/* Check if dirty is correctly typed for IN_PLACE */\n\n\t\tif (typeof dirty === 'string') {\n\t\t\tIN_PLACE = false;\n\t\t}\n\n\t\tif (IN_PLACE) {\n\t\t\t/* Do some early pre-sanitization to avoid unsafe root nodes */\n\t\t\tif (dirty.nodeName) {\n\t\t\t\tconst tagName = transformCaseFunc(dirty.nodeName);\n\n\t\t\t\tif (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {\n\t\t\t\t\tthrow typeErrorCreate('root node is forbidden and cannot be sanitized in-place');\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (dirty instanceof Node) {\n\t\t\t/* If dirty is a DOM element, append to an empty document to avoid\n\t\t\t\t elements being stripped by the parser */\n\t\t\tbody = _initDocument('');\n\t\t\timportedNode = body.ownerDocument.importNode(dirty, true);\n\n\t\t\tif (importedNode.nodeType === 1 && importedNode.nodeName === 'BODY') {\n\t\t\t\t/* Node is already a body, use as is */\n\t\t\t\tbody = importedNode;\n\t\t\t} else if (importedNode.nodeName === 'HTML') {\n\t\t\t\tbody = importedNode;\n\t\t\t} else {\n\t\t\t\t// eslint-disable-next-line unicorn/prefer-dom-node-append\n\t\t\t\tbody.appendChild(importedNode);\n\t\t\t}\n\t\t} else {\n\t\t\t/* Exit directly if we have nothing to do */\n\t\t\tif (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT && // eslint-disable-next-line unicorn/prefer-includes\n\t\t\t\tdirty.indexOf('<') === -1) {\n\t\t\t\treturn trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty;\n\t\t\t}\n\t\t\t/* Initialize the document to work on */\n\n\n\t\t\tbody = _initDocument(dirty);\n\t\t\t/* Check we have a DOM node from the data */\n\n\t\t\tif (!body) {\n\t\t\t\treturn RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : '';\n\t\t\t}\n\t\t}\n\t\t/* Remove first element node (ours) if FORCE_BODY is set */\n\n\n\t\tif (body && FORCE_BODY) {\n\t\t\t_forceRemove(body.firstChild);\n\t\t}\n\t\t/* Get node iterator */\n\n\n\t\tconst nodeIterator = _createIterator(IN_PLACE ? dirty : body);\n\t\t/* Now start iterating over the created document */\n\n\n\t\twhile (currentNode = nodeIterator.nextNode()) {\n\t\t\t/* Sanitize tags and elements */\n\t\t\tif (_sanitizeElements(currentNode)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t/* Shadow DOM detected, sanitize it */\n\n\n\t\t\tif (currentNode.content instanceof DocumentFragment) {\n\t\t\t\t_sanitizeShadowDOM(currentNode.content);\n\t\t\t}\n\t\t\t/* Check attributes, sanitize if necessary */\n\n\n\t\t\t_sanitizeAttributes(currentNode);\n\t\t}\n\t\t/* If we sanitized `dirty` in-place, return it. */\n\n\n\t\tif (IN_PLACE) {\n\t\t\treturn dirty;\n\t\t}\n\t\t/* Return sanitized string or DOM */\n\n\n\t\tif (RETURN_DOM) {\n\t\t\tif (RETURN_DOM_FRAGMENT) {\n\t\t\t\treturnNode = createDocumentFragment.call(body.ownerDocument);\n\n\t\t\t\twhile (body.firstChild) {\n\t\t\t\t\t// eslint-disable-next-line unicorn/prefer-dom-node-append\n\t\t\t\t\treturnNode.appendChild(body.firstChild);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturnNode = body;\n\t\t\t}\n\n\t\t\tif (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) {\n\t\t\t\t/*\n\t\t\t\t\tAdoptNode() is not used because internal state is not reset\n\t\t\t\t\t(e.g. the past names map of a HTMLFormElement), this is safe\n\t\t\t\t\tin theory but we would rather not risk another attack vector.\n\t\t\t\t\tThe state that is cloned by importNode() is explicitly defined\n\t\t\t\t\tby the specs.\n\t\t\t\t*/\n\t\t\t\treturnNode = importNode.call(originalDocument, returnNode, true);\n\t\t\t}\n\n\t\t\treturn returnNode;\n\t\t}\n\n\t\tlet serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;\n\t\t/* Serialize doctype if allowed */\n\n\t\tif (WHOLE_DOCUMENT && ALLOWED_TAGS['!doctype'] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) {\n\t\t\tserializedHTML = '\\n' + serializedHTML;\n\t\t}\n\t\t/* Sanitize final string template-safe */\n\n\n\t\tif (SAFE_FOR_TEMPLATES) {\n\t\t\tserializedHTML = stringReplace(serializedHTML, MUSTACHE_EXPR, ' ');\n\t\t\tserializedHTML = stringReplace(serializedHTML, ERB_EXPR, ' ');\n\t\t\tserializedHTML = stringReplace(serializedHTML, TMPLIT_EXPR, ' ');\n\t\t}\n\n\t\treturn trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;\n\t};\n\t/**\n\t * Public method to set the configuration once\n\t * setConfig\n\t *\n\t * @param {Object} cfg configuration object\n\t */\n\n\n\tDOMPurify.setConfig = function (cfg) {\n\t\t_parseConfig(cfg);\n\n\t\tSET_CONFIG = true;\n\t};\n\t/**\n\t * Public method to remove the configuration\n\t * clearConfig\n\t *\n\t */\n\n\n\tDOMPurify.clearConfig = function () {\n\t\tCONFIG = null;\n\t\tSET_CONFIG = false;\n\t};\n\t/**\n\t * Public method to check if an attribute value is valid.\n\t * Uses last set config, if any. Otherwise, uses config defaults.\n\t * isValidAttribute\n\t *\n\t * @param {string} tag Tag name of containing element.\n\t * @param {string} attr Attribute name.\n\t * @param {string} value Attribute value.\n\t * @return {Boolean} Returns true if `value` is valid. Otherwise, returns false.\n\t */\n\n\n\tDOMPurify.isValidAttribute = function (tag, attr, value) {\n\t\t/* Initialize shared config vars if necessary. */\n\t\tif (!CONFIG) {\n\t\t\t_parseConfig({});\n\t\t}\n\n\t\tconst lcTag = transformCaseFunc(tag);\n\t\tconst lcName = transformCaseFunc(attr);\n\t\treturn _isValidAttribute(lcTag, lcName, value);\n\t};\n\t/**\n\t * AddHook\n\t * Public method to add DOMPurify hooks\n\t *\n\t * @param {String} entryPoint entry point for the hook to add\n\t * @param {Function} hookFunction function to execute\n\t */\n\n\n\tDOMPurify.addHook = function (entryPoint, hookFunction) {\n\t\tif (typeof hookFunction !== 'function') {\n\t\t\treturn;\n\t\t}\n\n\t\thooks[entryPoint] = hooks[entryPoint] || [];\n\t\tarrayPush(hooks[entryPoint], hookFunction);\n\t};\n\t/**\n\t * RemoveHook\n\t * Public method to remove a DOMPurify hook at a given entryPoint\n\t * (pops it from the stack of hooks if more are present)\n\t *\n\t * @param {String} entryPoint entry point for the hook to remove\n\t * @return {Function} removed(popped) hook\n\t */\n\n\n\tDOMPurify.removeHook = function (entryPoint) {\n\t\tif (hooks[entryPoint]) {\n\t\t\treturn arrayPop(hooks[entryPoint]);\n\t\t}\n\t};\n\t/**\n\t * RemoveHooks\n\t * Public method to remove all DOMPurify hooks at a given entryPoint\n\t *\n\t * @param {String} entryPoint entry point for the hooks to remove\n\t */\n\n\n\tDOMPurify.removeHooks = function (entryPoint) {\n\t\tif (hooks[entryPoint]) {\n\t\t\thooks[entryPoint] = [];\n\t\t}\n\t};\n\t/**\n\t * RemoveAllHooks\n\t * Public method to remove all DOMPurify hooks\n\t *\n\t */\n\n\n\tDOMPurify.removeAllHooks = function () {\n\t\thooks = {};\n\t};\n\n\treturn DOMPurify;\n}\n\nvar purify = createDOMPurify();\n\n// ESM-comment-begin\n// define(function () { return purify; });\n// ESM-comment-end\n\n// ESM-uncomment-begin\nexport default purify;\nexport const version = purify.version;\nexport const isSupported = purify.isSupported;\nexport const sanitize = purify.sanitize;\nexport const setConfig = purify.setConfig;\nexport const clearConfig = purify.clearConfig;\nexport const isValidAttribute = purify.isValidAttribute;\nexport const addHook = purify.addHook;\nexport const removeHook = purify.removeHook;\nexport const removeHooks = purify.removeHooks;\nexport const removeAllHooks = purify.removeAllHooks;\n// ESM-uncomment-end\n", "/*---------------------------------------------------------------------------------------------\n * 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 * 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';\nexport var Schemas;\n(function (Schemas) {\n /**\n * A schema that is used for models that exist in memory\n * only and that have no correspondence on a server or such.\n */\n Schemas.inMemory = 'inmemory';\n /**\n * A schema that is used for setting files\n */\n Schemas.vscode = 'vscode';\n /**\n * A schema that is used for internal private files\n */\n Schemas.internal = 'private';\n /**\n * A walk-through document.\n */\n Schemas.walkThrough = 'walkThrough';\n /**\n * An embedded code snippet.\n */\n Schemas.walkThroughSnippet = 'walkThroughSnippet';\n Schemas.http = 'http';\n Schemas.https = 'https';\n Schemas.file = 'file';\n Schemas.mailto = 'mailto';\n Schemas.untitled = 'untitled';\n Schemas.data = 'data';\n Schemas.command = 'command';\n Schemas.vscodeRemote = 'vscode-remote';\n Schemas.vscodeRemoteResource = 'vscode-remote-resource';\n Schemas.vscodeManagedRemoteResource = 'vscode-managed-remote-resource';\n Schemas.vscodeUserData = 'vscode-userdata';\n Schemas.vscodeCustomEditor = 'vscode-custom-editor';\n Schemas.vscodeNotebookCell = 'vscode-notebook-cell';\n Schemas.vscodeNotebookCellMetadata = 'vscode-notebook-cell-metadata';\n Schemas.vscodeNotebookCellOutput = 'vscode-notebook-cell-output';\n Schemas.vscodeInteractiveInput = 'vscode-interactive-input';\n Schemas.vscodeSettings = 'vscode-settings';\n Schemas.vscodeWorkspaceTrust = 'vscode-workspace-trust';\n Schemas.vscodeTerminal = 'vscode-terminal';\n /** Scheme used for code blocks in chat. */\n Schemas.vscodeChatCodeBlock = 'vscode-chat-code-block';\n /** Scheme used for LHS of code compare (aka diff) blocks in chat. */\n Schemas.vscodeChatCodeCompreBlock = 'vscode-chat-code-compare-block';\n /** Scheme used for the chat input editor. */\n Schemas.vscodeChatSesssion = 'vscode-chat-editor';\n /**\n * Scheme used internally for webviews that aren't linked to a resource (i.e. not custom editors)\n */\n Schemas.webviewPanel = 'webview-panel';\n /**\n * Scheme used for loading the wrapper html and script in webviews.\n */\n Schemas.vscodeWebview = 'vscode-webview';\n /**\n * Scheme used for extension pages\n */\n Schemas.extension = 'extension';\n /**\n * Scheme used as a replacement of `file` scheme to load\n * files with our custom protocol handler (desktop only).\n */\n Schemas.vscodeFileResource = 'vscode-file';\n /**\n * Scheme used for temporary resources\n */\n Schemas.tmp = 'tmp';\n /**\n * Scheme used vs live share\n */\n Schemas.vsls = 'vsls';\n /**\n * Scheme used for the Source Control commit input's text document\n */\n Schemas.vscodeSourceControl = 'vscode-scm';\n /**\n * Scheme used for input box for creating comments.\n */\n Schemas.commentsInput = 'comment';\n /**\n * Scheme used for special rendering of settings in the release notes\n */\n Schemas.codeSetting = 'code-setting';\n})(Schemas || (Schemas = {}));\nexport function matchesScheme(target, scheme) {\n if (URI.isUri(target)) {\n return equalsIgnoreCase(target.scheme, scheme);\n }\n else {\n return startsWithIgnoreCase(target, scheme + ':');\n }\n}\nexport function matchesSomeScheme(target, ...schemes) {\n return schemes.some(scheme => matchesScheme(target, scheme));\n}\nexport const connectionTokenQueryName = 'tkn';\nclass RemoteAuthoritiesImpl {\n constructor() {\n this._hosts = Object.create(null);\n this._ports = Object.create(null);\n this._connectionTokens = Object.create(null);\n this._preferredWebSchema = 'http';\n this._delegate = null;\n this._serverRootPath = '/';\n }\n setPreferredWebSchema(schema) {\n this._preferredWebSchema = schema;\n }\n get _remoteResourcesPath() {\n return paths.posix.join(this._serverRootPath, Schemas.vscodeRemoteResource);\n }\n rewrite(uri) {\n if (this._delegate) {\n try {\n return this._delegate(uri);\n }\n catch (err) {\n errors.onUnexpectedError(err);\n return uri;\n }\n }\n const authority = uri.authority;\n let host = this._hosts[authority];\n if (host && host.indexOf(':') !== -1 && host.indexOf('[') === -1) {\n host = `[${host}]`;\n }\n const port = this._ports[authority];\n const connectionToken = this._connectionTokens[authority];\n let query = `path=${encodeURIComponent(uri.path)}`;\n if (typeof connectionToken === 'string') {\n query += `&${connectionTokenQueryName}=${encodeURIComponent(connectionToken)}`;\n }\n return URI.from({\n scheme: platform.isWeb ? this._preferredWebSchema : Schemas.vscodeRemoteResource,\n authority: `${host}:${port}`,\n path: this._remoteResourcesPath,\n query\n });\n }\n}\nexport const RemoteAuthorities = new RemoteAuthoritiesImpl();\nexport const VSCODE_AUTHORITY = 'vscode-app';\nclass FileAccessImpl {\n /**\n * Returns a URI to use in contexts where the browser is responsible\n * for loading (e.g. fetch()) or when used within the DOM.\n *\n * **Note:** use `dom.ts#asCSSUrl` whenever the URL is to be used in CSS context.\n */\n uriToBrowserUri(uri) {\n // Handle remote URIs via `RemoteAuthorities`\n if (uri.scheme === Schemas.vscodeRemote) {\n return RemoteAuthorities.rewrite(uri);\n }\n // Convert to `vscode-file` resource..\n if (\n // ...only ever for `file` resources\n uri.scheme === Schemas.file &&\n (\n // ...and we run in native environments\n platform.isNative ||\n // ...or web worker extensions on desktop\n (platform.webWorkerOrigin === `${Schemas.vscodeFileResource}://${FileAccessImpl.FALLBACK_AUTHORITY}`))) {\n return uri.with({\n scheme: Schemas.vscodeFileResource,\n // We need to provide an authority here so that it can serve\n // as origin for network and loading matters in chromium.\n // If the URI is not coming with an authority already, we\n // add our own\n authority: uri.authority || FileAccessImpl.FALLBACK_AUTHORITY,\n query: null,\n fragment: null\n });\n }\n return uri;\n }\n}\nFileAccessImpl.FALLBACK_AUTHORITY = VSCODE_AUTHORITY;\nexport const FileAccess = new FileAccessImpl();\nexport var COI;\n(function (COI) {\n const coiHeaders = new Map([\n ['1', { 'Cross-Origin-Opener-Policy': 'same-origin' }],\n ['2', { 'Cross-Origin-Embedder-Policy': 'require-corp' }],\n ['3', { 'Cross-Origin-Opener-Policy': 'same-origin', 'Cross-Origin-Embedder-Policy': 'require-corp' }],\n ]);\n COI.CoopAndCoep = Object.freeze(coiHeaders.get('3'));\n const coiSearchParamName = 'vscode-coi';\n /**\n * Extract desired headers from `vscode-coi` invocation\n */\n function getHeadersFromQuery(url) {\n let params;\n if (typeof url === 'string') {\n params = new URL(url).searchParams;\n }\n else if (url instanceof URL) {\n params = url.searchParams;\n }\n else if (URI.isUri(url)) {\n params = new URL(url.toString(true)).searchParams;\n }\n const value = params === null || params === void 0 ? void 0 : params.get(coiSearchParamName);\n if (!value) {\n return undefined;\n }\n return coiHeaders.get(value);\n }\n COI.getHeadersFromQuery = getHeadersFromQuery;\n /**\n * Add the `vscode-coi` query attribute based on wanting `COOP` and `COEP`. Will be a noop when `crossOriginIsolated`\n * isn't enabled the current context\n */\n function addSearchParam(urlOrSearch, coop, coep) {\n if (!globalThis.crossOriginIsolated) {\n // depends on the current context being COI\n return;\n }\n const value = coop && coep ? '3' : coep ? '2' : '1';\n if (urlOrSearch instanceof URLSearchParams) {\n urlOrSearch.set(coiSearchParamName, value);\n }\n else {\n urlOrSearch[coiSearchParamName] = value;\n }\n }\n COI.addSearchParam = addSearchParam;\n})(COI || (COI = {}));\n", "/*---------------------------------------------------------------------------------------------\n * 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 * as strings from './strings.js';\n/**\n * Return a hash value for an object.\n */\nexport function hash(obj) {\n return doHash(obj, 0);\n}\nexport function doHash(obj, hashVal) {\n switch (typeof obj) {\n case 'object':\n if (obj === null) {\n return numberHash(349, hashVal);\n }\n else if (Array.isArray(obj)) {\n return arrayHash(obj, hashVal);\n }\n return objectHash(obj, hashVal);\n case 'string':\n return stringHash(obj, hashVal);\n case 'boolean':\n return booleanHash(obj, hashVal);\n case 'number':\n return numberHash(obj, hashVal);\n case 'undefined':\n return numberHash(937, hashVal);\n default:\n return numberHash(617, hashVal);\n }\n}\nexport function numberHash(val, initialHashVal) {\n return (((initialHashVal << 5) - initialHashVal) + val) | 0; // hashVal * 31 + ch, keep as int32\n}\nfunction booleanHash(b, initialHashVal) {\n return numberHash(b ? 433 : 863, initialHashVal);\n}\nexport function stringHash(s, hashVal) {\n hashVal = numberHash(149417, hashVal);\n for (let i = 0, length = s.length; i < length; i++) {\n hashVal = numberHash(s.charCodeAt(i), hashVal);\n }\n return hashVal;\n}\nfunction arrayHash(arr, initialHashVal) {\n initialHashVal = numberHash(104579, initialHashVal);\n return arr.reduce((hashVal, item) => doHash(item, hashVal), initialHashVal);\n}\nfunction objectHash(obj, initialHashVal) {\n initialHashVal = numberHash(181387, initialHashVal);\n return Object.keys(obj).sort().reduce((hashVal, key) => {\n hashVal = stringHash(key, hashVal);\n return doHash(obj[key], hashVal);\n }, initialHashVal);\n}\nfunction leftRotate(value, bits, totalBits = 32) {\n // delta + bits = totalBits\n const delta = totalBits - bits;\n // All ones, expect `delta` zeros aligned to the right\n const mask = ~((1 << delta) - 1);\n // Join (value left-shifted `bits` bits) with (masked value right-shifted `delta` bits)\n return ((value << bits) | ((mask & value) >>> delta)) >>> 0;\n}\nfunction fill(dest, index = 0, count = dest.byteLength, value = 0) {\n for (let i = 0; i < count; i++) {\n dest[index + i] = value;\n }\n}\nfunction leftPad(value, length, char = '0') {\n while (value.length < length) {\n value = char + value;\n }\n return value;\n}\nexport function toHexString(bufferOrValue, bitsize = 32) {\n if (bufferOrValue instanceof ArrayBuffer) {\n return Array.from(new Uint8Array(bufferOrValue)).map(b => b.toString(16).padStart(2, '0')).join('');\n }\n return leftPad((bufferOrValue >>> 0).toString(16), bitsize / 4);\n}\n/**\n * A SHA1 implementation that works with strings and does not allocate.\n */\nexport class StringSHA1 {\n constructor() {\n this._h0 = 0x67452301;\n this._h1 = 0xEFCDAB89;\n this._h2 = 0x98BADCFE;\n this._h3 = 0x10325476;\n this._h4 = 0xC3D2E1F0;\n this._buff = new Uint8Array(64 /* SHA1Constant.BLOCK_SIZE */ + 3 /* to fit any utf-8 */);\n this._buffDV = new DataView(this._buff.buffer);\n this._buffLen = 0;\n this._totalLen = 0;\n this._leftoverHighSurrogate = 0;\n this._finished = false;\n }\n update(str) {\n const strLen = str.length;\n if (strLen === 0) {\n return;\n }\n const buff = this._buff;\n let buffLen = this._buffLen;\n let leftoverHighSurrogate = this._leftoverHighSurrogate;\n let charCode;\n let offset;\n if (leftoverHighSurrogate !== 0) {\n charCode = leftoverHighSurrogate;\n offset = -1;\n leftoverHighSurrogate = 0;\n }\n else {\n charCode = str.charCodeAt(0);\n offset = 0;\n }\n while (true) {\n let codePoint = charCode;\n if (strings.isHighSurrogate(charCode)) {\n if (offset + 1 < strLen) {\n const nextCharCode = str.charCodeAt(offset + 1);\n if (strings.isLowSurrogate(nextCharCode)) {\n offset++;\n codePoint = strings.computeCodePoint(charCode, nextCharCode);\n }\n else {\n // illegal => unicode replacement character\n codePoint = 65533 /* SHA1Constant.UNICODE_REPLACEMENT */;\n }\n }\n else {\n // last character is a surrogate pair\n leftoverHighSurrogate = charCode;\n break;\n }\n }\n else if (strings.isLowSurrogate(charCode)) {\n // illegal => unicode replacement character\n codePoint = 65533 /* SHA1Constant.UNICODE_REPLACEMENT */;\n }\n buffLen = this._push(buff, buffLen, codePoint);\n offset++;\n if (offset < strLen) {\n charCode = str.charCodeAt(offset);\n }\n else {\n break;\n }\n }\n this._buffLen = buffLen;\n this._leftoverHighSurrogate = leftoverHighSurrogate;\n }\n _push(buff, buffLen, codePoint) {\n if (codePoint < 0x0080) {\n buff[buffLen++] = codePoint;\n }\n else if (codePoint < 0x0800) {\n buff[buffLen++] = 0b11000000 | ((codePoint & 0b00000000000000000000011111000000) >>> 6);\n buff[buffLen++] = 0b10000000 | ((codePoint & 0b00000000000000000000000000111111) >>> 0);\n }\n else if (codePoint < 0x10000) {\n buff[buffLen++] = 0b11100000 | ((codePoint & 0b00000000000000001111000000000000) >>> 12);\n buff[buffLen++] = 0b10000000 | ((codePoint & 0b00000000000000000000111111000000) >>> 6);\n buff[buffLen++] = 0b10000000 | ((codePoint & 0b00000000000000000000000000111111) >>> 0);\n }\n else {\n buff[buffLen++] = 0b11110000 | ((codePoint & 0b00000000000111000000000000000000) >>> 18);\n buff[buffLen++] = 0b10000000 | ((codePoint & 0b00000000000000111111000000000000) >>> 12);\n buff[buffLen++] = 0b10000000 | ((codePoint & 0b00000000000000000000111111000000) >>> 6);\n buff[buffLen++] = 0b10000000 | ((codePoint & 0b00000000000000000000000000111111) >>> 0);\n }\n if (buffLen >= 64 /* SHA1Constant.BLOCK_SIZE */) {\n this._step();\n buffLen -= 64 /* SHA1Constant.BLOCK_SIZE */;\n this._totalLen += 64 /* SHA1Constant.BLOCK_SIZE */;\n // take last 3 in case of UTF8 overflow\n buff[0] = buff[64 /* SHA1Constant.BLOCK_SIZE */ + 0];\n buff[1] = buff[64 /* SHA1Constant.BLOCK_SIZE */ + 1];\n buff[2] = buff[64 /* SHA1Constant.BLOCK_SIZE */ + 2];\n }\n return buffLen;\n }\n digest() {\n if (!this._finished) {\n this._finished = true;\n if (this._leftoverHighSurrogate) {\n // illegal => unicode replacement character\n this._leftoverHighSurrogate = 0;\n this._buffLen = this._push(this._buff, this._buffLen, 65533 /* SHA1Constant.UNICODE_REPLACEMENT */);\n }\n this._totalLen += this._buffLen;\n this._wrapUp();\n }\n return toHexString(this._h0) + toHexString(this._h1) + toHexString(this._h2) + toHexString(this._h3) + toHexString(this._h4);\n }\n _wrapUp() {\n this._buff[this._buffLen++] = 0x80;\n fill(this._buff, this._buffLen);\n if (this._buffLen > 56) {\n this._step();\n fill(this._buff);\n }\n // this will fit because the mantissa can cover up to 52 bits\n const ml = 8 * this._totalLen;\n this._buffDV.setUint32(56, Math.floor(ml / 4294967296), false);\n this._buffDV.setUint32(60, ml % 4294967296, false);\n this._step();\n }\n _step() {\n const bigBlock32 = StringSHA1._bigBlock32;\n const data = this._buffDV;\n for (let j = 0; j < 64 /* 16*4 */; j += 4) {\n bigBlock32.setUint32(j, data.getUint32(j, false), false);\n }\n for (let j = 64; j < 320 /* 80*4 */; j += 4) {\n bigBlock32.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 }\n let a = this._h0;\n let b = this._h1;\n let c = this._h2;\n let d = this._h3;\n let e = this._h4;\n let f, k;\n let temp;\n for (let j = 0; j < 80; j++) {\n if (j < 20) {\n f = (b & c) | ((~b) & d);\n k = 0x5A827999;\n }\n else if (j < 40) {\n f = b ^ c ^ d;\n k = 0x6ED9EBA1;\n }\n else if (j < 60) {\n f = (b & c) | (b & d) | (c & d);\n k = 0x8F1BBCDC;\n }\n else {\n f = b ^ c ^ d;\n k = 0xCA62C1D6;\n }\n temp = (leftRotate(a, 5) + f + e + k + bigBlock32.getUint32(j * 4, false)) & 0xffffffff;\n e = d;\n d = c;\n c = leftRotate(b, 30);\n b = a;\n a = temp;\n }\n this._h0 = (this._h0 + a) & 0xffffffff;\n this._h1 = (this._h1 + b) & 0xffffffff;\n this._h2 = (this._h2 + c) & 0xffffffff;\n this._h3 = (this._h3 + d) & 0xffffffff;\n this._h4 = (this._h4 + e) & 0xffffffff;\n }\n}\nStringSHA1._bigBlock32 = new DataView(new ArrayBuffer(320)); // 80 * 4 = 320\n", "/*---------------------------------------------------------------------------------------------\n * 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 * as browser from './browser.js';\nimport { BrowserFeatures } from './canIUse.js';\nimport { StandardKeyboardEvent } from './keyboardEvent.js';\nimport { StandardMouseEvent } from './mouseEvent.js';\nimport { AbstractIdleValue, IntervalTimer, _runWhenIdle } from '../common/async.js';\nimport { onUnexpectedError } from '../common/errors.js';\nimport * as event from '../common/event.js';\nimport * as dompurify from './dompurify/dompurify.js';\nimport { Disposable, DisposableStore, toDisposable } from '../common/lifecycle.js';\nimport { FileAccess, RemoteAuthorities } from '../common/network.js';\nimport * as platform from '../common/platform.js';\nimport { hash } from '../common/hash.js';\nimport { ensureCodeWindow, mainWindow } from './window.js';\n//# region Multi-Window Support Utilities\nexport const { registerWindow, getWindow, getDocument, getWindows, getWindowsCount, getWindowId, getWindowById, hasWindow, onDidRegisterWindow, onWillUnregisterWindow, onDidUnregisterWindow } = (function () {\n const windows = new Map();\n ensureCodeWindow(mainWindow, 1);\n const mainWindowRegistration = { window: mainWindow, disposables: new DisposableStore() };\n windows.set(mainWindow.vscodeWindowId, mainWindowRegistration);\n const onDidRegisterWindow = new event.Emitter();\n const onDidUnregisterWindow = new event.Emitter();\n const onWillUnregisterWindow = new event.Emitter();\n function getWindowById(windowId, fallbackToMain) {\n const window = typeof windowId === 'number' ? windows.get(windowId) : undefined;\n return window !== null && window !== void 0 ? window : (fallbackToMain ? mainWindowRegistration : undefined);\n }\n return {\n onDidRegisterWindow: onDidRegisterWindow.event,\n onWillUnregisterWindow: onWillUnregisterWindow.event,\n onDidUnregisterWindow: onDidUnregisterWindow.event,\n registerWindow(window) {\n if (windows.has(window.vscodeWindowId)) {\n return Disposable.None;\n }\n const disposables = new DisposableStore();\n const registeredWindow = {\n window,\n disposables: disposables.add(new DisposableStore())\n };\n windows.set(window.vscodeWindowId, registeredWindow);\n disposables.add(toDisposable(() => {\n windows.delete(window.vscodeWindowId);\n onDidUnregisterWindow.fire(window);\n }));\n disposables.add(addDisposableListener(window, EventType.BEFORE_UNLOAD, () => {\n onWillUnregisterWindow.fire(window);\n }));\n onDidRegisterWindow.fire(registeredWindow);\n return disposables;\n },\n getWindows() {\n return windows.values();\n },\n getWindowsCount() {\n return windows.size;\n },\n getWindowId(targetWindow) {\n return targetWindow.vscodeWindowId;\n },\n hasWindow(windowId) {\n return windows.has(windowId);\n },\n getWindowById,\n getWindow(e) {\n var _a;\n const candidateNode = e;\n if ((_a = candidateNode === null || candidateNode === void 0 ? void 0 : candidateNode.ownerDocument) === null || _a === void 0 ? void 0 : _a.defaultView) {\n return candidateNode.ownerDocument.defaultView.window;\n }\n const candidateEvent = e;\n if (candidateEvent === null || candidateEvent === void 0 ? void 0 : candidateEvent.view) {\n return candidateEvent.view.window;\n }\n return mainWindow;\n },\n getDocument(e) {\n const candidateNode = e;\n return getWindow(candidateNode).document;\n }\n };\n})();\n//#endregion\nexport function clearNode(node) {\n while (node.firstChild) {\n node.firstChild.remove();\n }\n}\nclass DomListener {\n constructor(node, type, handler, options) {\n this._node = node;\n this._type = type;\n this._handler = handler;\n this._options = (options || false);\n this._node.addEventListener(this._type, this._handler, this._options);\n }\n dispose() {\n if (!this._handler) {\n // Already disposed\n return;\n }\n this._node.removeEventListener(this._type, this._handler, this._options);\n // Prevent leakers from holding on to the dom or handler func\n this._node = null;\n this._handler = null;\n }\n}\nexport function addDisposableListener(node, type, handler, useCaptureOrOptions) {\n return new DomListener(node, type, handler, useCaptureOrOptions);\n}\nfunction _wrapAsStandardMouseEvent(targetWindow, handler) {\n return function (e) {\n return handler(new StandardMouseEvent(targetWindow, e));\n };\n}\nfunction _wrapAsStandardKeyboardEvent(handler) {\n return function (e) {\n return handler(new StandardKeyboardEvent(e));\n };\n}\nexport const addStandardDisposableListener = function addStandardDisposableListener(node, type, handler, useCapture) {\n let wrapHandler = handler;\n if (type === 'click' || type === 'mousedown') {\n wrapHandler = _wrapAsStandardMouseEvent(getWindow(node), handler);\n }\n else if (type === 'keydown' || type === 'keypress' || type === 'keyup') {\n wrapHandler = _wrapAsStandardKeyboardEvent(handler);\n }\n return addDisposableListener(node, type, wrapHandler, useCapture);\n};\nexport const addStandardDisposableGenericMouseDownListener = function addStandardDisposableListener(node, handler, useCapture) {\n const wrapHandler = _wrapAsStandardMouseEvent(getWindow(node), handler);\n return addDisposableGenericMouseDownListener(node, wrapHandler, useCapture);\n};\nexport const addStandardDisposableGenericMouseUpListener = function addStandardDisposableListener(node, handler, useCapture) {\n const wrapHandler = _wrapAsStandardMouseEvent(getWindow(node), handler);\n return addDisposableGenericMouseUpListener(node, wrapHandler, useCapture);\n};\nexport function addDisposableGenericMouseDownListener(node, handler, useCapture) {\n return addDisposableListener(node, platform.isIOS && BrowserFeatures.pointerEvents ? EventType.POINTER_DOWN : EventType.MOUSE_DOWN, handler, useCapture);\n}\nexport function addDisposableGenericMouseUpListener(node, handler, useCapture) {\n return addDisposableListener(node, platform.isIOS && BrowserFeatures.pointerEvents ? EventType.POINTER_UP : EventType.MOUSE_UP, handler, useCapture);\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 targetWindow The window for which to run the idle callback\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 */\nexport function runWhenWindowIdle(targetWindow, callback, timeout) {\n return _runWhenIdle(targetWindow, callback, timeout);\n}\n/**\n * An implementation of the \"idle-until-urgent\"-strategy as introduced\n * here: https://philipwalton.com/articles/idle-until-urgent/\n */\nexport class WindowIdleValue extends AbstractIdleValue {\n constructor(targetWindow, executor) {\n super(targetWindow, executor);\n }\n}\n/**\n * Schedule a callback to be run at the next animation frame.\n * This allows multiple parties to register callbacks that should run at the next animation frame.\n * If currently in an animation frame, `runner` will be executed immediately.\n * @return token that can be used to cancel the scheduled runner (only if `runner` was not executed immediately).\n */\nexport let runAtThisOrScheduleAtNextAnimationFrame;\n/**\n * Schedule a callback to be run at the next animation frame.\n * This allows multiple parties to register callbacks that should run at the next animation frame.\n * If currently in an animation frame, `runner` will be executed at the next animation frame.\n * @return token that can be used to cancel the scheduled runner.\n */\nexport let scheduleAtNextAnimationFrame;\nexport class WindowIntervalTimer extends IntervalTimer {\n /**\n *\n * @param node The optional node from which the target window is determined\n */\n constructor(node) {\n super();\n this.defaultTarget = node && getWindow(node);\n }\n cancelAndSet(runner, interval, targetWindow) {\n return super.cancelAndSet(runner, interval, targetWindow !== null && targetWindow !== void 0 ? targetWindow : this.defaultTarget);\n }\n}\nclass AnimationFrameQueueItem {\n constructor(runner, priority = 0) {\n this._runner = runner;\n this.priority = priority;\n this._canceled = false;\n }\n dispose() {\n this._canceled = true;\n }\n execute() {\n if (this._canceled) {\n return;\n }\n try {\n this._runner();\n }\n catch (e) {\n onUnexpectedError(e);\n }\n }\n // Sort by priority (largest to lowest)\n static sort(a, b) {\n return b.priority - a.priority;\n }\n}\n(function () {\n /**\n * The runners scheduled at the next animation frame\n */\n const NEXT_QUEUE = new Map();\n /**\n * The runners scheduled at the current animation frame\n */\n const CURRENT_QUEUE = new Map();\n /**\n * A flag to keep track if the native requestAnimationFrame was already called\n */\n const animFrameRequested = new Map();\n /**\n * A flag to indicate if currently handling a native requestAnimationFrame callback\n */\n const inAnimationFrameRunner = new Map();\n const animationFrameRunner = (targetWindowId) => {\n var _a;\n animFrameRequested.set(targetWindowId, false);\n const currentQueue = (_a = NEXT_QUEUE.get(targetWindowId)) !== null && _a !== void 0 ? _a : [];\n CURRENT_QUEUE.set(targetWindowId, currentQueue);\n NEXT_QUEUE.set(targetWindowId, []);\n inAnimationFrameRunner.set(targetWindowId, true);\n while (currentQueue.length > 0) {\n currentQueue.sort(AnimationFrameQueueItem.sort);\n const top = currentQueue.shift();\n top.execute();\n }\n inAnimationFrameRunner.set(targetWindowId, false);\n };\n scheduleAtNextAnimationFrame = (targetWindow, runner, priority = 0) => {\n const targetWindowId = getWindowId(targetWindow);\n const item = new AnimationFrameQueueItem(runner, priority);\n let nextQueue = NEXT_QUEUE.get(targetWindowId);\n if (!nextQueue) {\n nextQueue = [];\n NEXT_QUEUE.set(targetWindowId, nextQueue);\n }\n nextQueue.push(item);\n if (!animFrameRequested.get(targetWindowId)) {\n animFrameRequested.set(targetWindowId, true);\n targetWindow.requestAnimationFrame(() => animationFrameRunner(targetWindowId));\n }\n return item;\n };\n runAtThisOrScheduleAtNextAnimationFrame = (targetWindow, runner, priority) => {\n const targetWindowId = getWindowId(targetWindow);\n if (inAnimationFrameRunner.get(targetWindowId)) {\n const item = new AnimationFrameQueueItem(runner, priority);\n let currentQueue = CURRENT_QUEUE.get(targetWindowId);\n if (!currentQueue) {\n currentQueue = [];\n CURRENT_QUEUE.set(targetWindowId, currentQueue);\n }\n currentQueue.push(item);\n return item;\n }\n else {\n return scheduleAtNextAnimationFrame(targetWindow, runner, priority);\n }\n };\n})();\nexport function getComputedStyle(el) {\n return getWindow(el).getComputedStyle(el, null);\n}\nexport function getClientArea(element, fallback) {\n const elWindow = getWindow(element);\n const elDocument = elWindow.document;\n // Try with DOM clientWidth / clientHeight\n if (element !== elDocument.body) {\n return new Dimension(element.clientWidth, element.clientHeight);\n }\n // If visual view port exits and it's on mobile, it should be used instead of window innerWidth / innerHeight, or document.body.clientWidth / document.body.clientHeight\n if (platform.isIOS && (elWindow === null || elWindow === void 0 ? void 0 : elWindow.visualViewport)) {\n return new Dimension(elWindow.visualViewport.width, elWindow.visualViewport.height);\n }\n // Try innerWidth / innerHeight\n if ((elWindow === null || elWindow === void 0 ? void 0 : elWindow.innerWidth) && elWindow.innerHeight) {\n return new Dimension(elWindow.innerWidth, elWindow.innerHeight);\n }\n // Try with document.body.clientWidth / document.body.clientHeight\n if (elDocument.body && elDocument.body.clientWidth && elDocument.body.clientHeight) {\n return new Dimension(elDocument.body.clientWidth, elDocument.body.clientHeight);\n }\n // Try with document.documentElement.clientWidth / document.documentElement.clientHeight\n if (elDocument.documentElement && elDocument.documentElement.clientWidth && elDocument.documentElement.clientHeight) {\n return new Dimension(elDocument.documentElement.clientWidth, elDocument.documentElement.clientHeight);\n }\n if (fallback) {\n return getClientArea(fallback);\n }\n throw new Error('Unable to figure out browser width and height');\n}\nclass SizeUtils {\n // Adapted from WinJS\n // Converts a CSS positioning string for the specified element to pixels.\n static convertToPixels(element, value) {\n return parseFloat(value) || 0;\n }\n static getDimension(element, cssPropertyName, jsPropertyName) {\n const computedStyle = getComputedStyle(element);\n const value = computedStyle ? computedStyle.getPropertyValue(cssPropertyName) : '0';\n return SizeUtils.convertToPixels(element, value);\n }\n static getBorderLeftWidth(element) {\n return SizeUtils.getDimension(element, 'border-left-width', 'borderLeftWidth');\n }\n static getBorderRightWidth(element) {\n return SizeUtils.getDimension(element, 'border-right-width', 'borderRightWidth');\n }\n static getBorderTopWidth(element) {\n return SizeUtils.getDimension(element, 'border-top-width', 'borderTopWidth');\n }\n static getBorderBottomWidth(element) {\n return SizeUtils.getDimension(element, 'border-bottom-width', 'borderBottomWidth');\n }\n static getPaddingLeft(element) {\n return SizeUtils.getDimension(element, 'padding-left', 'paddingLeft');\n }\n static getPaddingRight(element) {\n return SizeUtils.getDimension(element, 'padding-right', 'paddingRight');\n }\n static getPaddingTop(element) {\n return SizeUtils.getDimension(element, 'padding-top', 'paddingTop');\n }\n static getPaddingBottom(element) {\n return SizeUtils.getDimension(element, 'padding-bottom', 'paddingBottom');\n }\n static getMarginLeft(element) {\n return SizeUtils.getDimension(element, 'margin-left', 'marginLeft');\n }\n static getMarginTop(element) {\n return SizeUtils.getDimension(element, 'margin-top', 'marginTop');\n }\n static getMarginRight(element) {\n return SizeUtils.getDimension(element, 'margin-right', 'marginRight');\n }\n static getMarginBottom(element) {\n return SizeUtils.getDimension(element, 'margin-bottom', 'marginBottom');\n }\n}\nexport class Dimension {\n constructor(width, height) {\n this.width = width;\n this.height = height;\n }\n with(width = this.width, height = this.height) {\n if (width !== this.width || height !== this.height) {\n return new Dimension(width, height);\n }\n else {\n return this;\n }\n }\n static is(obj) {\n return typeof obj === 'object' && typeof obj.height === 'number' && typeof obj.width === 'number';\n }\n static lift(obj) {\n if (obj instanceof Dimension) {\n return obj;\n }\n else {\n return new Dimension(obj.width, obj.height);\n }\n }\n static equals(a, b) {\n if (a === b) {\n return true;\n }\n if (!a || !b) {\n return false;\n }\n return a.width === b.width && a.height === b.height;\n }\n}\nDimension.None = new Dimension(0, 0);\nexport function getTopLeftOffset(element) {\n // Adapted from WinJS.Utilities.getPosition\n // and added borders to the mix\n let offsetParent = element.offsetParent;\n let top = element.offsetTop;\n let left = element.offsetLeft;\n while ((element = element.parentNode) !== null\n && element !== element.ownerDocument.body\n && element !== element.ownerDocument.documentElement) {\n top -= element.scrollTop;\n const c = isShadowRoot(element) ? null : getComputedStyle(element);\n if (c) {\n left -= c.direction !== 'rtl' ? element.scrollLeft : -element.scrollLeft;\n }\n if (element === offsetParent) {\n left += SizeUtils.getBorderLeftWidth(element);\n top += SizeUtils.getBorderTopWidth(element);\n top += element.offsetTop;\n left += element.offsetLeft;\n offsetParent = element.offsetParent;\n }\n }\n return {\n left: left,\n top: top\n };\n}\nexport function size(element, width, height) {\n if (typeof width === 'number') {\n element.style.width = `${width}px`;\n }\n if (typeof height === 'number') {\n element.style.height = `${height}px`;\n }\n}\n/**\n * Returns the position of a dom node relative to the entire page.\n */\nexport function getDomNodePagePosition(domNode) {\n const bb = domNode.getBoundingClientRect();\n const window = getWindow(domNode);\n return {\n left: bb.left + window.scrollX,\n top: bb.top + window.scrollY,\n width: bb.width,\n height: bb.height\n };\n}\n/**\n * Returns the effective zoom on a given element before window zoom level is applied\n */\nexport function getDomNodeZoomLevel(domNode) {\n let testElement = domNode;\n let zoom = 1.0;\n do {\n const elementZoomLevel = getComputedStyle(testElement).zoom;\n if (elementZoomLevel !== null && elementZoomLevel !== undefined && elementZoomLevel !== '1') {\n zoom *= elementZoomLevel;\n }\n testElement = testElement.parentElement;\n } while (testElement !== null && testElement !== testElement.ownerDocument.documentElement);\n return zoom;\n}\n// Adapted from WinJS\n// Gets the width of the element, including margins.\nexport function getTotalWidth(element) {\n const margin = SizeUtils.getMarginLeft(element) + SizeUtils.getMarginRight(element);\n return element.offsetWidth + margin;\n}\nexport function getContentWidth(element) {\n const border = SizeUtils.getBorderLeftWidth(element) + SizeUtils.getBorderRightWidth(element);\n const padding = SizeUtils.getPaddingLeft(element) + SizeUtils.getPaddingRight(element);\n return element.offsetWidth - border - padding;\n}\n// Adapted from WinJS\n// Gets the height of the content of the specified element. The content height does not include borders or padding.\nexport function getContentHeight(element) {\n const border = SizeUtils.getBorderTopWidth(element) + SizeUtils.getBorderBottomWidth(element);\n const padding = SizeUtils.getPaddingTop(element) + SizeUtils.getPaddingBottom(element);\n return element.offsetHeight - border - padding;\n}\n// Adapted from WinJS\n// Gets the height of the element, including its margins.\nexport function getTotalHeight(element) {\n const margin = SizeUtils.getMarginTop(element) + SizeUtils.getMarginBottom(element);\n return element.offsetHeight + margin;\n}\n// ----------------------------------------------------------------------------------------\nexport function isAncestor(testChild, testAncestor) {\n return Boolean(testAncestor === null || testAncestor === void 0 ? void 0 : testAncestor.contains(testChild));\n}\nexport function findParentWithClass(node, clazz, stopAtClazzOrNode) {\n while (node && node.nodeType === node.ELEMENT_NODE) {\n if (node.classList.contains(clazz)) {\n return node;\n }\n if (stopAtClazzOrNode) {\n if (typeof stopAtClazzOrNode === 'string') {\n if (node.classList.contains(stopAtClazzOrNode)) {\n return null;\n }\n }\n else {\n if (node === stopAtClazzOrNode) {\n return null;\n }\n }\n }\n node = node.parentNode;\n }\n return null;\n}\nexport function hasParentWithClass(node, clazz, stopAtClazzOrNode) {\n return !!findParentWithClass(node, clazz, stopAtClazzOrNode);\n}\nexport function isShadowRoot(node) {\n return (node && !!node.host && !!node.mode);\n}\nexport function isInShadowDOM(domNode) {\n return !!getShadowRoot(domNode);\n}\nexport function getShadowRoot(domNode) {\n var _a;\n while (domNode.parentNode) {\n if (domNode === ((_a = domNode.ownerDocument) === null || _a === void 0 ? void 0 : _a.body)) {\n // reached the body\n return null;\n }\n domNode = domNode.parentNode;\n }\n return isShadowRoot(domNode) ? domNode : null;\n}\n/**\n * Returns the active element across all child windows\n * based on document focus. Falls back to the main\n * window if no window has focus.\n */\nexport function getActiveElement() {\n let result = getActiveDocument().activeElement;\n while (result === null || result === void 0 ? void 0 : result.shadowRoot) {\n result = result.shadowRoot.activeElement;\n }\n return result;\n}\n/**\n * Returns true if the focused window active element matches\n * the provided element. Falls back to the main window if no\n * window has focus.\n */\nexport function isActiveElement(element) {\n return getActiveElement() === element;\n}\n/**\n * Returns true if the focused window active element is contained in\n * `ancestor`. Falls back to the main window if no window has focus.\n */\nexport function isAncestorOfActiveElement(ancestor) {\n return isAncestor(getActiveElement(), ancestor);\n}\n/**\n * Returns the active document across main and child windows.\n * Prefers the window with focus, otherwise falls back to\n * the main windows document.\n */\nexport function getActiveDocument() {\n var _a;\n if (getWindowsCount() <= 1) {\n return mainWindow.document;\n }\n const documents = Array.from(getWindows()).map(({ window }) => window.document);\n return (_a = documents.find(doc => doc.hasFocus())) !== null && _a !== void 0 ? _a : mainWindow.document;\n}\n/**\n * Returns the active window across main and child windows.\n * Prefers the window with focus, otherwise falls back to\n * the main window.\n */\nexport function getActiveWindow() {\n var _a, _b;\n const document = getActiveDocument();\n return ((_b = (_a = document.defaultView) === null || _a === void 0 ? void 0 : _a.window) !== null && _b !== void 0 ? _b : mainWindow);\n}\nconst globalStylesheets = new Map();\n/**\n * A version of createStyleSheet which has a unified API to initialize/set the style content.\n */\nexport function createStyleSheet2() {\n return new WrappedStyleElement();\n}\nclass WrappedStyleElement {\n constructor() {\n this._currentCssStyle = '';\n this._styleSheet = undefined;\n }\n setStyle(cssStyle) {\n if (cssStyle === this._currentCssStyle) {\n return;\n }\n this._currentCssStyle = cssStyle;\n if (!this._styleSheet) {\n this._styleSheet = createStyleSheet(mainWindow.document.head, (s) => s.innerText = cssStyle);\n }\n else {\n this._styleSheet.innerText = cssStyle;\n }\n }\n dispose() {\n if (this._styleSheet) {\n this._styleSheet.remove();\n this._styleSheet = undefined;\n }\n }\n}\nexport function createStyleSheet(container = mainWindow.document.head, beforeAppend, disposableStore) {\n const style = document.createElement('style');\n style.type = 'text/css';\n style.media = 'screen';\n beforeAppend === null || beforeAppend === void 0 ? void 0 : beforeAppend(style);\n container.appendChild(style);\n if (disposableStore) {\n disposableStore.add(toDisposable(() => container.removeChild(style)));\n }\n // With as container, the stylesheet becomes global and is tracked\n // to support auxiliary windows to clone the stylesheet.\n if (container === mainWindow.document.head) {\n const globalStylesheetClones = new Set();\n globalStylesheets.set(style, globalStylesheetClones);\n for (const { window: targetWindow, disposables } of getWindows()) {\n if (targetWindow === mainWindow) {\n continue; // main window is already tracked\n }\n const cloneDisposable = disposables.add(cloneGlobalStyleSheet(style, globalStylesheetClones, targetWindow));\n disposableStore === null || disposableStore === void 0 ? void 0 : disposableStore.add(cloneDisposable);\n }\n }\n return style;\n}\nfunction cloneGlobalStyleSheet(globalStylesheet, globalStylesheetClones, targetWindow) {\n var _a, _b;\n const disposables = new DisposableStore();\n const clone = globalStylesheet.cloneNode(true);\n targetWindow.document.head.appendChild(clone);\n disposables.add(toDisposable(() => targetWindow.document.head.removeChild(clone)));\n for (const rule of getDynamicStyleSheetRules(globalStylesheet)) {\n (_a = clone.sheet) === null || _a === void 0 ? void 0 : _a.insertRule(rule.cssText, (_b = clone.sheet) === null || _b === void 0 ? void 0 : _b.cssRules.length);\n }\n disposables.add(sharedMutationObserver.observe(globalStylesheet, disposables, { childList: true })(() => {\n clone.textContent = globalStylesheet.textContent;\n }));\n globalStylesheetClones.add(clone);\n disposables.add(toDisposable(() => globalStylesheetClones.delete(clone)));\n return disposables;\n}\nexport const sharedMutationObserver = new class {\n constructor() {\n this.mutationObservers = new Map();\n }\n observe(target, disposables, options) {\n let mutationObserversPerTarget = this.mutationObservers.get(target);\n if (!mutationObserversPerTarget) {\n mutationObserversPerTarget = new Map();\n this.mutationObservers.set(target, mutationObserversPerTarget);\n }\n const optionsHash = hash(options);\n let mutationObserverPerOptions = mutationObserversPerTarget.get(optionsHash);\n if (!mutationObserverPerOptions) {\n const onDidMutate = new event.Emitter();\n const observer = new MutationObserver(mutations => onDidMutate.fire(mutations));\n observer.observe(target, options);\n const resolvedMutationObserverPerOptions = mutationObserverPerOptions = {\n users: 1,\n observer,\n onDidMutate: onDidMutate.event\n };\n disposables.add(toDisposable(() => {\n resolvedMutationObserverPerOptions.users -= 1;\n if (resolvedMutationObserverPerOptions.users === 0) {\n onDidMutate.dispose();\n observer.disconnect();\n mutationObserversPerTarget === null || mutationObserversPerTarget === void 0 ? void 0 : mutationObserversPerTarget.delete(optionsHash);\n if ((mutationObserversPerTarget === null || mutationObserversPerTarget === void 0 ? void 0 : mutationObserversPerTarget.size) === 0) {\n this.mutationObservers.delete(target);\n }\n }\n }));\n mutationObserversPerTarget.set(optionsHash, mutationObserverPerOptions);\n }\n else {\n mutationObserverPerOptions.users += 1;\n }\n return mutationObserverPerOptions.onDidMutate;\n }\n};\nlet _sharedStyleSheet = null;\nfunction getSharedStyleSheet() {\n if (!_sharedStyleSheet) {\n _sharedStyleSheet = createStyleSheet();\n }\n return _sharedStyleSheet;\n}\nfunction getDynamicStyleSheetRules(style) {\n var _a, _b;\n if ((_a = style === null || style === void 0 ? void 0 : style.sheet) === null || _a === void 0 ? void 0 : _a.rules) {\n // Chrome, IE\n return style.sheet.rules;\n }\n if ((_b = style === null || style === void 0 ? void 0 : style.sheet) === null || _b === void 0 ? void 0 : _b.cssRules) {\n // FF\n return style.sheet.cssRules;\n }\n return [];\n}\nexport function createCSSRule(selector, cssText, style = getSharedStyleSheet()) {\n var _a, _b;\n if (!style || !cssText) {\n return;\n }\n (_a = style.sheet) === null || _a === void 0 ? void 0 : _a.insertRule(`${selector} {${cssText}}`, 0);\n // Apply rule also to all cloned global stylesheets\n for (const clonedGlobalStylesheet of (_b = globalStylesheets.get(style)) !== null && _b !== void 0 ? _b : []) {\n createCSSRule(selector, cssText, clonedGlobalStylesheet);\n }\n}\nexport function removeCSSRulesContainingSelector(ruleName, style = getSharedStyleSheet()) {\n var _a, _b;\n if (!style) {\n return;\n }\n const rules = getDynamicStyleSheetRules(style);\n const toDelete = [];\n for (let i = 0; i < rules.length; i++) {\n const rule = rules[i];\n if (isCSSStyleRule(rule) && rule.selectorText.indexOf(ruleName) !== -1) {\n toDelete.push(i);\n }\n }\n for (let i = toDelete.length - 1; i >= 0; i--) {\n (_a = style.sheet) === null || _a === void 0 ? void 0 : _a.deleteRule(toDelete[i]);\n }\n // Remove rules also from all cloned global stylesheets\n for (const clonedGlobalStylesheet of (_b = globalStylesheets.get(style)) !== null && _b !== void 0 ? _b : []) {\n removeCSSRulesContainingSelector(ruleName, clonedGlobalStylesheet);\n }\n}\nfunction isCSSStyleRule(rule) {\n return typeof rule.selectorText === 'string';\n}\nexport function isMouseEvent(e) {\n // eslint-disable-next-line no-restricted-syntax\n return e instanceof MouseEvent || e instanceof getWindow(e).MouseEvent;\n}\nexport function isKeyboardEvent(e) {\n // eslint-disable-next-line no-restricted-syntax\n return e instanceof KeyboardEvent || e instanceof getWindow(e).KeyboardEvent;\n}\nexport const EventType = {\n // Mouse\n CLICK: 'click',\n AUXCLICK: 'auxclick',\n DBLCLICK: 'dblclick',\n MOUSE_UP: 'mouseup',\n MOUSE_DOWN: 'mousedown',\n MOUSE_OVER: 'mouseover',\n MOUSE_MOVE: 'mousemove',\n MOUSE_OUT: 'mouseout',\n MOUSE_ENTER: 'mouseenter',\n MOUSE_LEAVE: 'mouseleave',\n MOUSE_WHEEL: 'wheel',\n POINTER_UP: 'pointerup',\n POINTER_DOWN: 'pointerdown',\n POINTER_MOVE: 'pointermove',\n POINTER_LEAVE: 'pointerleave',\n CONTEXT_MENU: 'contextmenu',\n WHEEL: 'wheel',\n // Keyboard\n KEY_DOWN: 'keydown',\n KEY_PRESS: 'keypress',\n KEY_UP: 'keyup',\n // HTML Document\n LOAD: 'load',\n BEFORE_UNLOAD: 'beforeunload',\n UNLOAD: 'unload',\n PAGE_SHOW: 'pageshow',\n PAGE_HIDE: 'pagehide',\n PASTE: 'paste',\n ABORT: 'abort',\n ERROR: 'error',\n RESIZE: 'resize',\n SCROLL: 'scroll',\n FULLSCREEN_CHANGE: 'fullscreenchange',\n WK_FULLSCREEN_CHANGE: 'webkitfullscreenchange',\n // Form\n SELECT: 'select',\n CHANGE: 'change',\n SUBMIT: 'submit',\n RESET: 'reset',\n FOCUS: 'focus',\n FOCUS_IN: 'focusin',\n FOCUS_OUT: 'focusout',\n BLUR: 'blur',\n INPUT: 'input',\n // Local Storage\n STORAGE: 'storage',\n // Drag\n DRAG_START: 'dragstart',\n DRAG: 'drag',\n DRAG_ENTER: 'dragenter',\n DRAG_LEAVE: 'dragleave',\n DRAG_OVER: 'dragover',\n DROP: 'drop',\n DRAG_END: 'dragend',\n // Animation\n ANIMATION_START: browser.isWebKit ? 'webkitAnimationStart' : 'animationstart',\n ANIMATION_END: browser.isWebKit ? 'webkitAnimationEnd' : 'animationend',\n ANIMATION_ITERATION: browser.isWebKit ? 'webkitAnimationIteration' : 'animationiteration'\n};\nexport function isEventLike(obj) {\n const candidate = obj;\n return !!(candidate && typeof candidate.preventDefault === 'function' && typeof candidate.stopPropagation === 'function');\n}\nexport const EventHelper = {\n stop: (e, cancelBubble) => {\n e.preventDefault();\n if (cancelBubble) {\n e.stopPropagation();\n }\n return e;\n }\n};\nexport function saveParentsScrollTop(node) {\n const r = [];\n for (let i = 0; node && node.nodeType === node.ELEMENT_NODE; i++) {\n r[i] = node.scrollTop;\n node = node.parentNode;\n }\n return r;\n}\nexport function restoreParentsScrollTop(node, state) {\n for (let i = 0; node && node.nodeType === node.ELEMENT_NODE; i++) {\n if (node.scrollTop !== state[i]) {\n node.scrollTop = state[i];\n }\n node = node.parentNode;\n }\n}\nclass FocusTracker extends Disposable {\n static hasFocusWithin(element) {\n if (element instanceof HTMLElement) {\n const shadowRoot = getShadowRoot(element);\n const activeElement = (shadowRoot ? shadowRoot.activeElement : element.ownerDocument.activeElement);\n return isAncestor(activeElement, element);\n }\n else {\n const window = element;\n return isAncestor(window.document.activeElement, window.document);\n }\n }\n constructor(element) {\n super();\n this._onDidFocus = this._register(new event.Emitter());\n this.onDidFocus = this._onDidFocus.event;\n this._onDidBlur = this._register(new event.Emitter());\n this.onDidBlur = this._onDidBlur.event;\n let hasFocus = FocusTracker.hasFocusWithin(element);\n let loosingFocus = false;\n const onFocus = () => {\n loosingFocus = false;\n if (!hasFocus) {\n hasFocus = true;\n this._onDidFocus.fire();\n }\n };\n const onBlur = () => {\n if (hasFocus) {\n loosingFocus = true;\n (element instanceof HTMLElement ? getWindow(element) : element).setTimeout(() => {\n if (loosingFocus) {\n loosingFocus = false;\n hasFocus = false;\n this._onDidBlur.fire();\n }\n }, 0);\n }\n };\n this._refreshStateHandler = () => {\n const currentNodeHasFocus = FocusTracker.hasFocusWithin(element);\n if (currentNodeHasFocus !== hasFocus) {\n if (hasFocus) {\n onBlur();\n }\n else {\n onFocus();\n }\n }\n };\n this._register(addDisposableListener(element, EventType.FOCUS, onFocus, true));\n this._register(addDisposableListener(element, EventType.BLUR, onBlur, true));\n if (element instanceof HTMLElement) {\n this._register(addDisposableListener(element, EventType.FOCUS_IN, () => this._refreshStateHandler()));\n this._register(addDisposableListener(element, EventType.FOCUS_OUT, () => this._refreshStateHandler()));\n }\n }\n}\n/**\n * Creates a new `IFocusTracker` instance that tracks focus changes on the given `element` and its descendants.\n *\n * @param element The `HTMLElement` or `Window` to track focus changes on.\n * @returns An `IFocusTracker` instance.\n */\nexport function trackFocus(element) {\n return new FocusTracker(element);\n}\nexport function after(sibling, child) {\n sibling.after(child);\n return child;\n}\nexport function append(parent, ...children) {\n parent.append(...children);\n if (children.length === 1 && typeof children[0] !== 'string') {\n return children[0];\n }\n}\nexport function prepend(parent, child) {\n parent.insertBefore(child, parent.firstChild);\n return child;\n}\n/**\n * Removes all children from `parent` and appends `children`\n */\nexport function reset(parent, ...children) {\n parent.innerText = '';\n append(parent, ...children);\n}\nconst SELECTOR_REGEX = /([\\w\\-]+)?(#([\\w\\-]+))?((\\.([\\w\\-]+))*)/;\nexport var Namespace;\n(function (Namespace) {\n Namespace[\"HTML\"] = \"http://www.w3.org/1999/xhtml\";\n Namespace[\"SVG\"] = \"http://www.w3.org/2000/svg\";\n})(Namespace || (Namespace = {}));\nfunction _$(namespace, description, attrs, ...children) {\n const match = SELECTOR_REGEX.exec(description);\n if (!match) {\n throw new Error('Bad use of emmet');\n }\n const tagName = match[1] || 'div';\n let result;\n if (namespace !== Namespace.HTML) {\n result = document.createElementNS(namespace, tagName);\n }\n else {\n result = document.createElement(tagName);\n }\n if (match[3]) {\n result.id = match[3];\n }\n if (match[4]) {\n result.className = match[4].replace(/\\./g, ' ').trim();\n }\n if (attrs) {\n Object.entries(attrs).forEach(([name, value]) => {\n if (typeof value === 'undefined') {\n return;\n }\n if (/^on\\w+$/.test(name)) {\n result[name] = value;\n }\n else if (name === 'selected') {\n if (value) {\n result.setAttribute(name, 'true');\n }\n }\n else {\n result.setAttribute(name, value);\n }\n });\n }\n result.append(...children);\n return result;\n}\nexport function $(description, attrs, ...children) {\n return _$(Namespace.HTML, description, attrs, ...children);\n}\n$.SVG = function (description, attrs, ...children) {\n return _$(Namespace.SVG, description, attrs, ...children);\n};\nexport function setVisibility(visible, ...elements) {\n if (visible) {\n show(...elements);\n }\n else {\n hide(...elements);\n }\n}\nexport function show(...elements) {\n for (const element of elements) {\n element.style.display = '';\n element.removeAttribute('aria-hidden');\n }\n}\nexport function hide(...elements) {\n for (const element of elements) {\n element.style.display = 'none';\n element.setAttribute('aria-hidden', 'true');\n }\n}\n/**\n * Find a value usable for a dom node size such that the likelihood that it would be\n * displayed with constant screen pixels size is as high as possible.\n *\n * e.g. We would desire for the cursors to be 2px (CSS px) wide. Under a devicePixelRatio\n * of 1.25, the cursor will be 2.5 screen pixels wide. Depending on how the dom node aligns/\"snaps\"\n * with the screen pixels, it will sometimes be rendered with 2 screen pixels, and sometimes with 3 screen pixels.\n */\nexport function computeScreenAwareSize(window, cssPx) {\n const screenPx = window.devicePixelRatio * cssPx;\n return Math.max(1, Math.floor(screenPx)) / window.devicePixelRatio;\n}\n/**\n * Open safely a new window. This is the best way to do so, but you cannot tell\n * if the window was opened or if it was blocked by the browser's popup blocker.\n * If you want to tell if the browser blocked the new window, use {@link windowOpenWithSuccess}.\n *\n * See https://github.com/microsoft/monaco-editor/issues/601\n * To protect against malicious code in the linked site, particularly phishing attempts,\n * the window.opener should be set to null to prevent the linked site from having access\n * to change the location of the current page.\n * See https://mathiasbynens.github.io/rel-noopener/\n */\nexport function windowOpenNoOpener(url) {\n // By using 'noopener' in the `windowFeatures` argument, the newly created window will\n // not be able to use `window.opener` to reach back to the current page.\n // See https://stackoverflow.com/a/46958731\n // See https://developer.mozilla.org/en-US/docs/Web/API/Window/open#noopener\n // However, this also doesn't allow us to realize if the browser blocked\n // the creation of the window.\n mainWindow.open(url, '_blank', 'noopener');\n}\nexport function animate(targetWindow, fn) {\n const step = () => {\n fn();\n stepDisposable = scheduleAtNextAnimationFrame(targetWindow, step);\n };\n let stepDisposable = scheduleAtNextAnimationFrame(targetWindow, step);\n return toDisposable(() => stepDisposable.dispose());\n}\nRemoteAuthorities.setPreferredWebSchema(/^https:/.test(mainWindow.location.href) ? 'https' : 'http');\n/**\n * returns url('...')\n */\nexport function asCSSUrl(uri) {\n if (!uri) {\n return `url('')`;\n }\n return `url('${FileAccess.uriToBrowserUri(uri).toString(true).replace(/'/g, '%27')}')`;\n}\nexport function asCSSPropertyValue(value) {\n return `'${value.replace(/'/g, '%27')}'`;\n}\nexport function asCssValueWithDefault(cssPropertyValue, dflt) {\n if (cssPropertyValue !== undefined) {\n const variableMatch = cssPropertyValue.match(/^\\s*var\\((.+)\\)$/);\n if (variableMatch) {\n const varArguments = variableMatch[1].split(',', 2);\n if (varArguments.length === 2) {\n dflt = asCssValueWithDefault(varArguments[1].trim(), dflt);\n }\n return `var(${varArguments[0]}, ${dflt})`;\n }\n return cssPropertyValue;\n }\n return dflt;\n}\n// -- sanitize and trusted html\n/**\n * Hooks dompurify using `afterSanitizeAttributes` to check that all `href` and `src`\n * attributes are valid.\n */\nexport function hookDomPurifyHrefAndSrcSanitizer(allowedProtocols, allowDataImages = false) {\n // https://github.com/cure53/DOMPurify/blob/main/demos/hooks-scheme-allowlist.html\n // build an anchor to map URLs to\n const anchor = document.createElement('a');\n dompurify.addHook('afterSanitizeAttributes', (node) => {\n // check all href/src attributes for validity\n for (const attr of ['href', 'src']) {\n if (node.hasAttribute(attr)) {\n const attrValue = node.getAttribute(attr);\n if (attr === 'href' && attrValue.startsWith('#')) {\n // Allow fragment links\n continue;\n }\n anchor.href = attrValue;\n if (!allowedProtocols.includes(anchor.protocol.replace(/:$/, ''))) {\n if (allowDataImages && attr === 'src' && anchor.href.startsWith('data:')) {\n continue;\n }\n node.removeAttribute(attr);\n }\n }\n }\n });\n return toDisposable(() => {\n dompurify.removeHook('afterSanitizeAttributes');\n });\n}\n/**\n * List of safe, non-input html tags.\n */\nexport const basicMarkupHtmlTags = Object.freeze([\n 'a',\n 'abbr',\n 'b',\n 'bdo',\n 'blockquote',\n 'br',\n 'caption',\n 'cite',\n 'code',\n 'col',\n 'colgroup',\n 'dd',\n 'del',\n 'details',\n 'dfn',\n 'div',\n 'dl',\n 'dt',\n 'em',\n 'figcaption',\n 'figure',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'hr',\n 'i',\n 'img',\n 'input',\n 'ins',\n 'kbd',\n 'label',\n 'li',\n 'mark',\n 'ol',\n 'p',\n 'pre',\n 'q',\n 'rp',\n 'rt',\n 'ruby',\n 'samp',\n 'small',\n 'small',\n 'source',\n 'span',\n 'strike',\n 'strong',\n 'sub',\n 'summary',\n 'sup',\n 'table',\n 'tbody',\n 'td',\n 'tfoot',\n 'th',\n 'thead',\n 'time',\n 'tr',\n 'tt',\n 'u',\n 'ul',\n 'var',\n 'video',\n 'wbr',\n]);\nconst defaultDomPurifyConfig = Object.freeze({\n ALLOWED_TAGS: ['a', 'button', 'blockquote', 'code', 'div', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hr', 'input', 'label', 'li', 'p', 'pre', 'select', 'small', 'span', 'strong', 'textarea', 'ul', 'ol'],\n ALLOWED_ATTR: ['href', 'data-href', 'data-command', 'target', 'title', 'name', 'src', 'alt', 'class', 'id', 'role', 'tabindex', 'style', 'data-code', 'width', 'height', 'align', 'x-dispatch', 'required', 'checked', 'placeholder', 'type', 'start'],\n RETURN_DOM: false,\n RETURN_DOM_FRAGMENT: false,\n RETURN_TRUSTED_TYPE: true\n});\nexport class ModifierKeyEmitter extends event.Emitter {\n constructor() {\n super();\n this._subscriptions = new DisposableStore();\n this._keyStatus = {\n altKey: false,\n shiftKey: false,\n ctrlKey: false,\n metaKey: false\n };\n this._subscriptions.add(event.Event.runAndSubscribe(onDidRegisterWindow, ({ window, disposables }) => this.registerListeners(window, disposables), { window: mainWindow, disposables: this._subscriptions }));\n }\n registerListeners(window, disposables) {\n disposables.add(addDisposableListener(window, 'keydown', e => {\n if (e.defaultPrevented) {\n return;\n }\n const event = new StandardKeyboardEvent(e);\n // If Alt-key keydown event is repeated, ignore it #112347\n // Only known to be necessary for Alt-Key at the moment #115810\n if (event.keyCode === 6 /* KeyCode.Alt */ && e.repeat) {\n return;\n }\n if (e.altKey && !this._keyStatus.altKey) {\n this._keyStatus.lastKeyPressed = 'alt';\n }\n else if (e.ctrlKey && !this._keyStatus.ctrlKey) {\n this._keyStatus.lastKeyPressed = 'ctrl';\n }\n else if (e.metaKey && !this._keyStatus.metaKey) {\n this._keyStatus.lastKeyPressed = 'meta';\n }\n else if (e.shiftKey && !this._keyStatus.shiftKey) {\n this._keyStatus.lastKeyPressed = 'shift';\n }\n else if (event.keyCode !== 6 /* KeyCode.Alt */) {\n this._keyStatus.lastKeyPressed = undefined;\n }\n else {\n return;\n }\n this._keyStatus.altKey = e.altKey;\n this._keyStatus.ctrlKey = e.ctrlKey;\n this._keyStatus.metaKey = e.metaKey;\n this._keyStatus.shiftKey = e.shiftKey;\n if (this._keyStatus.lastKeyPressed) {\n this._keyStatus.event = e;\n this.fire(this._keyStatus);\n }\n }, true));\n disposables.add(addDisposableListener(window, 'keyup', e => {\n if (e.defaultPrevented) {\n return;\n }\n if (!e.altKey && this._keyStatus.altKey) {\n this._keyStatus.lastKeyReleased = 'alt';\n }\n else if (!e.ctrlKey && this._keyStatus.ctrlKey) {\n this._keyStatus.lastKeyReleased = 'ctrl';\n }\n else if (!e.metaKey && this._keyStatus.metaKey) {\n this._keyStatus.lastKeyReleased = 'meta';\n }\n else if (!e.shiftKey && this._keyStatus.shiftKey) {\n this._keyStatus.lastKeyReleased = 'shift';\n }\n else {\n this._keyStatus.lastKeyReleased = undefined;\n }\n if (this._keyStatus.lastKeyPressed !== this._keyStatus.lastKeyReleased) {\n this._keyStatus.lastKeyPressed = undefined;\n }\n this._keyStatus.altKey = e.altKey;\n this._keyStatus.ctrlKey = e.ctrlKey;\n this._keyStatus.metaKey = e.metaKey;\n this._keyStatus.shiftKey = e.shiftKey;\n if (this._keyStatus.lastKeyReleased) {\n this._keyStatus.event = e;\n this.fire(this._keyStatus);\n }\n }, true));\n disposables.add(addDisposableListener(window.document.body, 'mousedown', () => {\n this._keyStatus.lastKeyPressed = undefined;\n }, true));\n disposables.add(addDisposableListener(window.document.body, 'mouseup', () => {\n this._keyStatus.lastKeyPressed = undefined;\n }, true));\n disposables.add(addDisposableListener(window.document.body, 'mousemove', e => {\n if (e.buttons) {\n this._keyStatus.lastKeyPressed = undefined;\n }\n }, true));\n disposables.add(addDisposableListener(window, 'blur', () => {\n this.resetKeyStatus();\n }));\n }\n get keyStatus() {\n return this._keyStatus;\n }\n /**\n * Allows to explicitly reset the key status based on more knowledge (#109062)\n */\n resetKeyStatus() {\n this.doResetKeyStatus();\n this.fire(this._keyStatus);\n }\n doResetKeyStatus() {\n this._keyStatus = {\n altKey: false,\n shiftKey: false,\n ctrlKey: false,\n metaKey: false\n };\n }\n static getInstance() {\n if (!ModifierKeyEmitter.instance) {\n ModifierKeyEmitter.instance = new ModifierKeyEmitter();\n }\n return ModifierKeyEmitter.instance;\n }\n dispose() {\n super.dispose();\n this._subscriptions.dispose();\n }\n}\nexport class DragAndDropObserver extends Disposable {\n constructor(element, callbacks) {\n super();\n this.element = element;\n this.callbacks = callbacks;\n // A helper to fix issues with repeated DRAG_ENTER / DRAG_LEAVE\n // calls see https://github.com/microsoft/vscode/issues/14470\n // when the element has child elements where the events are fired\n // repeadedly.\n this.counter = 0;\n // Allows to measure the duration of the drag operation.\n this.dragStartTime = 0;\n this.registerListeners();\n }\n registerListeners() {\n if (this.callbacks.onDragStart) {\n this._register(addDisposableListener(this.element, EventType.DRAG_START, (e) => {\n var _a, _b;\n (_b = (_a = this.callbacks).onDragStart) === null || _b === void 0 ? void 0 : _b.call(_a, e);\n }));\n }\n if (this.callbacks.onDrag) {\n this._register(addDisposableListener(this.element, EventType.DRAG, (e) => {\n var _a, _b;\n (_b = (_a = this.callbacks).onDrag) === null || _b === void 0 ? void 0 : _b.call(_a, e);\n }));\n }\n this._register(addDisposableListener(this.element, EventType.DRAG_ENTER, (e) => {\n var _a, _b;\n this.counter++;\n this.dragStartTime = e.timeStamp;\n (_b = (_a = this.callbacks).onDragEnter) === null || _b === void 0 ? void 0 : _b.call(_a, e);\n }));\n this._register(addDisposableListener(this.element, EventType.DRAG_OVER, (e) => {\n var _a, _b;\n e.preventDefault(); // needed so that the drop event fires (https://stackoverflow.com/questions/21339924/drop-event-not-firing-in-chrome)\n (_b = (_a = this.callbacks).onDragOver) === null || _b === void 0 ? void 0 : _b.call(_a, e, e.timeStamp - this.dragStartTime);\n }));\n this._register(addDisposableListener(this.element, EventType.DRAG_LEAVE, (e) => {\n var _a, _b;\n this.counter--;\n if (this.counter === 0) {\n this.dragStartTime = 0;\n (_b = (_a = this.callbacks).onDragLeave) === null || _b === void 0 ? void 0 : _b.call(_a, e);\n }\n }));\n this._register(addDisposableListener(this.element, EventType.DRAG_END, (e) => {\n var _a, _b;\n this.counter = 0;\n this.dragStartTime = 0;\n (_b = (_a = this.callbacks).onDragEnd) === null || _b === void 0 ? void 0 : _b.call(_a, e);\n }));\n this._register(addDisposableListener(this.element, EventType.DROP, (e) => {\n var _a, _b;\n this.counter = 0;\n this.dragStartTime = 0;\n (_b = (_a = this.callbacks).onDrop) === null || _b === void 0 ? void 0 : _b.call(_a, e);\n }));\n }\n}\nconst H_REGEX = /(?[\\w\\-]+)?(?:#(?[\\w\\-]+))?(?(?:\\.(?:[\\w\\-]+))*)(?:@(?(?:[\\w\\_])+))?/;\nexport function h(tag, ...args) {\n let attributes;\n let children;\n if (Array.isArray(args[0])) {\n attributes = {};\n children = args[0];\n }\n else {\n attributes = args[0] || {};\n children = args[1];\n }\n const match = H_REGEX.exec(tag);\n if (!match || !match.groups) {\n throw new Error('Bad use of h');\n }\n const tagName = match.groups['tag'] || 'div';\n const el = document.createElement(tagName);\n if (match.groups['id']) {\n el.id = match.groups['id'];\n }\n const classNames = [];\n if (match.groups['class']) {\n for (const className of match.groups['class'].split('.')) {\n if (className !== '') {\n classNames.push(className);\n }\n }\n }\n if (attributes.className !== undefined) {\n for (const className of attributes.className.split('.')) {\n if (className !== '') {\n classNames.push(className);\n }\n }\n }\n if (classNames.length > 0) {\n el.className = classNames.join(' ');\n }\n const result = {};\n if (match.groups['name']) {\n result[match.groups['name']] = el;\n }\n if (children) {\n for (const c of children) {\n if (c instanceof HTMLElement) {\n el.appendChild(c);\n }\n else if (typeof c === 'string') {\n el.append(c);\n }\n else if ('root' in c) {\n Object.assign(result, c);\n el.appendChild(c.root);\n }\n }\n }\n for (const [key, value] of Object.entries(attributes)) {\n if (key === 'className') {\n continue;\n }\n else if (key === 'style') {\n for (const [cssKey, cssValue] of Object.entries(value)) {\n el.style.setProperty(camelCaseToHyphenCase(cssKey), typeof cssValue === 'number' ? cssValue + 'px' : '' + cssValue);\n }\n }\n else if (key === 'tabIndex') {\n el.tabIndex = value;\n }\n else {\n el.setAttribute(camelCaseToHyphenCase(key), value.toString());\n }\n }\n result['root'] = el;\n return result;\n}\nfunction camelCaseToHyphenCase(str) {\n return str.replace(/([a-z])([A-Z])/g, '$1-$2').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// ------ internal util\nexport var _util;\n(function (_util) {\n _util.serviceIds = new Map();\n _util.DI_TARGET = '$di$target';\n _util.DI_DEPENDENCIES = '$di$dependencies';\n function getServiceDependencies(ctor) {\n return ctor[_util.DI_DEPENDENCIES] || [];\n }\n _util.getServiceDependencies = getServiceDependencies;\n})(_util || (_util = {}));\nexport const IInstantiationService = createDecorator('instantiationService');\nfunction storeServiceDependency(id, target, index) {\n if (target[_util.DI_TARGET] === target) {\n target[_util.DI_DEPENDENCIES].push({ id, index });\n }\n else {\n target[_util.DI_DEPENDENCIES] = [{ id, index }];\n target[_util.DI_TARGET] = target;\n }\n}\n/**\n * The *only* valid way to create a {{ServiceIdentifier}}.\n */\nexport function createDecorator(serviceId) {\n if (_util.serviceIds.has(serviceId)) {\n return _util.serviceIds.get(serviceId);\n }\n const id = function (target, key, index) {\n if (arguments.length !== 3) {\n throw new Error('@IServiceName-decorator can only be used to decorate a parameter');\n }\n storeServiceDependency(id, target, index);\n };\n id.toString = () => serviceId;\n _util.serviceIds.set(serviceId, id);\n return id;\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 { createDecorator } from '../../../platform/instantiation/common/instantiation.js';\nexport const ICodeEditorService = createDecorator('codeEditorService');\n", "/*---------------------------------------------------------------------------------------------\n * 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 { createDecorator } from '../../../platform/instantiation/common/instantiation.js';\nexport const IModelService = createDecorator('modelService');\n", "import { createDecorator } from '../../../platform/instantiation/common/instantiation.js';\nexport const ITextModelService = createDecorator('textModelService');\n", "/*---------------------------------------------------------------------------------------------\n * 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 { Emitter } from './event.js';\nimport { Disposable } from './lifecycle.js';\nimport * as nls from '../../nls.js';\nexport class Action extends Disposable {\n constructor(id, label = '', cssClass = '', enabled = true, actionCallback) {\n super();\n this._onDidChange = this._register(new Emitter());\n this.onDidChange = this._onDidChange.event;\n this._enabled = true;\n this._id = id;\n this._label = label;\n this._cssClass = cssClass;\n this._enabled = enabled;\n this._actionCallback = actionCallback;\n }\n get id() {\n return this._id;\n }\n get label() {\n return this._label;\n }\n set label(value) {\n this._setLabel(value);\n }\n _setLabel(value) {\n if (this._label !== value) {\n this._label = value;\n this._onDidChange.fire({ label: value });\n }\n }\n get tooltip() {\n return this._tooltip || '';\n }\n set tooltip(value) {\n this._setTooltip(value);\n }\n _setTooltip(value) {\n if (this._tooltip !== value) {\n this._tooltip = value;\n this._onDidChange.fire({ tooltip: value });\n }\n }\n get class() {\n return this._cssClass;\n }\n set class(value) {\n this._setClass(value);\n }\n _setClass(value) {\n if (this._cssClass !== value) {\n this._cssClass = value;\n this._onDidChange.fire({ class: value });\n }\n }\n get enabled() {\n return this._enabled;\n }\n set enabled(value) {\n this._setEnabled(value);\n }\n _setEnabled(value) {\n if (this._enabled !== value) {\n this._enabled = value;\n this._onDidChange.fire({ enabled: value });\n }\n }\n get checked() {\n return this._checked;\n }\n set checked(value) {\n this._setChecked(value);\n }\n _setChecked(value) {\n if (this._checked !== value) {\n this._checked = value;\n this._onDidChange.fire({ checked: value });\n }\n }\n async run(event, data) {\n if (this._actionCallback) {\n await this._actionCallback(event);\n }\n }\n}\nexport class ActionRunner extends Disposable {\n constructor() {\n super(...arguments);\n this._onWillRun = this._register(new Emitter());\n this.onWillRun = this._onWillRun.event;\n this._onDidRun = this._register(new Emitter());\n this.onDidRun = this._onDidRun.event;\n }\n async run(action, context) {\n if (!action.enabled) {\n return;\n }\n this._onWillRun.fire({ action });\n let error = undefined;\n try {\n await this.runAction(action, context);\n }\n catch (e) {\n error = e;\n }\n this._onDidRun.fire({ action, error });\n }\n async runAction(action, context) {\n await action.run(context);\n }\n}\nexport class Separator {\n constructor() {\n this.id = Separator.ID;\n this.label = '';\n this.tooltip = '';\n this.class = 'separator';\n this.enabled = false;\n this.checked = false;\n }\n /**\n * Joins all non-empty lists of actions with separators.\n */\n static join(...actionLists) {\n let out = [];\n for (const list of actionLists) {\n if (!list.length) {\n // skip\n }\n else if (out.length) {\n out = [...out, new Separator(), ...list];\n }\n else {\n out = list;\n }\n }\n return out;\n }\n async run() { }\n}\nSeparator.ID = 'vs.actions.separator';\nexport class SubmenuAction {\n get actions() { return this._actions; }\n constructor(id, label, actions, cssClass) {\n this.tooltip = '';\n this.enabled = true;\n this.checked = undefined;\n this.id = id;\n this.label = label;\n this.class = cssClass;\n this._actions = actions;\n }\n async run() { }\n}\nexport class EmptySubmenuAction extends Action {\n constructor() {\n super(EmptySubmenuAction.ID, nls.localize('submenu.empty', '(empty)'), undefined, false);\n }\n}\nEmptySubmenuAction.ID = 'vs.actions.empty';\nexport function toAction(props) {\n var _a;\n return {\n id: props.id,\n label: props.label,\n class: props.class,\n enabled: (_a = props.enabled) !== null && _a !== void 0 ? _a : true,\n checked: props.checked,\n run: async (...args) => props.run(...args),\n tooltip: props.label\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 *--------------------------------------------------------------------------------------------*/\nimport { Codicon } from './codicons.js';\nexport var ThemeColor;\n(function (ThemeColor) {\n function isThemeColor(obj) {\n return obj && typeof obj === 'object' && typeof obj.id === 'string';\n }\n ThemeColor.isThemeColor = isThemeColor;\n})(ThemeColor || (ThemeColor = {}));\nexport var ThemeIcon;\n(function (ThemeIcon) {\n ThemeIcon.iconNameSegment = '[A-Za-z0-9]+';\n ThemeIcon.iconNameExpression = '[A-Za-z0-9-]+';\n ThemeIcon.iconModifierExpression = '~[A-Za-z]+';\n ThemeIcon.iconNameCharacter = '[A-Za-z0-9~-]';\n const ThemeIconIdRegex = new RegExp(`^(${ThemeIcon.iconNameExpression})(${ThemeIcon.iconModifierExpression})?$`);\n function asClassNameArray(icon) {\n const match = ThemeIconIdRegex.exec(icon.id);\n if (!match) {\n return asClassNameArray(Codicon.error);\n }\n const [, id, modifier] = match;\n const classNames = ['codicon', 'codicon-' + id];\n if (modifier) {\n classNames.push('codicon-modifier-' + modifier.substring(1));\n }\n return classNames;\n }\n ThemeIcon.asClassNameArray = asClassNameArray;\n function asClassName(icon) {\n return asClassNameArray(icon).join(' ');\n }\n ThemeIcon.asClassName = asClassName;\n function asCSSSelector(icon) {\n return '.' + asClassNameArray(icon).join('.');\n }\n ThemeIcon.asCSSSelector = asCSSSelector;\n function isThemeIcon(obj) {\n return obj && typeof obj === 'object' && typeof obj.id === 'string' && (typeof obj.color === 'undefined' || ThemeColor.isThemeColor(obj.color));\n }\n ThemeIcon.isThemeIcon = isThemeIcon;\n const _regexFromString = new RegExp(`^\\\\$\\\\((${ThemeIcon.iconNameExpression}(?:${ThemeIcon.iconModifierExpression})?)\\\\)$`);\n function fromString(str) {\n const match = _regexFromString.exec(str);\n if (!match) {\n return undefined;\n }\n const [, name] = match;\n return { id: name };\n }\n ThemeIcon.fromString = fromString;\n function fromId(id) {\n return { id };\n }\n ThemeIcon.fromId = fromId;\n function modify(icon, modifier) {\n let id = icon.id;\n const tildeIndex = id.lastIndexOf('~');\n if (tildeIndex !== -1) {\n id = id.substring(0, tildeIndex);\n }\n if (modifier) {\n id = `${id}~${modifier}`;\n }\n return { id };\n }\n ThemeIcon.modify = modify;\n function getModifier(icon) {\n const tildeIndex = icon.id.lastIndexOf('~');\n if (tildeIndex !== -1) {\n return icon.id.substring(tildeIndex + 1);\n }\n return undefined;\n }\n ThemeIcon.getModifier = getModifier;\n function isEqual(ti1, ti2) {\n var _a, _b;\n return ti1.id === ti2.id && ((_a = ti1.color) === null || _a === void 0 ? void 0 : _a.id) === ((_b = ti2.color) === null || _b === void 0 ? void 0 : _b.id);\n }\n ThemeIcon.isEqual = isEqual;\n})(ThemeIcon || (ThemeIcon = {}));\n", "/*---------------------------------------------------------------------------------------------\n * 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 { Emitter } from '../../../base/common/event.js';\nimport { Iterable } from '../../../base/common/iterator.js';\nimport { toDisposable } from '../../../base/common/lifecycle.js';\nimport { LinkedList } from '../../../base/common/linkedList.js';\nimport { validateConstraints } from '../../../base/common/types.js';\nimport { createDecorator } from '../../instantiation/common/instantiation.js';\nexport const ICommandService = createDecorator('commandService');\nexport const CommandsRegistry = new class {\n constructor() {\n this._commands = new Map();\n this._onDidRegisterCommand = new Emitter();\n this.onDidRegisterCommand = this._onDidRegisterCommand.event;\n }\n registerCommand(idOrCommand, handler) {\n if (!idOrCommand) {\n throw new Error(`invalid command`);\n }\n if (typeof idOrCommand === 'string') {\n if (!handler) {\n throw new Error(`invalid command`);\n }\n return this.registerCommand({ id: idOrCommand, handler });\n }\n // add argument validation if rich command metadata is provided\n if (idOrCommand.metadata && Array.isArray(idOrCommand.metadata.args)) {\n const constraints = [];\n for (const arg of idOrCommand.metadata.args) {\n constraints.push(arg.constraint);\n }\n const actualHandler = idOrCommand.handler;\n idOrCommand.handler = function (accessor, ...args) {\n validateConstraints(args, constraints);\n return actualHandler(accessor, ...args);\n };\n }\n // find a place to store the command\n const { id } = idOrCommand;\n let commands = this._commands.get(id);\n if (!commands) {\n commands = new LinkedList();\n this._commands.set(id, commands);\n }\n const removeFn = commands.unshift(idOrCommand);\n const ret = toDisposable(() => {\n removeFn();\n const command = this._commands.get(id);\n if (command === null || command === void 0 ? void 0 : command.isEmpty()) {\n this._commands.delete(id);\n }\n });\n // tell the world about this command\n this._onDidRegisterCommand.fire(id);\n return ret;\n }\n registerCommandAlias(oldId, newId) {\n return CommandsRegistry.registerCommand(oldId, (accessor, ...args) => accessor.get(ICommandService).executeCommand(newId, ...args));\n }\n getCommand(id) {\n const list = this._commands.get(id);\n if (!list || list.isEmpty()) {\n return undefined;\n }\n return Iterable.first(list);\n }\n getCommands() {\n const result = new Map();\n for (const key of this._commands.keys()) {\n const command = this.getCommand(key);\n if (command) {\n result.set(key, command);\n }\n }\n return result;\n }\n};\nCommandsRegistry.registerCommand('noop', () => { });\n", "/*---------------------------------------------------------------------------------------------\n * 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 { illegalState } from '../../../base/common/errors.js';\nimport { localize } from '../../../nls.js';\nfunction hintDidYouMean(...meant) {\n switch (meant.length) {\n case 1:\n return localize('contextkey.scanner.hint.didYouMean1', \"Did you mean {0}?\", meant[0]);\n case 2:\n return localize('contextkey.scanner.hint.didYouMean2', \"Did you mean {0} or {1}?\", meant[0], meant[1]);\n case 3:\n return localize('contextkey.scanner.hint.didYouMean3', \"Did you mean {0}, {1} or {2}?\", meant[0], meant[1], meant[2]);\n default: // we just don't expect that many\n return undefined;\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 * 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 constructor() {\n this._input = '';\n this._start = 0;\n this._current = 0;\n this._tokens = [];\n this._errors = [];\n // 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 this.stringRe = /[a-zA-Z0-9_<>\\-\\./\\\\:\\*\\?\\+\\[\\]\\^,#@;\"%\\$\\p{L}-]+/uy;\n }\n static getLexeme(token) {\n switch (token.type) {\n case 0 /* TokenType.LParen */:\n return '(';\n case 1 /* TokenType.RParen */:\n return ')';\n case 2 /* TokenType.Neg */:\n return '!';\n case 3 /* TokenType.Eq */:\n return token.isTripleEq ? '===' : '==';\n case 4 /* TokenType.NotEq */:\n return token.isTripleEq ? '!==' : '!=';\n case 5 /* TokenType.Lt */:\n return '<';\n case 6 /* TokenType.LtEq */:\n return '<=';\n case 7 /* TokenType.Gt */:\n return '>=';\n case 8 /* TokenType.GtEq */:\n return '>=';\n case 9 /* TokenType.RegexOp */:\n return '=~';\n case 10 /* TokenType.RegexStr */:\n return token.lexeme;\n case 11 /* TokenType.True */:\n return 'true';\n case 12 /* TokenType.False */:\n return 'false';\n case 13 /* TokenType.In */:\n return 'in';\n case 14 /* TokenType.Not */:\n return 'not';\n case 15 /* TokenType.And */:\n return '&&';\n case 16 /* TokenType.Or */:\n return '||';\n case 17 /* TokenType.Str */:\n return token.lexeme;\n case 18 /* TokenType.QuotedStr */:\n return token.lexeme;\n case 19 /* TokenType.Error */:\n return token.lexeme;\n case 20 /* TokenType.EOF */:\n return 'EOF';\n default:\n throw illegalState(`unhandled token type: ${JSON.stringify(token)}; have you forgotten to add a case?`);\n }\n }\n reset(value) {\n this._input = value;\n this._start = 0;\n this._current = 0;\n this._tokens = [];\n this._errors = [];\n return this;\n }\n scan() {\n while (!this._isAtEnd()) {\n this._start = this._current;\n const ch = this._advance();\n switch (ch) {\n case 40 /* CharCode.OpenParen */:\n this._addToken(0 /* TokenType.LParen */);\n break;\n case 41 /* CharCode.CloseParen */:\n this._addToken(1 /* TokenType.RParen */);\n break;\n case 33 /* CharCode.ExclamationMark */:\n if (this._match(61 /* CharCode.Equals */)) {\n const isTripleEq = this._match(61 /* CharCode.Equals */); // eat last `=` if `!==`\n this._tokens.push({ type: 4 /* TokenType.NotEq */, offset: this._start, isTripleEq });\n }\n else {\n this._addToken(2 /* TokenType.Neg */);\n }\n break;\n case 39 /* CharCode.SingleQuote */:\n this._quotedString();\n break;\n case 47 /* CharCode.Slash */:\n this._regex();\n break;\n case 61 /* CharCode.Equals */:\n if (this._match(61 /* CharCode.Equals */)) { // support `==`\n const isTripleEq = this._match(61 /* CharCode.Equals */); // eat last `=` if `===`\n this._tokens.push({ type: 3 /* TokenType.Eq */, offset: this._start, isTripleEq });\n }\n else if (this._match(126 /* CharCode.Tilde */)) {\n this._addToken(9 /* TokenType.RegexOp */);\n }\n else {\n this._error(hintDidYouMean('==', '=~'));\n }\n break;\n case 60 /* CharCode.LessThan */:\n this._addToken(this._match(61 /* CharCode.Equals */) ? 6 /* TokenType.LtEq */ : 5 /* TokenType.Lt */);\n break;\n case 62 /* CharCode.GreaterThan */:\n this._addToken(this._match(61 /* CharCode.Equals */) ? 8 /* TokenType.GtEq */ : 7 /* TokenType.Gt */);\n break;\n case 38 /* CharCode.Ampersand */:\n if (this._match(38 /* CharCode.Ampersand */)) {\n this._addToken(15 /* TokenType.And */);\n }\n else {\n this._error(hintDidYouMean('&&'));\n }\n break;\n case 124 /* CharCode.Pipe */:\n if (this._match(124 /* CharCode.Pipe */)) {\n this._addToken(16 /* TokenType.Or */);\n }\n else {\n this._error(hintDidYouMean('||'));\n }\n break;\n // TODO@ulugbekna: 1) rewrite using a regex 2) reconsider what characters are considered whitespace, including unicode, nbsp, etc.\n case 32 /* CharCode.Space */:\n case 13 /* CharCode.CarriageReturn */:\n case 9 /* CharCode.Tab */:\n case 10 /* CharCode.LineFeed */:\n case 160 /* CharCode.NoBreakSpace */: //  \n break;\n default:\n this._string();\n }\n }\n this._start = this._current;\n this._addToken(20 /* TokenType.EOF */);\n return Array.from(this._tokens);\n }\n _match(expected) {\n if (this._isAtEnd()) {\n return false;\n }\n if (this._input.charCodeAt(this._current) !== expected) {\n return false;\n }\n this._current++;\n return true;\n }\n _advance() {\n return this._input.charCodeAt(this._current++);\n }\n _peek() {\n return this._isAtEnd() ? 0 /* CharCode.Null */ : this._input.charCodeAt(this._current);\n }\n _addToken(type) {\n this._tokens.push({ type, offset: this._start });\n }\n _error(additional) {\n const offset = this._start;\n const lexeme = this._input.substring(this._start, this._current);\n const errToken = { type: 19 /* TokenType.Error */, offset: this._start, lexeme };\n this._errors.push({ offset, lexeme, additionalInfo: additional });\n this._tokens.push(errToken);\n }\n _string() {\n this.stringRe.lastIndex = this._start;\n const match = this.stringRe.exec(this._input);\n if (match) {\n this._current = this._start + match[0].length;\n const lexeme = this._input.substring(this._start, this._current);\n const keyword = Scanner._keywords.get(lexeme);\n if (keyword) {\n this._addToken(keyword);\n }\n else {\n this._tokens.push({ type: 17 /* TokenType.Str */, lexeme, offset: this._start });\n }\n }\n }\n // captures the lexeme without the leading and trailing '\n _quotedString() {\n while (this._peek() !== 39 /* CharCode.SingleQuote */ && !this._isAtEnd()) { // TODO@ulugbekna: add support for escaping ' ?\n this._advance();\n }\n if (this._isAtEnd()) {\n this._error(hintDidYouForgetToOpenOrCloseQuote);\n return;\n }\n // consume the closing '\n this._advance();\n this._tokens.push({ type: 18 /* TokenType.QuotedStr */, lexeme: this._input.substring(this._start + 1, this._current - 1), offset: this._start + 1 });\n }\n /*\n * Lexing a regex expression: /.../[igsmyu]*\n * Based on https://github.com/microsoft/TypeScript/blob/9247ef115e617805983740ba795d7a8164babf89/src/compiler/scanner.ts#L2129-L2181\n *\n * Note that we want slashes within a regex to be escaped, e.g., /file:\\\\/\\\\/\\\\// should match `file:///`\n */\n _regex() {\n let p = this._current;\n let inEscape = false;\n let inCharacterClass = false;\n while (true) {\n if (p >= this._input.length) {\n this._current = p;\n this._error(hintDidYouForgetToEscapeSlash);\n return;\n }\n const ch = this._input.charCodeAt(p);\n if (inEscape) { // parsing an escape character\n inEscape = false;\n }\n else if (ch === 47 /* CharCode.Slash */ && !inCharacterClass) { // end of regex\n p++;\n break;\n }\n else if (ch === 91 /* CharCode.OpenSquareBracket */) {\n inCharacterClass = true;\n }\n else if (ch === 92 /* CharCode.Backslash */) {\n inEscape = true;\n }\n else if (ch === 93 /* CharCode.CloseSquareBracket */) {\n inCharacterClass = false;\n }\n p++;\n }\n // Consume flags // TODO@ulugbekna: use regex instead\n while (p < this._input.length && Scanner._regexFlags.has(this._input.charCodeAt(p))) {\n p++;\n }\n this._current = p;\n const lexeme = this._input.substring(this._start, this._current);\n this._tokens.push({ type: 10 /* TokenType.RegexStr */, lexeme, offset: this._start });\n }\n _isAtEnd() {\n return this._current >= this._input.length;\n }\n}\nScanner._regexFlags = new Set(['i', 'g', 's', 'm', 'y', 'u'].map(ch => ch.charCodeAt(0)));\nScanner._keywords = new Map([\n ['not', 14 /* TokenType.Not */],\n ['in', 13 /* TokenType.In */],\n ['false', 12 /* TokenType.False */],\n ['true', 11 /* TokenType.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 *--------------------------------------------------------------------------------------------*/\nimport { isChrome, isEdge, isFirefox, isLinux, isMacintosh, isSafari, isWeb, isWindows } from '../../../base/common/platform.js';\nimport { isFalsyOrWhitespace } from '../../../base/common/strings.js';\nimport { Scanner } from './scanner.js';\nimport { createDecorator } from '../../instantiation/common/instantiation.js';\nimport { localize } from '../../../nls.js';\nconst CONSTANT_VALUES = new Map();\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);\nconst hasOwnProperty = Object.prototype.hasOwnProperty;\nconst defaultConfig = {\n regexParsingWithErrorRecovery: true\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 * 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 constructor(_config = defaultConfig) {\n this._config = _config;\n // lifetime note: `_scanner` lives as long as the parser does, i.e., is not reset between calls to `parse`\n this._scanner = new Scanner();\n // lifetime note: `_tokens`, `_current`, and `_parsingErrors` must be reset between calls to `parse`\n this._tokens = [];\n this._current = 0; // invariant: 0 <= this._current < this._tokens.length ; any incrementation of this value must first call `_isAtEnd`\n this._parsingErrors = [];\n this._flagsGYRe = /g|y/g;\n }\n /**\n * Parse a context key expression.\n *\n * @param input the expression to parse\n * @returns the parsed expression or `undefined` if there's an error - call `lexingErrors` and `parsingErrors` to see the errors\n */\n parse(input) {\n if (input === '') {\n this._parsingErrors.push({ message: errorEmptyString, offset: 0, lexeme: '', additionalInfo: hintEmptyString });\n return undefined;\n }\n this._tokens = this._scanner.reset(input).scan();\n // @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 this._current = 0;\n this._parsingErrors = [];\n try {\n const expr = this._expr();\n if (!this._isAtEnd()) {\n const peek = this._peek();\n const additionalInfo = peek.type === 17 /* TokenType.Str */ ? hintUnexpectedToken : undefined;\n this._parsingErrors.push({ message: errorUnexpectedToken, offset: peek.offset, lexeme: Scanner.getLexeme(peek), additionalInfo });\n throw Parser._parseError;\n }\n return expr;\n }\n catch (e) {\n if (!(e === Parser._parseError)) {\n throw e;\n }\n return undefined;\n }\n }\n _expr() {\n return this._or();\n }\n _or() {\n const expr = [this._and()];\n while (this._matchOne(16 /* TokenType.Or */)) {\n const right = this._and();\n expr.push(right);\n }\n return expr.length === 1 ? expr[0] : ContextKeyExpr.or(...expr);\n }\n _and() {\n const expr = [this._term()];\n while (this._matchOne(15 /* TokenType.And */)) {\n const right = this._term();\n expr.push(right);\n }\n return expr.length === 1 ? expr[0] : ContextKeyExpr.and(...expr);\n }\n _term() {\n if (this._matchOne(2 /* TokenType.Neg */)) {\n const peek = this._peek();\n switch (peek.type) {\n case 11 /* TokenType.True */:\n this._advance();\n return ContextKeyFalseExpr.INSTANCE;\n case 12 /* TokenType.False */:\n this._advance();\n return ContextKeyTrueExpr.INSTANCE;\n case 0 /* TokenType.LParen */: {\n this._advance();\n const expr = this._expr();\n this._consume(1 /* TokenType.RParen */, errorClosingParenthesis);\n return expr === null || expr === void 0 ? void 0 : expr.negate();\n }\n case 17 /* TokenType.Str */:\n this._advance();\n return ContextKeyNotExpr.create(peek.lexeme);\n default:\n throw this._errExpectedButGot(`KEY | true | false | '(' expression ')'`, peek);\n }\n }\n return this._primary();\n }\n _primary() {\n const peek = this._peek();\n switch (peek.type) {\n case 11 /* TokenType.True */:\n this._advance();\n return ContextKeyExpr.true();\n case 12 /* TokenType.False */:\n this._advance();\n return ContextKeyExpr.false();\n case 0 /* TokenType.LParen */: {\n this._advance();\n const expr = this._expr();\n this._consume(1 /* TokenType.RParen */, errorClosingParenthesis);\n return expr;\n }\n case 17 /* TokenType.Str */: {\n // KEY\n const key = peek.lexeme;\n this._advance();\n // =~ regex\n if (this._matchOne(9 /* TokenType.RegexOp */)) {\n // @ulugbekna: we need to reconstruct the regex from the tokens because some extensions use unescaped slashes in regexes\n const expr = this._peek();\n if (!this._config.regexParsingWithErrorRecovery) {\n this._advance();\n if (expr.type !== 10 /* TokenType.RegexStr */) {\n throw this._errExpectedButGot(`REGEX`, expr);\n }\n const regexLexeme = expr.lexeme;\n const closingSlashIndex = regexLexeme.lastIndexOf('/');\n const flags = closingSlashIndex === regexLexeme.length - 1 ? undefined : this._removeFlagsGY(regexLexeme.substring(closingSlashIndex + 1));\n let regexp;\n try {\n regexp = new RegExp(regexLexeme.substring(1, closingSlashIndex), flags);\n }\n catch (e) {\n throw this._errExpectedButGot(`REGEX`, expr);\n }\n return ContextKeyRegexExpr.create(key, regexp);\n }\n switch (expr.type) {\n case 10 /* TokenType.RegexStr */:\n case 19 /* TokenType.Error */: { // also handle an ErrorToken in case of smth such as /(/file)/\n const lexemeReconstruction = [expr.lexeme]; // /REGEX/ or /REGEX/FLAGS\n this._advance();\n let followingToken = this._peek();\n let parenBalance = 0;\n for (let i = 0; i < expr.lexeme.length; i++) {\n if (expr.lexeme.charCodeAt(i) === 40 /* CharCode.OpenParen */) {\n parenBalance++;\n }\n else if (expr.lexeme.charCodeAt(i) === 41 /* CharCode.CloseParen */) {\n parenBalance--;\n }\n }\n while (!this._isAtEnd() && followingToken.type !== 15 /* TokenType.And */ && followingToken.type !== 16 /* TokenType.Or */) {\n switch (followingToken.type) {\n case 0 /* TokenType.LParen */:\n parenBalance++;\n break;\n case 1 /* TokenType.RParen */:\n parenBalance--;\n break;\n case 10 /* TokenType.RegexStr */:\n case 18 /* TokenType.QuotedStr */:\n for (let i = 0; i < followingToken.lexeme.length; i++) {\n if (followingToken.lexeme.charCodeAt(i) === 40 /* CharCode.OpenParen */) {\n parenBalance++;\n }\n else if (expr.lexeme.charCodeAt(i) === 41 /* CharCode.CloseParen */) {\n parenBalance--;\n }\n }\n }\n if (parenBalance < 0) {\n break;\n }\n lexemeReconstruction.push(Scanner.getLexeme(followingToken));\n this._advance();\n followingToken = this._peek();\n }\n const regexLexeme = lexemeReconstruction.join('');\n const closingSlashIndex = regexLexeme.lastIndexOf('/');\n const flags = closingSlashIndex === regexLexeme.length - 1 ? undefined : this._removeFlagsGY(regexLexeme.substring(closingSlashIndex + 1));\n let regexp;\n try {\n regexp = new RegExp(regexLexeme.substring(1, closingSlashIndex), flags);\n }\n catch (e) {\n throw this._errExpectedButGot(`REGEX`, expr);\n }\n return ContextKeyExpr.regex(key, regexp);\n }\n case 18 /* TokenType.QuotedStr */: {\n const serializedValue = expr.lexeme;\n this._advance();\n // replicate old regex parsing behavior\n let regex = null;\n if (!isFalsyOrWhitespace(serializedValue)) {\n const start = serializedValue.indexOf('/');\n const end = serializedValue.lastIndexOf('/');\n if (start !== end && start >= 0) {\n const value = serializedValue.slice(start + 1, end);\n const caseIgnoreFlag = serializedValue[end + 1] === 'i' ? 'i' : '';\n try {\n regex = new RegExp(value, caseIgnoreFlag);\n }\n catch (_e) {\n throw this._errExpectedButGot(`REGEX`, expr);\n }\n }\n }\n if (regex === null) {\n throw this._errExpectedButGot('REGEX', expr);\n }\n return ContextKeyRegexExpr.create(key, regex);\n }\n default:\n throw this._errExpectedButGot('REGEX', this._peek());\n }\n }\n // [ 'not' 'in' value ]\n if (this._matchOne(14 /* TokenType.Not */)) {\n this._consume(13 /* TokenType.In */, errorNoInAfterNot);\n const right = this._value();\n return ContextKeyExpr.notIn(key, right);\n }\n // [ ('==' | '!=' | '<' | '<=' | '>' | '>=' | 'in') value ]\n const maybeOp = this._peek().type;\n switch (maybeOp) {\n case 3 /* TokenType.Eq */: {\n this._advance();\n const right = this._value();\n if (this._previous().type === 18 /* TokenType.QuotedStr */) { // to preserve old parser behavior: \"foo == 'true'\" is preserved as \"foo == 'true'\", but \"foo == true\" is optimized as \"foo\"\n return ContextKeyExpr.equals(key, right);\n }\n switch (right) {\n case 'true':\n return ContextKeyExpr.has(key);\n case 'false':\n return ContextKeyExpr.not(key);\n default:\n return ContextKeyExpr.equals(key, right);\n }\n }\n case 4 /* TokenType.NotEq */: {\n this._advance();\n const right = this._value();\n if (this._previous().type === 18 /* TokenType.QuotedStr */) { // same as above with \"foo != 'true'\"\n return ContextKeyExpr.notEquals(key, right);\n }\n switch (right) {\n case 'true':\n return ContextKeyExpr.not(key);\n case 'false':\n return ContextKeyExpr.has(key);\n default:\n return ContextKeyExpr.notEquals(key, right);\n }\n }\n // 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 // consequently, package.json linter should _warn_ the user if they're passing undesired things to ops\n case 5 /* TokenType.Lt */:\n this._advance();\n return ContextKeySmallerExpr.create(key, this._value());\n case 6 /* TokenType.LtEq */:\n this._advance();\n return ContextKeySmallerEqualsExpr.create(key, this._value());\n case 7 /* TokenType.Gt */:\n this._advance();\n return ContextKeyGreaterExpr.create(key, this._value());\n case 8 /* TokenType.GtEq */:\n this._advance();\n return ContextKeyGreaterEqualsExpr.create(key, this._value());\n case 13 /* TokenType.In */:\n this._advance();\n return ContextKeyExpr.in(key, this._value());\n default:\n return ContextKeyExpr.has(key);\n }\n }\n case 20 /* TokenType.EOF */:\n this._parsingErrors.push({ message: errorUnexpectedEOF, offset: peek.offset, lexeme: '', additionalInfo: hintUnexpectedEOF });\n throw Parser._parseError;\n default:\n throw this._errExpectedButGot(`true | false | KEY \\n\\t| KEY '=~' REGEX \\n\\t| KEY ('==' | '!=' | '<' | '<=' | '>' | '>=' | 'in' | 'not' 'in') value`, this._peek());\n }\n }\n _value() {\n const token = this._peek();\n switch (token.type) {\n case 17 /* TokenType.Str */:\n case 18 /* TokenType.QuotedStr */:\n this._advance();\n return token.lexeme;\n case 11 /* TokenType.True */:\n this._advance();\n return 'true';\n case 12 /* TokenType.False */:\n this._advance();\n return 'false';\n case 13 /* TokenType.In */: // we support `in` as a value, e.g., \"when\": \"languageId == in\" - exists in existing extensions\n this._advance();\n return 'in';\n default:\n // this allows \"when\": \"foo == \" which's used by existing extensions\n // we do not call `_advance` on purpose - we don't want to eat unintended tokens\n return '';\n }\n }\n _removeFlagsGY(flags) {\n return flags.replaceAll(this._flagsGYRe, '');\n }\n // careful: this can throw if current token is the initial one (ie index = 0)\n _previous() {\n return this._tokens[this._current - 1];\n }\n _matchOne(token) {\n if (this._check(token)) {\n this._advance();\n return true;\n }\n return false;\n }\n _advance() {\n if (!this._isAtEnd()) {\n this._current++;\n }\n return this._previous();\n }\n _consume(type, message) {\n if (this._check(type)) {\n return this._advance();\n }\n throw this._errExpectedButGot(message, this._peek());\n }\n _errExpectedButGot(expected, got, additionalInfo) {\n const message = localize('contextkey.parser.error.expectedButGot', \"Expected: {0}\\nReceived: '{1}'.\", expected, Scanner.getLexeme(got));\n const offset = got.offset;\n const lexeme = Scanner.getLexeme(got);\n this._parsingErrors.push({ message, offset, lexeme, additionalInfo });\n return Parser._parseError;\n }\n _check(type) {\n return this._peek().type === type;\n }\n _peek() {\n return this._tokens[this._current];\n }\n _isAtEnd() {\n return this._peek().type === 20 /* TokenType.EOF */;\n }\n}\n// Note: this doesn't produce an exact syntax tree but a normalized one\n// ContextKeyExpression's that we use as AST nodes do not expose constructors that do not normalize\nParser._parseError = new Error();\nexport class ContextKeyExpr {\n static false() {\n return ContextKeyFalseExpr.INSTANCE;\n }\n static true() {\n return ContextKeyTrueExpr.INSTANCE;\n }\n static has(key) {\n return ContextKeyDefinedExpr.create(key);\n }\n static equals(key, value) {\n return ContextKeyEqualsExpr.create(key, value);\n }\n static notEquals(key, value) {\n return ContextKeyNotEqualsExpr.create(key, value);\n }\n static regex(key, value) {\n return ContextKeyRegexExpr.create(key, value);\n }\n static in(key, value) {\n return ContextKeyInExpr.create(key, value);\n }\n static notIn(key, value) {\n return ContextKeyNotInExpr.create(key, value);\n }\n static not(key) {\n return ContextKeyNotExpr.create(key);\n }\n static and(...expr) {\n return ContextKeyAndExpr.create(expr, null, true);\n }\n static or(...expr) {\n return ContextKeyOrExpr.create(expr, null, true);\n }\n static deserialize(serialized) {\n if (serialized === undefined || serialized === null) { // an empty string needs to be handled by the parser to get a corresponding parsing error reported\n return undefined;\n }\n const expr = this._parser.parse(serialized);\n return expr;\n }\n}\nContextKeyExpr._parser = new Parser({ regexParsingWithErrorRecovery: false });\nexport function expressionsAreEqualWithConstantSubstitution(a, b) {\n const aExpr = a ? a.substituteConstants() : undefined;\n const bExpr = b ? b.substituteConstants() : undefined;\n if (!aExpr && !bExpr) {\n return true;\n }\n if (!aExpr || !bExpr) {\n return false;\n }\n return aExpr.equals(bExpr);\n}\nfunction cmp(a, b) {\n return a.cmp(b);\n}\nexport class ContextKeyFalseExpr {\n constructor() {\n this.type = 0 /* ContextKeyExprType.False */;\n }\n cmp(other) {\n return this.type - other.type;\n }\n equals(other) {\n return (other.type === this.type);\n }\n substituteConstants() {\n return this;\n }\n evaluate(context) {\n return false;\n }\n serialize() {\n return 'false';\n }\n keys() {\n return [];\n }\n negate() {\n return ContextKeyTrueExpr.INSTANCE;\n }\n}\nContextKeyFalseExpr.INSTANCE = new ContextKeyFalseExpr();\nexport class ContextKeyTrueExpr {\n constructor() {\n this.type = 1 /* ContextKeyExprType.True */;\n }\n cmp(other) {\n return this.type - other.type;\n }\n equals(other) {\n return (other.type === this.type);\n }\n substituteConstants() {\n return this;\n }\n evaluate(context) {\n return true;\n }\n serialize() {\n return 'true';\n }\n keys() {\n return [];\n }\n negate() {\n return ContextKeyFalseExpr.INSTANCE;\n }\n}\nContextKeyTrueExpr.INSTANCE = new ContextKeyTrueExpr();\nexport class ContextKeyDefinedExpr {\n static create(key, negated = null) {\n const constantValue = CONSTANT_VALUES.get(key);\n if (typeof constantValue === 'boolean') {\n return constantValue ? ContextKeyTrueExpr.INSTANCE : ContextKeyFalseExpr.INSTANCE;\n }\n return new ContextKeyDefinedExpr(key, negated);\n }\n constructor(key, negated) {\n this.key = key;\n this.negated = negated;\n this.type = 2 /* ContextKeyExprType.Defined */;\n }\n cmp(other) {\n if (other.type !== this.type) {\n return this.type - other.type;\n }\n return cmp1(this.key, other.key);\n }\n equals(other) {\n if (other.type === this.type) {\n return (this.key === other.key);\n }\n return false;\n }\n substituteConstants() {\n const constantValue = CONSTANT_VALUES.get(this.key);\n if (typeof constantValue === 'boolean') {\n return constantValue ? ContextKeyTrueExpr.INSTANCE : ContextKeyFalseExpr.INSTANCE;\n }\n return this;\n }\n evaluate(context) {\n return (!!context.getValue(this.key));\n }\n serialize() {\n return this.key;\n }\n keys() {\n return [this.key];\n }\n negate() {\n if (!this.negated) {\n this.negated = ContextKeyNotExpr.create(this.key, this);\n }\n return this.negated;\n }\n}\nexport class ContextKeyEqualsExpr {\n static create(key, value, negated = null) {\n if (typeof value === 'boolean') {\n return (value ? ContextKeyDefinedExpr.create(key, negated) : ContextKeyNotExpr.create(key, negated));\n }\n const constantValue = CONSTANT_VALUES.get(key);\n if (typeof constantValue === 'boolean') {\n const trueValue = constantValue ? 'true' : 'false';\n return (value === trueValue ? ContextKeyTrueExpr.INSTANCE : ContextKeyFalseExpr.INSTANCE);\n }\n return new ContextKeyEqualsExpr(key, value, negated);\n }\n constructor(key, value, negated) {\n this.key = key;\n this.value = value;\n this.negated = negated;\n this.type = 4 /* ContextKeyExprType.Equals */;\n }\n cmp(other) {\n if (other.type !== this.type) {\n return this.type - other.type;\n }\n return cmp2(this.key, this.value, other.key, other.value);\n }\n equals(other) {\n if (other.type === this.type) {\n return (this.key === other.key && this.value === other.value);\n }\n return false;\n }\n substituteConstants() {\n const constantValue = CONSTANT_VALUES.get(this.key);\n if (typeof constantValue === 'boolean') {\n const trueValue = constantValue ? 'true' : 'false';\n return (this.value === trueValue ? ContextKeyTrueExpr.INSTANCE : ContextKeyFalseExpr.INSTANCE);\n }\n return this;\n }\n evaluate(context) {\n // Intentional ==\n // eslint-disable-next-line eqeqeq\n return (context.getValue(this.key) == this.value);\n }\n serialize() {\n return `${this.key} == '${this.value}'`;\n }\n keys() {\n return [this.key];\n }\n negate() {\n if (!this.negated) {\n this.negated = ContextKeyNotEqualsExpr.create(this.key, this.value, this);\n }\n return this.negated;\n }\n}\nexport class ContextKeyInExpr {\n static create(key, valueKey) {\n return new ContextKeyInExpr(key, valueKey);\n }\n constructor(key, valueKey) {\n this.key = key;\n this.valueKey = valueKey;\n this.type = 10 /* ContextKeyExprType.In */;\n this.negated = null;\n }\n cmp(other) {\n if (other.type !== this.type) {\n return this.type - other.type;\n }\n return cmp2(this.key, this.valueKey, other.key, other.valueKey);\n }\n equals(other) {\n if (other.type === this.type) {\n return (this.key === other.key && this.valueKey === other.valueKey);\n }\n return false;\n }\n substituteConstants() {\n return this;\n }\n evaluate(context) {\n const source = context.getValue(this.valueKey);\n const item = context.getValue(this.key);\n if (Array.isArray(source)) {\n return source.includes(item);\n }\n if (typeof item === 'string' && typeof source === 'object' && source !== null) {\n return hasOwnProperty.call(source, item);\n }\n return false;\n }\n serialize() {\n return `${this.key} in '${this.valueKey}'`;\n }\n keys() {\n return [this.key, this.valueKey];\n }\n negate() {\n if (!this.negated) {\n this.negated = ContextKeyNotInExpr.create(this.key, this.valueKey);\n }\n return this.negated;\n }\n}\nexport class ContextKeyNotInExpr {\n static create(key, valueKey) {\n return new ContextKeyNotInExpr(key, valueKey);\n }\n constructor(key, valueKey) {\n this.key = key;\n this.valueKey = valueKey;\n this.type = 11 /* ContextKeyExprType.NotIn */;\n this._negated = ContextKeyInExpr.create(key, valueKey);\n }\n cmp(other) {\n if (other.type !== this.type) {\n return this.type - other.type;\n }\n return this._negated.cmp(other._negated);\n }\n equals(other) {\n if (other.type === this.type) {\n return this._negated.equals(other._negated);\n }\n return false;\n }\n substituteConstants() {\n return this;\n }\n evaluate(context) {\n return !this._negated.evaluate(context);\n }\n serialize() {\n return `${this.key} not in '${this.valueKey}'`;\n }\n keys() {\n return this._negated.keys();\n }\n negate() {\n return this._negated;\n }\n}\nexport class ContextKeyNotEqualsExpr {\n static create(key, value, negated = null) {\n if (typeof value === 'boolean') {\n if (value) {\n return ContextKeyNotExpr.create(key, negated);\n }\n return ContextKeyDefinedExpr.create(key, negated);\n }\n const constantValue = CONSTANT_VALUES.get(key);\n if (typeof constantValue === 'boolean') {\n const falseValue = constantValue ? 'true' : 'false';\n return (value === falseValue ? ContextKeyFalseExpr.INSTANCE : ContextKeyTrueExpr.INSTANCE);\n }\n return new ContextKeyNotEqualsExpr(key, value, negated);\n }\n constructor(key, value, negated) {\n this.key = key;\n this.value = value;\n this.negated = negated;\n this.type = 5 /* ContextKeyExprType.NotEquals */;\n }\n cmp(other) {\n if (other.type !== this.type) {\n return this.type - other.type;\n }\n return cmp2(this.key, this.value, other.key, other.value);\n }\n equals(other) {\n if (other.type === this.type) {\n return (this.key === other.key && this.value === other.value);\n }\n return false;\n }\n substituteConstants() {\n const constantValue = CONSTANT_VALUES.get(this.key);\n if (typeof constantValue === 'boolean') {\n const falseValue = constantValue ? 'true' : 'false';\n return (this.value === falseValue ? ContextKeyFalseExpr.INSTANCE : ContextKeyTrueExpr.INSTANCE);\n }\n return this;\n }\n evaluate(context) {\n // Intentional !=\n // eslint-disable-next-line eqeqeq\n return (context.getValue(this.key) != this.value);\n }\n serialize() {\n return `${this.key} != '${this.value}'`;\n }\n keys() {\n return [this.key];\n }\n negate() {\n if (!this.negated) {\n this.negated = ContextKeyEqualsExpr.create(this.key, this.value, this);\n }\n return this.negated;\n }\n}\nexport class ContextKeyNotExpr {\n static create(key, negated = null) {\n const constantValue = CONSTANT_VALUES.get(key);\n if (typeof constantValue === 'boolean') {\n return (constantValue ? ContextKeyFalseExpr.INSTANCE : ContextKeyTrueExpr.INSTANCE);\n }\n return new ContextKeyNotExpr(key, negated);\n }\n constructor(key, negated) {\n this.key = key;\n this.negated = negated;\n this.type = 3 /* ContextKeyExprType.Not */;\n }\n cmp(other) {\n if (other.type !== this.type) {\n return this.type - other.type;\n }\n return cmp1(this.key, other.key);\n }\n equals(other) {\n if (other.type === this.type) {\n return (this.key === other.key);\n }\n return false;\n }\n substituteConstants() {\n const constantValue = CONSTANT_VALUES.get(this.key);\n if (typeof constantValue === 'boolean') {\n return (constantValue ? ContextKeyFalseExpr.INSTANCE : ContextKeyTrueExpr.INSTANCE);\n }\n return this;\n }\n evaluate(context) {\n return (!context.getValue(this.key));\n }\n serialize() {\n return `!${this.key}`;\n }\n keys() {\n return [this.key];\n }\n negate() {\n if (!this.negated) {\n this.negated = ContextKeyDefinedExpr.create(this.key, this);\n }\n return this.negated;\n }\n}\nfunction withFloatOrStr(value, callback) {\n if (typeof value === 'string') {\n const n = parseFloat(value);\n if (!isNaN(n)) {\n value = n;\n }\n }\n if (typeof value === 'string' || typeof value === 'number') {\n return callback(value);\n }\n return ContextKeyFalseExpr.INSTANCE;\n}\nexport class ContextKeyGreaterExpr {\n static create(key, _value, negated = null) {\n return withFloatOrStr(_value, (value) => new ContextKeyGreaterExpr(key, value, negated));\n }\n constructor(key, value, negated) {\n this.key = key;\n this.value = value;\n this.negated = negated;\n this.type = 12 /* ContextKeyExprType.Greater */;\n }\n cmp(other) {\n if (other.type !== this.type) {\n return this.type - other.type;\n }\n return cmp2(this.key, this.value, other.key, other.value);\n }\n equals(other) {\n if (other.type === this.type) {\n return (this.key === other.key && this.value === other.value);\n }\n return false;\n }\n substituteConstants() {\n return this;\n }\n evaluate(context) {\n if (typeof this.value === 'string') {\n return false;\n }\n return (parseFloat(context.getValue(this.key)) > this.value);\n }\n serialize() {\n return `${this.key} > ${this.value}`;\n }\n keys() {\n return [this.key];\n }\n negate() {\n if (!this.negated) {\n this.negated = ContextKeySmallerEqualsExpr.create(this.key, this.value, this);\n }\n return this.negated;\n }\n}\nexport class ContextKeyGreaterEqualsExpr {\n static create(key, _value, negated = null) {\n return withFloatOrStr(_value, (value) => new ContextKeyGreaterEqualsExpr(key, value, negated));\n }\n constructor(key, value, negated) {\n this.key = key;\n this.value = value;\n this.negated = negated;\n this.type = 13 /* ContextKeyExprType.GreaterEquals */;\n }\n cmp(other) {\n if (other.type !== this.type) {\n return this.type - other.type;\n }\n return cmp2(this.key, this.value, other.key, other.value);\n }\n equals(other) {\n if (other.type === this.type) {\n return (this.key === other.key && this.value === other.value);\n }\n return false;\n }\n substituteConstants() {\n return this;\n }\n evaluate(context) {\n if (typeof this.value === 'string') {\n return false;\n }\n return (parseFloat(context.getValue(this.key)) >= this.value);\n }\n serialize() {\n return `${this.key} >= ${this.value}`;\n }\n keys() {\n return [this.key];\n }\n negate() {\n if (!this.negated) {\n this.negated = ContextKeySmallerExpr.create(this.key, this.value, this);\n }\n return this.negated;\n }\n}\nexport class ContextKeySmallerExpr {\n static create(key, _value, negated = null) {\n return withFloatOrStr(_value, (value) => new ContextKeySmallerExpr(key, value, negated));\n }\n constructor(key, value, negated) {\n this.key = key;\n this.value = value;\n this.negated = negated;\n this.type = 14 /* ContextKeyExprType.Smaller */;\n }\n cmp(other) {\n if (other.type !== this.type) {\n return this.type - other.type;\n }\n return cmp2(this.key, this.value, other.key, other.value);\n }\n equals(other) {\n if (other.type === this.type) {\n return (this.key === other.key && this.value === other.value);\n }\n return false;\n }\n substituteConstants() {\n return this;\n }\n evaluate(context) {\n if (typeof this.value === 'string') {\n return false;\n }\n return (parseFloat(context.getValue(this.key)) < this.value);\n }\n serialize() {\n return `${this.key} < ${this.value}`;\n }\n keys() {\n return [this.key];\n }\n negate() {\n if (!this.negated) {\n this.negated = ContextKeyGreaterEqualsExpr.create(this.key, this.value, this);\n }\n return this.negated;\n }\n}\nexport class ContextKeySmallerEqualsExpr {\n static create(key, _value, negated = null) {\n return withFloatOrStr(_value, (value) => new ContextKeySmallerEqualsExpr(key, value, negated));\n }\n constructor(key, value, negated) {\n this.key = key;\n this.value = value;\n this.negated = negated;\n this.type = 15 /* ContextKeyExprType.SmallerEquals */;\n }\n cmp(other) {\n if (other.type !== this.type) {\n return this.type - other.type;\n }\n return cmp2(this.key, this.value, other.key, other.value);\n }\n equals(other) {\n if (other.type === this.type) {\n return (this.key === other.key && this.value === other.value);\n }\n return false;\n }\n substituteConstants() {\n return this;\n }\n evaluate(context) {\n if (typeof this.value === 'string') {\n return false;\n }\n return (parseFloat(context.getValue(this.key)) <= this.value);\n }\n serialize() {\n return `${this.key} <= ${this.value}`;\n }\n keys() {\n return [this.key];\n }\n negate() {\n if (!this.negated) {\n this.negated = ContextKeyGreaterExpr.create(this.key, this.value, this);\n }\n return this.negated;\n }\n}\nexport class ContextKeyRegexExpr {\n static create(key, regexp) {\n return new ContextKeyRegexExpr(key, regexp);\n }\n constructor(key, regexp) {\n this.key = key;\n this.regexp = regexp;\n this.type = 7 /* ContextKeyExprType.Regex */;\n this.negated = null;\n //\n }\n cmp(other) {\n if (other.type !== this.type) {\n return this.type - other.type;\n }\n if (this.key < other.key) {\n return -1;\n }\n if (this.key > other.key) {\n return 1;\n }\n const thisSource = this.regexp ? this.regexp.source : '';\n const otherSource = other.regexp ? other.regexp.source : '';\n if (thisSource < otherSource) {\n return -1;\n }\n if (thisSource > otherSource) {\n return 1;\n }\n return 0;\n }\n equals(other) {\n if (other.type === this.type) {\n const thisSource = this.regexp ? this.regexp.source : '';\n const otherSource = other.regexp ? other.regexp.source : '';\n return (this.key === other.key && thisSource === otherSource);\n }\n return false;\n }\n substituteConstants() {\n return this;\n }\n evaluate(context) {\n const value = context.getValue(this.key);\n return this.regexp ? this.regexp.test(value) : false;\n }\n serialize() {\n const value = this.regexp\n ? `/${this.regexp.source}/${this.regexp.flags}`\n : '/invalid/';\n return `${this.key} =~ ${value}`;\n }\n keys() {\n return [this.key];\n }\n negate() {\n if (!this.negated) {\n this.negated = ContextKeyNotRegexExpr.create(this);\n }\n return this.negated;\n }\n}\nexport class ContextKeyNotRegexExpr {\n static create(actual) {\n return new ContextKeyNotRegexExpr(actual);\n }\n constructor(_actual) {\n this._actual = _actual;\n this.type = 8 /* ContextKeyExprType.NotRegex */;\n //\n }\n cmp(other) {\n if (other.type !== this.type) {\n return this.type - other.type;\n }\n return this._actual.cmp(other._actual);\n }\n equals(other) {\n if (other.type === this.type) {\n return this._actual.equals(other._actual);\n }\n return false;\n }\n substituteConstants() {\n return this;\n }\n evaluate(context) {\n return !this._actual.evaluate(context);\n }\n serialize() {\n return `!(${this._actual.serialize()})`;\n }\n keys() {\n return this._actual.keys();\n }\n negate() {\n return this._actual;\n }\n}\n/**\n * @returns the same instance if nothing changed.\n */\nfunction eliminateConstantsInArray(arr) {\n // Allocate array only if there is a difference\n let newArr = null;\n for (let i = 0, len = arr.length; i < len; i++) {\n const newExpr = arr[i].substituteConstants();\n if (arr[i] !== newExpr) {\n // something has changed!\n // allocate array on first difference\n if (newArr === null) {\n newArr = [];\n for (let j = 0; j < i; j++) {\n newArr[j] = arr[j];\n }\n }\n }\n if (newArr !== null) {\n newArr[i] = newExpr;\n }\n }\n if (newArr === null) {\n return arr;\n }\n return newArr;\n}\nexport class ContextKeyAndExpr {\n static create(_expr, negated, extraRedundantCheck) {\n return ContextKeyAndExpr._normalizeArr(_expr, negated, extraRedundantCheck);\n }\n constructor(expr, negated) {\n this.expr = expr;\n this.negated = negated;\n this.type = 6 /* ContextKeyExprType.And */;\n }\n cmp(other) {\n if (other.type !== this.type) {\n return this.type - other.type;\n }\n if (this.expr.length < other.expr.length) {\n return -1;\n }\n if (this.expr.length > other.expr.length) {\n return 1;\n }\n for (let i = 0, len = this.expr.length; i < len; i++) {\n const r = cmp(this.expr[i], other.expr[i]);\n if (r !== 0) {\n return r;\n }\n }\n return 0;\n }\n equals(other) {\n if (other.type === this.type) {\n if (this.expr.length !== other.expr.length) {\n return false;\n }\n for (let i = 0, len = this.expr.length; i < len; i++) {\n if (!this.expr[i].equals(other.expr[i])) {\n return false;\n }\n }\n return true;\n }\n return false;\n }\n substituteConstants() {\n const exprArr = eliminateConstantsInArray(this.expr);\n if (exprArr === this.expr) {\n // no change\n return this;\n }\n return ContextKeyAndExpr.create(exprArr, this.negated, false);\n }\n evaluate(context) {\n for (let i = 0, len = this.expr.length; i < len; i++) {\n if (!this.expr[i].evaluate(context)) {\n return false;\n }\n }\n return true;\n }\n static _normalizeArr(arr, negated, extraRedundantCheck) {\n const expr = [];\n let hasTrue = false;\n for (const e of arr) {\n if (!e) {\n continue;\n }\n if (e.type === 1 /* ContextKeyExprType.True */) {\n // anything && true ==> anything\n hasTrue = true;\n continue;\n }\n if (e.type === 0 /* ContextKeyExprType.False */) {\n // anything && false ==> false\n return ContextKeyFalseExpr.INSTANCE;\n }\n if (e.type === 6 /* ContextKeyExprType.And */) {\n expr.push(...e.expr);\n continue;\n }\n expr.push(e);\n }\n if (expr.length === 0 && hasTrue) {\n return ContextKeyTrueExpr.INSTANCE;\n }\n if (expr.length === 0) {\n return undefined;\n }\n if (expr.length === 1) {\n return expr[0];\n }\n expr.sort(cmp);\n // eliminate duplicate terms\n for (let i = 1; i < expr.length; i++) {\n if (expr[i - 1].equals(expr[i])) {\n expr.splice(i, 1);\n i--;\n }\n }\n if (expr.length === 1) {\n return expr[0];\n }\n // We must distribute any OR expression because we don't support parens\n // OR extensions will be at the end (due to sorting rules)\n while (expr.length > 1) {\n const lastElement = expr[expr.length - 1];\n if (lastElement.type !== 9 /* ContextKeyExprType.Or */) {\n break;\n }\n // pop the last element\n expr.pop();\n // pop the second to last element\n const secondToLastElement = expr.pop();\n const isFinished = (expr.length === 0);\n // distribute `lastElement` over `secondToLastElement`\n const resultElement = ContextKeyOrExpr.create(lastElement.expr.map(el => ContextKeyAndExpr.create([el, secondToLastElement], null, extraRedundantCheck)), null, isFinished);\n if (resultElement) {\n expr.push(resultElement);\n expr.sort(cmp);\n }\n }\n if (expr.length === 1) {\n return expr[0];\n }\n // resolve false AND expressions\n if (extraRedundantCheck) {\n for (let i = 0; i < expr.length; i++) {\n for (let j = i + 1; j < expr.length; j++) {\n if (expr[i].negate().equals(expr[j])) {\n // A && !A case\n return ContextKeyFalseExpr.INSTANCE;\n }\n }\n }\n if (expr.length === 1) {\n return expr[0];\n }\n }\n return new ContextKeyAndExpr(expr, negated);\n }\n serialize() {\n return this.expr.map(e => e.serialize()).join(' && ');\n }\n keys() {\n const result = [];\n for (const expr of this.expr) {\n result.push(...expr.keys());\n }\n return result;\n }\n negate() {\n if (!this.negated) {\n const result = [];\n for (const expr of this.expr) {\n result.push(expr.negate());\n }\n this.negated = ContextKeyOrExpr.create(result, this, true);\n }\n return this.negated;\n }\n}\nexport class ContextKeyOrExpr {\n static create(_expr, negated, extraRedundantCheck) {\n return ContextKeyOrExpr._normalizeArr(_expr, negated, extraRedundantCheck);\n }\n constructor(expr, negated) {\n this.expr = expr;\n this.negated = negated;\n this.type = 9 /* ContextKeyExprType.Or */;\n }\n cmp(other) {\n if (other.type !== this.type) {\n return this.type - other.type;\n }\n if (this.expr.length < other.expr.length) {\n return -1;\n }\n if (this.expr.length > other.expr.length) {\n return 1;\n }\n for (let i = 0, len = this.expr.length; i < len; i++) {\n const r = cmp(this.expr[i], other.expr[i]);\n if (r !== 0) {\n return r;\n }\n }\n return 0;\n }\n equals(other) {\n if (other.type === this.type) {\n if (this.expr.length !== other.expr.length) {\n return false;\n }\n for (let i = 0, len = this.expr.length; i < len; i++) {\n if (!this.expr[i].equals(other.expr[i])) {\n return false;\n }\n }\n return true;\n }\n return false;\n }\n substituteConstants() {\n const exprArr = eliminateConstantsInArray(this.expr);\n if (exprArr === this.expr) {\n // no change\n return this;\n }\n return ContextKeyOrExpr.create(exprArr, this.negated, false);\n }\n evaluate(context) {\n for (let i = 0, len = this.expr.length; i < len; i++) {\n if (this.expr[i].evaluate(context)) {\n return true;\n }\n }\n return false;\n }\n static _normalizeArr(arr, negated, extraRedundantCheck) {\n let expr = [];\n let hasFalse = false;\n if (arr) {\n for (let i = 0, len = arr.length; i < len; i++) {\n const e = arr[i];\n if (!e) {\n continue;\n }\n if (e.type === 0 /* ContextKeyExprType.False */) {\n // anything || false ==> anything\n hasFalse = true;\n continue;\n }\n if (e.type === 1 /* ContextKeyExprType.True */) {\n // anything || true ==> true\n return ContextKeyTrueExpr.INSTANCE;\n }\n if (e.type === 9 /* ContextKeyExprType.Or */) {\n expr = expr.concat(e.expr);\n continue;\n }\n expr.push(e);\n }\n if (expr.length === 0 && hasFalse) {\n return ContextKeyFalseExpr.INSTANCE;\n }\n expr.sort(cmp);\n }\n if (expr.length === 0) {\n return undefined;\n }\n if (expr.length === 1) {\n return expr[0];\n }\n // eliminate duplicate terms\n for (let i = 1; i < expr.length; i++) {\n if (expr[i - 1].equals(expr[i])) {\n expr.splice(i, 1);\n i--;\n }\n }\n if (expr.length === 1) {\n return expr[0];\n }\n // resolve true OR expressions\n if (extraRedundantCheck) {\n for (let i = 0; i < expr.length; i++) {\n for (let j = i + 1; j < expr.length; j++) {\n if (expr[i].negate().equals(expr[j])) {\n // A || !A case\n return ContextKeyTrueExpr.INSTANCE;\n }\n }\n }\n if (expr.length === 1) {\n return expr[0];\n }\n }\n return new ContextKeyOrExpr(expr, negated);\n }\n serialize() {\n return this.expr.map(e => e.serialize()).join(' || ');\n }\n keys() {\n const result = [];\n for (const expr of this.expr) {\n result.push(...expr.keys());\n }\n return result;\n }\n negate() {\n if (!this.negated) {\n const result = [];\n for (const expr of this.expr) {\n result.push(expr.negate());\n }\n // We don't support parens, so here we distribute the AND over the OR terminals\n // We always take the first 2 AND pairs and distribute them\n while (result.length > 1) {\n const LEFT = result.shift();\n const RIGHT = result.shift();\n const all = [];\n for (const left of getTerminals(LEFT)) {\n for (const right of getTerminals(RIGHT)) {\n all.push(ContextKeyAndExpr.create([left, right], null, false));\n }\n }\n result.unshift(ContextKeyOrExpr.create(all, null, false));\n }\n this.negated = ContextKeyOrExpr.create(result, this, true);\n }\n return this.negated;\n }\n}\nexport class RawContextKey extends ContextKeyDefinedExpr {\n static all() {\n return RawContextKey._info.values();\n }\n constructor(key, defaultValue, metaOrHide) {\n super(key, null);\n this._defaultValue = defaultValue;\n // collect all context keys into a central place\n if (typeof metaOrHide === 'object') {\n RawContextKey._info.push({ ...metaOrHide, key });\n }\n else if (metaOrHide !== true) {\n RawContextKey._info.push({ key, description: metaOrHide, type: defaultValue !== null && defaultValue !== undefined ? typeof defaultValue : undefined });\n }\n }\n bindTo(target) {\n return target.createKey(this.key, this._defaultValue);\n }\n getValue(target) {\n return target.getContextKeyValue(this.key);\n }\n toNegated() {\n return this.negate();\n }\n isEqualTo(value) {\n return ContextKeyEqualsExpr.create(this.key, value);\n }\n}\nRawContextKey._info = [];\nexport const IContextKeyService = createDecorator('contextKeyService');\nfunction cmp1(key1, key2) {\n if (key1 < key2) {\n return -1;\n }\n if (key1 > key2) {\n return 1;\n }\n return 0;\n}\nfunction cmp2(key1, value1, key2, value2) {\n if (key1 < key2) {\n return -1;\n }\n if (key1 > key2) {\n return 1;\n }\n if (value1 < value2) {\n return -1;\n }\n if (value1 > value2) {\n return 1;\n }\n return 0;\n}\n/**\n * Returns true if it is provable `p` implies `q`.\n */\nexport function implies(p, q) {\n if (p.type === 0 /* ContextKeyExprType.False */ || q.type === 1 /* ContextKeyExprType.True */) {\n // false implies anything\n // anything implies true\n return true;\n }\n if (p.type === 9 /* ContextKeyExprType.Or */) {\n if (q.type === 9 /* ContextKeyExprType.Or */) {\n // `a || b || c` can only imply something like `a || b || c || d`\n return allElementsIncluded(p.expr, q.expr);\n }\n return false;\n }\n if (q.type === 9 /* ContextKeyExprType.Or */) {\n for (const element of q.expr) {\n if (implies(p, element)) {\n return true;\n }\n }\n return false;\n }\n if (p.type === 6 /* ContextKeyExprType.And */) {\n if (q.type === 6 /* ContextKeyExprType.And */) {\n // `a && b && c` implies `a && c`\n return allElementsIncluded(q.expr, p.expr);\n }\n for (const element of p.expr) {\n if (implies(element, q)) {\n return true;\n }\n }\n return false;\n }\n return p.equals(q);\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, q) {\n let pIndex = 0;\n let qIndex = 0;\n while (pIndex < p.length && qIndex < q.length) {\n const cmp = p[pIndex].cmp(q[qIndex]);\n if (cmp < 0) {\n // an element from `p` is missing from `q`\n return false;\n }\n else if (cmp === 0) {\n pIndex++;\n qIndex++;\n }\n else {\n qIndex++;\n }\n }\n return (pIndex === p.length);\n}\nfunction getTerminals(node) {\n if (node.type === 9 /* ContextKeyExprType.Or */) {\n return node.expr;\n }\n return [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 *--------------------------------------------------------------------------------------------*/\nimport { BugIndicatingError, onUnexpectedError } from './errors.js';\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, message) {\n if (!value) {\n throw new Error(message ? `Assertion failed (${message})` : 'Assertion Failed');\n }\n}\nexport function assertNever(value, message = 'Unreachable') {\n throw new Error(message);\n}\n/**\n * Like assert, but doesn't throw.\n */\nexport function softAssert(condition) {\n if (!condition) {\n onUnexpectedError(new BugIndicatingError('Soft Assertion Failed'));\n }\n}\n/**\n * condition must be side-effect free!\n */\nexport function assertFn(condition) {\n if (!condition()) {\n // eslint-disable-next-line no-debugger\n debugger;\n // Reevaluate `condition` again to make debugging easier\n condition();\n onUnexpectedError(new BugIndicatingError('Assertion Failed'));\n }\n}\nexport function checkAdjacentItems(items, predicate) {\n let i = 0;\n while (i < items.length - 1) {\n const a = items[i];\n const b = items[i + 1];\n if (!predicate(a, b)) {\n return false;\n }\n i++;\n }\n return 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 *--------------------------------------------------------------------------------------------*/\nimport * as Assert from '../../../base/common/assert.js';\nimport * as Types from '../../../base/common/types.js';\nclass RegistryImpl {\n constructor() {\n this.data = new Map();\n }\n add(id, data) {\n Assert.ok(Types.isString(id));\n Assert.ok(Types.isObject(data));\n Assert.ok(!this.data.has(id), 'There is already an extension with this id');\n this.data.set(id, data);\n }\n as(id) {\n return this.data.get(id) || null;\n }\n}\nexport const Registry = 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 *--------------------------------------------------------------------------------------------*/\nimport { decodeKeybinding } from '../../../base/common/keybindings.js';\nimport { OS } from '../../../base/common/platform.js';\nimport { CommandsRegistry } from '../../commands/common/commands.js';\nimport { Registry } from '../../registry/common/platform.js';\nimport { combinedDisposable, DisposableStore, toDisposable } from '../../../base/common/lifecycle.js';\nimport { LinkedList } from '../../../base/common/linkedList.js';\n/**\n * Stores all built-in and extension-provided keybindings (but not ones that user defines themselves)\n */\nclass KeybindingsRegistryImpl {\n constructor() {\n this._coreKeybindings = new LinkedList();\n this._extensionKeybindings = [];\n this._cachedMergedKeybindings = null;\n }\n /**\n * Take current platform into account and reduce to primary & secondary.\n */\n static bindToCurrentPlatform(kb) {\n if (OS === 1 /* OperatingSystem.Windows */) {\n if (kb && kb.win) {\n return kb.win;\n }\n }\n else if (OS === 2 /* OperatingSystem.Macintosh */) {\n if (kb && kb.mac) {\n return kb.mac;\n }\n }\n else {\n if (kb && kb.linux) {\n return kb.linux;\n }\n }\n return kb;\n }\n registerKeybindingRule(rule) {\n const actualKb = KeybindingsRegistryImpl.bindToCurrentPlatform(rule);\n const result = new DisposableStore();\n if (actualKb && actualKb.primary) {\n const kk = decodeKeybinding(actualKb.primary, OS);\n if (kk) {\n result.add(this._registerDefaultKeybinding(kk, rule.id, rule.args, rule.weight, 0, rule.when));\n }\n }\n if (actualKb && Array.isArray(actualKb.secondary)) {\n for (let i = 0, len = actualKb.secondary.length; i < len; i++) {\n const k = actualKb.secondary[i];\n const kk = decodeKeybinding(k, OS);\n if (kk) {\n result.add(this._registerDefaultKeybinding(kk, rule.id, rule.args, rule.weight, -i - 1, rule.when));\n }\n }\n }\n return result;\n }\n registerCommandAndKeybindingRule(desc) {\n return combinedDisposable(this.registerKeybindingRule(desc), CommandsRegistry.registerCommand(desc));\n }\n _registerDefaultKeybinding(keybinding, commandId, commandArgs, weight1, weight2, when) {\n const remove = this._coreKeybindings.push({\n keybinding: keybinding,\n command: commandId,\n commandArgs: commandArgs,\n when: when,\n weight1: weight1,\n weight2: weight2,\n extensionId: null,\n isBuiltinExtension: false\n });\n this._cachedMergedKeybindings = null;\n return toDisposable(() => {\n remove();\n this._cachedMergedKeybindings = null;\n });\n }\n getDefaultKeybindings() {\n if (!this._cachedMergedKeybindings) {\n this._cachedMergedKeybindings = Array.from(this._coreKeybindings).concat(this._extensionKeybindings);\n this._cachedMergedKeybindings.sort(sorter);\n }\n return this._cachedMergedKeybindings.slice(0);\n }\n}\nexport const KeybindingsRegistry = new KeybindingsRegistryImpl();\n// Define extension point ids\nexport const Extensions = {\n EditorModes: 'platform.keybindingsRegistry'\n};\nRegistry.add(Extensions.EditorModes, KeybindingsRegistry);\nfunction sorter(a, b) {\n if (a.weight1 !== b.weight1) {\n return a.weight1 - b.weight1;\n }\n if (a.command && b.command) {\n if (a.command < b.command) {\n return -1;\n }\n if (a.command > b.command) {\n return 1;\n }\n }\n return a.weight2 - b.weight2;\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 *--------------------------------------------------------------------------------------------*/\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};\nvar MenuItemAction_1;\nimport { SubmenuAction } from '../../../base/common/actions.js';\nimport { ThemeIcon } from '../../../base/common/themables.js';\nimport { MicrotaskEmitter } from '../../../base/common/event.js';\nimport { DisposableStore, toDisposable } from '../../../base/common/lifecycle.js';\nimport { LinkedList } from '../../../base/common/linkedList.js';\nimport { CommandsRegistry, ICommandService } from '../../commands/common/commands.js';\nimport { ContextKeyExpr, IContextKeyService } from '../../contextkey/common/contextkey.js';\nimport { createDecorator } from '../../instantiation/common/instantiation.js';\nimport { KeybindingsRegistry } from '../../keybinding/common/keybindingsRegistry.js';\nexport function isIMenuItem(item) {\n return item.command !== undefined;\n}\nexport function isISubmenuItem(item) {\n return item.submenu !== undefined;\n}\nexport class MenuId {\n /**\n * Create a new `MenuId` with the unique identifier. Will throw if a menu\n * with the identifier already exists, use `MenuId.for(ident)` or a unique\n * identifier\n */\n constructor(identifier) {\n if (MenuId._instances.has(identifier)) {\n throw new TypeError(`MenuId with identifier '${identifier}' already exists. Use MenuId.for(ident) or a unique identifier`);\n }\n MenuId._instances.set(identifier, this);\n this.id = identifier;\n }\n}\nMenuId._instances = new Map();\nMenuId.CommandPalette = new MenuId('CommandPalette');\nMenuId.DebugBreakpointsContext = new MenuId('DebugBreakpointsContext');\nMenuId.DebugCallStackContext = new MenuId('DebugCallStackContext');\nMenuId.DebugConsoleContext = new MenuId('DebugConsoleContext');\nMenuId.DebugVariablesContext = new MenuId('DebugVariablesContext');\nMenuId.NotebookVariablesContext = new MenuId('NotebookVariablesContext');\nMenuId.DebugHoverContext = new MenuId('DebugHoverContext');\nMenuId.DebugWatchContext = new MenuId('DebugWatchContext');\nMenuId.DebugToolBar = new MenuId('DebugToolBar');\nMenuId.DebugToolBarStop = new MenuId('DebugToolBarStop');\nMenuId.EditorContext = new MenuId('EditorContext');\nMenuId.SimpleEditorContext = new MenuId('SimpleEditorContext');\nMenuId.EditorContent = new MenuId('EditorContent');\nMenuId.EditorLineNumberContext = new MenuId('EditorLineNumberContext');\nMenuId.EditorContextCopy = new MenuId('EditorContextCopy');\nMenuId.EditorContextPeek = new MenuId('EditorContextPeek');\nMenuId.EditorContextShare = new MenuId('EditorContextShare');\nMenuId.EditorTitle = new MenuId('EditorTitle');\nMenuId.EditorTitleRun = new MenuId('EditorTitleRun');\nMenuId.EditorTitleContext = new MenuId('EditorTitleContext');\nMenuId.EditorTitleContextShare = new MenuId('EditorTitleContextShare');\nMenuId.EmptyEditorGroup = new MenuId('EmptyEditorGroup');\nMenuId.EmptyEditorGroupContext = new MenuId('EmptyEditorGroupContext');\nMenuId.EditorTabsBarContext = new MenuId('EditorTabsBarContext');\nMenuId.EditorTabsBarShowTabsSubmenu = new MenuId('EditorTabsBarShowTabsSubmenu');\nMenuId.EditorTabsBarShowTabsZenModeSubmenu = new MenuId('EditorTabsBarShowTabsZenModeSubmenu');\nMenuId.EditorActionsPositionSubmenu = new MenuId('EditorActionsPositionSubmenu');\nMenuId.ExplorerContext = new MenuId('ExplorerContext');\nMenuId.ExplorerContextShare = new MenuId('ExplorerContextShare');\nMenuId.ExtensionContext = new MenuId('ExtensionContext');\nMenuId.GlobalActivity = new MenuId('GlobalActivity');\nMenuId.CommandCenter = new MenuId('CommandCenter');\nMenuId.CommandCenterCenter = new MenuId('CommandCenterCenter');\nMenuId.LayoutControlMenuSubmenu = new MenuId('LayoutControlMenuSubmenu');\nMenuId.LayoutControlMenu = new MenuId('LayoutControlMenu');\nMenuId.MenubarMainMenu = new MenuId('MenubarMainMenu');\nMenuId.MenubarAppearanceMenu = new MenuId('MenubarAppearanceMenu');\nMenuId.MenubarDebugMenu = new MenuId('MenubarDebugMenu');\nMenuId.MenubarEditMenu = new MenuId('MenubarEditMenu');\nMenuId.MenubarCopy = new MenuId('MenubarCopy');\nMenuId.MenubarFileMenu = new MenuId('MenubarFileMenu');\nMenuId.MenubarGoMenu = new MenuId('MenubarGoMenu');\nMenuId.MenubarHelpMenu = new MenuId('MenubarHelpMenu');\nMenuId.MenubarLayoutMenu = new MenuId('MenubarLayoutMenu');\nMenuId.MenubarNewBreakpointMenu = new MenuId('MenubarNewBreakpointMenu');\nMenuId.PanelAlignmentMenu = new MenuId('PanelAlignmentMenu');\nMenuId.PanelPositionMenu = new MenuId('PanelPositionMenu');\nMenuId.ActivityBarPositionMenu = new MenuId('ActivityBarPositionMenu');\nMenuId.MenubarPreferencesMenu = new MenuId('MenubarPreferencesMenu');\nMenuId.MenubarRecentMenu = new MenuId('MenubarRecentMenu');\nMenuId.MenubarSelectionMenu = new MenuId('MenubarSelectionMenu');\nMenuId.MenubarShare = new MenuId('MenubarShare');\nMenuId.MenubarSwitchEditorMenu = new MenuId('MenubarSwitchEditorMenu');\nMenuId.MenubarSwitchGroupMenu = new MenuId('MenubarSwitchGroupMenu');\nMenuId.MenubarTerminalMenu = new MenuId('MenubarTerminalMenu');\nMenuId.MenubarViewMenu = new MenuId('MenubarViewMenu');\nMenuId.MenubarHomeMenu = new MenuId('MenubarHomeMenu');\nMenuId.OpenEditorsContext = new MenuId('OpenEditorsContext');\nMenuId.OpenEditorsContextShare = new MenuId('OpenEditorsContextShare');\nMenuId.ProblemsPanelContext = new MenuId('ProblemsPanelContext');\nMenuId.SCMInputBox = new MenuId('SCMInputBox');\nMenuId.SCMChangesSeparator = new MenuId('SCMChangesSeparator');\nMenuId.SCMIncomingChanges = new MenuId('SCMIncomingChanges');\nMenuId.SCMIncomingChangesContext = new MenuId('SCMIncomingChangesContext');\nMenuId.SCMIncomingChangesSetting = new MenuId('SCMIncomingChangesSetting');\nMenuId.SCMOutgoingChanges = new MenuId('SCMOutgoingChanges');\nMenuId.SCMOutgoingChangesContext = new MenuId('SCMOutgoingChangesContext');\nMenuId.SCMOutgoingChangesSetting = new MenuId('SCMOutgoingChangesSetting');\nMenuId.SCMIncomingChangesAllChangesContext = new MenuId('SCMIncomingChangesAllChangesContext');\nMenuId.SCMIncomingChangesHistoryItemContext = new MenuId('SCMIncomingChangesHistoryItemContext');\nMenuId.SCMOutgoingChangesAllChangesContext = new MenuId('SCMOutgoingChangesAllChangesContext');\nMenuId.SCMOutgoingChangesHistoryItemContext = new MenuId('SCMOutgoingChangesHistoryItemContext');\nMenuId.SCMChangeContext = new MenuId('SCMChangeContext');\nMenuId.SCMResourceContext = new MenuId('SCMResourceContext');\nMenuId.SCMResourceContextShare = new MenuId('SCMResourceContextShare');\nMenuId.SCMResourceFolderContext = new MenuId('SCMResourceFolderContext');\nMenuId.SCMResourceGroupContext = new MenuId('SCMResourceGroupContext');\nMenuId.SCMSourceControl = new MenuId('SCMSourceControl');\nMenuId.SCMSourceControlInline = new MenuId('SCMSourceControlInline');\nMenuId.SCMSourceControlTitle = new MenuId('SCMSourceControlTitle');\nMenuId.SCMTitle = new MenuId('SCMTitle');\nMenuId.SearchContext = new MenuId('SearchContext');\nMenuId.SearchActionMenu = new MenuId('SearchActionContext');\nMenuId.StatusBarWindowIndicatorMenu = new MenuId('StatusBarWindowIndicatorMenu');\nMenuId.StatusBarRemoteIndicatorMenu = new MenuId('StatusBarRemoteIndicatorMenu');\nMenuId.StickyScrollContext = new MenuId('StickyScrollContext');\nMenuId.TestItem = new MenuId('TestItem');\nMenuId.TestItemGutter = new MenuId('TestItemGutter');\nMenuId.TestMessageContext = new MenuId('TestMessageContext');\nMenuId.TestMessageContent = new MenuId('TestMessageContent');\nMenuId.TestPeekElement = new MenuId('TestPeekElement');\nMenuId.TestPeekTitle = new MenuId('TestPeekTitle');\nMenuId.TouchBarContext = new MenuId('TouchBarContext');\nMenuId.TitleBarContext = new MenuId('TitleBarContext');\nMenuId.TitleBarTitleContext = new MenuId('TitleBarTitleContext');\nMenuId.TunnelContext = new MenuId('TunnelContext');\nMenuId.TunnelPrivacy = new MenuId('TunnelPrivacy');\nMenuId.TunnelProtocol = new MenuId('TunnelProtocol');\nMenuId.TunnelPortInline = new MenuId('TunnelInline');\nMenuId.TunnelTitle = new MenuId('TunnelTitle');\nMenuId.TunnelLocalAddressInline = new MenuId('TunnelLocalAddressInline');\nMenuId.TunnelOriginInline = new MenuId('TunnelOriginInline');\nMenuId.ViewItemContext = new MenuId('ViewItemContext');\nMenuId.ViewContainerTitle = new MenuId('ViewContainerTitle');\nMenuId.ViewContainerTitleContext = new MenuId('ViewContainerTitleContext');\nMenuId.ViewTitle = new MenuId('ViewTitle');\nMenuId.ViewTitleContext = new MenuId('ViewTitleContext');\nMenuId.CommentEditorActions = new MenuId('CommentEditorActions');\nMenuId.CommentThreadTitle = new MenuId('CommentThreadTitle');\nMenuId.CommentThreadActions = new MenuId('CommentThreadActions');\nMenuId.CommentThreadAdditionalActions = new MenuId('CommentThreadAdditionalActions');\nMenuId.CommentThreadTitleContext = new MenuId('CommentThreadTitleContext');\nMenuId.CommentThreadCommentContext = new MenuId('CommentThreadCommentContext');\nMenuId.CommentTitle = new MenuId('CommentTitle');\nMenuId.CommentActions = new MenuId('CommentActions');\nMenuId.CommentsViewThreadActions = new MenuId('CommentsViewThreadActions');\nMenuId.InteractiveToolbar = new MenuId('InteractiveToolbar');\nMenuId.InteractiveCellTitle = new MenuId('InteractiveCellTitle');\nMenuId.InteractiveCellDelete = new MenuId('InteractiveCellDelete');\nMenuId.InteractiveCellExecute = new MenuId('InteractiveCellExecute');\nMenuId.InteractiveInputExecute = new MenuId('InteractiveInputExecute');\nMenuId.IssueReporter = new MenuId('IssueReporter');\nMenuId.NotebookToolbar = new MenuId('NotebookToolbar');\nMenuId.NotebookStickyScrollContext = new MenuId('NotebookStickyScrollContext');\nMenuId.NotebookCellTitle = new MenuId('NotebookCellTitle');\nMenuId.NotebookCellDelete = new MenuId('NotebookCellDelete');\nMenuId.NotebookCellInsert = new MenuId('NotebookCellInsert');\nMenuId.NotebookCellBetween = new MenuId('NotebookCellBetween');\nMenuId.NotebookCellListTop = new MenuId('NotebookCellTop');\nMenuId.NotebookCellExecute = new MenuId('NotebookCellExecute');\nMenuId.NotebookCellExecuteGoTo = new MenuId('NotebookCellExecuteGoTo');\nMenuId.NotebookCellExecutePrimary = new MenuId('NotebookCellExecutePrimary');\nMenuId.NotebookDiffCellInputTitle = new MenuId('NotebookDiffCellInputTitle');\nMenuId.NotebookDiffCellMetadataTitle = new MenuId('NotebookDiffCellMetadataTitle');\nMenuId.NotebookDiffCellOutputsTitle = new MenuId('NotebookDiffCellOutputsTitle');\nMenuId.NotebookOutputToolbar = new MenuId('NotebookOutputToolbar');\nMenuId.NotebookOutlineFilter = new MenuId('NotebookOutlineFilter');\nMenuId.NotebookOutlineActionMenu = new MenuId('NotebookOutlineActionMenu');\nMenuId.NotebookEditorLayoutConfigure = new MenuId('NotebookEditorLayoutConfigure');\nMenuId.NotebookKernelSource = new MenuId('NotebookKernelSource');\nMenuId.BulkEditTitle = new MenuId('BulkEditTitle');\nMenuId.BulkEditContext = new MenuId('BulkEditContext');\nMenuId.TimelineItemContext = new MenuId('TimelineItemContext');\nMenuId.TimelineTitle = new MenuId('TimelineTitle');\nMenuId.TimelineTitleContext = new MenuId('TimelineTitleContext');\nMenuId.TimelineFilterSubMenu = new MenuId('TimelineFilterSubMenu');\nMenuId.AccountsContext = new MenuId('AccountsContext');\nMenuId.SidebarTitle = new MenuId('SidebarTitle');\nMenuId.PanelTitle = new MenuId('PanelTitle');\nMenuId.AuxiliaryBarTitle = new MenuId('AuxiliaryBarTitle');\nMenuId.AuxiliaryBarHeader = new MenuId('AuxiliaryBarHeader');\nMenuId.TerminalInstanceContext = new MenuId('TerminalInstanceContext');\nMenuId.TerminalEditorInstanceContext = new MenuId('TerminalEditorInstanceContext');\nMenuId.TerminalNewDropdownContext = new MenuId('TerminalNewDropdownContext');\nMenuId.TerminalTabContext = new MenuId('TerminalTabContext');\nMenuId.TerminalTabEmptyAreaContext = new MenuId('TerminalTabEmptyAreaContext');\nMenuId.TerminalStickyScrollContext = new MenuId('TerminalStickyScrollContext');\nMenuId.WebviewContext = new MenuId('WebviewContext');\nMenuId.InlineCompletionsActions = new MenuId('InlineCompletionsActions');\nMenuId.InlineEditActions = new MenuId('InlineEditActions');\nMenuId.NewFile = new MenuId('NewFile');\nMenuId.MergeInput1Toolbar = new MenuId('MergeToolbar1Toolbar');\nMenuId.MergeInput2Toolbar = new MenuId('MergeToolbar2Toolbar');\nMenuId.MergeBaseToolbar = new MenuId('MergeBaseToolbar');\nMenuId.MergeInputResultToolbar = new MenuId('MergeToolbarResultToolbar');\nMenuId.InlineSuggestionToolbar = new MenuId('InlineSuggestionToolbar');\nMenuId.InlineEditToolbar = new MenuId('InlineEditToolbar');\nMenuId.ChatContext = new MenuId('ChatContext');\nMenuId.ChatCodeBlock = new MenuId('ChatCodeblock');\nMenuId.ChatCompareBlock = new MenuId('ChatCompareBlock');\nMenuId.ChatMessageTitle = new MenuId('ChatMessageTitle');\nMenuId.ChatExecute = new MenuId('ChatExecute');\nMenuId.ChatExecuteSecondary = new MenuId('ChatExecuteSecondary');\nMenuId.ChatInputSide = new MenuId('ChatInputSide');\nMenuId.AccessibleView = new MenuId('AccessibleView');\nMenuId.MultiDiffEditorFileToolbar = new MenuId('MultiDiffEditorFileToolbar');\nMenuId.DiffEditorHunkToolbar = new MenuId('DiffEditorHunkToolbar');\nMenuId.DiffEditorSelectionToolbar = new MenuId('DiffEditorSelectionToolbar');\nexport const IMenuService = createDecorator('menuService');\nclass MenuRegistryChangeEvent {\n static for(id) {\n let value = this._all.get(id);\n if (!value) {\n value = new MenuRegistryChangeEvent(id);\n this._all.set(id, value);\n }\n return value;\n }\n static merge(events) {\n const ids = new Set();\n for (const item of events) {\n if (item instanceof MenuRegistryChangeEvent) {\n ids.add(item.id);\n }\n }\n return ids;\n }\n constructor(id) {\n this.id = id;\n this.has = candidate => candidate === id;\n }\n}\nMenuRegistryChangeEvent._all = new Map();\nexport const MenuRegistry = new class {\n constructor() {\n this._commands = new Map();\n this._menuItems = new Map();\n this._onDidChangeMenu = new MicrotaskEmitter({\n merge: MenuRegistryChangeEvent.merge\n });\n this.onDidChangeMenu = this._onDidChangeMenu.event;\n }\n addCommand(command) {\n this._commands.set(command.id, command);\n this._onDidChangeMenu.fire(MenuRegistryChangeEvent.for(MenuId.CommandPalette));\n return toDisposable(() => {\n if (this._commands.delete(command.id)) {\n this._onDidChangeMenu.fire(MenuRegistryChangeEvent.for(MenuId.CommandPalette));\n }\n });\n }\n getCommand(id) {\n return this._commands.get(id);\n }\n getCommands() {\n const map = new Map();\n this._commands.forEach((value, key) => map.set(key, value));\n return map;\n }\n appendMenuItem(id, item) {\n let list = this._menuItems.get(id);\n if (!list) {\n list = new LinkedList();\n this._menuItems.set(id, list);\n }\n const rm = list.push(item);\n this._onDidChangeMenu.fire(MenuRegistryChangeEvent.for(id));\n return toDisposable(() => {\n rm();\n this._onDidChangeMenu.fire(MenuRegistryChangeEvent.for(id));\n });\n }\n appendMenuItems(items) {\n const result = new DisposableStore();\n for (const { id, item } of items) {\n result.add(this.appendMenuItem(id, item));\n }\n return result;\n }\n getMenuItems(id) {\n let result;\n if (this._menuItems.has(id)) {\n result = [...this._menuItems.get(id)];\n }\n else {\n result = [];\n }\n if (id === MenuId.CommandPalette) {\n // CommandPalette is special because it shows\n // all commands by default\n this._appendImplicitItems(result);\n }\n return result;\n }\n _appendImplicitItems(result) {\n const set = new Set();\n for (const item of result) {\n if (isIMenuItem(item)) {\n set.add(item.command.id);\n if (item.alt) {\n set.add(item.alt.id);\n }\n }\n }\n this._commands.forEach((command, id) => {\n if (!set.has(id)) {\n result.push({ command });\n }\n });\n }\n};\nexport class SubmenuItemAction extends SubmenuAction {\n constructor(item, hideActions, actions) {\n super(`submenuitem.${item.submenu.id}`, typeof item.title === 'string' ? item.title : item.title.value, actions, 'submenu');\n this.item = item;\n this.hideActions = hideActions;\n }\n}\n// implements IAction, does NOT extend Action, so that no one\n// subscribes to events of Action or modified properties\nlet MenuItemAction = MenuItemAction_1 = class MenuItemAction {\n static label(action, options) {\n return (options === null || options === void 0 ? void 0 : options.renderShortTitle) && action.shortTitle\n ? (typeof action.shortTitle === 'string' ? action.shortTitle : action.shortTitle.value)\n : (typeof action.title === 'string' ? action.title : action.title.value);\n }\n constructor(item, alt, options, hideActions, menuKeybinding, contextKeyService, _commandService) {\n var _a, _b;\n this.hideActions = hideActions;\n this.menuKeybinding = menuKeybinding;\n this._commandService = _commandService;\n this.id = item.id;\n this.label = MenuItemAction_1.label(item, options);\n this.tooltip = (_b = (typeof item.tooltip === 'string' ? item.tooltip : (_a = item.tooltip) === null || _a === void 0 ? void 0 : _a.value)) !== null && _b !== void 0 ? _b : '';\n this.enabled = !item.precondition || contextKeyService.contextMatchesRules(item.precondition);\n this.checked = undefined;\n let icon;\n if (item.toggled) {\n const toggled = (item.toggled.condition ? item.toggled : { condition: item.toggled });\n this.checked = contextKeyService.contextMatchesRules(toggled.condition);\n if (this.checked && toggled.tooltip) {\n this.tooltip = typeof toggled.tooltip === 'string' ? toggled.tooltip : toggled.tooltip.value;\n }\n if (this.checked && ThemeIcon.isThemeIcon(toggled.icon)) {\n icon = toggled.icon;\n }\n if (this.checked && toggled.title) {\n this.label = typeof toggled.title === 'string' ? toggled.title : toggled.title.value;\n }\n }\n if (!icon) {\n icon = ThemeIcon.isThemeIcon(item.icon) ? item.icon : undefined;\n }\n this.item = item;\n this.alt = alt ? new MenuItemAction_1(alt, undefined, options, hideActions, undefined, contextKeyService, _commandService) : undefined;\n this._options = options;\n this.class = icon && ThemeIcon.asClassName(icon);\n }\n run(...args) {\n var _a, _b;\n let runArgs = [];\n if ((_a = this._options) === null || _a === void 0 ? void 0 : _a.arg) {\n runArgs = [...runArgs, this._options.arg];\n }\n if ((_b = this._options) === null || _b === void 0 ? void 0 : _b.shouldForwardArgs) {\n runArgs = [...runArgs, ...args];\n }\n return this._commandService.executeCommand(this.id, ...runArgs);\n }\n};\nMenuItemAction = MenuItemAction_1 = __decorate([\n __param(5, IContextKeyService),\n __param(6, ICommandService)\n], MenuItemAction);\nexport { MenuItemAction };\nexport class Action2 {\n constructor(desc) {\n this.desc = desc;\n }\n}\nexport function registerAction2(ctor) {\n const disposables = new DisposableStore();\n const action = new ctor();\n const { f1, menu, keybinding, ...command } = action.desc;\n if (CommandsRegistry.getCommand(command.id)) {\n throw new Error(`Cannot register two commands with the same id: ${command.id}`);\n }\n // command\n disposables.add(CommandsRegistry.registerCommand({\n id: command.id,\n handler: (accessor, ...args) => action.run(accessor, ...args),\n metadata: command.metadata,\n }));\n // menu\n if (Array.isArray(menu)) {\n for (const item of menu) {\n disposables.add(MenuRegistry.appendMenuItem(item.id, { command: { ...command, precondition: item.precondition === null ? undefined : command.precondition }, ...item }));\n }\n }\n else if (menu) {\n disposables.add(MenuRegistry.appendMenuItem(menu.id, { command: { ...command, precondition: menu.precondition === null ? undefined : command.precondition }, ...menu }));\n }\n if (f1) {\n disposables.add(MenuRegistry.appendMenuItem(MenuId.CommandPalette, { command, when: command.precondition }));\n disposables.add(MenuRegistry.addCommand(command));\n }\n // keybinding\n if (Array.isArray(keybinding)) {\n for (const item of keybinding) {\n disposables.add(KeybindingsRegistry.registerKeybindingRule({\n ...item,\n id: command.id,\n when: command.precondition ? ContextKeyExpr.and(command.precondition, item.when) : item.when\n }));\n }\n }\n else if (keybinding) {\n disposables.add(KeybindingsRegistry.registerKeybindingRule({\n ...keybinding,\n id: command.id,\n when: command.precondition ? ContextKeyExpr.and(command.precondition, keybinding.when) : keybinding.when\n }));\n }\n return disposables;\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 { createDecorator } from '../../instantiation/common/instantiation.js';\nexport const ITelemetryService = createDecorator('telemetryService');\n", "import { Emitter } from '../../../base/common/event.js';\nimport { Disposable } from '../../../base/common/lifecycle.js';\nimport { RawContextKey } from '../../contextkey/common/contextkey.js';\nimport { createDecorator } from '../../instantiation/common/instantiation.js';\nexport const ILogService = createDecorator('logService');\nexport var LogLevel;\n(function (LogLevel) {\n LogLevel[LogLevel[\"Off\"] = 0] = \"Off\";\n LogLevel[LogLevel[\"Trace\"] = 1] = \"Trace\";\n LogLevel[LogLevel[\"Debug\"] = 2] = \"Debug\";\n LogLevel[LogLevel[\"Info\"] = 3] = \"Info\";\n LogLevel[LogLevel[\"Warning\"] = 4] = \"Warning\";\n LogLevel[LogLevel[\"Error\"] = 5] = \"Error\";\n})(LogLevel || (LogLevel = {}));\nexport const DEFAULT_LOG_LEVEL = LogLevel.Info;\nexport class AbstractLogger extends Disposable {\n constructor() {\n super(...arguments);\n this.level = DEFAULT_LOG_LEVEL;\n this._onDidChangeLogLevel = this._register(new Emitter());\n this.onDidChangeLogLevel = this._onDidChangeLogLevel.event;\n }\n setLevel(level) {\n if (this.level !== level) {\n this.level = level;\n this._onDidChangeLogLevel.fire(this.level);\n }\n }\n getLevel() {\n return this.level;\n }\n checkLogLevel(level) {\n return this.level !== LogLevel.Off && this.level <= level;\n }\n}\nexport class ConsoleLogger extends AbstractLogger {\n constructor(logLevel = DEFAULT_LOG_LEVEL, useColors = true) {\n super();\n this.useColors = useColors;\n this.setLevel(logLevel);\n }\n trace(message, ...args) {\n if (this.checkLogLevel(LogLevel.Trace)) {\n if (this.useColors) {\n console.log('%cTRACE', 'color: #888', message, ...args);\n }\n else {\n console.log(message, ...args);\n }\n }\n }\n debug(message, ...args) {\n if (this.checkLogLevel(LogLevel.Debug)) {\n if (this.useColors) {\n console.log('%cDEBUG', 'background: #eee; color: #888', message, ...args);\n }\n else {\n console.log(message, ...args);\n }\n }\n }\n info(message, ...args) {\n if (this.checkLogLevel(LogLevel.Info)) {\n if (this.useColors) {\n console.log('%c INFO', 'color: #33f', message, ...args);\n }\n else {\n console.log(message, ...args);\n }\n }\n }\n warn(message, ...args) {\n if (this.checkLogLevel(LogLevel.Warning)) {\n if (this.useColors) {\n console.log('%c WARN', 'color: #993', message, ...args);\n }\n else {\n console.log(message, ...args);\n }\n }\n }\n error(message, ...args) {\n if (this.checkLogLevel(LogLevel.Error)) {\n if (this.useColors) {\n console.log('%c ERR', 'color: #f33', message, ...args);\n }\n else {\n console.error(message, ...args);\n }\n }\n }\n}\nexport class MultiplexLogger extends AbstractLogger {\n constructor(loggers) {\n super();\n this.loggers = loggers;\n if (loggers.length) {\n this.setLevel(loggers[0].getLevel());\n }\n }\n setLevel(level) {\n for (const logger of this.loggers) {\n logger.setLevel(level);\n }\n super.setLevel(level);\n }\n trace(message, ...args) {\n for (const logger of this.loggers) {\n logger.trace(message, ...args);\n }\n }\n debug(message, ...args) {\n for (const logger of this.loggers) {\n logger.debug(message, ...args);\n }\n }\n info(message, ...args) {\n for (const logger of this.loggers) {\n logger.info(message, ...args);\n }\n }\n warn(message, ...args) {\n for (const logger of this.loggers) {\n logger.warn(message, ...args);\n }\n }\n error(message, ...args) {\n for (const logger of this.loggers) {\n logger.error(message, ...args);\n }\n }\n dispose() {\n for (const logger of this.loggers) {\n logger.dispose();\n }\n super.dispose();\n }\n}\nexport function LogLevelToString(logLevel) {\n switch (logLevel) {\n case LogLevel.Trace: return 'trace';\n case LogLevel.Debug: return 'debug';\n case LogLevel.Info: return 'info';\n case LogLevel.Warning: return 'warn';\n case LogLevel.Error: return 'error';\n case LogLevel.Off: return 'off';\n }\n}\n// Contexts\nexport const CONTEXT_LOG_LEVEL = new RawContextKey('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 *--------------------------------------------------------------------------------------------*/\nimport * as nls from '../../nls.js';\nimport { URI } from '../../base/common/uri.js';\nimport { ICodeEditorService } from './services/codeEditorService.js';\nimport { Position } from '../common/core/position.js';\nimport { IModelService } from '../common/services/model.js';\nimport { ITextModelService } from '../common/services/resolverService.js';\nimport { MenuId, MenuRegistry, Action2 } from '../../platform/actions/common/actions.js';\nimport { CommandsRegistry } from '../../platform/commands/common/commands.js';\nimport { ContextKeyExpr, IContextKeyService } from '../../platform/contextkey/common/contextkey.js';\nimport { IInstantiationService } from '../../platform/instantiation/common/instantiation.js';\nimport { KeybindingsRegistry } from '../../platform/keybinding/common/keybindingsRegistry.js';\nimport { Registry } from '../../platform/registry/common/platform.js';\nimport { ITelemetryService } from '../../platform/telemetry/common/telemetry.js';\nimport { assertType } from '../../base/common/types.js';\nimport { ILogService } from '../../platform/log/common/log.js';\nimport { getActiveElement } from '../../base/browser/dom.js';\nexport class Command {\n constructor(opts) {\n this.id = opts.id;\n this.precondition = opts.precondition;\n this._kbOpts = opts.kbOpts;\n this._menuOpts = opts.menuOpts;\n this.metadata = opts.metadata;\n }\n register() {\n if (Array.isArray(this._menuOpts)) {\n this._menuOpts.forEach(this._registerMenuItem, this);\n }\n else if (this._menuOpts) {\n this._registerMenuItem(this._menuOpts);\n }\n if (this._kbOpts) {\n const kbOptsArr = Array.isArray(this._kbOpts) ? this._kbOpts : [this._kbOpts];\n for (const kbOpts of kbOptsArr) {\n let kbWhen = kbOpts.kbExpr;\n if (this.precondition) {\n if (kbWhen) {\n kbWhen = ContextKeyExpr.and(kbWhen, this.precondition);\n }\n else {\n kbWhen = this.precondition;\n }\n }\n const desc = {\n id: this.id,\n weight: kbOpts.weight,\n args: kbOpts.args,\n when: kbWhen,\n primary: kbOpts.primary,\n secondary: kbOpts.secondary,\n win: kbOpts.win,\n linux: kbOpts.linux,\n mac: kbOpts.mac,\n };\n KeybindingsRegistry.registerKeybindingRule(desc);\n }\n }\n CommandsRegistry.registerCommand({\n id: this.id,\n handler: (accessor, args) => this.runCommand(accessor, args),\n metadata: this.metadata\n });\n }\n _registerMenuItem(item) {\n MenuRegistry.appendMenuItem(item.menuId, {\n group: item.group,\n command: {\n id: this.id,\n title: item.title,\n icon: item.icon,\n precondition: this.precondition\n },\n when: item.when,\n order: item.order\n });\n }\n}\nexport class MultiCommand extends Command {\n constructor() {\n super(...arguments);\n this._implementations = [];\n }\n /**\n * A higher priority gets to be looked at first\n */\n addImplementation(priority, name, implementation, when) {\n this._implementations.push({ priority, name, implementation, when });\n this._implementations.sort((a, b) => b.priority - a.priority);\n return {\n dispose: () => {\n for (let i = 0; i < this._implementations.length; i++) {\n if (this._implementations[i].implementation === implementation) {\n this._implementations.splice(i, 1);\n return;\n }\n }\n }\n };\n }\n runCommand(accessor, args) {\n const logService = accessor.get(ILogService);\n const contextKeyService = accessor.get(IContextKeyService);\n logService.trace(`Executing Command '${this.id}' which has ${this._implementations.length} bound.`);\n for (const impl of this._implementations) {\n if (impl.when) {\n const context = contextKeyService.getContext(getActiveElement());\n const value = impl.when.evaluate(context);\n if (!value) {\n continue;\n }\n }\n const result = impl.implementation(accessor, args);\n if (result) {\n logService.trace(`Command '${this.id}' was handled by '${impl.name}'.`);\n if (typeof result === 'boolean') {\n return;\n }\n return result;\n }\n }\n logService.trace(`The Command '${this.id}' was not handled by any implementation.`);\n }\n}\n//#endregion\n/**\n * A command that delegates to another command's implementation.\n *\n * This lets different commands be registered but share the same implementation\n */\nexport class ProxyCommand extends Command {\n constructor(command, opts) {\n super(opts);\n this.command = command;\n }\n runCommand(accessor, args) {\n return this.command.runCommand(accessor, args);\n }\n}\nexport class EditorCommand extends Command {\n /**\n * Create a command class that is bound to a certain editor contribution.\n */\n static bindToContribution(controllerGetter) {\n return class EditorControllerCommandImpl extends EditorCommand {\n constructor(opts) {\n super(opts);\n this._callback = opts.handler;\n }\n runEditorCommand(accessor, editor, args) {\n const controller = controllerGetter(editor);\n if (controller) {\n this._callback(controller, args);\n }\n }\n };\n }\n static runEditorCommand(accessor, args, precondition, runner) {\n const codeEditorService = accessor.get(ICodeEditorService);\n // Find the editor with text focus or active\n const editor = codeEditorService.getFocusedCodeEditor() || codeEditorService.getActiveCodeEditor();\n if (!editor) {\n // well, at least we tried...\n return;\n }\n return editor.invokeWithinContext((editorAccessor) => {\n const kbService = editorAccessor.get(IContextKeyService);\n if (!kbService.contextMatchesRules(precondition !== null && precondition !== void 0 ? precondition : undefined)) {\n // precondition does not hold\n return;\n }\n return runner(editorAccessor, editor, args);\n });\n }\n runCommand(accessor, args) {\n return EditorCommand.runEditorCommand(accessor, args, this.precondition, (accessor, editor, args) => this.runEditorCommand(accessor, editor, args));\n }\n}\nexport class EditorAction extends EditorCommand {\n static convertOptions(opts) {\n let menuOpts;\n if (Array.isArray(opts.menuOpts)) {\n menuOpts = opts.menuOpts;\n }\n else if (opts.menuOpts) {\n menuOpts = [opts.menuOpts];\n }\n else {\n menuOpts = [];\n }\n function withDefaults(item) {\n if (!item.menuId) {\n item.menuId = MenuId.EditorContext;\n }\n if (!item.title) {\n item.title = opts.label;\n }\n item.when = ContextKeyExpr.and(opts.precondition, item.when);\n return item;\n }\n if (Array.isArray(opts.contextMenuOpts)) {\n menuOpts.push(...opts.contextMenuOpts.map(withDefaults));\n }\n else if (opts.contextMenuOpts) {\n menuOpts.push(withDefaults(opts.contextMenuOpts));\n }\n opts.menuOpts = menuOpts;\n return opts;\n }\n constructor(opts) {\n super(EditorAction.convertOptions(opts));\n this.label = opts.label;\n this.alias = opts.alias;\n }\n runEditorCommand(accessor, editor, args) {\n this.reportTelemetry(accessor, editor);\n return this.run(accessor, editor, args || {});\n }\n reportTelemetry(accessor, editor) {\n accessor.get(ITelemetryService).publicLog2('editorActionInvoked', { name: this.label, id: this.id });\n }\n}\nexport class MultiEditorAction extends EditorAction {\n constructor() {\n super(...arguments);\n this._implementations = [];\n }\n /**\n * A higher priority gets to be looked at first\n */\n addImplementation(priority, implementation) {\n this._implementations.push([priority, implementation]);\n this._implementations.sort((a, b) => b[0] - a[0]);\n return {\n dispose: () => {\n for (let i = 0; i < this._implementations.length; i++) {\n if (this._implementations[i][1] === implementation) {\n this._implementations.splice(i, 1);\n return;\n }\n }\n }\n };\n }\n run(accessor, editor, args) {\n for (const impl of this._implementations) {\n const result = impl[1](accessor, editor, args);\n if (result) {\n if (typeof result === 'boolean') {\n return;\n }\n return result;\n }\n }\n }\n}\n//#endregion EditorAction\n//#region EditorAction2\nexport class EditorAction2 extends Action2 {\n run(accessor, ...args) {\n // Find the editor with text focus or active\n const codeEditorService = accessor.get(ICodeEditorService);\n const editor = codeEditorService.getFocusedCodeEditor() || codeEditorService.getActiveCodeEditor();\n if (!editor) {\n // well, at least we tried...\n return;\n }\n // precondition does hold\n return editor.invokeWithinContext((editorAccessor) => {\n var _a, _b;\n const kbService = editorAccessor.get(IContextKeyService);\n const logService = editorAccessor.get(ILogService);\n const enabled = kbService.contextMatchesRules((_a = this.desc.precondition) !== null && _a !== void 0 ? _a : undefined);\n if (!enabled) {\n logService.debug(`[EditorAction2] NOT running command because its precondition is FALSE`, this.desc.id, (_b = this.desc.precondition) === null || _b === void 0 ? void 0 : _b.serialize());\n return;\n }\n return this.runEditorCommand(editorAccessor, editor, ...args);\n });\n }\n}\n//#endregion\n// --- Registration of commands and actions\nexport function registerModelAndPositionCommand(id, handler) {\n CommandsRegistry.registerCommand(id, function (accessor, ...args) {\n const instaService = accessor.get(IInstantiationService);\n const [resource, position] = args;\n assertType(URI.isUri(resource));\n assertType(Position.isIPosition(position));\n const model = accessor.get(IModelService).getModel(resource);\n if (model) {\n const editorPosition = Position.lift(position);\n return instaService.invokeFunction(handler, model, editorPosition, ...args.slice(2));\n }\n return accessor.get(ITextModelService).createModelReference(resource).then(reference => {\n return new Promise((resolve, reject) => {\n try {\n const result = instaService.invokeFunction(handler, reference.object.textEditorModel, Position.lift(position), args.slice(2));\n resolve(result);\n }\n catch (err) {\n reject(err);\n }\n }).finally(() => {\n reference.dispose();\n });\n });\n });\n}\nexport function registerEditorCommand(editorCommand) {\n EditorContributionRegistry.INSTANCE.registerEditorCommand(editorCommand);\n return editorCommand;\n}\nexport function registerEditorAction(ctor) {\n const action = new ctor();\n EditorContributionRegistry.INSTANCE.registerEditorAction(action);\n return action;\n}\nexport function registerMultiEditorAction(action) {\n EditorContributionRegistry.INSTANCE.registerEditorAction(action);\n return action;\n}\nexport function registerInstantiatedEditorAction(editorAction) {\n EditorContributionRegistry.INSTANCE.registerEditorAction(editorAction);\n}\n/**\n * Registers an editor contribution. Editor contributions have a lifecycle which is bound\n * to a specific code editor instance.\n */\nexport function registerEditorContribution(id, ctor, instantiation) {\n EditorContributionRegistry.INSTANCE.registerEditorContribution(id, ctor, instantiation);\n}\nexport var EditorExtensionsRegistry;\n(function (EditorExtensionsRegistry) {\n function getEditorCommand(commandId) {\n return EditorContributionRegistry.INSTANCE.getEditorCommand(commandId);\n }\n EditorExtensionsRegistry.getEditorCommand = getEditorCommand;\n function getEditorActions() {\n return EditorContributionRegistry.INSTANCE.getEditorActions();\n }\n EditorExtensionsRegistry.getEditorActions = getEditorActions;\n function getEditorContributions() {\n return EditorContributionRegistry.INSTANCE.getEditorContributions();\n }\n EditorExtensionsRegistry.getEditorContributions = getEditorContributions;\n function getSomeEditorContributions(ids) {\n return EditorContributionRegistry.INSTANCE.getEditorContributions().filter(c => ids.indexOf(c.id) >= 0);\n }\n EditorExtensionsRegistry.getSomeEditorContributions = getSomeEditorContributions;\n function getDiffEditorContributions() {\n return EditorContributionRegistry.INSTANCE.getDiffEditorContributions();\n }\n EditorExtensionsRegistry.getDiffEditorContributions = getDiffEditorContributions;\n})(EditorExtensionsRegistry || (EditorExtensionsRegistry = {}));\n// Editor extension points\nconst Extensions = {\n EditorCommonContributions: 'editor.contributions'\n};\nclass EditorContributionRegistry {\n constructor() {\n this.editorContributions = [];\n this.diffEditorContributions = [];\n this.editorActions = [];\n this.editorCommands = Object.create(null);\n }\n registerEditorContribution(id, ctor, instantiation) {\n this.editorContributions.push({ id, ctor: ctor, instantiation });\n }\n getEditorContributions() {\n return this.editorContributions.slice(0);\n }\n getDiffEditorContributions() {\n return this.diffEditorContributions.slice(0);\n }\n registerEditorAction(action) {\n action.register();\n this.editorActions.push(action);\n }\n getEditorActions() {\n return this.editorActions;\n }\n registerEditorCommand(editorCommand) {\n editorCommand.register();\n this.editorCommands[editorCommand.id] = editorCommand;\n }\n getEditorCommand(commandId) {\n return (this.editorCommands[commandId] || null);\n }\n}\nEditorContributionRegistry.INSTANCE = new EditorContributionRegistry();\nRegistry.add(Extensions.EditorCommonContributions, EditorContributionRegistry.INSTANCE);\nfunction registerCommand(command) {\n command.register();\n return command;\n}\nexport const UndoCommand = registerCommand(new MultiCommand({\n id: 'undo',\n precondition: undefined,\n kbOpts: {\n weight: 0 /* KeybindingWeight.EditorCore */,\n primary: 2048 /* KeyMod.CtrlCmd */ | 56 /* KeyCode.KeyZ */\n },\n menuOpts: [{\n menuId: MenuId.MenubarEditMenu,\n group: '1_do',\n title: nls.localize({ key: 'miUndo', comment: ['&& denotes a mnemonic'] }, \"&&Undo\"),\n order: 1\n }, {\n menuId: MenuId.CommandPalette,\n group: '',\n title: nls.localize('undo', \"Undo\"),\n order: 1\n }]\n}));\nregisterCommand(new ProxyCommand(UndoCommand, { id: 'default:undo', precondition: undefined }));\nexport const RedoCommand = registerCommand(new MultiCommand({\n id: 'redo',\n precondition: undefined,\n kbOpts: {\n weight: 0 /* KeybindingWeight.EditorCore */,\n primary: 2048 /* KeyMod.CtrlCmd */ | 55 /* KeyCode.KeyY */,\n secondary: [2048 /* KeyMod.CtrlCmd */ | 1024 /* KeyMod.Shift */ | 56 /* KeyCode.KeyZ */],\n mac: { primary: 2048 /* KeyMod.CtrlCmd */ | 1024 /* KeyMod.Shift */ | 56 /* KeyCode.KeyZ */ }\n },\n menuOpts: [{\n menuId: MenuId.MenubarEditMenu,\n group: '1_do',\n title: nls.localize({ key: 'miRedo', comment: ['&& denotes a mnemonic'] }, \"&&Redo\"),\n order: 2\n }, {\n menuId: MenuId.CommandPalette,\n group: '',\n title: nls.localize('redo', \"Redo\"),\n order: 1\n }]\n}));\nregisterCommand(new ProxyCommand(RedoCommand, { id: 'default:redo', precondition: undefined }));\nexport const SelectAllCommand = registerCommand(new MultiCommand({\n id: 'editor.action.selectAll',\n precondition: undefined,\n kbOpts: {\n weight: 0 /* KeybindingWeight.EditorCore */,\n kbExpr: null,\n primary: 2048 /* KeyMod.CtrlCmd */ | 31 /* KeyCode.KeyA */\n },\n menuOpts: [{\n menuId: MenuId.MenubarSelectionMenu,\n group: '1_basic',\n title: nls.localize({ key: 'miSelectAll', comment: ['&& denotes a mnemonic'] }, \"&&Select All\"),\n order: 1\n }, {\n menuId: MenuId.CommandPalette,\n group: '',\n title: nls.localize('selectAll', \"Select All\"),\n order: 1\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 * Describes what to do with the indentation when pressing Enter.\n */\nexport var IndentAction;\n(function (IndentAction) {\n /**\n * Insert new line and copy the previous line's indentation.\n */\n IndentAction[IndentAction[\"None\"] = 0] = \"None\";\n /**\n * Insert new line and indent once (relative to the previous line's indentation).\n */\n IndentAction[IndentAction[\"Indent\"] = 1] = \"Indent\";\n /**\n * Insert two new lines:\n * - the first one indented which will hold the cursor\n * - the second one at the same indentation level\n */\n IndentAction[IndentAction[\"IndentOutdent\"] = 2] = \"IndentOutdent\";\n /**\n * Insert new line and outdent once (relative to the previous line's indentation).\n */\n IndentAction[IndentAction[\"Outdent\"] = 3] = \"Outdent\";\n})(IndentAction || (IndentAction = {}));\n/**\n * @internal\n */\nexport class StandardAutoClosingPairConditional {\n constructor(source) {\n this._neutralCharacter = null;\n this._neutralCharacterSearched = false;\n this.open = source.open;\n this.close = source.close;\n // initially allowed in all tokens\n this._inString = true;\n this._inComment = true;\n this._inRegEx = true;\n if (Array.isArray(source.notIn)) {\n for (let i = 0, len = source.notIn.length; i < len; i++) {\n const notIn = source.notIn[i];\n switch (notIn) {\n case 'string':\n this._inString = false;\n break;\n case 'comment':\n this._inComment = false;\n break;\n case 'regex':\n this._inRegEx = false;\n break;\n }\n }\n }\n }\n isOK(standardToken) {\n switch (standardToken) {\n case 0 /* StandardTokenType.Other */:\n return true;\n case 1 /* StandardTokenType.Comment */:\n return this._inComment;\n case 2 /* StandardTokenType.String */:\n return this._inString;\n case 3 /* StandardTokenType.RegEx */:\n return this._inRegEx;\n }\n }\n shouldAutoClose(context, column) {\n // Always complete on empty line\n if (context.getTokenCount() === 0) {\n return true;\n }\n const tokenIndex = context.findTokenIndexAtOffset(column - 2);\n const standardTokenType = context.getStandardTokenType(tokenIndex);\n return this.isOK(standardTokenType);\n }\n _findNeutralCharacterInRange(fromCharCode, toCharCode) {\n for (let charCode = fromCharCode; charCode <= toCharCode; charCode++) {\n const character = String.fromCharCode(charCode);\n if (!this.open.includes(character) && !this.close.includes(character)) {\n return character;\n }\n }\n return null;\n }\n /**\n * Find a character in the range [0-9a-zA-Z] that does not appear in the open or close\n */\n findNeutralCharacter() {\n if (!this._neutralCharacterSearched) {\n this._neutralCharacterSearched = true;\n if (!this._neutralCharacter) {\n this._neutralCharacter = this._findNeutralCharacterInRange(48 /* CharCode.Digit0 */, 57 /* CharCode.Digit9 */);\n }\n if (!this._neutralCharacter) {\n this._neutralCharacter = this._findNeutralCharacterInRange(97 /* CharCode.a */, 122 /* CharCode.z */);\n }\n if (!this._neutralCharacter) {\n this._neutralCharacter = this._findNeutralCharacterInRange(65 /* CharCode.A */, 90 /* CharCode.Z */);\n }\n }\n return this._neutralCharacter;\n }\n}\n/**\n * @internal\n */\nexport class AutoClosingPairs {\n constructor(autoClosingPairs) {\n this.autoClosingPairsOpenByStart = new Map();\n this.autoClosingPairsOpenByEnd = new Map();\n this.autoClosingPairsCloseByStart = new Map();\n this.autoClosingPairsCloseByEnd = new Map();\n this.autoClosingPairsCloseSingleChar = new Map();\n for (const pair of autoClosingPairs) {\n appendEntry(this.autoClosingPairsOpenByStart, pair.open.charAt(0), pair);\n appendEntry(this.autoClosingPairsOpenByEnd, pair.open.charAt(pair.open.length - 1), pair);\n appendEntry(this.autoClosingPairsCloseByStart, pair.close.charAt(0), pair);\n appendEntry(this.autoClosingPairsCloseByEnd, pair.close.charAt(pair.close.length - 1), pair);\n if (pair.close.length === 1 && pair.open.length === 1) {\n appendEntry(this.autoClosingPairsCloseSingleChar, pair.close, pair);\n }\n }\n }\n}\nfunction appendEntry(target, key, value) {\n if (target.has(key)) {\n target.get(key).push(value);\n }\n else {\n target.set(key, [value]);\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 *--------------------------------------------------------------------------------------------*/\nexport function createScopedLineTokens(context, offset) {\n const tokenCount = context.getCount();\n const tokenIndex = context.findTokenIndexAtOffset(offset);\n const desiredLanguageId = context.getLanguageId(tokenIndex);\n let lastTokenIndex = tokenIndex;\n while (lastTokenIndex + 1 < tokenCount && context.getLanguageId(lastTokenIndex + 1) === desiredLanguageId) {\n lastTokenIndex++;\n }\n let firstTokenIndex = tokenIndex;\n while (firstTokenIndex > 0 && context.getLanguageId(firstTokenIndex - 1) === desiredLanguageId) {\n firstTokenIndex--;\n }\n return new ScopedLineTokens(context, desiredLanguageId, firstTokenIndex, lastTokenIndex + 1, context.getStartOffset(firstTokenIndex), context.getEndOffset(lastTokenIndex));\n}\nexport class ScopedLineTokens {\n constructor(actual, languageId, firstTokenIndex, lastTokenIndex, firstCharOffset, lastCharOffset) {\n this._scopedLineTokensBrand = undefined;\n this._actual = actual;\n this.languageId = languageId;\n this._firstTokenIndex = firstTokenIndex;\n this._lastTokenIndex = lastTokenIndex;\n this.firstCharOffset = firstCharOffset;\n this._lastCharOffset = lastCharOffset;\n }\n getLineContent() {\n const actualLineContent = this._actual.getLineContent();\n return actualLineContent.substring(this.firstCharOffset, this._lastCharOffset);\n }\n getActualLineContentBefore(offset) {\n const actualLineContent = this._actual.getLineContent();\n return actualLineContent.substring(0, this.firstCharOffset + offset);\n }\n getTokenCount() {\n return this._lastTokenIndex - this._firstTokenIndex;\n }\n findTokenIndexAtOffset(offset) {\n return this._actual.findTokenIndexAtOffset(offset + this.firstCharOffset) - this._firstTokenIndex;\n }\n getStandardTokenType(tokenIndex) {\n return this._actual.getStandardTokenType(tokenIndex + this._firstTokenIndex);\n }\n}\nexport function ignoreBracketsInToken(standardTokenType) {\n return (standardTokenType & 3 /* IgnoreBracketsInTokens.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 *--------------------------------------------------------------------------------------------*/\nimport { StandardAutoClosingPairConditional } from '../languageConfiguration.js';\nexport class CharacterPairSupport {\n constructor(config) {\n if (config.autoClosingPairs) {\n this._autoClosingPairs = config.autoClosingPairs.map(el => new StandardAutoClosingPairConditional(el));\n }\n else if (config.brackets) {\n this._autoClosingPairs = config.brackets.map(b => new StandardAutoClosingPairConditional({ open: b[0], close: b[1] }));\n }\n else {\n this._autoClosingPairs = [];\n }\n if (config.__electricCharacterSupport && config.__electricCharacterSupport.docComment) {\n const docComment = config.__electricCharacterSupport.docComment;\n // IDocComment is legacy, only partially supported\n this._autoClosingPairs.push(new StandardAutoClosingPairConditional({ open: docComment.open, close: docComment.close || '' }));\n }\n this._autoCloseBeforeForQuotes = typeof config.autoCloseBefore === 'string' ? config.autoCloseBefore : CharacterPairSupport.DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED_QUOTES;\n this._autoCloseBeforeForBrackets = typeof config.autoCloseBefore === 'string' ? config.autoCloseBefore : CharacterPairSupport.DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED_BRACKETS;\n this._surroundingPairs = config.surroundingPairs || this._autoClosingPairs;\n }\n getAutoClosingPairs() {\n return this._autoClosingPairs;\n }\n getAutoCloseBeforeSet(forQuotes) {\n return (forQuotes ? this._autoCloseBeforeForQuotes : this._autoCloseBeforeForBrackets);\n }\n getSurroundingPairs() {\n return this._surroundingPairs;\n }\n}\nCharacterPairSupport.DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED_QUOTES = ';:.,=}])> \\n\\t';\nCharacterPairSupport.DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED_BRACKETS = '\\'\"`;:.,=}])> \\n\\t';\n", "/*---------------------------------------------------------------------------------------------\n * 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 { Lazy } from './lazy.js';\nconst hasBuffer = (typeof Buffer !== 'undefined');\nconst indexOfTable = new Lazy(() => new Uint8Array(256));\nlet textDecoder;\nexport class VSBuffer {\n /**\n * When running in a nodejs context, if `actual` is not a nodejs Buffer, the backing store for\n * the returned `VSBuffer` instance might use a nodejs Buffer allocated from node's Buffer pool,\n * which is not transferrable.\n */\n static wrap(actual) {\n if (hasBuffer && !(Buffer.isBuffer(actual))) {\n // https://nodejs.org/dist/latest-v10.x/docs/api/buffer.html#buffer_class_method_buffer_from_arraybuffer_byteoffset_length\n // Create a zero-copy Buffer wrapper around the ArrayBuffer pointed to by the Uint8Array\n actual = Buffer.from(actual.buffer, actual.byteOffset, actual.byteLength);\n }\n return new VSBuffer(actual);\n }\n constructor(buffer) {\n this.buffer = buffer;\n this.byteLength = this.buffer.byteLength;\n }\n toString() {\n if (hasBuffer) {\n return this.buffer.toString();\n }\n else {\n if (!textDecoder) {\n textDecoder = new TextDecoder();\n }\n return textDecoder.decode(this.buffer);\n }\n }\n}\nexport function readUInt16LE(source, offset) {\n return (((source[offset + 0] << 0) >>> 0) |\n ((source[offset + 1] << 8) >>> 0));\n}\nexport function writeUInt16LE(destination, value, offset) {\n destination[offset + 0] = (value & 0b11111111);\n value = value >>> 8;\n destination[offset + 1] = (value & 0b11111111);\n}\nexport function readUInt32BE(source, offset) {\n return (source[offset] * 2 ** 24\n + source[offset + 1] * 2 ** 16\n + source[offset + 2] * 2 ** 8\n + source[offset + 3]);\n}\nexport function writeUInt32BE(destination, value, offset) {\n destination[offset + 3] = value;\n value = value >>> 8;\n destination[offset + 2] = value;\n value = value >>> 8;\n destination[offset + 1] = value;\n value = value >>> 8;\n destination[offset] = value;\n}\nexport function readUInt8(source, offset) {\n return source[offset];\n}\nexport function writeUInt8(destination, value, offset) {\n destination[offset] = 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 *--------------------------------------------------------------------------------------------*/\nimport * as strings from '../../../base/common/strings.js';\nimport * as platform from '../../../base/common/platform.js';\nimport * as buffer from '../../../base/common/buffer.js';\nlet _utf16LE_TextDecoder;\nfunction getUTF16LE_TextDecoder() {\n if (!_utf16LE_TextDecoder) {\n _utf16LE_TextDecoder = new TextDecoder('UTF-16LE');\n }\n return _utf16LE_TextDecoder;\n}\nlet _utf16BE_TextDecoder;\nfunction getUTF16BE_TextDecoder() {\n if (!_utf16BE_TextDecoder) {\n _utf16BE_TextDecoder = new TextDecoder('UTF-16BE');\n }\n return _utf16BE_TextDecoder;\n}\nlet _platformTextDecoder;\nexport function getPlatformTextDecoder() {\n if (!_platformTextDecoder) {\n _platformTextDecoder = platform.isLittleEndian() ? getUTF16LE_TextDecoder() : getUTF16BE_TextDecoder();\n }\n return _platformTextDecoder;\n}\nexport function decodeUTF16LE(source, offset, len) {\n const view = new Uint16Array(source.buffer, offset, len);\n if (len > 0 && (view[0] === 0xFEFF || view[0] === 0xFFFE)) {\n // UTF16 sometimes starts with a BOM https://de.wikipedia.org/wiki/Byte_Order_Mark\n // It looks like TextDecoder.decode will eat up a leading BOM (0xFEFF or 0xFFFE)\n // We don't want that behavior because we know the string is UTF16LE and the BOM should be maintained\n // So we use the manual decoder\n return compatDecodeUTF16LE(source, offset, len);\n }\n return getUTF16LE_TextDecoder().decode(view);\n}\nfunction compatDecodeUTF16LE(source, offset, len) {\n const result = [];\n let resultLen = 0;\n for (let i = 0; i < len; i++) {\n const charCode = buffer.readUInt16LE(source, offset);\n offset += 2;\n result[resultLen++] = String.fromCharCode(charCode);\n }\n return result.join('');\n}\nexport class StringBuilder {\n constructor(capacity) {\n this._capacity = capacity | 0;\n this._buffer = new Uint16Array(this._capacity);\n this._completedStrings = null;\n this._bufferLength = 0;\n }\n reset() {\n this._completedStrings = null;\n this._bufferLength = 0;\n }\n build() {\n if (this._completedStrings !== null) {\n this._flushBuffer();\n return this._completedStrings.join('');\n }\n return this._buildBuffer();\n }\n _buildBuffer() {\n if (this._bufferLength === 0) {\n return '';\n }\n const view = new Uint16Array(this._buffer.buffer, 0, this._bufferLength);\n return getPlatformTextDecoder().decode(view);\n }\n _flushBuffer() {\n const bufferString = this._buildBuffer();\n this._bufferLength = 0;\n if (this._completedStrings === null) {\n this._completedStrings = [bufferString];\n }\n else {\n this._completedStrings[this._completedStrings.length] = bufferString;\n }\n }\n /**\n * Append a char code (<2^16)\n */\n appendCharCode(charCode) {\n const remainingSpace = this._capacity - this._bufferLength;\n if (remainingSpace <= 1) {\n if (remainingSpace === 0 || strings.isHighSurrogate(charCode)) {\n this._flushBuffer();\n }\n }\n this._buffer[this._bufferLength++] = charCode;\n }\n /**\n * Append an ASCII char code (<2^8)\n */\n appendASCIICharCode(charCode) {\n if (this._bufferLength === this._capacity) {\n // buffer is full\n this._flushBuffer();\n }\n this._buffer[this._bufferLength++] = charCode;\n }\n appendString(str) {\n const strLen = str.length;\n if (this._bufferLength + strLen >= this._capacity) {\n // This string does not fit in the remaining buffer space\n this._flushBuffer();\n this._completedStrings[this._completedStrings.length] = str;\n return;\n }\n for (let i = 0; i < strLen; i++) {\n this._buffer[this._bufferLength++] = str.charCodeAt(i);\n }\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 *--------------------------------------------------------------------------------------------*/\nimport * as strings from '../../../../base/common/strings.js';\nimport * as stringBuilder from '../../core/stringBuilder.js';\nimport { Range } from '../../core/range.js';\n/**\n * Represents a grouping of colliding bracket pairs.\n *\n * Most of the times this contains a single bracket pair,\n * but sometimes this contains multiple bracket pairs in cases\n * where the same string appears as a closing bracket for multiple\n * bracket pairs, or the same string appears an opening bracket for\n * multiple bracket pairs.\n *\n * e.g. of a group containing a single pair:\n * open: ['{'], close: ['}']\n *\n * e.g. of a group containing multiple pairs:\n * open: ['if', 'for'], close: ['end', 'end']\n */\nexport class RichEditBracket {\n constructor(languageId, index, open, close, forwardRegex, reversedRegex) {\n this._richEditBracketBrand = undefined;\n this.languageId = languageId;\n this.index = index;\n this.open = open;\n this.close = close;\n this.forwardRegex = forwardRegex;\n this.reversedRegex = reversedRegex;\n this._openSet = RichEditBracket._toSet(this.open);\n this._closeSet = RichEditBracket._toSet(this.close);\n }\n /**\n * Check if the provided `text` is an open bracket in this group.\n */\n isOpen(text) {\n return this._openSet.has(text);\n }\n /**\n * Check if the provided `text` is a close bracket in this group.\n */\n isClose(text) {\n return this._closeSet.has(text);\n }\n static _toSet(arr) {\n const result = new Set();\n for (const element of arr) {\n result.add(element);\n }\n return result;\n }\n}\n/**\n * Groups together brackets that have equal open or close sequences.\n *\n * For example, if the following brackets are defined:\n * ['IF','END']\n * ['for','end']\n * ['{','}']\n *\n * Then the grouped brackets would be:\n * { open: ['if', 'for'], close: ['end', 'end'] }\n * { open: ['{'], close: ['}'] }\n *\n */\nfunction groupFuzzyBrackets(brackets) {\n const N = brackets.length;\n brackets = brackets.map(b => [b[0].toLowerCase(), b[1].toLowerCase()]);\n const group = [];\n for (let i = 0; i < N; i++) {\n group[i] = i;\n }\n const areOverlapping = (a, b) => {\n const [aOpen, aClose] = a;\n const [bOpen, bClose] = b;\n return (aOpen === bOpen || aOpen === bClose || aClose === bOpen || aClose === bClose);\n };\n const mergeGroups = (g1, g2) => {\n const newG = Math.min(g1, g2);\n const oldG = Math.max(g1, g2);\n for (let i = 0; i < N; i++) {\n if (group[i] === oldG) {\n group[i] = newG;\n }\n }\n };\n // group together brackets that have the same open or the same close sequence\n for (let i = 0; i < N; i++) {\n const a = brackets[i];\n for (let j = i + 1; j < N; j++) {\n const b = brackets[j];\n if (areOverlapping(a, b)) {\n mergeGroups(group[i], group[j]);\n }\n }\n }\n const result = [];\n for (let g = 0; g < N; g++) {\n const currentOpen = [];\n const currentClose = [];\n for (let i = 0; i < N; i++) {\n if (group[i] === g) {\n const [open, close] = brackets[i];\n currentOpen.push(open);\n currentClose.push(close);\n }\n }\n if (currentOpen.length > 0) {\n result.push({\n open: currentOpen,\n close: currentClose\n });\n }\n }\n return result;\n}\nexport class RichEditBrackets {\n constructor(languageId, _brackets) {\n this._richEditBracketsBrand = undefined;\n const brackets = groupFuzzyBrackets(_brackets);\n this.brackets = brackets.map((b, index) => {\n return new RichEditBracket(languageId, index, b.open, b.close, getRegexForBracketPair(b.open, b.close, brackets, index), getReversedRegexForBracketPair(b.open, b.close, brackets, index));\n });\n this.forwardRegex = getRegexForBrackets(this.brackets);\n this.reversedRegex = getReversedRegexForBrackets(this.brackets);\n this.textIsBracket = {};\n this.textIsOpenBracket = {};\n this.maxBracketLength = 0;\n for (const bracket of this.brackets) {\n for (const open of bracket.open) {\n this.textIsBracket[open] = bracket;\n this.textIsOpenBracket[open] = true;\n this.maxBracketLength = Math.max(this.maxBracketLength, open.length);\n }\n for (const close of bracket.close) {\n this.textIsBracket[close] = bracket;\n this.textIsOpenBracket[close] = false;\n this.maxBracketLength = Math.max(this.maxBracketLength, close.length);\n }\n }\n }\n}\nfunction collectSuperstrings(str, brackets, currentIndex, dest) {\n for (let i = 0, len = brackets.length; i < len; i++) {\n if (i === currentIndex) {\n continue;\n }\n const bracket = brackets[i];\n for (const open of bracket.open) {\n if (open.indexOf(str) >= 0) {\n dest.push(open);\n }\n }\n for (const close of bracket.close) {\n if (close.indexOf(str) >= 0) {\n dest.push(close);\n }\n }\n }\n}\nfunction lengthcmp(a, b) {\n return a.length - b.length;\n}\nfunction unique(arr) {\n if (arr.length <= 1) {\n return arr;\n }\n const result = [];\n const seen = new Set();\n for (const element of arr) {\n if (seen.has(element)) {\n continue;\n }\n result.push(element);\n seen.add(element);\n }\n return result;\n}\n/**\n * Create a regular expression that can be used to search forward in a piece of text\n * for a group of bracket pairs. But this regex must be built in a way in which\n * it is aware of the other bracket pairs defined for the language.\n *\n * For example, if a language contains the following bracket pairs:\n * ['begin', 'end']\n * ['if', 'end if']\n * The two bracket pairs do not collide because no open or close brackets are equal.\n * So the function getRegexForBracketPair is called twice, once with\n * the ['begin'], ['end'] group consisting of one bracket pair, and once with\n * the ['if'], ['end if'] group consiting of the other bracket pair.\n *\n * But there could be a situation where an occurrence of 'end if' is mistaken\n * for an occurrence of 'end'.\n *\n * Therefore, for the bracket pair ['begin', 'end'], the regex will also\n * target 'end if'. The regex will be something like:\n * /(\\bend if\\b)|(\\bend\\b)|(\\bif\\b)/\n *\n * The regex also searches for \"superstrings\" (other brackets that might be mistaken with the current bracket).\n *\n */\nfunction getRegexForBracketPair(open, close, brackets, currentIndex) {\n // search in all brackets for other brackets that are a superstring of these brackets\n let pieces = [];\n pieces = pieces.concat(open);\n pieces = pieces.concat(close);\n for (let i = 0, len = pieces.length; i < len; i++) {\n collectSuperstrings(pieces[i], brackets, currentIndex, pieces);\n }\n pieces = unique(pieces);\n pieces.sort(lengthcmp);\n pieces.reverse();\n return createBracketOrRegExp(pieces);\n}\n/**\n * Matching a regular expression in JS can only be done \"forwards\". So JS offers natively only\n * methods to find the first match of a regex in a string. But sometimes, it is useful to\n * find the last match of a regex in a string. For such a situation, a nice solution is to\n * simply reverse the string and then search for a reversed regex.\n *\n * This function also has the fine details of `getRegexForBracketPair`. For the same example\n * given above, the regex produced here would look like:\n * /(\\bfi dne\\b)|(\\bdne\\b)|(\\bfi\\b)/\n */\nfunction getReversedRegexForBracketPair(open, close, brackets, currentIndex) {\n // search in all brackets for other brackets that are a superstring of these brackets\n let pieces = [];\n pieces = pieces.concat(open);\n pieces = pieces.concat(close);\n for (let i = 0, len = pieces.length; i < len; i++) {\n collectSuperstrings(pieces[i], brackets, currentIndex, pieces);\n }\n pieces = unique(pieces);\n pieces.sort(lengthcmp);\n pieces.reverse();\n return createBracketOrRegExp(pieces.map(toReversedString));\n}\n/**\n * Creates a regular expression that targets all bracket pairs.\n *\n * e.g. for the bracket pairs:\n * ['{','}']\n * ['begin,'end']\n * ['for','end']\n * the regex would look like:\n * /(\\{)|(\\})|(\\bbegin\\b)|(\\bend\\b)|(\\bfor\\b)/\n */\nfunction getRegexForBrackets(brackets) {\n let pieces = [];\n for (const bracket of brackets) {\n for (const open of bracket.open) {\n pieces.push(open);\n }\n for (const close of bracket.close) {\n pieces.push(close);\n }\n }\n pieces = unique(pieces);\n return createBracketOrRegExp(pieces);\n}\n/**\n * Matching a regular expression in JS can only be done \"forwards\". So JS offers natively only\n * methods to find the first match of a regex in a string. But sometimes, it is useful to\n * find the last match of a regex in a string. For such a situation, a nice solution is to\n * simply reverse the string and then search for a reversed regex.\n *\n * e.g. for the bracket pairs:\n * ['{','}']\n * ['begin,'end']\n * ['for','end']\n * the regex would look like:\n * /(\\{)|(\\})|(\\bnigeb\\b)|(\\bdne\\b)|(\\brof\\b)/\n */\nfunction getReversedRegexForBrackets(brackets) {\n let pieces = [];\n for (const bracket of brackets) {\n for (const open of bracket.open) {\n pieces.push(open);\n }\n for (const close of bracket.close) {\n pieces.push(close);\n }\n }\n pieces = unique(pieces);\n return createBracketOrRegExp(pieces.map(toReversedString));\n}\nfunction prepareBracketForRegExp(str) {\n // This bracket pair uses letters like e.g. \"begin\" - \"end\"\n const insertWordBoundaries = (/^[\\w ]+$/.test(str));\n str = strings.escapeRegExpCharacters(str);\n return (insertWordBoundaries ? `\\\\b${str}\\\\b` : str);\n}\nfunction createBracketOrRegExp(pieces) {\n const regexStr = `(${pieces.map(prepareBracketForRegExp).join(')|(')})`;\n return strings.createRegExp(regexStr, true);\n}\nconst toReversedString = (function () {\n function reverse(str) {\n // create a Uint16Array and then use a TextDecoder to create a string\n const arr = new Uint16Array(str.length);\n let offset = 0;\n for (let i = str.length - 1; i >= 0; i--) {\n arr[offset++] = str.charCodeAt(i);\n }\n return stringBuilder.getPlatformTextDecoder().decode(arr);\n }\n let lastInput = null;\n let lastOutput = null;\n return function toReversedString(str) {\n if (lastInput !== str) {\n lastInput = str;\n lastOutput = reverse(lastInput);\n }\n return lastOutput;\n };\n})();\nexport class BracketsUtils {\n static _findPrevBracketInText(reversedBracketRegex, lineNumber, reversedText, offset) {\n const m = reversedText.match(reversedBracketRegex);\n if (!m) {\n return null;\n }\n const matchOffset = reversedText.length - (m.index || 0);\n const matchLength = m[0].length;\n const absoluteMatchOffset = offset + matchOffset;\n return new Range(lineNumber, absoluteMatchOffset - matchLength + 1, lineNumber, absoluteMatchOffset + 1);\n }\n static findPrevBracketInRange(reversedBracketRegex, lineNumber, lineText, startOffset, endOffset) {\n // Because JS does not support backwards regex search, we search forwards in a reversed string with a reversed regex ;)\n const reversedLineText = toReversedString(lineText);\n const reversedSubstr = reversedLineText.substring(lineText.length - endOffset, lineText.length - startOffset);\n return this._findPrevBracketInText(reversedBracketRegex, lineNumber, reversedSubstr, startOffset);\n }\n static findNextBracketInText(bracketRegex, lineNumber, text, offset) {\n const m = text.match(bracketRegex);\n if (!m) {\n return null;\n }\n const matchOffset = m.index || 0;\n const matchLength = m[0].length;\n if (matchLength === 0) {\n return null;\n }\n const absoluteMatchOffset = offset + matchOffset;\n return new Range(lineNumber, absoluteMatchOffset + 1, lineNumber, absoluteMatchOffset + 1 + matchLength);\n }\n static findNextBracketInRange(bracketRegex, lineNumber, lineText, startOffset, endOffset) {\n const substr = lineText.substring(startOffset, endOffset);\n return this.findNextBracketInText(bracketRegex, lineNumber, substr, startOffset);\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 *--------------------------------------------------------------------------------------------*/\nimport { distinct } from '../../../../base/common/arrays.js';\nimport { ignoreBracketsInToken } from '../supports.js';\nimport { BracketsUtils } from './richEditBrackets.js';\nexport class BracketElectricCharacterSupport {\n constructor(richEditBrackets) {\n this._richEditBrackets = richEditBrackets;\n }\n getElectricCharacters() {\n const result = [];\n if (this._richEditBrackets) {\n for (const bracket of this._richEditBrackets.brackets) {\n for (const close of bracket.close) {\n const lastChar = close.charAt(close.length - 1);\n result.push(lastChar);\n }\n }\n }\n return distinct(result);\n }\n onElectricCharacter(character, context, column) {\n if (!this._richEditBrackets || this._richEditBrackets.brackets.length === 0) {\n return null;\n }\n const tokenIndex = context.findTokenIndexAtOffset(column - 1);\n if (ignoreBracketsInToken(context.getStandardTokenType(tokenIndex))) {\n return null;\n }\n const reversedBracketRegex = this._richEditBrackets.reversedRegex;\n const text = context.getLineContent().substring(0, column - 1) + character;\n const r = BracketsUtils.findPrevBracketInRange(reversedBracketRegex, 1, text, 0, text.length);\n if (!r) {\n return null;\n }\n const bracketText = text.substring(r.startColumn - 1, r.endColumn - 1).toLowerCase();\n const isOpen = this._richEditBrackets.textIsOpenBracket[bracketText];\n if (isOpen) {\n return null;\n }\n const textBeforeBracket = context.getActualLineContentBefore(r.startColumn - 1);\n if (!/^\\s*$/.test(textBeforeBracket)) {\n // There is other text on the line before the bracket\n return null;\n }\n return {\n matchOpenBracket: bracketText\n };\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 *--------------------------------------------------------------------------------------------*/\nfunction resetGlobalRegex(reg) {\n if (reg.global) {\n reg.lastIndex = 0;\n }\n return true;\n}\nexport class IndentRulesSupport {\n constructor(indentationRules) {\n this._indentationRules = indentationRules;\n }\n shouldIncrease(text) {\n if (this._indentationRules) {\n if (this._indentationRules.increaseIndentPattern && resetGlobalRegex(this._indentationRules.increaseIndentPattern) && this._indentationRules.increaseIndentPattern.test(text)) {\n return true;\n }\n // if (this._indentationRules.indentNextLinePattern && this._indentationRules.indentNextLinePattern.test(text)) {\n // \treturn true;\n // }\n }\n return false;\n }\n shouldDecrease(text) {\n if (this._indentationRules && this._indentationRules.decreaseIndentPattern && resetGlobalRegex(this._indentationRules.decreaseIndentPattern) && this._indentationRules.decreaseIndentPattern.test(text)) {\n return true;\n }\n return false;\n }\n shouldIndentNextLine(text) {\n if (this._indentationRules && this._indentationRules.indentNextLinePattern && resetGlobalRegex(this._indentationRules.indentNextLinePattern) && this._indentationRules.indentNextLinePattern.test(text)) {\n return true;\n }\n return false;\n }\n shouldIgnore(text) {\n // the text matches `unIndentedLinePattern`\n if (this._indentationRules && this._indentationRules.unIndentedLinePattern && resetGlobalRegex(this._indentationRules.unIndentedLinePattern) && this._indentationRules.unIndentedLinePattern.test(text)) {\n return true;\n }\n return false;\n }\n getIndentMetadata(text) {\n let ret = 0;\n if (this.shouldIncrease(text)) {\n ret += 1 /* IndentConsts.INCREASE_MASK */;\n }\n if (this.shouldDecrease(text)) {\n ret += 2 /* IndentConsts.DECREASE_MASK */;\n }\n if (this.shouldIndentNextLine(text)) {\n ret += 4 /* IndentConsts.INDENT_NEXTLINE_MASK */;\n }\n if (this.shouldIgnore(text)) {\n ret += 8 /* IndentConsts.UNINDENT_MASK */;\n }\n return ret;\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 *--------------------------------------------------------------------------------------------*/\nimport { onUnexpectedError } from '../../../../base/common/errors.js';\nimport * as strings from '../../../../base/common/strings.js';\nimport { IndentAction } from '../languageConfiguration.js';\nexport class OnEnterSupport {\n constructor(opts) {\n opts = opts || {};\n opts.brackets = opts.brackets || [\n ['(', ')'],\n ['{', '}'],\n ['[', ']']\n ];\n this._brackets = [];\n opts.brackets.forEach((bracket) => {\n const openRegExp = OnEnterSupport._createOpenBracketRegExp(bracket[0]);\n const closeRegExp = OnEnterSupport._createCloseBracketRegExp(bracket[1]);\n if (openRegExp && closeRegExp) {\n this._brackets.push({\n open: bracket[0],\n openRegExp: openRegExp,\n close: bracket[1],\n closeRegExp: closeRegExp,\n });\n }\n });\n this._regExpRules = opts.onEnterRules || [];\n }\n onEnter(autoIndent, previousLineText, beforeEnterText, afterEnterText) {\n // (1): `regExpRules`\n if (autoIndent >= 3 /* EditorAutoIndentStrategy.Advanced */) {\n for (let i = 0, len = this._regExpRules.length; i < len; i++) {\n const rule = this._regExpRules[i];\n const regResult = [{\n reg: rule.beforeText,\n text: beforeEnterText\n }, {\n reg: rule.afterText,\n text: afterEnterText\n }, {\n reg: rule.previousLineText,\n text: previousLineText\n }].every((obj) => {\n if (!obj.reg) {\n return true;\n }\n obj.reg.lastIndex = 0; // To disable the effect of the \"g\" flag.\n return obj.reg.test(obj.text);\n });\n if (regResult) {\n return rule.action;\n }\n }\n }\n // (2): Special indent-outdent\n if (autoIndent >= 2 /* EditorAutoIndentStrategy.Brackets */) {\n if (beforeEnterText.length > 0 && afterEnterText.length > 0) {\n for (let i = 0, len = this._brackets.length; i < len; i++) {\n const bracket = this._brackets[i];\n if (bracket.openRegExp.test(beforeEnterText) && bracket.closeRegExp.test(afterEnterText)) {\n return { indentAction: IndentAction.IndentOutdent };\n }\n }\n }\n }\n // (4): Open bracket based logic\n if (autoIndent >= 2 /* EditorAutoIndentStrategy.Brackets */) {\n if (beforeEnterText.length > 0) {\n for (let i = 0, len = this._brackets.length; i < len; i++) {\n const bracket = this._brackets[i];\n if (bracket.openRegExp.test(beforeEnterText)) {\n return { indentAction: IndentAction.Indent };\n }\n }\n }\n }\n return null;\n }\n static _createOpenBracketRegExp(bracket) {\n let str = strings.escapeRegExpCharacters(bracket);\n if (!/\\B/.test(str.charAt(0))) {\n str = '\\\\b' + str;\n }\n str += '\\\\s*$';\n return OnEnterSupport._safeRegExp(str);\n }\n static _createCloseBracketRegExp(bracket) {\n let str = strings.escapeRegExpCharacters(bracket);\n if (!/\\B/.test(str.charAt(str.length - 1))) {\n str = str + '\\\\b';\n }\n str = '^\\\\s*' + str;\n return OnEnterSupport._safeRegExp(str);\n }\n static _safeRegExp(def) {\n try {\n return new RegExp(def);\n }\n catch (err) {\n onUnexpectedError(err);\n return null;\n }\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 *--------------------------------------------------------------------------------------------*/\nimport { createDecorator } from '../../instantiation/common/instantiation.js';\nexport const IConfigurationService = createDecorator('configurationService');\nexport function toValuesTree(properties, conflictReporter) {\n const root = Object.create(null);\n for (const key in properties) {\n addToValueTree(root, key, properties[key], conflictReporter);\n }\n return root;\n}\nexport function addToValueTree(settingsTreeRoot, key, value, conflictReporter) {\n const segments = key.split('.');\n const last = segments.pop();\n let curr = settingsTreeRoot;\n for (let i = 0; i < segments.length; i++) {\n const s = segments[i];\n let obj = curr[s];\n switch (typeof obj) {\n case 'undefined':\n obj = curr[s] = Object.create(null);\n break;\n case 'object':\n if (obj === null) {\n conflictReporter(`Ignoring ${key} as ${segments.slice(0, i + 1).join('.')} is null`);\n return;\n }\n break;\n default:\n conflictReporter(`Ignoring ${key} as ${segments.slice(0, i + 1).join('.')} is ${JSON.stringify(obj)}`);\n return;\n }\n curr = obj;\n }\n if (typeof curr === 'object' && curr !== null) {\n try {\n curr[last] = value; // workaround https://github.com/microsoft/vscode/issues/13606\n }\n catch (e) {\n conflictReporter(`Ignoring ${key} as ${segments.join('.')} is ${JSON.stringify(curr)}`);\n }\n }\n else {\n conflictReporter(`Ignoring ${key} as ${segments.join('.')} is ${JSON.stringify(curr)}`);\n }\n}\nexport function removeFromValueTree(valueTree, key) {\n const segments = key.split('.');\n doRemoveFromValueTree(valueTree, segments);\n}\nfunction doRemoveFromValueTree(valueTree, segments) {\n const first = segments.shift();\n if (segments.length === 0) {\n // Reached last segment\n delete valueTree[first];\n return;\n }\n if (Object.keys(valueTree).indexOf(first) !== -1) {\n const value = valueTree[first];\n if (typeof value === 'object' && !Array.isArray(value)) {\n doRemoveFromValueTree(value, segments);\n if (Object.keys(value).length === 0) {\n delete valueTree[first];\n }\n }\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(config, settingPath, defaultValue) {\n function accessSetting(config, path) {\n let current = config;\n for (const component of path) {\n if (typeof current !== 'object' || current === null) {\n return undefined;\n }\n current = current[component];\n }\n return current;\n }\n const path = settingPath.split('.');\n const result = accessSetting(config, path);\n return typeof result === 'undefined' ? defaultValue : result;\n}\nexport function getLanguageTagSettingPlainKey(settingKey) {\n return settingKey.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 *--------------------------------------------------------------------------------------------*/\nimport { createDecorator } from '../../../platform/instantiation/common/instantiation.js';\nexport const ILanguageService = createDecorator('languageService');\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nexport class SyncDescriptor {\n constructor(ctor, staticArguments = [], supportsDelayedInstantiation = false) {\n this.ctor = ctor;\n this.staticArguments = staticArguments;\n this.supportsDelayedInstantiation = supportsDelayedInstantiation;\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 *--------------------------------------------------------------------------------------------*/\nimport { SyncDescriptor } from './descriptors.js';\nconst _registry = [];\nexport function registerSingleton(id, ctorOrDescriptor, supportsDelayedInstantiation) {\n if (!(ctorOrDescriptor instanceof SyncDescriptor)) {\n ctorOrDescriptor = new SyncDescriptor(ctorOrDescriptor, [], Boolean(supportsDelayedInstantiation));\n }\n _registry.push([id, ctorOrDescriptor]);\n}\nexport function getSingletonServiceDescriptors() {\n return _registry;\n}\n", "export const Mimes = Object.freeze({\n text: 'text/plain',\n binary: 'application/octet-stream',\n unknown: 'application/unknown',\n markdown: 'text/markdown',\n latex: 'text/latex',\n uriList: 'text/uri-list',\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 { Emitter } from '../../../base/common/event.js';\nimport * as platform from '../../registry/common/platform.js';\nexport const Extensions = {\n JSONContribution: 'base.contributions.json'\n};\nfunction normalizeId(id) {\n if (id.length > 0 && id.charAt(id.length - 1) === '#') {\n return id.substring(0, id.length - 1);\n }\n return id;\n}\nclass JSONContributionRegistry {\n constructor() {\n this._onDidChangeSchema = new Emitter();\n this.schemasById = {};\n }\n registerSchema(uri, unresolvedSchemaContent) {\n this.schemasById[normalizeId(uri)] = unresolvedSchemaContent;\n this._onDidChangeSchema.fire(uri);\n }\n notifySchemaChanged(uri) {\n this._onDidChangeSchema.fire(uri);\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 *--------------------------------------------------------------------------------------------*/\nimport { distinct } from '../../../base/common/arrays.js';\nimport { Emitter } from '../../../base/common/event.js';\nimport * as types from '../../../base/common/types.js';\nimport * as nls from '../../../nls.js';\nimport { getLanguageTagSettingPlainKey } from './configuration.js';\nimport { Extensions as JSONExtensions } from '../../jsonschemas/common/jsonContributionRegistry.js';\nimport { Registry } from '../../registry/common/platform.js';\nexport const Extensions = {\n Configuration: 'base.contributions.configuration'\n};\nexport const allSettings = { properties: {}, patternProperties: {} };\nexport const applicationSettings = { properties: {}, patternProperties: {} };\nexport const machineSettings = { properties: {}, patternProperties: {} };\nexport const machineOverridableSettings = { properties: {}, patternProperties: {} };\nexport const windowSettings = { properties: {}, patternProperties: {} };\nexport const resourceSettings = { properties: {}, patternProperties: {} };\nexport const resourceLanguageSettingsSchemaId = 'vscode://schemas/settings/resourceLanguage';\nconst contributionRegistry = Registry.as(JSONExtensions.JSONContribution);\nclass ConfigurationRegistry {\n constructor() {\n this.overrideIdentifiers = new Set();\n this._onDidSchemaChange = new Emitter();\n this._onDidUpdateConfiguration = new Emitter();\n this.configurationDefaultsOverrides = new Map();\n this.defaultLanguageConfigurationOverridesNode = {\n id: 'defaultOverrides',\n title: nls.localize('defaultLanguageConfigurationOverrides.title', \"Default Language Configuration Overrides\"),\n properties: {}\n };\n this.configurationContributors = [this.defaultLanguageConfigurationOverridesNode];\n this.resourceLanguageSettingsSchema = {\n properties: {},\n patternProperties: {},\n additionalProperties: true,\n allowTrailingCommas: true,\n allowComments: true\n };\n this.configurationProperties = {};\n this.policyConfigurations = new Map();\n this.excludedConfigurationProperties = {};\n contributionRegistry.registerSchema(resourceLanguageSettingsSchemaId, this.resourceLanguageSettingsSchema);\n this.registerOverridePropertyPatternKey();\n }\n registerConfiguration(configuration, validate = true) {\n this.registerConfigurations([configuration], validate);\n }\n registerConfigurations(configurations, validate = true) {\n const properties = new Set();\n this.doRegisterConfigurations(configurations, validate, properties);\n contributionRegistry.registerSchema(resourceLanguageSettingsSchemaId, this.resourceLanguageSettingsSchema);\n this._onDidSchemaChange.fire();\n this._onDidUpdateConfiguration.fire({ properties });\n }\n registerDefaultConfigurations(configurationDefaults) {\n const properties = new Set();\n this.doRegisterDefaultConfigurations(configurationDefaults, properties);\n this._onDidSchemaChange.fire();\n this._onDidUpdateConfiguration.fire({ properties, defaultsOverrides: true });\n }\n doRegisterDefaultConfigurations(configurationDefaults, bucket) {\n var _a;\n const overrideIdentifiers = [];\n for (const { overrides, source } of configurationDefaults) {\n for (const key in overrides) {\n bucket.add(key);\n if (OVERRIDE_PROPERTY_REGEX.test(key)) {\n const configurationDefaultOverride = this.configurationDefaultsOverrides.get(key);\n const valuesSources = (_a = configurationDefaultOverride === null || configurationDefaultOverride === void 0 ? void 0 : configurationDefaultOverride.valuesSources) !== null && _a !== void 0 ? _a : new Map();\n if (source) {\n for (const configuration of Object.keys(overrides[key])) {\n valuesSources.set(configuration, source);\n }\n }\n const defaultValue = { ...((configurationDefaultOverride === null || configurationDefaultOverride === void 0 ? void 0 : configurationDefaultOverride.value) || {}), ...overrides[key] };\n this.configurationDefaultsOverrides.set(key, { source, value: defaultValue, valuesSources });\n const plainKey = getLanguageTagSettingPlainKey(key);\n const property = {\n type: 'object',\n default: defaultValue,\n description: nls.localize('defaultLanguageConfiguration.description', \"Configure settings to be overridden for the {0} language.\", plainKey),\n $ref: resourceLanguageSettingsSchemaId,\n defaultDefaultValue: defaultValue,\n source: types.isString(source) ? undefined : source,\n defaultValueSource: source\n };\n overrideIdentifiers.push(...overrideIdentifiersFromKey(key));\n this.configurationProperties[key] = property;\n this.defaultLanguageConfigurationOverridesNode.properties[key] = property;\n }\n else {\n this.configurationDefaultsOverrides.set(key, { value: overrides[key], source });\n const property = this.configurationProperties[key];\n if (property) {\n this.updatePropertyDefaultValue(key, property);\n this.updateSchema(key, property);\n }\n }\n }\n }\n this.doRegisterOverrideIdentifiers(overrideIdentifiers);\n }\n registerOverrideIdentifiers(overrideIdentifiers) {\n this.doRegisterOverrideIdentifiers(overrideIdentifiers);\n this._onDidSchemaChange.fire();\n }\n doRegisterOverrideIdentifiers(overrideIdentifiers) {\n for (const overrideIdentifier of overrideIdentifiers) {\n this.overrideIdentifiers.add(overrideIdentifier);\n }\n this.updateOverridePropertyPatternKey();\n }\n doRegisterConfigurations(configurations, validate, bucket) {\n configurations.forEach(configuration => {\n this.validateAndRegisterProperties(configuration, validate, configuration.extensionInfo, configuration.restrictedProperties, undefined, bucket);\n this.configurationContributors.push(configuration);\n this.registerJSONConfiguration(configuration);\n });\n }\n validateAndRegisterProperties(configuration, validate = true, extensionInfo, restrictedProperties, scope = 3 /* ConfigurationScope.WINDOW */, bucket) {\n var _a;\n scope = types.isUndefinedOrNull(configuration.scope) ? scope : configuration.scope;\n const properties = configuration.properties;\n if (properties) {\n for (const key in properties) {\n const property = properties[key];\n if (validate && validateProperty(key, property)) {\n delete properties[key];\n continue;\n }\n property.source = extensionInfo;\n // update default value\n property.defaultDefaultValue = properties[key].default;\n this.updatePropertyDefaultValue(key, property);\n // update scope\n if (OVERRIDE_PROPERTY_REGEX.test(key)) {\n property.scope = undefined; // No scope for overridable properties `[${identifier}]`\n }\n else {\n property.scope = types.isUndefinedOrNull(property.scope) ? scope : property.scope;\n property.restricted = types.isUndefinedOrNull(property.restricted) ? !!(restrictedProperties === null || restrictedProperties === void 0 ? void 0 : restrictedProperties.includes(key)) : property.restricted;\n }\n // Add to properties maps\n // Property is included by default if 'included' is unspecified\n if (properties[key].hasOwnProperty('included') && !properties[key].included) {\n this.excludedConfigurationProperties[key] = properties[key];\n delete properties[key];\n continue;\n }\n else {\n this.configurationProperties[key] = properties[key];\n if ((_a = properties[key].policy) === null || _a === void 0 ? void 0 : _a.name) {\n this.policyConfigurations.set(properties[key].policy.name, key);\n }\n }\n if (!properties[key].deprecationMessage && properties[key].markdownDeprecationMessage) {\n // If not set, default deprecationMessage to the markdown source\n properties[key].deprecationMessage = properties[key].markdownDeprecationMessage;\n }\n bucket.add(key);\n }\n }\n const subNodes = configuration.allOf;\n if (subNodes) {\n for (const node of subNodes) {\n this.validateAndRegisterProperties(node, validate, extensionInfo, restrictedProperties, scope, bucket);\n }\n }\n }\n getConfigurationProperties() {\n return this.configurationProperties;\n }\n getPolicyConfigurations() {\n return this.policyConfigurations;\n }\n registerJSONConfiguration(configuration) {\n const register = (configuration) => {\n const properties = configuration.properties;\n if (properties) {\n for (const key in properties) {\n this.updateSchema(key, properties[key]);\n }\n }\n const subNodes = configuration.allOf;\n subNodes === null || subNodes === void 0 ? void 0 : subNodes.forEach(register);\n };\n register(configuration);\n }\n updateSchema(key, property) {\n allSettings.properties[key] = property;\n switch (property.scope) {\n case 1 /* ConfigurationScope.APPLICATION */:\n applicationSettings.properties[key] = property;\n break;\n case 2 /* ConfigurationScope.MACHINE */:\n machineSettings.properties[key] = property;\n break;\n case 6 /* ConfigurationScope.MACHINE_OVERRIDABLE */:\n machineOverridableSettings.properties[key] = property;\n break;\n case 3 /* ConfigurationScope.WINDOW */:\n windowSettings.properties[key] = property;\n break;\n case 4 /* ConfigurationScope.RESOURCE */:\n resourceSettings.properties[key] = property;\n break;\n case 5 /* ConfigurationScope.LANGUAGE_OVERRIDABLE */:\n resourceSettings.properties[key] = property;\n this.resourceLanguageSettingsSchema.properties[key] = property;\n break;\n }\n }\n updateOverridePropertyPatternKey() {\n for (const overrideIdentifier of this.overrideIdentifiers.values()) {\n const overrideIdentifierProperty = `[${overrideIdentifier}]`;\n const resourceLanguagePropertiesSchema = {\n type: 'object',\n description: nls.localize('overrideSettings.defaultDescription', \"Configure editor settings to be overridden for a language.\"),\n errorMessage: nls.localize('overrideSettings.errorMessage', \"This setting does not support per-language configuration.\"),\n $ref: resourceLanguageSettingsSchemaId,\n };\n this.updatePropertyDefaultValue(overrideIdentifierProperty, resourceLanguagePropertiesSchema);\n allSettings.properties[overrideIdentifierProperty] = resourceLanguagePropertiesSchema;\n applicationSettings.properties[overrideIdentifierProperty] = resourceLanguagePropertiesSchema;\n machineSettings.properties[overrideIdentifierProperty] = resourceLanguagePropertiesSchema;\n machineOverridableSettings.properties[overrideIdentifierProperty] = resourceLanguagePropertiesSchema;\n windowSettings.properties[overrideIdentifierProperty] = resourceLanguagePropertiesSchema;\n resourceSettings.properties[overrideIdentifierProperty] = resourceLanguagePropertiesSchema;\n }\n }\n registerOverridePropertyPatternKey() {\n const resourceLanguagePropertiesSchema = {\n type: 'object',\n description: nls.localize('overrideSettings.defaultDescription', \"Configure editor settings to be overridden for a language.\"),\n errorMessage: nls.localize('overrideSettings.errorMessage', \"This setting does not support per-language configuration.\"),\n $ref: resourceLanguageSettingsSchemaId,\n };\n allSettings.patternProperties[OVERRIDE_PROPERTY_PATTERN] = resourceLanguagePropertiesSchema;\n applicationSettings.patternProperties[OVERRIDE_PROPERTY_PATTERN] = resourceLanguagePropertiesSchema;\n machineSettings.patternProperties[OVERRIDE_PROPERTY_PATTERN] = resourceLanguagePropertiesSchema;\n machineOverridableSettings.patternProperties[OVERRIDE_PROPERTY_PATTERN] = resourceLanguagePropertiesSchema;\n windowSettings.patternProperties[OVERRIDE_PROPERTY_PATTERN] = resourceLanguagePropertiesSchema;\n resourceSettings.patternProperties[OVERRIDE_PROPERTY_PATTERN] = resourceLanguagePropertiesSchema;\n this._onDidSchemaChange.fire();\n }\n updatePropertyDefaultValue(key, property) {\n const configurationdefaultOverride = this.configurationDefaultsOverrides.get(key);\n let defaultValue = configurationdefaultOverride === null || configurationdefaultOverride === void 0 ? void 0 : configurationdefaultOverride.value;\n let defaultSource = configurationdefaultOverride === null || configurationdefaultOverride === void 0 ? void 0 : configurationdefaultOverride.source;\n if (types.isUndefined(defaultValue)) {\n defaultValue = property.defaultDefaultValue;\n defaultSource = undefined;\n }\n if (types.isUndefined(defaultValue)) {\n defaultValue = getDefaultValue(property.type);\n }\n property.default = defaultValue;\n property.defaultValueSource = defaultSource;\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);\nexport function overrideIdentifiersFromKey(key) {\n const identifiers = [];\n if (OVERRIDE_PROPERTY_REGEX.test(key)) {\n let matches = OVERRIDE_IDENTIFIER_REGEX.exec(key);\n while (matches === null || matches === void 0 ? void 0 : matches.length) {\n const identifier = matches[1].trim();\n if (identifier) {\n identifiers.push(identifier);\n }\n matches = OVERRIDE_IDENTIFIER_REGEX.exec(key);\n }\n }\n return distinct(identifiers);\n}\nexport function getDefaultValue(type) {\n const t = Array.isArray(type) ? type[0] : type;\n switch (t) {\n case 'boolean':\n return false;\n case 'integer':\n case 'number':\n return 0;\n case 'string':\n return '';\n case 'array':\n return [];\n case 'object':\n return {};\n default:\n return null;\n }\n}\nconst configurationRegistry = new ConfigurationRegistry();\nRegistry.add(Extensions.Configuration, configurationRegistry);\nexport function validateProperty(property, schema) {\n var _a, _b, _c, _d;\n if (!property.trim()) {\n return nls.localize('config.property.empty', \"Cannot register an empty property\");\n }\n if (OVERRIDE_PROPERTY_REGEX.test(property)) {\n return nls.localize('config.property.languageDefault', \"Cannot register '{0}'. This matches property pattern '\\\\\\\\[.*\\\\\\\\]$' for describing language specific editor settings. Use 'configurationDefaults' contribution.\", property);\n }\n if (configurationRegistry.getConfigurationProperties()[property] !== undefined) {\n return nls.localize('config.property.duplicate', \"Cannot register '{0}'. This property is already registered.\", property);\n }\n if (((_a = schema.policy) === null || _a === void 0 ? void 0 : _a.name) && configurationRegistry.getPolicyConfigurations().get((_b = schema.policy) === null || _b === void 0 ? void 0 : _b.name) !== undefined) {\n return nls.localize('config.policy.duplicate', \"Cannot register '{0}'. The associated policy {1} is already registered with {2}.\", property, (_c = schema.policy) === null || _c === void 0 ? void 0 : _c.name, configurationRegistry.getPolicyConfigurations().get((_d = schema.policy) === null || _d === void 0 ? void 0 : _d.name));\n }\n return 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 *--------------------------------------------------------------------------------------------*/\nimport * as nls from '../../../nls.js';\nimport { Emitter } from '../../../base/common/event.js';\nimport { Registry } from '../../../platform/registry/common/platform.js';\nimport { Mimes } from '../../../base/common/mime.js';\nimport { Extensions as ConfigurationExtensions } from '../../../platform/configuration/common/configurationRegistry.js';\n// Define extension point ids\nexport const Extensions = {\n ModesRegistry: 'editor.modesRegistry'\n};\nexport class EditorModesRegistry {\n constructor() {\n this._onDidChangeLanguages = new Emitter();\n this.onDidChangeLanguages = this._onDidChangeLanguages.event;\n this._languages = [];\n }\n registerLanguage(def) {\n this._languages.push(def);\n this._onDidChangeLanguages.fire(undefined);\n return {\n dispose: () => {\n for (let i = 0, len = this._languages.length; i < len; i++) {\n if (this._languages[i] === def) {\n this._languages.splice(i, 1);\n return;\n }\n }\n }\n };\n }\n getLanguages() {\n return this._languages;\n }\n}\nexport const ModesRegistry = new EditorModesRegistry();\nRegistry.add(Extensions.ModesRegistry, ModesRegistry);\nexport const PLAINTEXT_LANGUAGE_ID = 'plaintext';\nexport const PLAINTEXT_EXTENSION = '.txt';\nModesRegistry.registerLanguage({\n id: PLAINTEXT_LANGUAGE_ID,\n extensions: [PLAINTEXT_EXTENSION],\n aliases: [nls.localize('plainText.alias', \"Plain Text\"), 'text'],\n mimetypes: [Mimes.text]\n});\nRegistry.as(ConfigurationExtensions.Configuration)\n .registerDefaultConfigurations([{\n overrides: {\n '[plaintext]': {\n 'editor.unicodeHighlight.ambiguousCharacters': false,\n 'editor.unicodeHighlight.invisibleCharacters': false\n }\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 *--------------------------------------------------------------------------------------------*/\nimport { CachedFunction } from '../../../../base/common/cache.js';\n/**\n * Captures all bracket related configurations for a single language.\n * Immutable.\n*/\nexport class LanguageBracketsConfiguration {\n constructor(languageId, config) {\n this.languageId = languageId;\n const bracketPairs = config.brackets ? filterValidBrackets(config.brackets) : [];\n const openingBracketInfos = new CachedFunction((bracket) => {\n const closing = new Set();\n return {\n info: new OpeningBracketKind(this, bracket, closing),\n closing,\n };\n });\n const closingBracketInfos = new CachedFunction((bracket) => {\n const opening = new Set();\n const openingColorized = new Set();\n return {\n info: new ClosingBracketKind(this, bracket, opening, openingColorized),\n opening,\n openingColorized,\n };\n });\n for (const [open, close] of bracketPairs) {\n const opening = openingBracketInfos.get(open);\n const closing = closingBracketInfos.get(close);\n opening.closing.add(closing.info);\n closing.opening.add(opening.info);\n }\n // Treat colorized brackets as brackets, and mark them as colorized.\n const colorizedBracketPairs = config.colorizedBracketPairs\n ? filterValidBrackets(config.colorizedBracketPairs)\n // If not configured: Take all brackets except `<` ... `>`\n // Many languages set < ... > as bracket pair, even though they also use it as comparison operator.\n // This leads to problems when colorizing this bracket, so we exclude it if not explicitly configured otherwise.\n // https://github.com/microsoft/vscode/issues/132476\n : bracketPairs.filter((p) => !(p[0] === '<' && p[1] === '>'));\n for (const [open, close] of colorizedBracketPairs) {\n const opening = openingBracketInfos.get(open);\n const closing = closingBracketInfos.get(close);\n opening.closing.add(closing.info);\n closing.openingColorized.add(opening.info);\n closing.opening.add(opening.info);\n }\n this._openingBrackets = new Map([...openingBracketInfos.cachedValues].map(([k, v]) => [k, v.info]));\n this._closingBrackets = new Map([...closingBracketInfos.cachedValues].map(([k, v]) => [k, v.info]));\n }\n /**\n * No two brackets have the same bracket text.\n */\n get openingBrackets() {\n return [...this._openingBrackets.values()];\n }\n /**\n * No two brackets have the same bracket text.\n */\n get closingBrackets() {\n return [...this._closingBrackets.values()];\n }\n getOpeningBracketInfo(bracketText) {\n return this._openingBrackets.get(bracketText);\n }\n getClosingBracketInfo(bracketText) {\n return this._closingBrackets.get(bracketText);\n }\n getBracketInfo(bracketText) {\n return this.getOpeningBracketInfo(bracketText) || this.getClosingBracketInfo(bracketText);\n }\n}\nfunction filterValidBrackets(bracketPairs) {\n return bracketPairs.filter(([open, close]) => open !== '' && close !== '');\n}\nexport class BracketKindBase {\n constructor(config, bracketText) {\n this.config = config;\n this.bracketText = bracketText;\n }\n get languageId() {\n return this.config.languageId;\n }\n}\nexport class OpeningBracketKind extends BracketKindBase {\n constructor(config, bracketText, openedBrackets) {\n super(config, bracketText);\n this.openedBrackets = openedBrackets;\n this.isOpeningBracket = true;\n }\n}\nexport class ClosingBracketKind extends BracketKindBase {\n constructor(config, bracketText, \n /**\n * Non empty array of all opening brackets this bracket closes.\n */\n openingBrackets, openingColorizedBrackets) {\n super(config, bracketText);\n this.openingBrackets = openingBrackets;\n this.openingColorizedBrackets = openingColorizedBrackets;\n this.isOpeningBracket = false;\n }\n /**\n * Checks if this bracket closes the given other bracket.\n * If the bracket infos come from different configurations, this method will return false.\n */\n closes(other) {\n if (other['config'] !== this.config) {\n return false;\n }\n return this.openingBrackets.has(other);\n }\n closesColorized(other) {\n if (other['config'] !== this.config) {\n return false;\n }\n return this.openingColorizedBrackets.has(other);\n }\n getOpeningBrackets() {\n return [...this.openingBrackets];\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 *--------------------------------------------------------------------------------------------*/\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};\nimport { Emitter } from '../../../base/common/event.js';\nimport { Disposable, toDisposable } from '../../../base/common/lifecycle.js';\nimport * as strings from '../../../base/common/strings.js';\nimport { DEFAULT_WORD_REGEXP, ensureValidWordDefinition } from '../core/wordHelper.js';\nimport { AutoClosingPairs } from './languageConfiguration.js';\nimport { createScopedLineTokens } from './supports.js';\nimport { CharacterPairSupport } from './supports/characterPair.js';\nimport { BracketElectricCharacterSupport } from './supports/electricCharacter.js';\nimport { IndentRulesSupport } from './supports/indentRules.js';\nimport { OnEnterSupport } from './supports/onEnter.js';\nimport { RichEditBrackets } from './supports/richEditBrackets.js';\nimport { createDecorator } from '../../../platform/instantiation/common/instantiation.js';\nimport { IConfigurationService } from '../../../platform/configuration/common/configuration.js';\nimport { ILanguageService } from './language.js';\nimport { registerSingleton } from '../../../platform/instantiation/common/extensions.js';\nimport { PLAINTEXT_LANGUAGE_ID } from './modesRegistry.js';\nimport { LanguageBracketsConfiguration } from './supports/languageBracketsConfiguration.js';\nexport class LanguageConfigurationServiceChangeEvent {\n constructor(languageId) {\n this.languageId = languageId;\n }\n affects(languageId) {\n return !this.languageId ? true : this.languageId === languageId;\n }\n}\nexport const ILanguageConfigurationService = createDecorator('languageConfigurationService');\nlet LanguageConfigurationService = class LanguageConfigurationService extends Disposable {\n constructor(configurationService, languageService) {\n super();\n this.configurationService = configurationService;\n this.languageService = languageService;\n this._registry = this._register(new LanguageConfigurationRegistry());\n this.onDidChangeEmitter = this._register(new Emitter());\n this.onDidChange = this.onDidChangeEmitter.event;\n this.configurations = new Map();\n const languageConfigKeys = new Set(Object.values(customizedLanguageConfigKeys));\n this._register(this.configurationService.onDidChangeConfiguration((e) => {\n const globalConfigChanged = e.change.keys.some((k) => languageConfigKeys.has(k));\n const localConfigChanged = e.change.overrides\n .filter(([overrideLangName, keys]) => keys.some((k) => languageConfigKeys.has(k)))\n .map(([overrideLangName]) => overrideLangName);\n if (globalConfigChanged) {\n this.configurations.clear();\n this.onDidChangeEmitter.fire(new LanguageConfigurationServiceChangeEvent(undefined));\n }\n else {\n for (const languageId of localConfigChanged) {\n if (this.languageService.isRegisteredLanguageId(languageId)) {\n this.configurations.delete(languageId);\n this.onDidChangeEmitter.fire(new LanguageConfigurationServiceChangeEvent(languageId));\n }\n }\n }\n }));\n this._register(this._registry.onDidChange((e) => {\n this.configurations.delete(e.languageId);\n this.onDidChangeEmitter.fire(new LanguageConfigurationServiceChangeEvent(e.languageId));\n }));\n }\n register(languageId, configuration, priority) {\n return this._registry.register(languageId, configuration, priority);\n }\n getLanguageConfiguration(languageId) {\n let result = this.configurations.get(languageId);\n if (!result) {\n result = computeConfig(languageId, this._registry, this.configurationService, this.languageService);\n this.configurations.set(languageId, result);\n }\n return result;\n }\n};\nLanguageConfigurationService = __decorate([\n __param(0, IConfigurationService),\n __param(1, ILanguageService)\n], LanguageConfigurationService);\nexport { LanguageConfigurationService };\nfunction computeConfig(languageId, registry, configurationService, languageService) {\n let languageConfig = registry.getLanguageConfiguration(languageId);\n if (!languageConfig) {\n if (!languageService.isRegisteredLanguageId(languageId)) {\n // this happens for the null language, which can be returned by monarch.\n // Instead of throwing an error, we just return a default config.\n return new ResolvedLanguageConfiguration(languageId, {});\n }\n languageConfig = new ResolvedLanguageConfiguration(languageId, {});\n }\n const customizedConfig = getCustomizedLanguageConfig(languageConfig.languageId, configurationService);\n const data = combineLanguageConfigurations([languageConfig.underlyingConfig, customizedConfig]);\n const config = new ResolvedLanguageConfiguration(languageConfig.languageId, data);\n return config;\n}\nconst customizedLanguageConfigKeys = {\n brackets: 'editor.language.brackets',\n colorizedBracketPairs: 'editor.language.colorizedBracketPairs'\n};\nfunction getCustomizedLanguageConfig(languageId, configurationService) {\n const brackets = configurationService.getValue(customizedLanguageConfigKeys.brackets, {\n overrideIdentifier: languageId,\n });\n const colorizedBracketPairs = configurationService.getValue(customizedLanguageConfigKeys.colorizedBracketPairs, {\n overrideIdentifier: languageId,\n });\n return {\n brackets: validateBracketPairs(brackets),\n colorizedBracketPairs: validateBracketPairs(colorizedBracketPairs),\n };\n}\nfunction validateBracketPairs(data) {\n if (!Array.isArray(data)) {\n return undefined;\n }\n return data.map(pair => {\n if (!Array.isArray(pair) || pair.length !== 2) {\n return undefined;\n }\n return [pair[0], pair[1]];\n }).filter((p) => !!p);\n}\nexport function getIndentationAtPosition(model, lineNumber, column) {\n const lineText = model.getLineContent(lineNumber);\n let indentation = strings.getLeadingWhitespace(lineText);\n if (indentation.length > column - 1) {\n indentation = indentation.substring(0, column - 1);\n }\n return indentation;\n}\nexport function getScopedLineTokens(model, lineNumber, columnNumber) {\n model.tokenization.forceTokenization(lineNumber);\n const lineTokens = model.tokenization.getLineTokens(lineNumber);\n const column = (typeof columnNumber === 'undefined' ? model.getLineMaxColumn(lineNumber) - 1 : columnNumber - 1);\n return createScopedLineTokens(lineTokens, column);\n}\nclass ComposedLanguageConfiguration {\n constructor(languageId) {\n this.languageId = languageId;\n this._resolved = null;\n this._entries = [];\n this._order = 0;\n this._resolved = null;\n }\n register(configuration, priority) {\n const entry = new LanguageConfigurationContribution(configuration, priority, ++this._order);\n this._entries.push(entry);\n this._resolved = null;\n return toDisposable(() => {\n for (let i = 0; i < this._entries.length; i++) {\n if (this._entries[i] === entry) {\n this._entries.splice(i, 1);\n this._resolved = null;\n break;\n }\n }\n });\n }\n getResolvedConfiguration() {\n if (!this._resolved) {\n const config = this._resolve();\n if (config) {\n this._resolved = new ResolvedLanguageConfiguration(this.languageId, config);\n }\n }\n return this._resolved;\n }\n _resolve() {\n if (this._entries.length === 0) {\n return null;\n }\n this._entries.sort(LanguageConfigurationContribution.cmp);\n return combineLanguageConfigurations(this._entries.map(e => e.configuration));\n }\n}\nfunction combineLanguageConfigurations(configs) {\n let result = {\n comments: undefined,\n brackets: undefined,\n wordPattern: undefined,\n indentationRules: undefined,\n onEnterRules: undefined,\n autoClosingPairs: undefined,\n surroundingPairs: undefined,\n autoCloseBefore: undefined,\n folding: undefined,\n colorizedBracketPairs: undefined,\n __electricCharacterSupport: undefined,\n };\n for (const entry of configs) {\n result = {\n comments: entry.comments || result.comments,\n brackets: entry.brackets || result.brackets,\n wordPattern: entry.wordPattern || result.wordPattern,\n indentationRules: entry.indentationRules || result.indentationRules,\n onEnterRules: entry.onEnterRules || result.onEnterRules,\n autoClosingPairs: entry.autoClosingPairs || result.autoClosingPairs,\n surroundingPairs: entry.surroundingPairs || result.surroundingPairs,\n autoCloseBefore: entry.autoCloseBefore || result.autoCloseBefore,\n folding: entry.folding || result.folding,\n colorizedBracketPairs: entry.colorizedBracketPairs || result.colorizedBracketPairs,\n __electricCharacterSupport: entry.__electricCharacterSupport || result.__electricCharacterSupport,\n };\n }\n return result;\n}\nclass LanguageConfigurationContribution {\n constructor(configuration, priority, order) {\n this.configuration = configuration;\n this.priority = priority;\n this.order = order;\n }\n static cmp(a, b) {\n if (a.priority === b.priority) {\n // higher order last\n return a.order - b.order;\n }\n // higher priority last\n return a.priority - b.priority;\n }\n}\nexport class LanguageConfigurationChangeEvent {\n constructor(languageId) {\n this.languageId = languageId;\n }\n}\nexport class LanguageConfigurationRegistry extends Disposable {\n constructor() {\n super();\n this._entries = new Map();\n this._onDidChange = this._register(new Emitter());\n this.onDidChange = this._onDidChange.event;\n this._register(this.register(PLAINTEXT_LANGUAGE_ID, {\n brackets: [\n ['(', ')'],\n ['[', ']'],\n ['{', '}'],\n ],\n surroundingPairs: [\n { open: '{', close: '}' },\n { open: '[', close: ']' },\n { open: '(', close: ')' },\n { open: '<', close: '>' },\n { open: '\\\"', close: '\\\"' },\n { open: '\\'', close: '\\'' },\n { open: '`', close: '`' },\n ],\n colorizedBracketPairs: [],\n folding: {\n offSide: true\n }\n }, 0));\n }\n /**\n * @param priority Use a higher number for higher priority\n */\n register(languageId, configuration, priority = 0) {\n let entries = this._entries.get(languageId);\n if (!entries) {\n entries = new ComposedLanguageConfiguration(languageId);\n this._entries.set(languageId, entries);\n }\n const disposable = entries.register(configuration, priority);\n this._onDidChange.fire(new LanguageConfigurationChangeEvent(languageId));\n return toDisposable(() => {\n disposable.dispose();\n this._onDidChange.fire(new LanguageConfigurationChangeEvent(languageId));\n });\n }\n getLanguageConfiguration(languageId) {\n const entries = this._entries.get(languageId);\n return (entries === null || entries === void 0 ? void 0 : entries.getResolvedConfiguration()) || null;\n }\n}\n/**\n * Immutable.\n*/\nexport class ResolvedLanguageConfiguration {\n constructor(languageId, underlyingConfig) {\n this.languageId = languageId;\n this.underlyingConfig = underlyingConfig;\n this._brackets = null;\n this._electricCharacter = null;\n this._onEnterSupport =\n this.underlyingConfig.brackets ||\n this.underlyingConfig.indentationRules ||\n this.underlyingConfig.onEnterRules\n ? new OnEnterSupport(this.underlyingConfig)\n : null;\n this.comments = ResolvedLanguageConfiguration._handleComments(this.underlyingConfig);\n this.characterPair = new CharacterPairSupport(this.underlyingConfig);\n this.wordDefinition = this.underlyingConfig.wordPattern || DEFAULT_WORD_REGEXP;\n this.indentationRules = this.underlyingConfig.indentationRules;\n if (this.underlyingConfig.indentationRules) {\n this.indentRulesSupport = new IndentRulesSupport(this.underlyingConfig.indentationRules);\n }\n else {\n this.indentRulesSupport = null;\n }\n this.foldingRules = this.underlyingConfig.folding || {};\n this.bracketsNew = new LanguageBracketsConfiguration(languageId, this.underlyingConfig);\n }\n getWordDefinition() {\n return ensureValidWordDefinition(this.wordDefinition);\n }\n get brackets() {\n if (!this._brackets && this.underlyingConfig.brackets) {\n this._brackets = new RichEditBrackets(this.languageId, this.underlyingConfig.brackets);\n }\n return this._brackets;\n }\n get electricCharacter() {\n if (!this._electricCharacter) {\n this._electricCharacter = new BracketElectricCharacterSupport(this.brackets);\n }\n return this._electricCharacter;\n }\n onEnter(autoIndent, previousLineText, beforeEnterText, afterEnterText) {\n if (!this._onEnterSupport) {\n return null;\n }\n return this._onEnterSupport.onEnter(autoIndent, previousLineText, beforeEnterText, afterEnterText);\n }\n getAutoClosingPairs() {\n return new AutoClosingPairs(this.characterPair.getAutoClosingPairs());\n }\n getAutoCloseBeforeSet(forQuotes) {\n return this.characterPair.getAutoCloseBeforeSet(forQuotes);\n }\n getSurroundingPairs() {\n return this.characterPair.getSurroundingPairs();\n }\n static _handleComments(conf) {\n const commentRule = conf.comments;\n if (!commentRule) {\n return null;\n }\n // comment configuration\n const comments = {};\n if (commentRule.lineComment) {\n comments.lineCommentToken = commentRule.lineComment;\n }\n if (commentRule.blockComment) {\n const [blockStart, blockEnd] = commentRule.blockComment;\n comments.blockCommentStartToken = blockStart;\n comments.blockCommentEndToken = blockEnd;\n }\n return comments;\n }\n}\nregisterSingleton(ILanguageConfigurationService, LanguageConfigurationService, 1 /* 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 *--------------------------------------------------------------------------------------------*/\nexport function toUint8(v) {\n if (v < 0) {\n return 0;\n }\n if (v > 255 /* Constants.MAX_UINT_8 */) {\n return 255 /* Constants.MAX_UINT_8 */;\n }\n return v | 0;\n}\nexport function toUint32(v) {\n if (v < 0) {\n return 0;\n }\n if (v > 4294967295 /* Constants.MAX_UINT_32 */) {\n return 4294967295 /* Constants.MAX_UINT_32 */;\n }\n return v | 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 *--------------------------------------------------------------------------------------------*/\nimport { toUint8 } from '../../../base/common/uint.js';\n/**\n * A fast character classifier that uses a compact array for ASCII values.\n */\nexport class CharacterClassifier {\n constructor(_defaultValue) {\n const defaultValue = toUint8(_defaultValue);\n this._defaultValue = defaultValue;\n this._asciiMap = CharacterClassifier._createAsciiMap(defaultValue);\n this._map = new Map();\n }\n static _createAsciiMap(defaultValue) {\n const asciiMap = new Uint8Array(256);\n asciiMap.fill(defaultValue);\n return asciiMap;\n }\n set(charCode, _value) {\n const value = toUint8(_value);\n if (charCode >= 0 && charCode < 256) {\n this._asciiMap[charCode] = value;\n }\n else {\n this._map.set(charCode, value);\n }\n }\n get(charCode) {\n if (charCode >= 0 && charCode < 256) {\n return this._asciiMap[charCode];\n }\n else {\n return (this._map.get(charCode) || this._defaultValue);\n }\n }\n clear() {\n this._asciiMap.fill(this._defaultValue);\n this._map.clear();\n }\n}\nexport class CharacterSet {\n constructor() {\n this._actual = new CharacterClassifier(0 /* Boolean.False */);\n }\n add(charCode) {\n this._actual.set(charCode, 1 /* Boolean.True */);\n }\n has(charCode) {\n return (this._actual.get(charCode) === 1 /* Boolean.True */);\n }\n clear() {\n return this._actual.clear();\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 *--------------------------------------------------------------------------------------------*/\nvar _a, _b;\nclass ResourceMapEntry {\n constructor(uri, value) {\n this.uri = uri;\n this.value = value;\n }\n}\nfunction isEntries(arg) {\n return Array.isArray(arg);\n}\nexport class ResourceMap {\n constructor(arg, toKey) {\n this[_a] = 'ResourceMap';\n if (arg instanceof ResourceMap) {\n this.map = new Map(arg.map);\n this.toKey = toKey !== null && toKey !== void 0 ? toKey : ResourceMap.defaultToKey;\n }\n else if (isEntries(arg)) {\n this.map = new Map();\n this.toKey = toKey !== null && toKey !== void 0 ? toKey : ResourceMap.defaultToKey;\n for (const [resource, value] of arg) {\n this.set(resource, value);\n }\n }\n else {\n this.map = new Map();\n this.toKey = arg !== null && arg !== void 0 ? arg : ResourceMap.defaultToKey;\n }\n }\n set(resource, value) {\n this.map.set(this.toKey(resource), new ResourceMapEntry(resource, value));\n return this;\n }\n get(resource) {\n var _c;\n return (_c = this.map.get(this.toKey(resource))) === null || _c === void 0 ? void 0 : _c.value;\n }\n has(resource) {\n return this.map.has(this.toKey(resource));\n }\n get size() {\n return this.map.size;\n }\n clear() {\n this.map.clear();\n }\n delete(resource) {\n return this.map.delete(this.toKey(resource));\n }\n forEach(clb, thisArg) {\n if (typeof thisArg !== 'undefined') {\n clb = clb.bind(thisArg);\n }\n for (const [_, entry] of this.map) {\n clb(entry.value, entry.uri, this);\n }\n }\n *values() {\n for (const entry of this.map.values()) {\n yield entry.value;\n }\n }\n *keys() {\n for (const entry of this.map.values()) {\n yield entry.uri;\n }\n }\n *entries() {\n for (const entry of this.map.values()) {\n yield [entry.uri, entry.value];\n }\n }\n *[(_a = Symbol.toStringTag, Symbol.iterator)]() {\n for (const [, entry] of this.map) {\n yield [entry.uri, entry.value];\n }\n }\n}\nResourceMap.defaultToKey = (resource) => resource.toString();\nexport class LinkedMap {\n constructor() {\n this[_b] = 'LinkedMap';\n this._map = new Map();\n this._head = undefined;\n this._tail = undefined;\n this._size = 0;\n this._state = 0;\n }\n clear() {\n this._map.clear();\n this._head = undefined;\n this._tail = undefined;\n this._size = 0;\n this._state++;\n }\n isEmpty() {\n return !this._head && !this._tail;\n }\n get size() {\n return this._size;\n }\n get first() {\n var _c;\n return (_c = this._head) === null || _c === void 0 ? void 0 : _c.value;\n }\n get last() {\n var _c;\n return (_c = this._tail) === null || _c === void 0 ? void 0 : _c.value;\n }\n has(key) {\n return this._map.has(key);\n }\n get(key, touch = 0 /* Touch.None */) {\n const item = this._map.get(key);\n if (!item) {\n return undefined;\n }\n if (touch !== 0 /* Touch.None */) {\n this.touch(item, touch);\n }\n return item.value;\n }\n set(key, value, touch = 0 /* Touch.None */) {\n let item = this._map.get(key);\n if (item) {\n item.value = value;\n if (touch !== 0 /* Touch.None */) {\n this.touch(item, touch);\n }\n }\n else {\n item = { key, value, next: undefined, previous: undefined };\n switch (touch) {\n case 0 /* Touch.None */:\n this.addItemLast(item);\n break;\n case 1 /* Touch.AsOld */:\n this.addItemFirst(item);\n break;\n case 2 /* Touch.AsNew */:\n this.addItemLast(item);\n break;\n default:\n this.addItemLast(item);\n break;\n }\n this._map.set(key, item);\n this._size++;\n }\n return this;\n }\n delete(key) {\n return !!this.remove(key);\n }\n remove(key) {\n const item = this._map.get(key);\n if (!item) {\n return undefined;\n }\n this._map.delete(key);\n this.removeItem(item);\n this._size--;\n return item.value;\n }\n shift() {\n if (!this._head && !this._tail) {\n return undefined;\n }\n if (!this._head || !this._tail) {\n throw new Error('Invalid list');\n }\n const item = this._head;\n this._map.delete(item.key);\n this.removeItem(item);\n this._size--;\n return item.value;\n }\n forEach(callbackfn, thisArg) {\n const state = this._state;\n let current = this._head;\n while (current) {\n if (thisArg) {\n callbackfn.bind(thisArg)(current.value, current.key, this);\n }\n else {\n callbackfn(current.value, current.key, this);\n }\n if (this._state !== state) {\n throw new Error(`LinkedMap got modified during iteration.`);\n }\n current = current.next;\n }\n }\n keys() {\n const map = this;\n const state = this._state;\n let current = this._head;\n const iterator = {\n [Symbol.iterator]() {\n return iterator;\n },\n next() {\n if (map._state !== state) {\n throw new Error(`LinkedMap got modified during iteration.`);\n }\n if (current) {\n const result = { value: current.key, done: false };\n current = current.next;\n return result;\n }\n else {\n return { value: undefined, done: true };\n }\n }\n };\n return iterator;\n }\n values() {\n const map = this;\n const state = this._state;\n let current = this._head;\n const iterator = {\n [Symbol.iterator]() {\n return iterator;\n },\n next() {\n if (map._state !== state) {\n throw new Error(`LinkedMap got modified during iteration.`);\n }\n if (current) {\n const result = { value: current.value, done: false };\n current = current.next;\n return result;\n }\n else {\n return { value: undefined, done: true };\n }\n }\n };\n return iterator;\n }\n entries() {\n const map = this;\n const state = this._state;\n let current = this._head;\n const iterator = {\n [Symbol.iterator]() {\n return iterator;\n },\n next() {\n if (map._state !== state) {\n throw new Error(`LinkedMap got modified during iteration.`);\n }\n if (current) {\n const result = { value: [current.key, current.value], done: false };\n current = current.next;\n return result;\n }\n else {\n return { value: undefined, done: true };\n }\n }\n };\n return iterator;\n }\n [(_b = Symbol.toStringTag, Symbol.iterator)]() {\n return this.entries();\n }\n trimOld(newSize) {\n if (newSize >= this.size) {\n return;\n }\n if (newSize === 0) {\n this.clear();\n return;\n }\n let current = this._head;\n let currentSize = this.size;\n while (current && currentSize > newSize) {\n this._map.delete(current.key);\n current = current.next;\n currentSize--;\n }\n this._head = current;\n this._size = currentSize;\n if (current) {\n current.previous = undefined;\n }\n this._state++;\n }\n trimNew(newSize) {\n if (newSize >= this.size) {\n return;\n }\n if (newSize === 0) {\n this.clear();\n return;\n }\n let current = this._tail;\n let currentSize = this.size;\n while (current && currentSize > newSize) {\n this._map.delete(current.key);\n current = current.previous;\n currentSize--;\n }\n this._tail = current;\n this._size = currentSize;\n if (current) {\n current.next = undefined;\n }\n this._state++;\n }\n addItemFirst(item) {\n // First time Insert\n if (!this._head && !this._tail) {\n this._tail = item;\n }\n else if (!this._head) {\n throw new Error('Invalid list');\n }\n else {\n item.next = this._head;\n this._head.previous = item;\n }\n this._head = item;\n this._state++;\n }\n addItemLast(item) {\n // First time Insert\n if (!this._head && !this._tail) {\n this._head = item;\n }\n else if (!this._tail) {\n throw new Error('Invalid list');\n }\n else {\n item.previous = this._tail;\n this._tail.next = item;\n }\n this._tail = item;\n this._state++;\n }\n removeItem(item) {\n if (item === this._head && item === this._tail) {\n this._head = undefined;\n this._tail = undefined;\n }\n else if (item === this._head) {\n // This can only happen if size === 1 which is handled\n // by the case above.\n if (!item.next) {\n throw new Error('Invalid list');\n }\n item.next.previous = undefined;\n this._head = item.next;\n }\n else if (item === this._tail) {\n // This can only happen if size === 1 which is handled\n // by the case above.\n if (!item.previous) {\n throw new Error('Invalid list');\n }\n item.previous.next = undefined;\n this._tail = item.previous;\n }\n else {\n const next = item.next;\n const previous = item.previous;\n if (!next || !previous) {\n throw new Error('Invalid list');\n }\n next.previous = previous;\n previous.next = next;\n }\n item.next = undefined;\n item.previous = undefined;\n this._state++;\n }\n touch(item, touch) {\n if (!this._head || !this._tail) {\n throw new Error('Invalid list');\n }\n if ((touch !== 1 /* Touch.AsOld */ && touch !== 2 /* Touch.AsNew */)) {\n return;\n }\n if (touch === 1 /* Touch.AsOld */) {\n if (item === this._head) {\n return;\n }\n const next = item.next;\n const previous = item.previous;\n // Unlink the item\n if (item === this._tail) {\n // previous must be defined since item was not head but is tail\n // So there are more than on item in the map\n previous.next = undefined;\n this._tail = previous;\n }\n else {\n // Both next and previous are not undefined since item was neither head nor tail.\n next.previous = previous;\n previous.next = next;\n }\n // Insert the node at head\n item.previous = undefined;\n item.next = this._head;\n this._head.previous = item;\n this._head = item;\n this._state++;\n }\n else if (touch === 2 /* Touch.AsNew */) {\n if (item === this._tail) {\n return;\n }\n const next = item.next;\n const previous = item.previous;\n // Unlink the item.\n if (item === this._head) {\n // next must be defined since item was not tail but is head\n // So there are more than on item in the map\n next.previous = undefined;\n this._head = next;\n }\n else {\n // Both next and previous are not undefined since item was neither head nor tail.\n next.previous = previous;\n previous.next = next;\n }\n item.next = undefined;\n item.previous = this._tail;\n this._tail.next = item;\n this._tail = item;\n this._state++;\n }\n }\n toJSON() {\n const data = [];\n this.forEach((value, key) => {\n data.push([key, value]);\n });\n return data;\n }\n fromJSON(data) {\n this.clear();\n for (const [key, value] of data) {\n this.set(key, value);\n }\n }\n}\nclass Cache extends LinkedMap {\n constructor(limit, ratio = 1) {\n super();\n this._limit = limit;\n this._ratio = Math.min(Math.max(0, ratio), 1);\n }\n get limit() {\n return this._limit;\n }\n set limit(limit) {\n this._limit = limit;\n this.checkTrim();\n }\n get(key, touch = 2 /* Touch.AsNew */) {\n return super.get(key, touch);\n }\n peek(key) {\n return super.get(key, 0 /* Touch.None */);\n }\n set(key, value) {\n super.set(key, value, 2 /* Touch.AsNew */);\n return this;\n }\n checkTrim() {\n if (this.size > this._limit) {\n this.trim(Math.round(this._limit * this._ratio));\n }\n }\n}\nexport class LRUCache extends Cache {\n constructor(limit, ratio = 1) {\n super(limit, ratio);\n }\n trim(newSize) {\n this.trimOld(newSize);\n }\n set(key, value) {\n super.set(key, value);\n this.checkTrim();\n return this;\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 {\n constructor(entries) {\n this._m1 = new Map();\n this._m2 = new Map();\n if (entries) {\n for (const [key, value] of entries) {\n this.set(key, value);\n }\n }\n }\n clear() {\n this._m1.clear();\n this._m2.clear();\n }\n set(key, value) {\n this._m1.set(key, value);\n this._m2.set(value, key);\n }\n get(key) {\n return this._m1.get(key);\n }\n getKey(value) {\n return this._m2.get(value);\n }\n delete(key) {\n const value = this._m1.get(key);\n if (value === undefined) {\n return false;\n }\n this._m1.delete(key);\n this._m2.delete(value);\n return true;\n }\n keys() {\n return this._m1.keys();\n }\n values() {\n return this._m1.values();\n }\n}\nexport class SetMap {\n constructor() {\n this.map = new Map();\n }\n add(key, value) {\n let values = this.map.get(key);\n if (!values) {\n values = new Set();\n this.map.set(key, values);\n }\n values.add(value);\n }\n delete(key, value) {\n const values = this.map.get(key);\n if (!values) {\n return;\n }\n values.delete(value);\n if (values.size === 0) {\n this.map.delete(key);\n }\n }\n forEach(key, fn) {\n const values = this.map.get(key);\n if (!values) {\n return;\n }\n values.forEach(fn);\n }\n get(key) {\n const values = this.map.get(key);\n if (!values) {\n return new Set();\n }\n return values;\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 *--------------------------------------------------------------------------------------------*/\nimport { LRUCache } from '../../../base/common/map.js';\nimport { CharacterClassifier } from './characterClassifier.js';\nexport class WordCharacterClassifier extends CharacterClassifier {\n constructor(wordSeparators, intlSegmenterLocales) {\n super(0 /* WordCharacterClass.Regular */);\n this._segmenter = null;\n this._cachedLine = null;\n this._cachedSegments = [];\n this.intlSegmenterLocales = intlSegmenterLocales;\n if (this.intlSegmenterLocales.length > 0) {\n this._segmenter = new Intl.Segmenter(this.intlSegmenterLocales, { granularity: 'word' });\n }\n else {\n this._segmenter = null;\n }\n for (let i = 0, len = wordSeparators.length; i < len; i++) {\n this.set(wordSeparators.charCodeAt(i), 2 /* WordCharacterClass.WordSeparator */);\n }\n this.set(32 /* CharCode.Space */, 1 /* WordCharacterClass.Whitespace */);\n this.set(9 /* CharCode.Tab */, 1 /* WordCharacterClass.Whitespace */);\n }\n findPrevIntlWordBeforeOrAtOffset(line, offset) {\n let candidate = null;\n for (const segment of this._getIntlSegmenterWordsOnLine(line)) {\n if (segment.index > offset) {\n break;\n }\n candidate = segment;\n }\n return candidate;\n }\n findNextIntlWordAtOrAfterOffset(lineContent, offset) {\n for (const segment of this._getIntlSegmenterWordsOnLine(lineContent)) {\n if (segment.index < offset) {\n continue;\n }\n return segment;\n }\n return null;\n }\n _getIntlSegmenterWordsOnLine(line) {\n if (!this._segmenter) {\n return [];\n }\n // Check if the line has changed from the previous call\n if (this._cachedLine === line) {\n return this._cachedSegments;\n }\n // Update the cache with the new line\n this._cachedLine = line;\n this._cachedSegments = this._filterWordSegments(this._segmenter.segment(line));\n return this._cachedSegments;\n }\n _filterWordSegments(segments) {\n const result = [];\n for (const segment of segments) {\n if (this._isWordLike(segment)) {\n result.push(segment);\n }\n }\n return result;\n }\n _isWordLike(segment) {\n if (segment.isWordLike) {\n return true;\n }\n return false;\n }\n}\nconst wordClassifierCache = new LRUCache(10);\nexport function getMapForWordSeparators(wordSeparators, intlSegmenterLocales) {\n const key = `${wordSeparators}/${intlSegmenterLocales.join(',')}`;\n let result = wordClassifierCache.get(key);\n if (!result) {\n result = new WordCharacterClassifier(wordSeparators, intlSegmenterLocales);\n wordClassifierCache.set(key, result);\n }\n return 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 *--------------------------------------------------------------------------------------------*/\nimport { equals } from '../../base/common/objects.js';\n/**\n * Vertical Lane in the overview ruler of the editor.\n */\nexport var OverviewRulerLane;\n(function (OverviewRulerLane) {\n OverviewRulerLane[OverviewRulerLane[\"Left\"] = 1] = \"Left\";\n OverviewRulerLane[OverviewRulerLane[\"Center\"] = 2] = \"Center\";\n OverviewRulerLane[OverviewRulerLane[\"Right\"] = 4] = \"Right\";\n OverviewRulerLane[OverviewRulerLane[\"Full\"] = 7] = \"Full\";\n})(OverviewRulerLane || (OverviewRulerLane = {}));\n/**\n * Vertical Lane in the glyph margin of the editor.\n */\nexport var GlyphMarginLane;\n(function (GlyphMarginLane) {\n GlyphMarginLane[GlyphMarginLane[\"Left\"] = 1] = \"Left\";\n GlyphMarginLane[GlyphMarginLane[\"Center\"] = 2] = \"Center\";\n GlyphMarginLane[GlyphMarginLane[\"Right\"] = 3] = \"Right\";\n})(GlyphMarginLane || (GlyphMarginLane = {}));\nexport var InjectedTextCursorStops;\n(function (InjectedTextCursorStops) {\n InjectedTextCursorStops[InjectedTextCursorStops[\"Both\"] = 0] = \"Both\";\n InjectedTextCursorStops[InjectedTextCursorStops[\"Right\"] = 1] = \"Right\";\n InjectedTextCursorStops[InjectedTextCursorStops[\"Left\"] = 2] = \"Left\";\n InjectedTextCursorStops[InjectedTextCursorStops[\"None\"] = 3] = \"None\";\n})(InjectedTextCursorStops || (InjectedTextCursorStops = {}));\nexport class TextModelResolvedOptions {\n get originalIndentSize() {\n return this._indentSizeIsTabSize ? 'tabSize' : this.indentSize;\n }\n /**\n * @internal\n */\n constructor(src) {\n this._textModelResolvedOptionsBrand = undefined;\n this.tabSize = Math.max(1, src.tabSize | 0);\n if (src.indentSize === 'tabSize') {\n this.indentSize = this.tabSize;\n this._indentSizeIsTabSize = true;\n }\n else {\n this.indentSize = Math.max(1, src.indentSize | 0);\n this._indentSizeIsTabSize = false;\n }\n this.insertSpaces = Boolean(src.insertSpaces);\n this.defaultEOL = src.defaultEOL | 0;\n this.trimAutoWhitespace = Boolean(src.trimAutoWhitespace);\n this.bracketPairColorizationOptions = src.bracketPairColorizationOptions;\n }\n /**\n * @internal\n */\n equals(other) {\n return (this.tabSize === other.tabSize\n && this._indentSizeIsTabSize === other._indentSizeIsTabSize\n && this.indentSize === other.indentSize\n && this.insertSpaces === other.insertSpaces\n && this.defaultEOL === other.defaultEOL\n && this.trimAutoWhitespace === other.trimAutoWhitespace\n && equals(this.bracketPairColorizationOptions, other.bracketPairColorizationOptions));\n }\n /**\n * @internal\n */\n createChangeEvent(newOpts) {\n return {\n tabSize: this.tabSize !== newOpts.tabSize,\n indentSize: this.indentSize !== newOpts.indentSize,\n insertSpaces: this.insertSpaces !== newOpts.insertSpaces,\n trimAutoWhitespace: this.trimAutoWhitespace !== newOpts.trimAutoWhitespace,\n };\n }\n}\nexport class FindMatch {\n /**\n * @internal\n */\n constructor(range, matches) {\n this._findMatchBrand = undefined;\n this.range = range;\n this.matches = matches;\n }\n}\n/**\n * @internal\n */\nexport function isITextSnapshot(obj) {\n return (obj && typeof obj.read === 'function');\n}\n/**\n * @internal\n */\nexport class ValidAnnotatedEditOperation {\n constructor(identifier, range, text, forceMoveMarkers, isAutoWhitespaceEdit, _isTracked) {\n this.identifier = identifier;\n this.range = range;\n this.text = text;\n this.forceMoveMarkers = forceMoveMarkers;\n this.isAutoWhitespaceEdit = isAutoWhitespaceEdit;\n this._isTracked = _isTracked;\n }\n}\n/**\n * @internal\n */\nexport class SearchData {\n constructor(regex, wordSeparators, simpleSearch) {\n this.regex = regex;\n this.wordSeparators = wordSeparators;\n this.simpleSearch = simpleSearch;\n }\n}\n/**\n * @internal\n */\nexport class ApplyEditsResult {\n constructor(reverseEdits, changes, trimAutoWhitespaceLineNumbers) {\n this.reverseEdits = reverseEdits;\n this.changes = changes;\n this.trimAutoWhitespaceLineNumbers = trimAutoWhitespaceLineNumbers;\n }\n}\n/**\n * @internal\n */\nexport function shouldSynchronizeModel(model) {\n return (!model.isTooLargeForSyncing() && !model.isForSimpleWidget);\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 * as strings from '../../../base/common/strings.js';\nimport { getMapForWordSeparators } from '../core/wordCharacterClassifier.js';\nimport { Position } from '../core/position.js';\nimport { Range } from '../core/range.js';\nimport { FindMatch, SearchData } from '../model.js';\nconst LIMIT_FIND_COUNT = 999;\nexport class SearchParams {\n constructor(searchString, isRegex, matchCase, wordSeparators) {\n this.searchString = searchString;\n this.isRegex = isRegex;\n this.matchCase = matchCase;\n this.wordSeparators = wordSeparators;\n }\n parseSearchRequest() {\n if (this.searchString === '') {\n return null;\n }\n // Try to create a RegExp out of the params\n let multiline;\n if (this.isRegex) {\n multiline = isMultilineRegexSource(this.searchString);\n }\n else {\n multiline = (this.searchString.indexOf('\\n') >= 0);\n }\n let regex = null;\n try {\n regex = strings.createRegExp(this.searchString, this.isRegex, {\n matchCase: this.matchCase,\n wholeWord: false,\n multiline: multiline,\n global: true,\n unicode: true\n });\n }\n catch (err) {\n return null;\n }\n if (!regex) {\n return null;\n }\n let canUseSimpleSearch = (!this.isRegex && !multiline);\n if (canUseSimpleSearch && this.searchString.toLowerCase() !== this.searchString.toUpperCase()) {\n // casing might make a difference\n canUseSimpleSearch = this.matchCase;\n }\n return new SearchData(regex, this.wordSeparators ? getMapForWordSeparators(this.wordSeparators, []) : null, canUseSimpleSearch ? this.searchString : null);\n }\n}\nexport function isMultilineRegexSource(searchString) {\n if (!searchString || searchString.length === 0) {\n return false;\n }\n for (let i = 0, len = searchString.length; i < len; i++) {\n const chCode = searchString.charCodeAt(i);\n if (chCode === 10 /* CharCode.LineFeed */) {\n return true;\n }\n if (chCode === 92 /* CharCode.Backslash */) {\n // move to next char\n i++;\n if (i >= len) {\n // string ends with a \\\n break;\n }\n const nextChCode = searchString.charCodeAt(i);\n if (nextChCode === 110 /* CharCode.n */ || nextChCode === 114 /* CharCode.r */ || nextChCode === 87 /* CharCode.W */) {\n return true;\n }\n }\n }\n return false;\n}\nexport function createFindMatch(range, rawMatches, captureMatches) {\n if (!captureMatches) {\n return new FindMatch(range, null);\n }\n const matches = [];\n for (let i = 0, len = rawMatches.length; i < len; i++) {\n matches[i] = rawMatches[i];\n }\n return new FindMatch(range, matches);\n}\nclass LineFeedCounter {\n constructor(text) {\n const lineFeedsOffsets = [];\n let lineFeedsOffsetsLen = 0;\n for (let i = 0, textLen = text.length; i < textLen; i++) {\n if (text.charCodeAt(i) === 10 /* CharCode.LineFeed */) {\n lineFeedsOffsets[lineFeedsOffsetsLen++] = i;\n }\n }\n this._lineFeedsOffsets = lineFeedsOffsets;\n }\n findLineFeedCountBeforeOffset(offset) {\n const lineFeedsOffsets = this._lineFeedsOffsets;\n let min = 0;\n let max = lineFeedsOffsets.length - 1;\n if (max === -1) {\n // no line feeds\n return 0;\n }\n if (offset <= lineFeedsOffsets[0]) {\n // before first line feed\n return 0;\n }\n while (min < max) {\n const mid = min + ((max - min) / 2 >> 0);\n if (lineFeedsOffsets[mid] >= offset) {\n max = mid - 1;\n }\n else {\n if (lineFeedsOffsets[mid + 1] >= offset) {\n // bingo!\n min = mid;\n max = mid;\n }\n else {\n min = mid + 1;\n }\n }\n }\n return min + 1;\n }\n}\nexport class TextModelSearch {\n static findMatches(model, searchParams, searchRange, captureMatches, limitResultCount) {\n const searchData = searchParams.parseSearchRequest();\n if (!searchData) {\n return [];\n }\n if (searchData.regex.multiline) {\n return this._doFindMatchesMultiline(model, searchRange, new Searcher(searchData.wordSeparators, searchData.regex), captureMatches, limitResultCount);\n }\n return this._doFindMatchesLineByLine(model, searchRange, searchData, captureMatches, limitResultCount);\n }\n /**\n * Multiline search always executes on the lines concatenated with \\n.\n * We must therefore compensate for the count of \\n in case the model is CRLF\n */\n static _getMultilineMatchRange(model, deltaOffset, text, lfCounter, matchIndex, match0) {\n let startOffset;\n let lineFeedCountBeforeMatch = 0;\n if (lfCounter) {\n lineFeedCountBeforeMatch = lfCounter.findLineFeedCountBeforeOffset(matchIndex);\n startOffset = deltaOffset + matchIndex + lineFeedCountBeforeMatch /* add as many \\r as there were \\n */;\n }\n else {\n startOffset = deltaOffset + matchIndex;\n }\n let endOffset;\n if (lfCounter) {\n const lineFeedCountBeforeEndOfMatch = lfCounter.findLineFeedCountBeforeOffset(matchIndex + match0.length);\n const lineFeedCountInMatch = lineFeedCountBeforeEndOfMatch - lineFeedCountBeforeMatch;\n endOffset = startOffset + match0.length + lineFeedCountInMatch /* add as many \\r as there were \\n */;\n }\n else {\n endOffset = startOffset + match0.length;\n }\n const startPosition = model.getPositionAt(startOffset);\n const endPosition = model.getPositionAt(endOffset);\n return new Range(startPosition.lineNumber, startPosition.column, endPosition.lineNumber, endPosition.column);\n }\n static _doFindMatchesMultiline(model, searchRange, searcher, captureMatches, limitResultCount) {\n const deltaOffset = model.getOffsetAt(searchRange.getStartPosition());\n // We always execute multiline search over the lines joined with \\n\n // This makes it that \\n will match the EOL for both CRLF and LF models\n // We compensate for offset errors in `_getMultilineMatchRange`\n const text = model.getValueInRange(searchRange, 1 /* EndOfLinePreference.LF */);\n const lfCounter = (model.getEOL() === '\\r\\n' ? new LineFeedCounter(text) : null);\n const result = [];\n let counter = 0;\n let m;\n searcher.reset(0);\n while ((m = searcher.next(text))) {\n result[counter++] = createFindMatch(this._getMultilineMatchRange(model, deltaOffset, text, lfCounter, m.index, m[0]), m, captureMatches);\n if (counter >= limitResultCount) {\n return result;\n }\n }\n return result;\n }\n static _doFindMatchesLineByLine(model, searchRange, searchData, captureMatches, limitResultCount) {\n const result = [];\n let resultLen = 0;\n // Early case for a search range that starts & stops on the same line number\n if (searchRange.startLineNumber === searchRange.endLineNumber) {\n const text = model.getLineContent(searchRange.startLineNumber).substring(searchRange.startColumn - 1, searchRange.endColumn - 1);\n resultLen = this._findMatchesInLine(searchData, text, searchRange.startLineNumber, searchRange.startColumn - 1, resultLen, result, captureMatches, limitResultCount);\n return result;\n }\n // Collect results from first line\n const text = model.getLineContent(searchRange.startLineNumber).substring(searchRange.startColumn - 1);\n resultLen = this._findMatchesInLine(searchData, text, searchRange.startLineNumber, searchRange.startColumn - 1, resultLen, result, captureMatches, limitResultCount);\n // Collect results from middle lines\n for (let lineNumber = searchRange.startLineNumber + 1; lineNumber < searchRange.endLineNumber && resultLen < limitResultCount; lineNumber++) {\n resultLen = this._findMatchesInLine(searchData, model.getLineContent(lineNumber), lineNumber, 0, resultLen, result, captureMatches, limitResultCount);\n }\n // Collect results from last line\n if (resultLen < limitResultCount) {\n const text = model.getLineContent(searchRange.endLineNumber).substring(0, searchRange.endColumn - 1);\n resultLen = this._findMatchesInLine(searchData, text, searchRange.endLineNumber, 0, resultLen, result, captureMatches, limitResultCount);\n }\n return result;\n }\n static _findMatchesInLine(searchData, text, lineNumber, deltaOffset, resultLen, result, captureMatches, limitResultCount) {\n const wordSeparators = searchData.wordSeparators;\n if (!captureMatches && searchData.simpleSearch) {\n const searchString = searchData.simpleSearch;\n const searchStringLen = searchString.length;\n const textLength = text.length;\n let lastMatchIndex = -searchStringLen;\n while ((lastMatchIndex = text.indexOf(searchString, lastMatchIndex + searchStringLen)) !== -1) {\n if (!wordSeparators || isValidMatch(wordSeparators, text, textLength, lastMatchIndex, searchStringLen)) {\n result[resultLen++] = new FindMatch(new Range(lineNumber, lastMatchIndex + 1 + deltaOffset, lineNumber, lastMatchIndex + 1 + searchStringLen + deltaOffset), null);\n if (resultLen >= limitResultCount) {\n return resultLen;\n }\n }\n }\n return resultLen;\n }\n const searcher = new Searcher(searchData.wordSeparators, searchData.regex);\n let m;\n // Reset regex to search from the beginning\n searcher.reset(0);\n do {\n m = searcher.next(text);\n if (m) {\n result[resultLen++] = createFindMatch(new Range(lineNumber, m.index + 1 + deltaOffset, lineNumber, m.index + 1 + m[0].length + deltaOffset), m, captureMatches);\n if (resultLen >= limitResultCount) {\n return resultLen;\n }\n }\n } while (m);\n return resultLen;\n }\n static findNextMatch(model, searchParams, searchStart, captureMatches) {\n const searchData = searchParams.parseSearchRequest();\n if (!searchData) {\n return null;\n }\n const searcher = new Searcher(searchData.wordSeparators, searchData.regex);\n if (searchData.regex.multiline) {\n return this._doFindNextMatchMultiline(model, searchStart, searcher, captureMatches);\n }\n return this._doFindNextMatchLineByLine(model, searchStart, searcher, captureMatches);\n }\n static _doFindNextMatchMultiline(model, searchStart, searcher, captureMatches) {\n const searchTextStart = new Position(searchStart.lineNumber, 1);\n const deltaOffset = model.getOffsetAt(searchTextStart);\n const lineCount = model.getLineCount();\n // We always execute multiline search over the lines joined with \\n\n // This makes it that \\n will match the EOL for both CRLF and LF models\n // We compensate for offset errors in `_getMultilineMatchRange`\n const text = model.getValueInRange(new Range(searchTextStart.lineNumber, searchTextStart.column, lineCount, model.getLineMaxColumn(lineCount)), 1 /* EndOfLinePreference.LF */);\n const lfCounter = (model.getEOL() === '\\r\\n' ? new LineFeedCounter(text) : null);\n searcher.reset(searchStart.column - 1);\n const m = searcher.next(text);\n if (m) {\n return createFindMatch(this._getMultilineMatchRange(model, deltaOffset, text, lfCounter, m.index, m[0]), m, captureMatches);\n }\n if (searchStart.lineNumber !== 1 || searchStart.column !== 1) {\n // Try again from the top\n return this._doFindNextMatchMultiline(model, new Position(1, 1), searcher, captureMatches);\n }\n return null;\n }\n static _doFindNextMatchLineByLine(model, searchStart, searcher, captureMatches) {\n const lineCount = model.getLineCount();\n const startLineNumber = searchStart.lineNumber;\n // Look in first line\n const text = model.getLineContent(startLineNumber);\n const r = this._findFirstMatchInLine(searcher, text, startLineNumber, searchStart.column, captureMatches);\n if (r) {\n return r;\n }\n for (let i = 1; i <= lineCount; i++) {\n const lineIndex = (startLineNumber + i - 1) % lineCount;\n const text = model.getLineContent(lineIndex + 1);\n const r = this._findFirstMatchInLine(searcher, text, lineIndex + 1, 1, captureMatches);\n if (r) {\n return r;\n }\n }\n return null;\n }\n static _findFirstMatchInLine(searcher, text, lineNumber, fromColumn, captureMatches) {\n // Set regex to search from column\n searcher.reset(fromColumn - 1);\n const m = searcher.next(text);\n if (m) {\n return createFindMatch(new Range(lineNumber, m.index + 1, lineNumber, m.index + 1 + m[0].length), m, captureMatches);\n }\n return null;\n }\n static findPreviousMatch(model, searchParams, searchStart, captureMatches) {\n const searchData = searchParams.parseSearchRequest();\n if (!searchData) {\n return null;\n }\n const searcher = new Searcher(searchData.wordSeparators, searchData.regex);\n if (searchData.regex.multiline) {\n return this._doFindPreviousMatchMultiline(model, searchStart, searcher, captureMatches);\n }\n return this._doFindPreviousMatchLineByLine(model, searchStart, searcher, captureMatches);\n }\n static _doFindPreviousMatchMultiline(model, searchStart, searcher, captureMatches) {\n const matches = this._doFindMatchesMultiline(model, new Range(1, 1, searchStart.lineNumber, searchStart.column), searcher, captureMatches, 10 * LIMIT_FIND_COUNT);\n if (matches.length > 0) {\n return matches[matches.length - 1];\n }\n const lineCount = model.getLineCount();\n if (searchStart.lineNumber !== lineCount || searchStart.column !== model.getLineMaxColumn(lineCount)) {\n // Try again with all content\n return this._doFindPreviousMatchMultiline(model, new Position(lineCount, model.getLineMaxColumn(lineCount)), searcher, captureMatches);\n }\n return null;\n }\n static _doFindPreviousMatchLineByLine(model, searchStart, searcher, captureMatches) {\n const lineCount = model.getLineCount();\n const startLineNumber = searchStart.lineNumber;\n // Look in first line\n const text = model.getLineContent(startLineNumber).substring(0, searchStart.column - 1);\n const r = this._findLastMatchInLine(searcher, text, startLineNumber, captureMatches);\n if (r) {\n return r;\n }\n for (let i = 1; i <= lineCount; i++) {\n const lineIndex = (lineCount + startLineNumber - i - 1) % lineCount;\n const text = model.getLineContent(lineIndex + 1);\n const r = this._findLastMatchInLine(searcher, text, lineIndex + 1, captureMatches);\n if (r) {\n return r;\n }\n }\n return null;\n }\n static _findLastMatchInLine(searcher, text, lineNumber, captureMatches) {\n let bestResult = null;\n let m;\n searcher.reset(0);\n while ((m = searcher.next(text))) {\n bestResult = createFindMatch(new Range(lineNumber, m.index + 1, lineNumber, m.index + 1 + m[0].length), m, captureMatches);\n }\n return bestResult;\n }\n}\nfunction leftIsWordBounday(wordSeparators, text, textLength, matchStartIndex, matchLength) {\n if (matchStartIndex === 0) {\n // Match starts at start of string\n return true;\n }\n const charBefore = text.charCodeAt(matchStartIndex - 1);\n if (wordSeparators.get(charBefore) !== 0 /* WordCharacterClass.Regular */) {\n // The character before the match is a word separator\n return true;\n }\n if (charBefore === 13 /* CharCode.CarriageReturn */ || charBefore === 10 /* CharCode.LineFeed */) {\n // The character before the match is line break or carriage return.\n return true;\n }\n if (matchLength > 0) {\n const firstCharInMatch = text.charCodeAt(matchStartIndex);\n if (wordSeparators.get(firstCharInMatch) !== 0 /* WordCharacterClass.Regular */) {\n // The first character inside the match is a word separator\n return true;\n }\n }\n return false;\n}\nfunction rightIsWordBounday(wordSeparators, text, textLength, matchStartIndex, matchLength) {\n if (matchStartIndex + matchLength === textLength) {\n // Match ends at end of string\n return true;\n }\n const charAfter = text.charCodeAt(matchStartIndex + matchLength);\n if (wordSeparators.get(charAfter) !== 0 /* WordCharacterClass.Regular */) {\n // The character after the match is a word separator\n return true;\n }\n if (charAfter === 13 /* CharCode.CarriageReturn */ || charAfter === 10 /* CharCode.LineFeed */) {\n // The character after the match is line break or carriage return.\n return true;\n }\n if (matchLength > 0) {\n const lastCharInMatch = text.charCodeAt(matchStartIndex + matchLength - 1);\n if (wordSeparators.get(lastCharInMatch) !== 0 /* WordCharacterClass.Regular */) {\n // The last character in the match is a word separator\n return true;\n }\n }\n return false;\n}\nexport function isValidMatch(wordSeparators, text, textLength, matchStartIndex, matchLength) {\n return (leftIsWordBounday(wordSeparators, text, textLength, matchStartIndex, matchLength)\n && rightIsWordBounday(wordSeparators, text, textLength, matchStartIndex, matchLength));\n}\nexport class Searcher {\n constructor(wordSeparators, searchRegex) {\n this._wordSeparators = wordSeparators;\n this._searchRegex = searchRegex;\n this._prevMatchStartIndex = -1;\n this._prevMatchLength = 0;\n }\n reset(lastIndex) {\n this._searchRegex.lastIndex = lastIndex;\n this._prevMatchStartIndex = -1;\n this._prevMatchLength = 0;\n }\n next(text) {\n const textLength = text.length;\n let m;\n do {\n if (this._prevMatchStartIndex + this._prevMatchLength === textLength) {\n // Reached the end of the line\n return null;\n }\n m = this._searchRegex.exec(text);\n if (!m) {\n return null;\n }\n const matchStartIndex = m.index;\n const matchLength = m[0].length;\n if (matchStartIndex === this._prevMatchStartIndex && matchLength === this._prevMatchLength) {\n if (matchLength === 0) {\n // the search result is an empty string and won't advance `regex.lastIndex`, so `regex.exec` will stuck here\n // we attempt to recover from that by advancing by two if surrogate pair found and by one otherwise\n if (strings.getNextCodePoint(text, textLength, this._searchRegex.lastIndex) > 0xFFFF) {\n this._searchRegex.lastIndex += 2;\n }\n else {\n this._searchRegex.lastIndex += 1;\n }\n continue;\n }\n // Exit early if the regex matches the same range twice\n return null;\n }\n this._prevMatchStartIndex = matchStartIndex;\n this._prevMatchLength = matchLength;\n if (!this._wordSeparators || isValidMatch(this._wordSeparators, text, textLength, matchStartIndex, matchLength)) {\n return m;\n }\n } while (m);\n return null;\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 *--------------------------------------------------------------------------------------------*/\nimport { BugIndicatingError } from '../../../base/common/errors.js';\n/**\n * A range of offsets (0-based).\n*/\nexport class OffsetRange {\n static addRange(range, sortedRanges) {\n let i = 0;\n while (i < sortedRanges.length && sortedRanges[i].endExclusive < range.start) {\n i++;\n }\n let j = i;\n while (j < sortedRanges.length && sortedRanges[j].start <= range.endExclusive) {\n j++;\n }\n if (i === j) {\n sortedRanges.splice(i, 0, range);\n }\n else {\n const start = Math.min(range.start, sortedRanges[i].start);\n const end = Math.max(range.endExclusive, sortedRanges[j - 1].endExclusive);\n sortedRanges.splice(i, j - i, new OffsetRange(start, end));\n }\n }\n static tryCreate(start, endExclusive) {\n if (start > endExclusive) {\n return undefined;\n }\n return new OffsetRange(start, endExclusive);\n }\n static ofLength(length) {\n return new OffsetRange(0, length);\n }\n static ofStartAndLength(start, length) {\n return new OffsetRange(start, start + length);\n }\n constructor(start, endExclusive) {\n this.start = start;\n this.endExclusive = endExclusive;\n if (start > endExclusive) {\n throw new BugIndicatingError(`Invalid range: ${this.toString()}`);\n }\n }\n get isEmpty() {\n return this.start === this.endExclusive;\n }\n delta(offset) {\n return new OffsetRange(this.start + offset, this.endExclusive + offset);\n }\n deltaStart(offset) {\n return new OffsetRange(this.start + offset, this.endExclusive);\n }\n deltaEnd(offset) {\n return new OffsetRange(this.start, this.endExclusive + offset);\n }\n get length() {\n return this.endExclusive - this.start;\n }\n toString() {\n return `[${this.start}, ${this.endExclusive})`;\n }\n contains(offset) {\n return this.start <= offset && offset < this.endExclusive;\n }\n /**\n * for all numbers n: range1.contains(n) or range2.contains(n) => range1.join(range2).contains(n)\n * The joined range is the smallest range that contains both ranges.\n */\n join(other) {\n return new OffsetRange(Math.min(this.start, other.start), Math.max(this.endExclusive, other.endExclusive));\n }\n /**\n * for all numbers n: range1.contains(n) and range2.contains(n) <=> range1.intersect(range2).contains(n)\n *\n * The resulting range is empty if the ranges do not intersect, but touch.\n * If the ranges don't even touch, the result is undefined.\n */\n intersect(other) {\n const start = Math.max(this.start, other.start);\n const end = Math.min(this.endExclusive, other.endExclusive);\n if (start <= end) {\n return new OffsetRange(start, end);\n }\n return undefined;\n }\n intersects(other) {\n const start = Math.max(this.start, other.start);\n const end = Math.min(this.endExclusive, other.endExclusive);\n return start < end;\n }\n isBefore(other) {\n return this.endExclusive <= other.start;\n }\n isAfter(other) {\n return this.start >= other.endExclusive;\n }\n slice(arr) {\n return arr.slice(this.start, this.endExclusive);\n }\n substring(str) {\n return str.substring(this.start, this.endExclusive);\n }\n /**\n * Returns the given value if it is contained in this instance, otherwise the closest value that is contained.\n * The range must not be empty.\n */\n clip(value) {\n if (this.isEmpty) {\n throw new BugIndicatingError(`Invalid clipping range: ${this.toString()}`);\n }\n return Math.max(this.start, Math.min(this.endExclusive - 1, value));\n }\n /**\n * Returns `r := value + k * length` such that `r` is contained in this range.\n * The range must not be empty.\n *\n * E.g. `[5, 10).clipCyclic(10) === 5`, `[5, 10).clipCyclic(11) === 6` and `[5, 10).clipCyclic(4) === 9`.\n */\n clipCyclic(value) {\n if (this.isEmpty) {\n throw new BugIndicatingError(`Invalid clipping range: ${this.toString()}`);\n }\n if (value < this.start) {\n return this.endExclusive - ((this.start - value) % this.length);\n }\n if (value >= this.endExclusive) {\n return this.start + ((value - this.start) % this.length);\n }\n return value;\n }\n forEach(f) {\n for (let i = this.start; i < this.endExclusive; i++) {\n f(i);\n }\n }\n}\nexport class OffsetRangeSet {\n constructor() {\n this._sortedRanges = [];\n }\n addRange(range) {\n let i = 0;\n while (i < this._sortedRanges.length && this._sortedRanges[i].endExclusive < range.start) {\n i++;\n }\n let j = i;\n while (j < this._sortedRanges.length && this._sortedRanges[j].start <= range.endExclusive) {\n j++;\n }\n if (i === j) {\n this._sortedRanges.splice(i, 0, range);\n }\n else {\n const start = Math.min(range.start, this._sortedRanges[i].start);\n const end = Math.max(range.endExclusive, this._sortedRanges[j - 1].endExclusive);\n this._sortedRanges.splice(i, j - i, new OffsetRange(start, end));\n }\n }\n toString() {\n return this._sortedRanges.map(r => r.toString()).join(', ');\n }\n /**\n * Returns of there is a value that is contained in this instance and the given range.\n */\n intersectsStrict(other) {\n // TODO use binary search\n let i = 0;\n while (i < this._sortedRanges.length && this._sortedRanges[i].endExclusive <= other.start) {\n i++;\n }\n return i < this._sortedRanges.length && this._sortedRanges[i].start < other.endExclusive;\n }\n intersectWithRange(other) {\n // TODO use binary search + slice\n const result = new OffsetRangeSet();\n for (const range of this._sortedRanges) {\n const intersection = range.intersect(other);\n if (intersection) {\n result.addRange(intersection);\n }\n }\n return result;\n }\n intersectWithRangeLength(other) {\n return this.intersectWithRange(other).length;\n }\n get length() {\n return this._sortedRanges.reduce((prev, cur) => prev + cur.length, 0);\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 *--------------------------------------------------------------------------------------------*/\nexport function findLast(array, predicate) {\n const idx = findLastIdx(array, predicate);\n if (idx === -1) {\n return undefined;\n }\n return array[idx];\n}\nexport function findLastIdx(array, predicate, fromIndex = array.length - 1) {\n for (let i = fromIndex; i >= 0; i--) {\n const element = array[i];\n if (predicate(element)) {\n return i;\n }\n }\n return -1;\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(array, predicate) {\n const idx = findLastIdxMonotonous(array, predicate);\n return idx === -1 ? undefined : array[idx];\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(array, predicate, startIdx = 0, endIdxEx = array.length) {\n let i = startIdx;\n let j = endIdxEx;\n while (i < j) {\n const k = Math.floor((i + j) / 2);\n if (predicate(array[k])) {\n i = k + 1;\n }\n else {\n j = k;\n }\n }\n return i - 1;\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(array, predicate) {\n const idx = findFirstIdxMonotonousOrArrLen(array, predicate);\n return idx === array.length ? undefined : array[idx];\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(array, predicate, startIdx = 0, endIdxEx = array.length) {\n let i = startIdx;\n let j = endIdxEx;\n while (i < j) {\n const k = Math.floor((i + j) / 2);\n if (predicate(array[k])) {\n j = k;\n }\n else {\n i = k + 1;\n }\n }\n return i;\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 {\n constructor(_array) {\n this._array = _array;\n this._findLastMonotonousLastIdx = 0;\n }\n /**\n * The predicate must be monotonous, i.e. `arr.map(predicate)` must be like `[true, ..., true, false, ..., false]`!\n * For subsequent calls, current predicate must be weaker than (or equal to) the previous predicate, i.e. more entries must be `true`.\n */\n findLastMonotonous(predicate) {\n if (MonotonousArray.assertInvariants) {\n if (this._prevFindLastPredicate) {\n for (const item of this._array) {\n if (this._prevFindLastPredicate(item) && !predicate(item)) {\n throw new Error('MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.');\n }\n }\n }\n this._prevFindLastPredicate = predicate;\n }\n const idx = findLastIdxMonotonous(this._array, predicate, this._findLastMonotonousLastIdx);\n this._findLastMonotonousLastIdx = idx + 1;\n return idx === -1 ? undefined : this._array[idx];\n }\n}\nMonotonousArray.assertInvariants = false;\n/**\n * Returns the first item that is equal to or greater than every other item.\n*/\nexport function findFirstMax(array, comparator) {\n if (array.length === 0) {\n return undefined;\n }\n let max = array[0];\n for (let i = 1; i < array.length; i++) {\n const item = array[i];\n if (comparator(item, max) > 0) {\n max = item;\n }\n }\n return max;\n}\n/**\n * Returns the last item that is equal to or greater than every other item.\n*/\nexport function findLastMax(array, comparator) {\n if (array.length === 0) {\n return undefined;\n }\n let max = array[0];\n for (let i = 1; i < array.length; i++) {\n const item = array[i];\n if (comparator(item, max) >= 0) {\n max = item;\n }\n }\n return max;\n}\n/**\n * Returns the first item that is equal to or less than every other item.\n*/\nexport function findFirstMin(array, comparator) {\n return findFirstMax(array, (a, b) => -comparator(a, b));\n}\nexport function findMaxIdx(array, comparator) {\n if (array.length === 0) {\n return -1;\n }\n let maxIdx = 0;\n for (let i = 1; i < array.length; i++) {\n const item = array[i];\n if (comparator(item, array[maxIdx]) > 0) {\n maxIdx = i;\n }\n }\n return maxIdx;\n}\n/**\n * Returns the first mapped value of the array which is not undefined.\n */\nexport function mapFindFirst(items, mapFn) {\n for (const value of items) {\n const mapped = mapFn(value);\n if (mapped !== undefined) {\n return mapped;\n }\n }\n return 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 *--------------------------------------------------------------------------------------------*/\nimport { BugIndicatingError } from '../../../base/common/errors.js';\nimport { OffsetRange } from './offsetRange.js';\nimport { Range } from './range.js';\nimport { findFirstIdxMonotonousOrArrLen, findLastIdxMonotonous, findLastMonotonous } from '../../../base/common/arraysFind.js';\n/**\n * A range of lines (1-based).\n */\nexport class LineRange {\n static fromRangeInclusive(range) {\n return new LineRange(range.startLineNumber, range.endLineNumber + 1);\n }\n /**\n * @param lineRanges An array of sorted line ranges.\n */\n static joinMany(lineRanges) {\n if (lineRanges.length === 0) {\n return [];\n }\n let result = new LineRangeSet(lineRanges[0].slice());\n for (let i = 1; i < lineRanges.length; i++) {\n result = result.getUnion(new LineRangeSet(lineRanges[i].slice()));\n }\n return result.ranges;\n }\n static join(lineRanges) {\n if (lineRanges.length === 0) {\n throw new BugIndicatingError('lineRanges cannot be empty');\n }\n let startLineNumber = lineRanges[0].startLineNumber;\n let endLineNumberExclusive = lineRanges[0].endLineNumberExclusive;\n for (let i = 1; i < lineRanges.length; i++) {\n startLineNumber = Math.min(startLineNumber, lineRanges[i].startLineNumber);\n endLineNumberExclusive = Math.max(endLineNumberExclusive, lineRanges[i].endLineNumberExclusive);\n }\n return new LineRange(startLineNumber, endLineNumberExclusive);\n }\n static ofLength(startLineNumber, length) {\n return new LineRange(startLineNumber, startLineNumber + length);\n }\n /**\n * @internal\n */\n static deserialize(lineRange) {\n return new LineRange(lineRange[0], lineRange[1]);\n }\n constructor(startLineNumber, endLineNumberExclusive) {\n if (startLineNumber > endLineNumberExclusive) {\n throw new BugIndicatingError(`startLineNumber ${startLineNumber} cannot be after endLineNumberExclusive ${endLineNumberExclusive}`);\n }\n this.startLineNumber = startLineNumber;\n this.endLineNumberExclusive = endLineNumberExclusive;\n }\n /**\n * Indicates if this line range contains the given line number.\n */\n contains(lineNumber) {\n return this.startLineNumber <= lineNumber && lineNumber < this.endLineNumberExclusive;\n }\n /**\n * Indicates if this line range is empty.\n */\n get isEmpty() {\n return this.startLineNumber === this.endLineNumberExclusive;\n }\n /**\n * Moves this line range by the given offset of line numbers.\n */\n delta(offset) {\n return new LineRange(this.startLineNumber + offset, this.endLineNumberExclusive + offset);\n }\n deltaLength(offset) {\n return new LineRange(this.startLineNumber, this.endLineNumberExclusive + offset);\n }\n /**\n * The number of lines this line range spans.\n */\n get length() {\n return this.endLineNumberExclusive - this.startLineNumber;\n }\n /**\n * Creates a line range that combines this and the given line range.\n */\n join(other) {\n return new LineRange(Math.min(this.startLineNumber, other.startLineNumber), Math.max(this.endLineNumberExclusive, other.endLineNumberExclusive));\n }\n toString() {\n return `[${this.startLineNumber},${this.endLineNumberExclusive})`;\n }\n /**\n * The resulting range is empty if the ranges do not intersect, but touch.\n * If the ranges don't even touch, the result is undefined.\n */\n intersect(other) {\n const startLineNumber = Math.max(this.startLineNumber, other.startLineNumber);\n const endLineNumberExclusive = Math.min(this.endLineNumberExclusive, other.endLineNumberExclusive);\n if (startLineNumber <= endLineNumberExclusive) {\n return new LineRange(startLineNumber, endLineNumberExclusive);\n }\n return undefined;\n }\n intersectsStrict(other) {\n return this.startLineNumber < other.endLineNumberExclusive && other.startLineNumber < this.endLineNumberExclusive;\n }\n overlapOrTouch(other) {\n return this.startLineNumber <= other.endLineNumberExclusive && other.startLineNumber <= this.endLineNumberExclusive;\n }\n equals(b) {\n return this.startLineNumber === b.startLineNumber && this.endLineNumberExclusive === b.endLineNumberExclusive;\n }\n toInclusiveRange() {\n if (this.isEmpty) {\n return null;\n }\n return new Range(this.startLineNumber, 1, this.endLineNumberExclusive - 1, Number.MAX_SAFE_INTEGER);\n }\n /**\n * @deprecated Using this function is discouraged because it might lead to bugs: The end position is not guaranteed to be a valid position!\n */\n toExclusiveRange() {\n return new Range(this.startLineNumber, 1, this.endLineNumberExclusive, 1);\n }\n mapToLineArray(f) {\n const result = [];\n for (let lineNumber = this.startLineNumber; lineNumber < this.endLineNumberExclusive; lineNumber++) {\n result.push(f(lineNumber));\n }\n return result;\n }\n forEach(f) {\n for (let lineNumber = this.startLineNumber; lineNumber < this.endLineNumberExclusive; lineNumber++) {\n f(lineNumber);\n }\n }\n /**\n * @internal\n */\n serialize() {\n return [this.startLineNumber, this.endLineNumberExclusive];\n }\n includes(lineNumber) {\n return this.startLineNumber <= lineNumber && lineNumber < this.endLineNumberExclusive;\n }\n /**\n * Converts this 1-based line range to a 0-based offset range (subtracts 1!).\n * @internal\n */\n toOffsetRange() {\n return new OffsetRange(this.startLineNumber - 1, this.endLineNumberExclusive - 1);\n }\n}\nexport class LineRangeSet {\n constructor(\n /**\n * Sorted by start line number.\n * No two line ranges are touching or intersecting.\n */\n _normalizedRanges = []) {\n this._normalizedRanges = _normalizedRanges;\n }\n get ranges() {\n return this._normalizedRanges;\n }\n addRange(range) {\n if (range.length === 0) {\n return;\n }\n // Idea: Find joinRange such that:\n // replaceRange = _normalizedRanges.replaceRange(joinRange, range.joinAll(joinRange.map(idx => this._normalizedRanges[idx])))\n // idx of first element that touches range or that is after range\n const joinRangeStartIdx = findFirstIdxMonotonousOrArrLen(this._normalizedRanges, r => r.endLineNumberExclusive >= range.startLineNumber);\n // idx of element after { last element that touches range or that is before range }\n const joinRangeEndIdxExclusive = findLastIdxMonotonous(this._normalizedRanges, r => r.startLineNumber <= range.endLineNumberExclusive) + 1;\n if (joinRangeStartIdx === joinRangeEndIdxExclusive) {\n // If there is no element that touches range, then joinRangeStartIdx === joinRangeEndIdxExclusive and that value is the index of the element after range\n this._normalizedRanges.splice(joinRangeStartIdx, 0, range);\n }\n else if (joinRangeStartIdx === joinRangeEndIdxExclusive - 1) {\n // Else, there is an element that touches range and in this case it is both the first and last element. Thus we can replace it\n const joinRange = this._normalizedRanges[joinRangeStartIdx];\n this._normalizedRanges[joinRangeStartIdx] = joinRange.join(range);\n }\n else {\n // First and last element are different - we need to replace the entire range\n const joinRange = this._normalizedRanges[joinRangeStartIdx].join(this._normalizedRanges[joinRangeEndIdxExclusive - 1]).join(range);\n this._normalizedRanges.splice(joinRangeStartIdx, joinRangeEndIdxExclusive - joinRangeStartIdx, joinRange);\n }\n }\n contains(lineNumber) {\n const rangeThatStartsBeforeEnd = findLastMonotonous(this._normalizedRanges, r => r.startLineNumber <= lineNumber);\n return !!rangeThatStartsBeforeEnd && rangeThatStartsBeforeEnd.endLineNumberExclusive > lineNumber;\n }\n intersects(range) {\n const rangeThatStartsBeforeEnd = findLastMonotonous(this._normalizedRanges, r => r.startLineNumber < range.endLineNumberExclusive);\n return !!rangeThatStartsBeforeEnd && rangeThatStartsBeforeEnd.endLineNumberExclusive > range.startLineNumber;\n }\n getUnion(other) {\n if (this._normalizedRanges.length === 0) {\n return other;\n }\n if (other._normalizedRanges.length === 0) {\n return this;\n }\n const result = [];\n let i1 = 0;\n let i2 = 0;\n let current = null;\n while (i1 < this._normalizedRanges.length || i2 < other._normalizedRanges.length) {\n let next = null;\n if (i1 < this._normalizedRanges.length && i2 < other._normalizedRanges.length) {\n const lineRange1 = this._normalizedRanges[i1];\n const lineRange2 = other._normalizedRanges[i2];\n if (lineRange1.startLineNumber < lineRange2.startLineNumber) {\n next = lineRange1;\n i1++;\n }\n else {\n next = lineRange2;\n i2++;\n }\n }\n else if (i1 < this._normalizedRanges.length) {\n next = this._normalizedRanges[i1];\n i1++;\n }\n else {\n next = other._normalizedRanges[i2];\n i2++;\n }\n if (current === null) {\n current = next;\n }\n else {\n if (current.endLineNumberExclusive >= next.startLineNumber) {\n // merge\n current = new LineRange(current.startLineNumber, Math.max(current.endLineNumberExclusive, next.endLineNumberExclusive));\n }\n else {\n // push\n result.push(current);\n current = next;\n }\n }\n }\n if (current !== null) {\n result.push(current);\n }\n return new LineRangeSet(result);\n }\n /**\n * Subtracts all ranges in this set from `range` and returns the result.\n */\n subtractFrom(range) {\n // idx of first element that touches range or that is after range\n const joinRangeStartIdx = findFirstIdxMonotonousOrArrLen(this._normalizedRanges, r => r.endLineNumberExclusive >= range.startLineNumber);\n // idx of element after { last element that touches range or that is before range }\n const joinRangeEndIdxExclusive = findLastIdxMonotonous(this._normalizedRanges, r => r.startLineNumber <= range.endLineNumberExclusive) + 1;\n if (joinRangeStartIdx === joinRangeEndIdxExclusive) {\n return new LineRangeSet([range]);\n }\n const result = [];\n let startLineNumber = range.startLineNumber;\n for (let i = joinRangeStartIdx; i < joinRangeEndIdxExclusive; i++) {\n const r = this._normalizedRanges[i];\n if (r.startLineNumber > startLineNumber) {\n result.push(new LineRange(startLineNumber, r.startLineNumber));\n }\n startLineNumber = r.endLineNumberExclusive;\n }\n if (startLineNumber < range.endLineNumberExclusive) {\n result.push(new LineRange(startLineNumber, range.endLineNumberExclusive));\n }\n return new LineRangeSet(result);\n }\n toString() {\n return this._normalizedRanges.map(r => r.toString()).join(', ');\n }\n getIntersection(other) {\n const result = [];\n let i1 = 0;\n let i2 = 0;\n while (i1 < this._normalizedRanges.length && i2 < other._normalizedRanges.length) {\n const r1 = this._normalizedRanges[i1];\n const r2 = other._normalizedRanges[i2];\n const i = r1.intersect(r2);\n if (i && !i.isEmpty) {\n result.push(i);\n }\n if (r1.endLineNumberExclusive < r2.endLineNumberExclusive) {\n i1++;\n }\n else {\n i2++;\n }\n }\n return new LineRangeSet(result);\n }\n getWithDelta(value) {\n return new LineRangeSet(this._normalizedRanges.map(r => r.delta(value)));\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 *--------------------------------------------------------------------------------------------*/\nimport { Position } from './position.js';\nimport { Range } from './range.js';\n/**\n * Represents a non-negative length of text in terms of line and column count.\n*/\nexport class TextLength {\n static betweenPositions(position1, position2) {\n if (position1.lineNumber === position2.lineNumber) {\n return new TextLength(0, position2.column - position1.column);\n }\n else {\n return new TextLength(position2.lineNumber - position1.lineNumber, position2.column - 1);\n }\n }\n static ofRange(range) {\n return TextLength.betweenPositions(range.getStartPosition(), range.getEndPosition());\n }\n static ofText(text) {\n let line = 0;\n let column = 0;\n for (const c of text) {\n if (c === '\\n') {\n line++;\n column = 0;\n }\n else {\n column++;\n }\n }\n return new TextLength(line, column);\n }\n constructor(lineCount, columnCount) {\n this.lineCount = lineCount;\n this.columnCount = columnCount;\n }\n isGreaterThanOrEqualTo(other) {\n if (this.lineCount !== other.lineCount) {\n return this.lineCount > other.lineCount;\n }\n return this.columnCount >= other.columnCount;\n }\n createRange(startPosition) {\n if (this.lineCount === 0) {\n return new Range(startPosition.lineNumber, startPosition.column, startPosition.lineNumber, startPosition.column + this.columnCount);\n }\n else {\n return new Range(startPosition.lineNumber, startPosition.column, startPosition.lineNumber + this.lineCount, this.columnCount + 1);\n }\n }\n addToPosition(position) {\n if (this.lineCount === 0) {\n return new Position(position.lineNumber, position.column + this.columnCount);\n }\n else {\n return new Position(position.lineNumber + this.lineCount, this.columnCount + 1);\n }\n }\n toString() {\n return `${this.lineCount},${this.columnCount}`;\n }\n}\nTextLength.zero = new TextLength(0, 0);\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nfunction roundFloat(number, decimalPoints) {\n const decimal = Math.pow(10, decimalPoints);\n return Math.round(number * decimal) / decimal;\n}\nexport class RGBA {\n constructor(r, g, b, a = 1) {\n this._rgbaBrand = undefined;\n this.r = Math.min(255, Math.max(0, r)) | 0;\n this.g = Math.min(255, Math.max(0, g)) | 0;\n this.b = Math.min(255, Math.max(0, b)) | 0;\n this.a = roundFloat(Math.max(Math.min(1, a), 0), 3);\n }\n static equals(a, b) {\n return a.r === b.r && a.g === b.g && a.b === b.b && a.a === b.a;\n }\n}\nexport class HSLA {\n constructor(h, s, l, a) {\n this._hslaBrand = undefined;\n this.h = Math.max(Math.min(360, h), 0) | 0;\n this.s = roundFloat(Math.max(Math.min(1, s), 0), 3);\n this.l = roundFloat(Math.max(Math.min(1, l), 0), 3);\n this.a = roundFloat(Math.max(Math.min(1, a), 0), 3);\n }\n static equals(a, b) {\n return a.h === b.h && a.s === b.s && a.l === b.l && a.a === b.a;\n }\n /**\n * Converts an RGB color value to HSL. Conversion formula\n * adapted from http://en.wikipedia.org/wiki/HSL_color_space.\n * Assumes r, g, and b are contained in the set [0, 255] and\n * returns h in the set [0, 360], s, and l in the set [0, 1].\n */\n static fromRGBA(rgba) {\n const r = rgba.r / 255;\n const g = rgba.g / 255;\n const b = rgba.b / 255;\n const a = rgba.a;\n const max = Math.max(r, g, b);\n const min = Math.min(r, g, b);\n let h = 0;\n let s = 0;\n const l = (min + max) / 2;\n const chroma = max - min;\n if (chroma > 0) {\n s = Math.min((l <= 0.5 ? chroma / (2 * l) : chroma / (2 - (2 * l))), 1);\n switch (max) {\n case r:\n h = (g - b) / chroma + (g < b ? 6 : 0);\n break;\n case g:\n h = (b - r) / chroma + 2;\n break;\n case b:\n h = (r - g) / chroma + 4;\n break;\n }\n h *= 60;\n h = Math.round(h);\n }\n return new HSLA(h, s, l, a);\n }\n static _hue2rgb(p, q, t) {\n if (t < 0) {\n t += 1;\n }\n if (t > 1) {\n t -= 1;\n }\n if (t < 1 / 6) {\n return p + (q - p) * 6 * t;\n }\n if (t < 1 / 2) {\n return q;\n }\n if (t < 2 / 3) {\n return p + (q - p) * (2 / 3 - t) * 6;\n }\n return p;\n }\n /**\n * Converts an HSL color value to RGB. Conversion formula\n * adapted from http://en.wikipedia.org/wiki/HSL_color_space.\n * Assumes h in the set [0, 360] s, and l are contained in the set [0, 1] and\n * returns r, g, and b in the set [0, 255].\n */\n static toRGBA(hsla) {\n const h = hsla.h / 360;\n const { s, l, a } = hsla;\n let r, g, b;\n if (s === 0) {\n r = g = b = l; // achromatic\n }\n else {\n const q = l < 0.5 ? l * (1 + s) : l + s - l * s;\n const p = 2 * l - q;\n r = HSLA._hue2rgb(p, q, h + 1 / 3);\n g = HSLA._hue2rgb(p, q, h);\n b = HSLA._hue2rgb(p, q, h - 1 / 3);\n }\n return new RGBA(Math.round(r * 255), Math.round(g * 255), Math.round(b * 255), a);\n }\n}\nexport class HSVA {\n constructor(h, s, v, a) {\n this._hsvaBrand = undefined;\n this.h = Math.max(Math.min(360, h), 0) | 0;\n this.s = roundFloat(Math.max(Math.min(1, s), 0), 3);\n this.v = roundFloat(Math.max(Math.min(1, v), 0), 3);\n this.a = roundFloat(Math.max(Math.min(1, a), 0), 3);\n }\n static equals(a, b) {\n return a.h === b.h && a.s === b.s && a.v === b.v && a.a === b.a;\n }\n // from http://www.rapidtables.com/convert/color/rgb-to-hsv.htm\n static fromRGBA(rgba) {\n const r = rgba.r / 255;\n const g = rgba.g / 255;\n const b = rgba.b / 255;\n const cmax = Math.max(r, g, b);\n const cmin = Math.min(r, g, b);\n const delta = cmax - cmin;\n const s = cmax === 0 ? 0 : (delta / cmax);\n let m;\n if (delta === 0) {\n m = 0;\n }\n else if (cmax === r) {\n m = ((((g - b) / delta) % 6) + 6) % 6;\n }\n else if (cmax === g) {\n m = ((b - r) / delta) + 2;\n }\n else {\n m = ((r - g) / delta) + 4;\n }\n return new HSVA(Math.round(m * 60), s, cmax, rgba.a);\n }\n // from http://www.rapidtables.com/convert/color/hsv-to-rgb.htm\n static toRGBA(hsva) {\n const { h, s, v, a } = hsva;\n const c = v * s;\n const x = c * (1 - Math.abs((h / 60) % 2 - 1));\n const m = v - c;\n let [r, g, b] = [0, 0, 0];\n if (h < 60) {\n r = c;\n g = x;\n }\n else if (h < 120) {\n r = x;\n g = c;\n }\n else if (h < 180) {\n g = c;\n b = x;\n }\n else if (h < 240) {\n g = x;\n b = c;\n }\n else if (h < 300) {\n r = x;\n b = c;\n }\n else if (h <= 360) {\n r = c;\n b = x;\n }\n r = Math.round((r + m) * 255);\n g = Math.round((g + m) * 255);\n b = Math.round((b + m) * 255);\n return new RGBA(r, g, b, a);\n }\n}\nexport class Color {\n static fromHex(hex) {\n return Color.Format.CSS.parseHex(hex) || Color.red;\n }\n static equals(a, b) {\n if (!a && !b) {\n return true;\n }\n if (!a || !b) {\n return false;\n }\n return a.equals(b);\n }\n get hsla() {\n if (this._hsla) {\n return this._hsla;\n }\n else {\n return HSLA.fromRGBA(this.rgba);\n }\n }\n get hsva() {\n if (this._hsva) {\n return this._hsva;\n }\n return HSVA.fromRGBA(this.rgba);\n }\n constructor(arg) {\n if (!arg) {\n throw new Error('Color needs a value');\n }\n else if (arg instanceof RGBA) {\n this.rgba = arg;\n }\n else if (arg instanceof HSLA) {\n this._hsla = arg;\n this.rgba = HSLA.toRGBA(arg);\n }\n else if (arg instanceof HSVA) {\n this._hsva = arg;\n this.rgba = HSVA.toRGBA(arg);\n }\n else {\n throw new Error('Invalid color ctor argument');\n }\n }\n equals(other) {\n return !!other && RGBA.equals(this.rgba, other.rgba) && HSLA.equals(this.hsla, other.hsla) && HSVA.equals(this.hsva, other.hsva);\n }\n /**\n * http://www.w3.org/TR/WCAG20/#relativeluminancedef\n * Returns the number in the set [0, 1]. O => Darkest Black. 1 => Lightest white.\n */\n getRelativeLuminance() {\n const R = Color._relativeLuminanceForComponent(this.rgba.r);\n const G = Color._relativeLuminanceForComponent(this.rgba.g);\n const B = Color._relativeLuminanceForComponent(this.rgba.b);\n const luminance = 0.2126 * R + 0.7152 * G + 0.0722 * B;\n return roundFloat(luminance, 4);\n }\n static _relativeLuminanceForComponent(color) {\n const c = color / 255;\n return (c <= 0.03928) ? c / 12.92 : Math.pow(((c + 0.055) / 1.055), 2.4);\n }\n /**\n *\thttp://24ways.org/2010/calculating-color-contrast\n * Return 'true' if lighter color otherwise 'false'\n */\n isLighter() {\n const yiq = (this.rgba.r * 299 + this.rgba.g * 587 + this.rgba.b * 114) / 1000;\n return yiq >= 128;\n }\n isLighterThan(another) {\n const lum1 = this.getRelativeLuminance();\n const lum2 = another.getRelativeLuminance();\n return lum1 > lum2;\n }\n isDarkerThan(another) {\n const lum1 = this.getRelativeLuminance();\n const lum2 = another.getRelativeLuminance();\n return lum1 < lum2;\n }\n lighten(factor) {\n return new Color(new HSLA(this.hsla.h, this.hsla.s, this.hsla.l + this.hsla.l * factor, this.hsla.a));\n }\n darken(factor) {\n return new Color(new HSLA(this.hsla.h, this.hsla.s, this.hsla.l - this.hsla.l * factor, this.hsla.a));\n }\n transparent(factor) {\n const { r, g, b, a } = this.rgba;\n return new Color(new RGBA(r, g, b, a * factor));\n }\n isTransparent() {\n return this.rgba.a === 0;\n }\n isOpaque() {\n return this.rgba.a === 1;\n }\n opposite() {\n return new Color(new RGBA(255 - this.rgba.r, 255 - this.rgba.g, 255 - this.rgba.b, this.rgba.a));\n }\n makeOpaque(opaqueBackground) {\n if (this.isOpaque() || opaqueBackground.rgba.a !== 1) {\n // only allow to blend onto a non-opaque color onto a opaque color\n return this;\n }\n const { r, g, b, a } = this.rgba;\n // https://stackoverflow.com/questions/12228548/finding-equivalent-color-with-opacity\n return new Color(new RGBA(opaqueBackground.rgba.r - a * (opaqueBackground.rgba.r - r), opaqueBackground.rgba.g - a * (opaqueBackground.rgba.g - g), opaqueBackground.rgba.b - a * (opaqueBackground.rgba.b - b), 1));\n }\n toString() {\n if (!this._toString) {\n this._toString = Color.Format.CSS.format(this);\n }\n return this._toString;\n }\n static getLighterColor(of, relative, factor) {\n if (of.isLighterThan(relative)) {\n return of;\n }\n factor = factor ? factor : 0.5;\n const lum1 = of.getRelativeLuminance();\n const lum2 = relative.getRelativeLuminance();\n factor = factor * (lum2 - lum1) / lum2;\n return of.lighten(factor);\n }\n static getDarkerColor(of, relative, factor) {\n if (of.isDarkerThan(relative)) {\n return of;\n }\n factor = factor ? factor : 0.5;\n const lum1 = of.getRelativeLuminance();\n const lum2 = relative.getRelativeLuminance();\n factor = factor * (lum1 - lum2) / lum1;\n return of.darken(factor);\n }\n}\nColor.white = new Color(new RGBA(255, 255, 255, 1));\nColor.black = new Color(new RGBA(0, 0, 0, 1));\nColor.red = new Color(new RGBA(255, 0, 0, 1));\nColor.blue = new Color(new RGBA(0, 0, 255, 1));\nColor.green = new Color(new RGBA(0, 255, 0, 1));\nColor.cyan = new Color(new RGBA(0, 255, 255, 1));\nColor.lightgrey = new Color(new RGBA(211, 211, 211, 1));\nColor.transparent = new Color(new RGBA(0, 0, 0, 0));\n(function (Color) {\n let Format;\n (function (Format) {\n let CSS;\n (function (CSS) {\n function formatRGB(color) {\n if (color.rgba.a === 1) {\n return `rgb(${color.rgba.r}, ${color.rgba.g}, ${color.rgba.b})`;\n }\n return Color.Format.CSS.formatRGBA(color);\n }\n CSS.formatRGB = formatRGB;\n function formatRGBA(color) {\n return `rgba(${color.rgba.r}, ${color.rgba.g}, ${color.rgba.b}, ${+(color.rgba.a).toFixed(2)})`;\n }\n CSS.formatRGBA = formatRGBA;\n function formatHSL(color) {\n if (color.hsla.a === 1) {\n return `hsl(${color.hsla.h}, ${(color.hsla.s * 100).toFixed(2)}%, ${(color.hsla.l * 100).toFixed(2)}%)`;\n }\n return Color.Format.CSS.formatHSLA(color);\n }\n CSS.formatHSL = formatHSL;\n function formatHSLA(color) {\n return `hsla(${color.hsla.h}, ${(color.hsla.s * 100).toFixed(2)}%, ${(color.hsla.l * 100).toFixed(2)}%, ${color.hsla.a.toFixed(2)})`;\n }\n CSS.formatHSLA = formatHSLA;\n function _toTwoDigitHex(n) {\n const r = n.toString(16);\n return r.length !== 2 ? '0' + r : r;\n }\n /**\n * Formats the color as #RRGGBB\n */\n function formatHex(color) {\n return `#${_toTwoDigitHex(color.rgba.r)}${_toTwoDigitHex(color.rgba.g)}${_toTwoDigitHex(color.rgba.b)}`;\n }\n CSS.formatHex = formatHex;\n /**\n * Formats the color as #RRGGBBAA\n * If 'compact' is set, colors without transparancy will be printed as #RRGGBB\n */\n function formatHexA(color, compact = false) {\n if (compact && color.rgba.a === 1) {\n return Color.Format.CSS.formatHex(color);\n }\n return `#${_toTwoDigitHex(color.rgba.r)}${_toTwoDigitHex(color.rgba.g)}${_toTwoDigitHex(color.rgba.b)}${_toTwoDigitHex(Math.round(color.rgba.a * 255))}`;\n }\n CSS.formatHexA = formatHexA;\n /**\n * The default format will use HEX if opaque and RGBA otherwise.\n */\n function format(color) {\n if (color.isOpaque()) {\n return Color.Format.CSS.formatHex(color);\n }\n return Color.Format.CSS.formatRGBA(color);\n }\n CSS.format = format;\n /**\n * Converts an Hex color value to a Color.\n * returns r, g, and b are contained in the set [0, 255]\n * @param hex string (#RGB, #RGBA, #RRGGBB or #RRGGBBAA).\n */\n function parseHex(hex) {\n const length = hex.length;\n if (length === 0) {\n // Invalid color\n return null;\n }\n if (hex.charCodeAt(0) !== 35 /* CharCode.Hash */) {\n // Does not begin with a #\n return null;\n }\n if (length === 7) {\n // #RRGGBB format\n const r = 16 * _parseHexDigit(hex.charCodeAt(1)) + _parseHexDigit(hex.charCodeAt(2));\n const g = 16 * _parseHexDigit(hex.charCodeAt(3)) + _parseHexDigit(hex.charCodeAt(4));\n const b = 16 * _parseHexDigit(hex.charCodeAt(5)) + _parseHexDigit(hex.charCodeAt(6));\n return new Color(new RGBA(r, g, b, 1));\n }\n if (length === 9) {\n // #RRGGBBAA format\n const r = 16 * _parseHexDigit(hex.charCodeAt(1)) + _parseHexDigit(hex.charCodeAt(2));\n const g = 16 * _parseHexDigit(hex.charCodeAt(3)) + _parseHexDigit(hex.charCodeAt(4));\n const b = 16 * _parseHexDigit(hex.charCodeAt(5)) + _parseHexDigit(hex.charCodeAt(6));\n const a = 16 * _parseHexDigit(hex.charCodeAt(7)) + _parseHexDigit(hex.charCodeAt(8));\n return new Color(new RGBA(r, g, b, a / 255));\n }\n if (length === 4) {\n // #RGB format\n const r = _parseHexDigit(hex.charCodeAt(1));\n const g = _parseHexDigit(hex.charCodeAt(2));\n const b = _parseHexDigit(hex.charCodeAt(3));\n return new Color(new RGBA(16 * r + r, 16 * g + g, 16 * b + b));\n }\n if (length === 5) {\n // #RGBA format\n const r = _parseHexDigit(hex.charCodeAt(1));\n const g = _parseHexDigit(hex.charCodeAt(2));\n const b = _parseHexDigit(hex.charCodeAt(3));\n const a = _parseHexDigit(hex.charCodeAt(4));\n return new Color(new RGBA(16 * r + r, 16 * g + g, 16 * b + b, (16 * a + a) / 255));\n }\n // Invalid color\n return null;\n }\n CSS.parseHex = parseHex;\n function _parseHexDigit(charCode) {\n switch (charCode) {\n case 48 /* CharCode.Digit0 */: return 0;\n case 49 /* CharCode.Digit1 */: return 1;\n case 50 /* CharCode.Digit2 */: return 2;\n case 51 /* CharCode.Digit3 */: return 3;\n case 52 /* CharCode.Digit4 */: return 4;\n case 53 /* CharCode.Digit5 */: return 5;\n case 54 /* CharCode.Digit6 */: return 6;\n case 55 /* CharCode.Digit7 */: return 7;\n case 56 /* CharCode.Digit8 */: return 8;\n case 57 /* CharCode.Digit9 */: return 9;\n case 97 /* CharCode.a */: return 10;\n case 65 /* CharCode.A */: return 10;\n case 98 /* CharCode.b */: return 11;\n case 66 /* CharCode.B */: return 11;\n case 99 /* CharCode.c */: return 12;\n case 67 /* CharCode.C */: return 12;\n case 100 /* CharCode.d */: return 13;\n case 68 /* CharCode.D */: return 13;\n case 101 /* CharCode.e */: return 14;\n case 69 /* CharCode.E */: return 14;\n case 102 /* CharCode.f */: return 15;\n case 70 /* CharCode.F */: return 15;\n }\n return 0;\n }\n })(CSS = Format.CSS || (Format.CSS = {}));\n })(Format = Color.Format || (Color.Format = {}));\n})(Color || (Color = {}));\n", "/*---------------------------------------------------------------------------------------------\n * 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 { createDecorator } from '../../../platform/instantiation/common/instantiation.js';\nexport const ILanguageFeaturesService = createDecorator('ILanguageFeaturesService');\n", "/*---------------------------------------------------------------------------------------------\n * 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 { Token, TokenizationResult, EncodedTokenizationResult } from '../languages.js';\nexport const NullState = new class {\n clone() {\n return this;\n }\n equals(other) {\n return (this === other);\n }\n};\nexport function nullTokenize(languageId, state) {\n return new TokenizationResult([new Token(0, '', languageId)], state);\n}\nexport function nullTokenizeEncoded(languageId, state) {\n const tokens = new Uint32Array(2);\n tokens[0] = 0;\n tokens[1] = ((languageId << 0 /* MetadataConsts.LANGUAGEID_OFFSET */)\n | (0 /* StandardTokenType.Other */ << 8 /* MetadataConsts.TOKEN_TYPE_OFFSET */)\n | (0 /* FontStyle.None */ << 11 /* MetadataConsts.FONT_STYLE_OFFSET */)\n | (1 /* ColorId.DefaultForeground */ << 15 /* MetadataConsts.FOREGROUND_OFFSET */)\n | (2 /* ColorId.DefaultBackground */ << 24 /* MetadataConsts.BACKGROUND_OFFSET */)) >>> 0;\n return new EncodedTokenizationResult(tokens, state === null ? NullState : state);\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 */\nexport class TokenMetadata {\n static getLanguageId(metadata) {\n return (metadata & 255 /* MetadataConsts.LANGUAGEID_MASK */) >>> 0 /* MetadataConsts.LANGUAGEID_OFFSET */;\n }\n static getTokenType(metadata) {\n return (metadata & 768 /* MetadataConsts.TOKEN_TYPE_MASK */) >>> 8 /* MetadataConsts.TOKEN_TYPE_OFFSET */;\n }\n static containsBalancedBrackets(metadata) {\n return (metadata & 1024 /* MetadataConsts.BALANCED_BRACKETS_MASK */) !== 0;\n }\n static getFontStyle(metadata) {\n return (metadata & 30720 /* MetadataConsts.FONT_STYLE_MASK */) >>> 11 /* MetadataConsts.FONT_STYLE_OFFSET */;\n }\n static getForeground(metadata) {\n return (metadata & 16744448 /* MetadataConsts.FOREGROUND_MASK */) >>> 15 /* MetadataConsts.FOREGROUND_OFFSET */;\n }\n static getBackground(metadata) {\n return (metadata & 4278190080 /* MetadataConsts.BACKGROUND_MASK */) >>> 24 /* MetadataConsts.BACKGROUND_OFFSET */;\n }\n static getClassNameFromMetadata(metadata) {\n const foreground = this.getForeground(metadata);\n let className = 'mtk' + foreground;\n const fontStyle = this.getFontStyle(metadata);\n if (fontStyle & 1 /* FontStyle.Italic */) {\n className += ' mtki';\n }\n if (fontStyle & 2 /* FontStyle.Bold */) {\n className += ' mtkb';\n }\n if (fontStyle & 4 /* FontStyle.Underline */) {\n className += ' mtku';\n }\n if (fontStyle & 8 /* FontStyle.Strikethrough */) {\n className += ' mtks';\n }\n return className;\n }\n static getInlineStyleFromMetadata(metadata, colorMap) {\n const foreground = this.getForeground(metadata);\n const fontStyle = this.getFontStyle(metadata);\n let result = `color: ${colorMap[foreground]};`;\n if (fontStyle & 1 /* FontStyle.Italic */) {\n result += 'font-style: italic;';\n }\n if (fontStyle & 2 /* FontStyle.Bold */) {\n result += 'font-weight: bold;';\n }\n let textDecoration = '';\n if (fontStyle & 4 /* FontStyle.Underline */) {\n textDecoration += ' underline';\n }\n if (fontStyle & 8 /* FontStyle.Strikethrough */) {\n textDecoration += ' line-through';\n }\n if (textDecoration) {\n result += `text-decoration:${textDecoration};`;\n }\n return result;\n }\n static getPresentationFromMetadata(metadata) {\n const foreground = this.getForeground(metadata);\n const fontStyle = this.getFontStyle(metadata);\n return {\n foreground: foreground,\n italic: Boolean(fontStyle & 1 /* FontStyle.Italic */),\n bold: Boolean(fontStyle & 2 /* FontStyle.Bold */),\n underline: Boolean(fontStyle & 4 /* FontStyle.Underline */),\n strikethrough: Boolean(fontStyle & 8 /* FontStyle.Strikethrough */),\n };\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 *--------------------------------------------------------------------------------------------*/\nimport { TokenMetadata } from '../encodedTokenAttributes.js';\nexport class LineTokens {\n static createEmpty(lineContent, decoder) {\n const defaultMetadata = LineTokens.defaultTokenMetadata;\n const tokens = new Uint32Array(2);\n tokens[0] = lineContent.length;\n tokens[1] = defaultMetadata;\n return new LineTokens(tokens, lineContent, decoder);\n }\n constructor(tokens, text, decoder) {\n this._lineTokensBrand = undefined;\n this._tokens = tokens;\n this._tokensCount = (this._tokens.length >>> 1);\n this._text = text;\n this._languageIdCodec = decoder;\n }\n equals(other) {\n if (other instanceof LineTokens) {\n return this.slicedEquals(other, 0, this._tokensCount);\n }\n return false;\n }\n slicedEquals(other, sliceFromTokenIndex, sliceTokenCount) {\n if (this._text !== other._text) {\n return false;\n }\n if (this._tokensCount !== other._tokensCount) {\n return false;\n }\n const from = (sliceFromTokenIndex << 1);\n const to = from + (sliceTokenCount << 1);\n for (let i = from; i < to; i++) {\n if (this._tokens[i] !== other._tokens[i]) {\n return false;\n }\n }\n return true;\n }\n getLineContent() {\n return this._text;\n }\n getCount() {\n return this._tokensCount;\n }\n getStartOffset(tokenIndex) {\n if (tokenIndex > 0) {\n return this._tokens[(tokenIndex - 1) << 1];\n }\n return 0;\n }\n getMetadata(tokenIndex) {\n const metadata = this._tokens[(tokenIndex << 1) + 1];\n return metadata;\n }\n getLanguageId(tokenIndex) {\n const metadata = this._tokens[(tokenIndex << 1) + 1];\n const languageId = TokenMetadata.getLanguageId(metadata);\n return this._languageIdCodec.decodeLanguageId(languageId);\n }\n getStandardTokenType(tokenIndex) {\n const metadata = this._tokens[(tokenIndex << 1) + 1];\n return TokenMetadata.getTokenType(metadata);\n }\n getForeground(tokenIndex) {\n const metadata = this._tokens[(tokenIndex << 1) + 1];\n return TokenMetadata.getForeground(metadata);\n }\n getClassName(tokenIndex) {\n const metadata = this._tokens[(tokenIndex << 1) + 1];\n return TokenMetadata.getClassNameFromMetadata(metadata);\n }\n getInlineStyle(tokenIndex, colorMap) {\n const metadata = this._tokens[(tokenIndex << 1) + 1];\n return TokenMetadata.getInlineStyleFromMetadata(metadata, colorMap);\n }\n getPresentation(tokenIndex) {\n const metadata = this._tokens[(tokenIndex << 1) + 1];\n return TokenMetadata.getPresentationFromMetadata(metadata);\n }\n getEndOffset(tokenIndex) {\n return this._tokens[tokenIndex << 1];\n }\n /**\n * Find the token containing offset `offset`.\n * @param offset The search offset\n * @return The index of the token containing the offset.\n */\n findTokenIndexAtOffset(offset) {\n return LineTokens.findIndexInTokensArray(this._tokens, offset);\n }\n inflate() {\n return this;\n }\n sliceAndInflate(startOffset, endOffset, deltaOffset) {\n return new SliceLineTokens(this, startOffset, endOffset, deltaOffset);\n }\n static convertToEndOffset(tokens, lineTextLength) {\n const tokenCount = (tokens.length >>> 1);\n const lastTokenIndex = tokenCount - 1;\n for (let tokenIndex = 0; tokenIndex < lastTokenIndex; tokenIndex++) {\n tokens[tokenIndex << 1] = tokens[(tokenIndex + 1) << 1];\n }\n tokens[lastTokenIndex << 1] = lineTextLength;\n }\n static findIndexInTokensArray(tokens, desiredIndex) {\n if (tokens.length <= 2) {\n return 0;\n }\n let low = 0;\n let high = (tokens.length >>> 1) - 1;\n while (low < high) {\n const mid = low + Math.floor((high - low) / 2);\n const endOffset = tokens[(mid << 1)];\n if (endOffset === desiredIndex) {\n return mid + 1;\n }\n else if (endOffset < desiredIndex) {\n low = mid + 1;\n }\n else if (endOffset > desiredIndex) {\n high = mid;\n }\n }\n return low;\n }\n /**\n * @pure\n * @param insertTokens Must be sorted by offset.\n */\n withInserted(insertTokens) {\n if (insertTokens.length === 0) {\n return this;\n }\n let nextOriginalTokenIdx = 0;\n let nextInsertTokenIdx = 0;\n let text = '';\n const newTokens = new Array();\n let originalEndOffset = 0;\n while (true) {\n const nextOriginalTokenEndOffset = nextOriginalTokenIdx < this._tokensCount ? this._tokens[nextOriginalTokenIdx << 1] : -1;\n const nextInsertToken = nextInsertTokenIdx < insertTokens.length ? insertTokens[nextInsertTokenIdx] : null;\n if (nextOriginalTokenEndOffset !== -1 && (nextInsertToken === null || nextOriginalTokenEndOffset <= nextInsertToken.offset)) {\n // original token ends before next insert token\n text += this._text.substring(originalEndOffset, nextOriginalTokenEndOffset);\n const metadata = this._tokens[(nextOriginalTokenIdx << 1) + 1];\n newTokens.push(text.length, metadata);\n nextOriginalTokenIdx++;\n originalEndOffset = nextOriginalTokenEndOffset;\n }\n else if (nextInsertToken) {\n if (nextInsertToken.offset > originalEndOffset) {\n // insert token is in the middle of the next token.\n text += this._text.substring(originalEndOffset, nextInsertToken.offset);\n const metadata = this._tokens[(nextOriginalTokenIdx << 1) + 1];\n newTokens.push(text.length, metadata);\n originalEndOffset = nextInsertToken.offset;\n }\n text += nextInsertToken.text;\n newTokens.push(text.length, nextInsertToken.tokenMetadata);\n nextInsertTokenIdx++;\n }\n else {\n break;\n }\n }\n return new LineTokens(new Uint32Array(newTokens), text, this._languageIdCodec);\n }\n}\nLineTokens.defaultTokenMetadata = ((0 /* FontStyle.None */ << 11 /* MetadataConsts.FONT_STYLE_OFFSET */)\n | (1 /* ColorId.DefaultForeground */ << 15 /* MetadataConsts.FOREGROUND_OFFSET */)\n | (2 /* ColorId.DefaultBackground */ << 24 /* MetadataConsts.BACKGROUND_OFFSET */)) >>> 0;\nclass SliceLineTokens {\n constructor(source, startOffset, endOffset, deltaOffset) {\n this._source = source;\n this._startOffset = startOffset;\n this._endOffset = endOffset;\n this._deltaOffset = deltaOffset;\n this._firstTokenIndex = source.findTokenIndexAtOffset(startOffset);\n this._tokensCount = 0;\n for (let i = this._firstTokenIndex, len = source.getCount(); i < len; i++) {\n const tokenStartOffset = source.getStartOffset(i);\n if (tokenStartOffset >= endOffset) {\n break;\n }\n this._tokensCount++;\n }\n }\n getMetadata(tokenIndex) {\n return this._source.getMetadata(this._firstTokenIndex + tokenIndex);\n }\n getLanguageId(tokenIndex) {\n return this._source.getLanguageId(this._firstTokenIndex + tokenIndex);\n }\n getLineContent() {\n return this._source.getLineContent().substring(this._startOffset, this._endOffset);\n }\n equals(other) {\n if (other instanceof SliceLineTokens) {\n return (this._startOffset === other._startOffset\n && this._endOffset === other._endOffset\n && this._deltaOffset === other._deltaOffset\n && this._source.slicedEquals(other._source, this._firstTokenIndex, this._tokensCount));\n }\n return false;\n }\n getCount() {\n return this._tokensCount;\n }\n getForeground(tokenIndex) {\n return this._source.getForeground(this._firstTokenIndex + tokenIndex);\n }\n getEndOffset(tokenIndex) {\n const tokenEndOffset = this._source.getEndOffset(this._firstTokenIndex + tokenIndex);\n return Math.min(this._endOffset, tokenEndOffset) - this._startOffset + this._deltaOffset;\n }\n getClassName(tokenIndex) {\n return this._source.getClassName(this._firstTokenIndex + tokenIndex);\n }\n getInlineStyle(tokenIndex, colorMap) {\n return this._source.getInlineStyle(this._firstTokenIndex + tokenIndex, colorMap);\n }\n getPresentation(tokenIndex) {\n return this._source.getPresentation(this._firstTokenIndex + tokenIndex);\n }\n findTokenIndexAtOffset(offset) {\n return this._source.findTokenIndexAtOffset(offset + this._startOffset - this._deltaOffset) - this._firstTokenIndex;\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 *--------------------------------------------------------------------------------------------*/\nimport { Disposable } from '../../../base/common/lifecycle.js';\nimport { Emitter } from '../../../base/common/event.js';\nimport { getWindow, scheduleAtNextAnimationFrame } from '../../../base/browser/dom.js';\nexport class ElementSizeObserver extends Disposable {\n constructor(referenceDomElement, dimension) {\n super();\n this._onDidChange = this._register(new Emitter());\n this.onDidChange = this._onDidChange.event;\n this._referenceDomElement = referenceDomElement;\n this._width = -1;\n this._height = -1;\n this._resizeObserver = null;\n this.measureReferenceDomElement(false, dimension);\n }\n dispose() {\n this.stopObserving();\n super.dispose();\n }\n getWidth() {\n return this._width;\n }\n getHeight() {\n return this._height;\n }\n startObserving() {\n if (!this._resizeObserver && this._referenceDomElement) {\n // We want to react to the resize observer only once per animation frame\n // The first time the resize observer fires, we will react to it immediately.\n // Otherwise we will postpone to the next animation frame.\n // We'll use `observeContentRect` to store the content rect we received.\n let observedDimenstion = null;\n const observeNow = () => {\n if (observedDimenstion) {\n this.observe({ width: observedDimenstion.width, height: observedDimenstion.height });\n }\n else {\n this.observe();\n }\n };\n let shouldObserve = false;\n let alreadyObservedThisAnimationFrame = false;\n const update = () => {\n if (shouldObserve && !alreadyObservedThisAnimationFrame) {\n try {\n shouldObserve = false;\n alreadyObservedThisAnimationFrame = true;\n observeNow();\n }\n finally {\n scheduleAtNextAnimationFrame(getWindow(this._referenceDomElement), () => {\n alreadyObservedThisAnimationFrame = false;\n update();\n });\n }\n }\n };\n this._resizeObserver = new ResizeObserver((entries) => {\n if (entries && entries[0] && entries[0].contentRect) {\n observedDimenstion = { width: entries[0].contentRect.width, height: entries[0].contentRect.height };\n }\n else {\n observedDimenstion = null;\n }\n shouldObserve = true;\n update();\n });\n this._resizeObserver.observe(this._referenceDomElement);\n }\n }\n stopObserving() {\n if (this._resizeObserver) {\n this._resizeObserver.disconnect();\n this._resizeObserver = null;\n }\n }\n observe(dimension) {\n this.measureReferenceDomElement(true, dimension);\n }\n measureReferenceDomElement(emitEvent, dimension) {\n let observedWidth = 0;\n let observedHeight = 0;\n if (dimension) {\n observedWidth = dimension.width;\n observedHeight = dimension.height;\n }\n else if (this._referenceDomElement) {\n observedWidth = this._referenceDomElement.clientWidth;\n observedHeight = this._referenceDomElement.clientHeight;\n }\n observedWidth = Math.max(5, observedWidth);\n observedHeight = Math.max(5, observedHeight);\n if (this._width !== observedWidth || this._height !== observedHeight) {\n this._width = observedWidth;\n this._height = observedHeight;\n if (emitEvent) {\n this._onDidChange.fire();\n }\n }\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 *--------------------------------------------------------------------------------------------*/\nimport { assertNever } from '../../../base/common/assert.js';\nimport { RunOnceScheduler } from '../../../base/common/async.js';\nimport { Color } from '../../../base/common/color.js';\nimport { Emitter } from '../../../base/common/event.js';\nimport { Extensions as JSONExtensions } from '../../jsonschemas/common/jsonContributionRegistry.js';\nimport * as platform from '../../registry/common/platform.js';\n/**\n * Returns the css variable name for the given color identifier. Dots (`.`) are replaced with hyphens (`-`) and\n * everything is prefixed with `--vscode-`.\n *\n * @sample `editorSuggestWidget.background` is `--vscode-editorSuggestWidget-background`.\n */\nexport function asCssVariableName(colorIdent) {\n return `--vscode-${colorIdent.replace(/\\./g, '-')}`;\n}\nexport function asCssVariable(color) {\n return `var(${asCssVariableName(color)})`;\n}\nexport function asCssVariableWithDefault(color, defaultCssValue) {\n return `var(${asCssVariableName(color)}, ${defaultCssValue})`;\n}\n// color registry\nexport const Extensions = {\n ColorContribution: 'base.contributions.colors'\n};\nclass ColorRegistry {\n constructor() {\n this._onDidChangeSchema = new Emitter();\n this.onDidChangeSchema = this._onDidChangeSchema.event;\n this.colorSchema = { type: 'object', properties: {} };\n this.colorReferenceSchema = { type: 'string', enum: [], enumDescriptions: [] };\n this.colorsById = {};\n }\n registerColor(id, defaults, description, needsTransparency = false, deprecationMessage) {\n const colorContribution = { id, description, defaults, needsTransparency, deprecationMessage };\n this.colorsById[id] = colorContribution;\n const propertySchema = { type: 'string', description, format: 'color-hex', defaultSnippets: [{ body: '${1:#ff0000}' }] };\n if (deprecationMessage) {\n propertySchema.deprecationMessage = deprecationMessage;\n }\n if (needsTransparency) {\n propertySchema.pattern = '^#(?:(?[0-9a-fA-f]{3}[0-9a-eA-E])|(?:[0-9a-fA-F]{6}(?:(?![fF]{2})(?:[0-9a-fA-F]{2}))))?$';\n propertySchema.patternErrorMessage = 'This color must be transparent or it will obscure content';\n }\n this.colorSchema.properties[id] = propertySchema;\n this.colorReferenceSchema.enum.push(id);\n this.colorReferenceSchema.enumDescriptions.push(description);\n this._onDidChangeSchema.fire();\n return id;\n }\n getColors() {\n return Object.keys(this.colorsById).map(id => this.colorsById[id]);\n }\n resolveDefaultColor(id, theme) {\n const colorDesc = this.colorsById[id];\n if (colorDesc && colorDesc.defaults) {\n const colorValue = colorDesc.defaults[theme.type];\n return resolveColorValue(colorValue, theme);\n }\n return undefined;\n }\n getColorSchema() {\n return this.colorSchema;\n }\n toString() {\n const sorter = (a, b) => {\n const cat1 = a.indexOf('.') === -1 ? 0 : 1;\n const cat2 = b.indexOf('.') === -1 ? 0 : 1;\n if (cat1 !== cat2) {\n return cat1 - cat2;\n }\n return a.localeCompare(b);\n };\n return Object.keys(this.colorsById).sort(sorter).map(k => `- \\`${k}\\`: ${this.colorsById[k].description}`).join('\\n');\n }\n}\nconst colorRegistry = new ColorRegistry();\nplatform.Registry.add(Extensions.ColorContribution, colorRegistry);\nexport function registerColor(id, defaults, description, needsTransparency, deprecationMessage) {\n return colorRegistry.registerColor(id, defaults, description, needsTransparency, deprecationMessage);\n}\n// ----- color functions\nexport function executeTransform(transform, theme) {\n var _a, _b, _c, _d;\n switch (transform.op) {\n case 0 /* ColorTransformType.Darken */:\n return (_a = resolveColorValue(transform.value, theme)) === null || _a === void 0 ? void 0 : _a.darken(transform.factor);\n case 1 /* ColorTransformType.Lighten */:\n return (_b = resolveColorValue(transform.value, theme)) === null || _b === void 0 ? void 0 : _b.lighten(transform.factor);\n case 2 /* ColorTransformType.Transparent */:\n return (_c = resolveColorValue(transform.value, theme)) === null || _c === void 0 ? void 0 : _c.transparent(transform.factor);\n case 3 /* ColorTransformType.Opaque */: {\n const backgroundColor = resolveColorValue(transform.background, theme);\n if (!backgroundColor) {\n return resolveColorValue(transform.value, theme);\n }\n return (_d = resolveColorValue(transform.value, theme)) === null || _d === void 0 ? void 0 : _d.makeOpaque(backgroundColor);\n }\n case 4 /* ColorTransformType.OneOf */:\n for (const candidate of transform.values) {\n const color = resolveColorValue(candidate, theme);\n if (color) {\n return color;\n }\n }\n return undefined;\n case 6 /* ColorTransformType.IfDefinedThenElse */:\n return resolveColorValue(theme.defines(transform.if) ? transform.then : transform.else, theme);\n case 5 /* ColorTransformType.LessProminent */: {\n const from = resolveColorValue(transform.value, theme);\n if (!from) {\n return undefined;\n }\n const backgroundColor = resolveColorValue(transform.background, theme);\n if (!backgroundColor) {\n return from.transparent(transform.factor * transform.transparency);\n }\n return from.isDarkerThan(backgroundColor)\n ? Color.getLighterColor(from, backgroundColor, transform.factor).transparent(transform.transparency)\n : Color.getDarkerColor(from, backgroundColor, transform.factor).transparent(transform.transparency);\n }\n default:\n throw assertNever(transform);\n }\n}\nexport function darken(colorValue, factor) {\n return { op: 0 /* ColorTransformType.Darken */, value: colorValue, factor };\n}\nexport function lighten(colorValue, factor) {\n return { op: 1 /* ColorTransformType.Lighten */, value: colorValue, factor };\n}\nexport function transparent(colorValue, factor) {\n return { op: 2 /* ColorTransformType.Transparent */, value: colorValue, factor };\n}\nexport function oneOf(...colorValues) {\n return { op: 4 /* ColorTransformType.OneOf */, values: colorValues };\n}\nexport function ifDefinedThenElse(ifArg, thenArg, elseArg) {\n return { op: 6 /* ColorTransformType.IfDefinedThenElse */, if: ifArg, then: thenArg, else: elseArg };\n}\nexport function lessProminent(colorValue, backgroundColorValue, factor, transparency) {\n return { op: 5 /* ColorTransformType.LessProminent */, value: colorValue, background: backgroundColorValue, factor, transparency };\n}\n// ----- implementation\n/**\n * @param colorValue Resolve a color value in the context of a theme\n */\nexport function resolveColorValue(colorValue, theme) {\n if (colorValue === null) {\n return undefined;\n }\n else if (typeof colorValue === 'string') {\n if (colorValue[0] === '#') {\n return Color.fromHex(colorValue);\n }\n return theme.getColor(colorValue);\n }\n else if (colorValue instanceof Color) {\n return colorValue;\n }\n else if (typeof colorValue === 'object') {\n return executeTransform(colorValue, theme);\n }\n return undefined;\n}\nexport const workbenchColorsSchemaId = 'vscode://schemas/workbench-colors';\nconst schemaRegistry = platform.Registry.as(JSONExtensions.JSONContribution);\nschemaRegistry.registerSchema(workbenchColorsSchemaId, colorRegistry.getColorSchema());\nconst delayer = new RunOnceScheduler(() => schemaRegistry.notifySchemaChanged(workbenchColorsSchemaId), 200);\ncolorRegistry.onDidChangeSchema(() => {\n if (!delayer.isScheduled()) {\n delayer.schedule();\n }\n});\n// setTimeout(_ => console.log(colorRegistry.toString()), 5000);\n", "/*---------------------------------------------------------------------------------------------\n * 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 * as nls from '../../../../nls.js';\n// Import the effects we need\nimport { Color } from '../../../../base/common/color.js';\nimport { registerColor, transparent } from '../colorUtils.js';\nexport const foreground = registerColor('foreground', { dark: '#CCCCCC', light: '#616161', hcDark: '#FFFFFF', hcLight: '#292929' }, nls.localize('foreground', \"Overall foreground color. This color is only used if not overridden by a component.\"));\nexport const disabledForeground = registerColor('disabledForeground', { dark: '#CCCCCC80', light: '#61616180', hcDark: '#A5A5A5', hcLight: '#7F7F7F' }, nls.localize('disabledForeground', \"Overall foreground for disabled elements. This color is only used if not overridden by a component.\"));\nexport const errorForeground = registerColor('errorForeground', { dark: '#F48771', light: '#A1260D', hcDark: '#F48771', hcLight: '#B5200D' }, nls.localize('errorForeground', \"Overall foreground color for error messages. This color is only used if not overridden by a component.\"));\nexport const descriptionForeground = registerColor('descriptionForeground', { light: '#717171', dark: transparent(foreground, 0.7), hcDark: transparent(foreground, 0.7), hcLight: transparent(foreground, 0.7) }, nls.localize('descriptionForeground', \"Foreground color for description text providing additional information, for example for a label.\"));\nexport const iconForeground = registerColor('icon.foreground', { dark: '#C5C5C5', light: '#424242', hcDark: '#FFFFFF', hcLight: '#292929' }, nls.localize('iconForeground', \"The default color for icons in the workbench.\"));\nexport const focusBorder = registerColor('focusBorder', { dark: '#007FD4', light: '#0090F1', hcDark: '#F38518', hcLight: '#006BBD' }, nls.localize('focusBorder', \"Overall border color for focused elements. This color is only used if not overridden by a component.\"));\nexport const contrastBorder = registerColor('contrastBorder', { light: null, dark: null, hcDark: '#6FC3DF', hcLight: '#0F4A85' }, nls.localize('contrastBorder', \"An extra border around elements to separate them from others for greater contrast.\"));\nexport const activeContrastBorder = registerColor('contrastActiveBorder', { light: null, dark: null, hcDark: focusBorder, hcLight: focusBorder }, nls.localize('activeContrastBorder', \"An extra border around active elements to separate them from others for greater contrast.\"));\nexport const selectionBackground = registerColor('selection.background', { light: null, dark: null, hcDark: null, hcLight: null }, nls.localize('selectionBackground', \"The background color of text selections in the workbench (e.g. for input fields or text areas). Note that this does not apply to selections within the editor.\"));\n// ------ text link\nexport const textLinkForeground = registerColor('textLink.foreground', { light: '#006AB1', dark: '#3794FF', hcDark: '#21A6FF', hcLight: '#0F4A85' }, nls.localize('textLinkForeground', \"Foreground color for links in text.\"));\nexport const textLinkActiveForeground = registerColor('textLink.activeForeground', { light: '#006AB1', dark: '#3794FF', hcDark: '#21A6FF', hcLight: '#0F4A85' }, nls.localize('textLinkActiveForeground', \"Foreground color for links in text when clicked on and on mouse hover.\"));\nexport const textSeparatorForeground = registerColor('textSeparator.foreground', { light: '#0000002e', dark: '#ffffff2e', hcDark: Color.black, hcLight: '#292929' }, nls.localize('textSeparatorForeground', \"Color for text separators.\"));\n// ------ text preformat\nexport const textPreformatForeground = registerColor('textPreformat.foreground', { light: '#A31515', dark: '#D7BA7D', hcDark: '#000000', hcLight: '#FFFFFF' }, nls.localize('textPreformatForeground', \"Foreground color for preformatted text segments.\"));\nexport const textPreformatBackground = registerColor('textPreformat.background', { light: '#0000001A', dark: '#FFFFFF1A', hcDark: '#FFFFFF', hcLight: '#09345f' }, nls.localize('textPreformatBackground', \"Background color for preformatted text segments.\"));\n// ------ text block quote\nexport const textBlockQuoteBackground = registerColor('textBlockQuote.background', { light: '#f2f2f2', dark: '#222222', hcDark: null, hcLight: '#F2F2F2' }, nls.localize('textBlockQuoteBackground', \"Background color for block quotes in text.\"));\nexport const textBlockQuoteBorder = registerColor('textBlockQuote.border', { light: '#007acc80', dark: '#007acc80', hcDark: Color.white, hcLight: '#292929' }, nls.localize('textBlockQuoteBorder', \"Border color for block quotes in text.\"));\n// ------ text code block\nexport const textCodeBlockBackground = registerColor('textCodeBlock.background', { light: '#dcdcdc66', dark: '#0a0a0a66', hcDark: Color.black, hcLight: '#F2F2F2' }, nls.localize('textCodeBlockBackground', \"Background color for code blocks in text.\"));\n", "/*---------------------------------------------------------------------------------------------\n * 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 * as nls from '../../../../nls.js';\n// Import the effects we need\nimport { Color } from '../../../../base/common/color.js';\nimport { registerColor, transparent } from '../colorUtils.js';\n// Import the colors we need\nimport { contrastBorder, focusBorder } from './baseColors.js';\n// ----- sash\nexport const sashHoverBorder = registerColor('sash.hoverBorder', { dark: focusBorder, light: focusBorder, hcDark: focusBorder, hcLight: focusBorder }, nls.localize('sashActiveBorder', \"Border color of active sashes.\"));\n// ----- badge\nexport const badgeBackground = registerColor('badge.background', { dark: '#4D4D4D', light: '#C4C4C4', hcDark: Color.black, hcLight: '#0F4A85' }, nls.localize('badgeBackground', \"Badge background color. Badges are small information labels, e.g. for search results count.\"));\nexport const badgeForeground = registerColor('badge.foreground', { dark: Color.white, light: '#333', hcDark: Color.white, hcLight: Color.white }, nls.localize('badgeForeground', \"Badge foreground color. Badges are small information labels, e.g. for search results count.\"));\n// ----- scrollbar\nexport const scrollbarShadow = registerColor('scrollbar.shadow', { dark: '#000000', light: '#DDDDDD', hcDark: null, hcLight: null }, nls.localize('scrollbarShadow', \"Scrollbar shadow to indicate that the view is scrolled.\"));\nexport const scrollbarSliderBackground = registerColor('scrollbarSlider.background', { dark: Color.fromHex('#797979').transparent(0.4), light: Color.fromHex('#646464').transparent(0.4), hcDark: transparent(contrastBorder, 0.6), hcLight: transparent(contrastBorder, 0.4) }, nls.localize('scrollbarSliderBackground', \"Scrollbar slider background color.\"));\nexport const scrollbarSliderHoverBackground = registerColor('scrollbarSlider.hoverBackground', { dark: Color.fromHex('#646464').transparent(0.7), light: Color.fromHex('#646464').transparent(0.7), hcDark: transparent(contrastBorder, 0.8), hcLight: transparent(contrastBorder, 0.8) }, nls.localize('scrollbarSliderHoverBackground', \"Scrollbar slider background color when hovering.\"));\nexport const scrollbarSliderActiveBackground = registerColor('scrollbarSlider.activeBackground', { dark: Color.fromHex('#BFBFBF').transparent(0.4), light: Color.fromHex('#000000').transparent(0.6), hcDark: contrastBorder, hcLight: contrastBorder }, nls.localize('scrollbarSliderActiveBackground', \"Scrollbar slider background color when clicked on.\"));\n// ----- progress bar\nexport const progressBarBackground = registerColor('progressBar.background', { dark: Color.fromHex('#0E70C0'), light: Color.fromHex('#0E70C0'), hcDark: contrastBorder, hcLight: contrastBorder }, nls.localize('progressBarBackground', \"Background color of the progress bar that can show for long running operations.\"));\n", "/*---------------------------------------------------------------------------------------------\n * 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 * as nls from '../../../../nls.js';\n// Import the effects we need\nimport { Color, RGBA } from '../../../../base/common/color.js';\nimport { registerColor, transparent, lessProminent, darken, lighten } from '../colorUtils.js';\n// Import the colors we need\nimport { foreground, contrastBorder, activeContrastBorder } from './baseColors.js';\nimport { scrollbarShadow, badgeBackground } from './miscColors.js';\n// ----- editor\nexport const editorBackground = registerColor('editor.background', { light: '#ffffff', dark: '#1E1E1E', hcDark: Color.black, hcLight: Color.white }, nls.localize('editorBackground', \"Editor background color.\"));\nexport const editorForeground = registerColor('editor.foreground', { light: '#333333', dark: '#BBBBBB', hcDark: Color.white, hcLight: foreground }, nls.localize('editorForeground', \"Editor default foreground color.\"));\nexport const editorStickyScrollBackground = registerColor('editorStickyScroll.background', { light: editorBackground, dark: editorBackground, hcDark: editorBackground, hcLight: editorBackground }, nls.localize('editorStickyScrollBackground', \"Background color of sticky scroll in the editor\"));\nexport const editorStickyScrollHoverBackground = registerColor('editorStickyScrollHover.background', { dark: '#2A2D2E', light: '#F0F0F0', hcDark: null, hcLight: Color.fromHex('#0F4A85').transparent(0.1) }, nls.localize('editorStickyScrollHoverBackground', \"Background color of sticky scroll on hover in the editor\"));\nexport const editorStickyScrollBorder = registerColor('editorStickyScroll.border', { dark: null, light: null, hcDark: contrastBorder, hcLight: contrastBorder }, nls.localize('editorStickyScrollBorder', \"Border color of sticky scroll in the editor\"));\nexport const editorStickyScrollShadow = registerColor('editorStickyScroll.shadow', { dark: scrollbarShadow, light: scrollbarShadow, hcDark: scrollbarShadow, hcLight: scrollbarShadow }, nls.localize('editorStickyScrollShadow', \" Shadow color of sticky scroll in the editor\"));\nexport const editorWidgetBackground = registerColor('editorWidget.background', { dark: '#252526', light: '#F3F3F3', hcDark: '#0C141F', hcLight: Color.white }, nls.localize('editorWidgetBackground', 'Background color of editor widgets, such as find/replace.'));\nexport const editorWidgetForeground = registerColor('editorWidget.foreground', { dark: foreground, light: foreground, hcDark: foreground, hcLight: foreground }, nls.localize('editorWidgetForeground', 'Foreground color of editor widgets, such as find/replace.'));\nexport const editorWidgetBorder = registerColor('editorWidget.border', { dark: '#454545', light: '#C8C8C8', hcDark: contrastBorder, hcLight: contrastBorder }, nls.localize('editorWidgetBorder', 'Border color of editor widgets. The color is only used if the widget chooses to have a border and if the color is not overridden by a widget.'));\nexport const editorWidgetResizeBorder = registerColor('editorWidget.resizeBorder', { light: null, dark: null, hcDark: null, hcLight: null }, nls.localize('editorWidgetResizeBorder', \"Border color of the resize bar of editor widgets. The color is only used if the widget chooses to have a resize border and if the color is not overridden by a widget.\"));\nexport const editorErrorBackground = registerColor('editorError.background', { dark: null, light: null, hcDark: null, hcLight: null }, nls.localize('editorError.background', 'Background color of error text in the editor. The color must not be opaque so as not to hide underlying decorations.'), true);\nexport const editorErrorForeground = registerColor('editorError.foreground', { dark: '#F14C4C', light: '#E51400', hcDark: '#F48771', hcLight: '#B5200D' }, nls.localize('editorError.foreground', 'Foreground color of error squigglies in the editor.'));\nexport const editorErrorBorder = registerColor('editorError.border', { dark: null, light: null, hcDark: Color.fromHex('#E47777').transparent(0.8), hcLight: '#B5200D' }, nls.localize('errorBorder', 'If set, color of double underlines for errors in the editor.'));\nexport const editorWarningBackground = registerColor('editorWarning.background', { dark: null, light: null, hcDark: null, hcLight: null }, nls.localize('editorWarning.background', 'Background color of warning text in the editor. The color must not be opaque so as not to hide underlying decorations.'), true);\nexport const editorWarningForeground = registerColor('editorWarning.foreground', { dark: '#CCA700', light: '#BF8803', hcDark: '#FFD370', hcLight: '#895503' }, nls.localize('editorWarning.foreground', 'Foreground color of warning squigglies in the editor.'));\nexport const editorWarningBorder = registerColor('editorWarning.border', { dark: null, light: null, hcDark: Color.fromHex('#FFCC00').transparent(0.8), hcLight: Color.fromHex('#FFCC00').transparent(0.8) }, nls.localize('warningBorder', 'If set, color of double underlines for warnings in the editor.'));\nexport const editorInfoBackground = registerColor('editorInfo.background', { dark: null, light: null, hcDark: null, hcLight: null }, nls.localize('editorInfo.background', 'Background color of info text in the editor. The color must not be opaque so as not to hide underlying decorations.'), true);\nexport const editorInfoForeground = registerColor('editorInfo.foreground', { dark: '#3794FF', light: '#1a85ff', hcDark: '#3794FF', hcLight: '#1a85ff' }, nls.localize('editorInfo.foreground', 'Foreground color of info squigglies in the editor.'));\nexport const editorInfoBorder = registerColor('editorInfo.border', { dark: null, light: null, hcDark: Color.fromHex('#3794FF').transparent(0.8), hcLight: '#292929' }, nls.localize('infoBorder', 'If set, color of double underlines for infos in the editor.'));\nexport const editorHintForeground = registerColor('editorHint.foreground', { dark: Color.fromHex('#eeeeee').transparent(0.7), light: '#6c6c6c', hcDark: null, hcLight: null }, nls.localize('editorHint.foreground', 'Foreground color of hint squigglies in the editor.'));\nexport const editorHintBorder = registerColor('editorHint.border', { dark: null, light: null, hcDark: Color.fromHex('#eeeeee').transparent(0.8), hcLight: '#292929' }, nls.localize('hintBorder', 'If set, color of double underlines for hints in the editor.'));\nexport const editorActiveLinkForeground = registerColor('editorLink.activeForeground', { dark: '#4E94CE', light: Color.blue, hcDark: Color.cyan, hcLight: '#292929' }, nls.localize('activeLinkForeground', 'Color of active links.'));\n// ----- editor selection\nexport const editorSelectionBackground = registerColor('editor.selectionBackground', { light: '#ADD6FF', dark: '#264F78', hcDark: '#f3f518', hcLight: '#0F4A85' }, nls.localize('editorSelectionBackground', \"Color of the editor selection.\"));\nexport const editorSelectionForeground = registerColor('editor.selectionForeground', { light: null, dark: null, hcDark: '#000000', hcLight: Color.white }, nls.localize('editorSelectionForeground', \"Color of the selected text for high contrast.\"));\nexport const editorInactiveSelection = registerColor('editor.inactiveSelectionBackground', { light: transparent(editorSelectionBackground, 0.5), dark: transparent(editorSelectionBackground, 0.5), hcDark: transparent(editorSelectionBackground, 0.7), hcLight: transparent(editorSelectionBackground, 0.5) }, nls.localize('editorInactiveSelection', \"Color of the selection in an inactive editor. The color must not be opaque so as not to hide underlying decorations.\"), true);\nexport const editorSelectionHighlight = registerColor('editor.selectionHighlightBackground', { light: lessProminent(editorSelectionBackground, editorBackground, 0.3, 0.6), dark: lessProminent(editorSelectionBackground, editorBackground, 0.3, 0.6), hcDark: null, hcLight: null }, nls.localize('editorSelectionHighlight', 'Color for regions with the same content as the selection. The color must not be opaque so as not to hide underlying decorations.'), true);\nexport const editorSelectionHighlightBorder = registerColor('editor.selectionHighlightBorder', { light: null, dark: null, hcDark: activeContrastBorder, hcLight: activeContrastBorder }, nls.localize('editorSelectionHighlightBorder', \"Border color for regions with the same content as the selection.\"));\n// ----- editor find\nexport const editorFindMatch = registerColor('editor.findMatchBackground', { light: '#A8AC94', dark: '#515C6A', hcDark: null, hcLight: null }, nls.localize('editorFindMatch', \"Color of the current search match.\"));\nexport const editorFindMatchHighlight = registerColor('editor.findMatchHighlightBackground', { light: '#EA5C0055', dark: '#EA5C0055', hcDark: null, hcLight: null }, nls.localize('findMatchHighlight', \"Color of the other search matches. The color must not be opaque so as not to hide underlying decorations.\"), true);\nexport const editorFindRangeHighlight = registerColor('editor.findRangeHighlightBackground', { dark: '#3a3d4166', light: '#b4b4b44d', hcDark: null, hcLight: null }, nls.localize('findRangeHighlight', \"Color of the range limiting the search. The color must not be opaque so as not to hide underlying decorations.\"), true);\nexport const editorFindMatchBorder = registerColor('editor.findMatchBorder', { light: null, dark: null, hcDark: activeContrastBorder, hcLight: activeContrastBorder }, nls.localize('editorFindMatchBorder', \"Border color of the current search match.\"));\nexport const editorFindMatchHighlightBorder = registerColor('editor.findMatchHighlightBorder', { light: null, dark: null, hcDark: activeContrastBorder, hcLight: activeContrastBorder }, nls.localize('findMatchHighlightBorder', \"Border color of the other search matches.\"));\nexport const editorFindRangeHighlightBorder = registerColor('editor.findRangeHighlightBorder', { dark: null, light: null, hcDark: transparent(activeContrastBorder, 0.4), hcLight: transparent(activeContrastBorder, 0.4) }, nls.localize('findRangeHighlightBorder', \"Border color of the range limiting the search. The color must not be opaque so as not to hide underlying decorations.\"), true);\n// ----- editor hover\nexport const editorHoverHighlight = registerColor('editor.hoverHighlightBackground', { light: '#ADD6FF26', dark: '#264f7840', hcDark: '#ADD6FF26', hcLight: null }, nls.localize('hoverHighlight', 'Highlight below the word for which a hover is shown. The color must not be opaque so as not to hide underlying decorations.'), true);\nexport const editorHoverBackground = registerColor('editorHoverWidget.background', { light: editorWidgetBackground, dark: editorWidgetBackground, hcDark: editorWidgetBackground, hcLight: editorWidgetBackground }, nls.localize('hoverBackground', 'Background color of the editor hover.'));\nexport const editorHoverForeground = registerColor('editorHoverWidget.foreground', { light: editorWidgetForeground, dark: editorWidgetForeground, hcDark: editorWidgetForeground, hcLight: editorWidgetForeground }, nls.localize('hoverForeground', 'Foreground color of the editor hover.'));\nexport const editorHoverBorder = registerColor('editorHoverWidget.border', { light: editorWidgetBorder, dark: editorWidgetBorder, hcDark: editorWidgetBorder, hcLight: editorWidgetBorder }, nls.localize('hoverBorder', 'Border color of the editor hover.'));\nexport const editorHoverStatusBarBackground = registerColor('editorHoverWidget.statusBarBackground', { dark: lighten(editorHoverBackground, 0.2), light: darken(editorHoverBackground, 0.05), hcDark: editorWidgetBackground, hcLight: editorWidgetBackground }, nls.localize('statusBarBackground', \"Background color of the editor hover status bar.\"));\n// ----- editor inlay hint\nexport const editorInlayHintForeground = registerColor('editorInlayHint.foreground', { dark: '#969696', light: '#969696', hcDark: Color.white, hcLight: Color.black }, nls.localize('editorInlayHintForeground', 'Foreground color of inline hints'));\nexport const editorInlayHintBackground = registerColor('editorInlayHint.background', { dark: transparent(badgeBackground, .10), light: transparent(badgeBackground, .10), hcDark: transparent(Color.white, .10), hcLight: transparent(badgeBackground, .10) }, nls.localize('editorInlayHintBackground', 'Background color of inline hints'));\nexport const editorInlayHintTypeForeground = registerColor('editorInlayHint.typeForeground', { dark: editorInlayHintForeground, light: editorInlayHintForeground, hcDark: editorInlayHintForeground, hcLight: editorInlayHintForeground }, nls.localize('editorInlayHintForegroundTypes', 'Foreground color of inline hints for types'));\nexport const editorInlayHintTypeBackground = registerColor('editorInlayHint.typeBackground', { dark: editorInlayHintBackground, light: editorInlayHintBackground, hcDark: editorInlayHintBackground, hcLight: editorInlayHintBackground }, nls.localize('editorInlayHintBackgroundTypes', 'Background color of inline hints for types'));\nexport const editorInlayHintParameterForeground = registerColor('editorInlayHint.parameterForeground', { dark: editorInlayHintForeground, light: editorInlayHintForeground, hcDark: editorInlayHintForeground, hcLight: editorInlayHintForeground }, nls.localize('editorInlayHintForegroundParameter', 'Foreground color of inline hints for parameters'));\nexport const editorInlayHintParameterBackground = registerColor('editorInlayHint.parameterBackground', { dark: editorInlayHintBackground, light: editorInlayHintBackground, hcDark: editorInlayHintBackground, hcLight: editorInlayHintBackground }, nls.localize('editorInlayHintBackgroundParameter', 'Background color of inline hints for parameters'));\n// ----- editor lightbulb\nexport const editorLightBulbForeground = registerColor('editorLightBulb.foreground', { dark: '#FFCC00', light: '#DDB100', hcDark: '#FFCC00', hcLight: '#007ACC' }, nls.localize('editorLightBulbForeground', \"The color used for the lightbulb actions icon.\"));\nexport const editorLightBulbAutoFixForeground = registerColor('editorLightBulbAutoFix.foreground', { dark: '#75BEFF', light: '#007ACC', hcDark: '#75BEFF', hcLight: '#007ACC' }, nls.localize('editorLightBulbAutoFixForeground', \"The color used for the lightbulb auto fix actions icon.\"));\nexport const editorLightBulbAiForeground = registerColor('editorLightBulbAi.foreground', { dark: editorLightBulbForeground, light: editorLightBulbForeground, hcDark: editorLightBulbForeground, hcLight: editorLightBulbForeground }, nls.localize('editorLightBulbAiForeground', \"The color used for the lightbulb AI icon.\"));\n// ----- editor snippet\nexport const snippetTabstopHighlightBackground = registerColor('editor.snippetTabstopHighlightBackground', { dark: new Color(new RGBA(124, 124, 124, 0.3)), light: new Color(new RGBA(10, 50, 100, 0.2)), hcDark: new Color(new RGBA(124, 124, 124, 0.3)), hcLight: new Color(new RGBA(10, 50, 100, 0.2)) }, nls.localize('snippetTabstopHighlightBackground', \"Highlight background color of a snippet tabstop.\"));\nexport const snippetTabstopHighlightBorder = registerColor('editor.snippetTabstopHighlightBorder', { dark: null, light: null, hcDark: null, hcLight: null }, nls.localize('snippetTabstopHighlightBorder', \"Highlight border color of a snippet tabstop.\"));\nexport const snippetFinalTabstopHighlightBackground = registerColor('editor.snippetFinalTabstopHighlightBackground', { dark: null, light: null, hcDark: null, hcLight: null }, nls.localize('snippetFinalTabstopHighlightBackground', \"Highlight background color of the final tabstop of a snippet.\"));\nexport const snippetFinalTabstopHighlightBorder = registerColor('editor.snippetFinalTabstopHighlightBorder', { dark: '#525252', light: new Color(new RGBA(10, 50, 100, 0.5)), hcDark: '#525252', hcLight: '#292929' }, nls.localize('snippetFinalTabstopHighlightBorder', \"Highlight border color of the final tabstop of a snippet.\"));\n// ----- diff editor\nexport const defaultInsertColor = new Color(new RGBA(155, 185, 85, .2));\nexport const defaultRemoveColor = new Color(new RGBA(255, 0, 0, .2));\nexport const diffInserted = registerColor('diffEditor.insertedTextBackground', { dark: '#9ccc2c33', light: '#9ccc2c40', hcDark: null, hcLight: null }, nls.localize('diffEditorInserted', 'Background color for text that got inserted. The color must not be opaque so as not to hide underlying decorations.'), true);\nexport const diffRemoved = registerColor('diffEditor.removedTextBackground', { dark: '#ff000033', light: '#ff000033', hcDark: null, hcLight: null }, nls.localize('diffEditorRemoved', 'Background color for text that got removed. The color must not be opaque so as not to hide underlying decorations.'), true);\nexport const diffInsertedLine = registerColor('diffEditor.insertedLineBackground', { dark: defaultInsertColor, light: defaultInsertColor, hcDark: null, hcLight: null }, nls.localize('diffEditorInsertedLines', 'Background color for lines that got inserted. The color must not be opaque so as not to hide underlying decorations.'), true);\nexport const diffRemovedLine = registerColor('diffEditor.removedLineBackground', { dark: defaultRemoveColor, light: defaultRemoveColor, hcDark: null, hcLight: null }, nls.localize('diffEditorRemovedLines', 'Background color for lines that got removed. The color must not be opaque so as not to hide underlying decorations.'), true);\nexport const diffInsertedLineGutter = registerColor('diffEditorGutter.insertedLineBackground', { dark: null, light: null, hcDark: null, hcLight: null }, nls.localize('diffEditorInsertedLineGutter', 'Background color for the margin where lines got inserted.'));\nexport const diffRemovedLineGutter = registerColor('diffEditorGutter.removedLineBackground', { dark: null, light: null, hcDark: null, hcLight: null }, nls.localize('diffEditorRemovedLineGutter', 'Background color for the margin where lines got removed.'));\nexport const diffOverviewRulerInserted = registerColor('diffEditorOverview.insertedForeground', { dark: null, light: null, hcDark: null, hcLight: null }, nls.localize('diffEditorOverviewInserted', 'Diff overview ruler foreground for inserted content.'));\nexport const diffOverviewRulerRemoved = registerColor('diffEditorOverview.removedForeground', { dark: null, light: null, hcDark: null, hcLight: null }, nls.localize('diffEditorOverviewRemoved', 'Diff overview ruler foreground for removed content.'));\nexport const diffInsertedOutline = registerColor('diffEditor.insertedTextBorder', { dark: null, light: null, hcDark: '#33ff2eff', hcLight: '#374E06' }, nls.localize('diffEditorInsertedOutline', 'Outline color for the text that got inserted.'));\nexport const diffRemovedOutline = registerColor('diffEditor.removedTextBorder', { dark: null, light: null, hcDark: '#FF008F', hcLight: '#AD0707' }, nls.localize('diffEditorRemovedOutline', 'Outline color for text that got removed.'));\nexport const diffBorder = registerColor('diffEditor.border', { dark: null, light: null, hcDark: contrastBorder, hcLight: contrastBorder }, nls.localize('diffEditorBorder', 'Border color between the two text editors.'));\nexport const diffDiagonalFill = registerColor('diffEditor.diagonalFill', { dark: '#cccccc33', light: '#22222233', hcDark: null, hcLight: null }, nls.localize('diffDiagonalFill', \"Color of the diff editor's diagonal fill. The diagonal fill is used in side-by-side diff views.\"));\nexport const diffUnchangedRegionBackground = registerColor('diffEditor.unchangedRegionBackground', { dark: 'sideBar.background', light: 'sideBar.background', hcDark: 'sideBar.background', hcLight: 'sideBar.background' }, nls.localize('diffEditor.unchangedRegionBackground', \"The background color of unchanged blocks in the diff editor.\"));\nexport const diffUnchangedRegionForeground = registerColor('diffEditor.unchangedRegionForeground', { dark: 'foreground', light: 'foreground', hcDark: 'foreground', hcLight: 'foreground' }, nls.localize('diffEditor.unchangedRegionForeground', \"The foreground color of unchanged blocks in the diff editor.\"));\nexport const diffUnchangedTextBackground = registerColor('diffEditor.unchangedCodeBackground', { dark: '#74747429', light: '#b8b8b829', hcDark: null, hcLight: null }, nls.localize('diffEditor.unchangedCodeBackground', \"The background color of unchanged code in the diff editor.\"));\n// ----- widget\nexport const widgetShadow = registerColor('widget.shadow', { dark: transparent(Color.black, .36), light: transparent(Color.black, .16), hcDark: null, hcLight: null }, nls.localize('widgetShadow', 'Shadow color of widgets such as find/replace inside the editor.'));\nexport const widgetBorder = registerColor('widget.border', { dark: null, light: null, hcDark: contrastBorder, hcLight: contrastBorder }, nls.localize('widgetBorder', 'Border color of widgets such as find/replace inside the editor.'));\n// ----- toolbar\nexport const toolbarHoverBackground = registerColor('toolbar.hoverBackground', { dark: '#5a5d5e50', light: '#b8b8b850', hcDark: null, hcLight: null }, nls.localize('toolbarHoverBackground', \"Toolbar background when hovering over actions using the mouse\"));\nexport const toolbarHoverOutline = registerColor('toolbar.hoverOutline', { dark: null, light: null, hcDark: activeContrastBorder, hcLight: activeContrastBorder }, nls.localize('toolbarHoverOutline', \"Toolbar outline when hovering over actions using the mouse\"));\nexport const toolbarActiveBackground = registerColor('toolbar.activeBackground', { dark: lighten(toolbarHoverBackground, 0.1), light: darken(toolbarHoverBackground, 0.1), hcDark: null, hcLight: null }, nls.localize('toolbarActiveBackground', \"Toolbar background when holding the mouse over actions\"));\n// ----- breadcumbs\nexport const breadcrumbsForeground = registerColor('breadcrumb.foreground', { light: transparent(foreground, 0.8), dark: transparent(foreground, 0.8), hcDark: transparent(foreground, 0.8), hcLight: transparent(foreground, 0.8) }, nls.localize('breadcrumbsFocusForeground', \"Color of focused breadcrumb items.\"));\nexport const breadcrumbsBackground = registerColor('breadcrumb.background', { light: editorBackground, dark: editorBackground, hcDark: editorBackground, hcLight: editorBackground }, nls.localize('breadcrumbsBackground', \"Background color of breadcrumb items.\"));\nexport const breadcrumbsFocusForeground = registerColor('breadcrumb.focusForeground', { light: darken(foreground, 0.2), dark: lighten(foreground, 0.1), hcDark: lighten(foreground, 0.1), hcLight: lighten(foreground, 0.1) }, nls.localize('breadcrumbsFocusForeground', \"Color of focused breadcrumb items.\"));\nexport const breadcrumbsActiveSelectionForeground = registerColor('breadcrumb.activeSelectionForeground', { light: darken(foreground, 0.2), dark: lighten(foreground, 0.1), hcDark: lighten(foreground, 0.1), hcLight: lighten(foreground, 0.1) }, nls.localize('breadcrumbsSelectedForeground', \"Color of selected breadcrumb items.\"));\nexport const breadcrumbsPickerBackground = registerColor('breadcrumbPicker.background', { light: editorWidgetBackground, dark: editorWidgetBackground, hcDark: editorWidgetBackground, hcLight: editorWidgetBackground }, nls.localize('breadcrumbsSelectedBackground', \"Background color of breadcrumb item picker.\"));\n// ----- merge\nconst headerTransparency = 0.5;\nconst currentBaseColor = Color.fromHex('#40C8AE').transparent(headerTransparency);\nconst incomingBaseColor = Color.fromHex('#40A6FF').transparent(headerTransparency);\nconst commonBaseColor = Color.fromHex('#606060').transparent(0.4);\nconst contentTransparency = 0.4;\nconst rulerTransparency = 1;\nexport const mergeCurrentHeaderBackground = registerColor('merge.currentHeaderBackground', { dark: currentBaseColor, light: currentBaseColor, hcDark: null, hcLight: null }, nls.localize('mergeCurrentHeaderBackground', 'Current header background in inline merge-conflicts. The color must not be opaque so as not to hide underlying decorations.'), true);\nexport const mergeCurrentContentBackground = registerColor('merge.currentContentBackground', { dark: transparent(mergeCurrentHeaderBackground, contentTransparency), light: transparent(mergeCurrentHeaderBackground, contentTransparency), hcDark: transparent(mergeCurrentHeaderBackground, contentTransparency), hcLight: transparent(mergeCurrentHeaderBackground, contentTransparency) }, nls.localize('mergeCurrentContentBackground', 'Current content background in inline merge-conflicts. The color must not be opaque so as not to hide underlying decorations.'), true);\nexport const mergeIncomingHeaderBackground = registerColor('merge.incomingHeaderBackground', { dark: incomingBaseColor, light: incomingBaseColor, hcDark: null, hcLight: null }, nls.localize('mergeIncomingHeaderBackground', 'Incoming header background in inline merge-conflicts. The color must not be opaque so as not to hide underlying decorations.'), true);\nexport const mergeIncomingContentBackground = registerColor('merge.incomingContentBackground', { dark: transparent(mergeIncomingHeaderBackground, contentTransparency), light: transparent(mergeIncomingHeaderBackground, contentTransparency), hcDark: transparent(mergeIncomingHeaderBackground, contentTransparency), hcLight: transparent(mergeIncomingHeaderBackground, contentTransparency) }, nls.localize('mergeIncomingContentBackground', 'Incoming content background in inline merge-conflicts. The color must not be opaque so as not to hide underlying decorations.'), true);\nexport const mergeCommonHeaderBackground = registerColor('merge.commonHeaderBackground', { dark: commonBaseColor, light: commonBaseColor, hcDark: null, hcLight: null }, nls.localize('mergeCommonHeaderBackground', 'Common ancestor header background in inline merge-conflicts. The color must not be opaque so as not to hide underlying decorations.'), true);\nexport const mergeCommonContentBackground = registerColor('merge.commonContentBackground', { dark: transparent(mergeCommonHeaderBackground, contentTransparency), light: transparent(mergeCommonHeaderBackground, contentTransparency), hcDark: transparent(mergeCommonHeaderBackground, contentTransparency), hcLight: transparent(mergeCommonHeaderBackground, contentTransparency) }, nls.localize('mergeCommonContentBackground', 'Common ancestor content background in inline merge-conflicts. The color must not be opaque so as not to hide underlying decorations.'), true);\nexport const mergeBorder = registerColor('merge.border', { dark: null, light: null, hcDark: '#C3DF6F', hcLight: '#007ACC' }, nls.localize('mergeBorder', 'Border color on headers and the splitter in inline merge-conflicts.'));\nexport const overviewRulerCurrentContentForeground = registerColor('editorOverviewRuler.currentContentForeground', { dark: transparent(mergeCurrentHeaderBackground, rulerTransparency), light: transparent(mergeCurrentHeaderBackground, rulerTransparency), hcDark: mergeBorder, hcLight: mergeBorder }, nls.localize('overviewRulerCurrentContentForeground', 'Current overview ruler foreground for inline merge-conflicts.'));\nexport const overviewRulerIncomingContentForeground = registerColor('editorOverviewRuler.incomingContentForeground', { dark: transparent(mergeIncomingHeaderBackground, rulerTransparency), light: transparent(mergeIncomingHeaderBackground, rulerTransparency), hcDark: mergeBorder, hcLight: mergeBorder }, nls.localize('overviewRulerIncomingContentForeground', 'Incoming overview ruler foreground for inline merge-conflicts.'));\nexport const overviewRulerCommonContentForeground = registerColor('editorOverviewRuler.commonContentForeground', { dark: transparent(mergeCommonHeaderBackground, rulerTransparency), light: transparent(mergeCommonHeaderBackground, rulerTransparency), hcDark: mergeBorder, hcLight: mergeBorder }, nls.localize('overviewRulerCommonContentForeground', 'Common ancestor overview ruler foreground for inline merge-conflicts.'));\nexport const overviewRulerFindMatchForeground = registerColor('editorOverviewRuler.findMatchForeground', { dark: '#d186167e', light: '#d186167e', hcDark: '#AB5A00', hcLight: '' }, nls.localize('overviewRulerFindMatchForeground', 'Overview ruler marker color for find matches. The color must not be opaque so as not to hide underlying decorations.'), true);\nexport const overviewRulerSelectionHighlightForeground = registerColor('editorOverviewRuler.selectionHighlightForeground', { dark: '#A0A0A0CC', light: '#A0A0A0CC', hcDark: '#A0A0A0CC', hcLight: '#A0A0A0CC' }, nls.localize('overviewRulerSelectionHighlightForeground', 'Overview ruler marker color for selection highlights. The color must not be opaque so as not to hide underlying decorations.'), true);\n// ----- problems\nexport const problemsErrorIconForeground = registerColor('problemsErrorIcon.foreground', { dark: editorErrorForeground, light: editorErrorForeground, hcDark: editorErrorForeground, hcLight: editorErrorForeground }, nls.localize('problemsErrorIconForeground', \"The color used for the problems error icon.\"));\nexport const problemsWarningIconForeground = registerColor('problemsWarningIcon.foreground', { dark: editorWarningForeground, light: editorWarningForeground, hcDark: editorWarningForeground, hcLight: editorWarningForeground }, nls.localize('problemsWarningIconForeground', \"The color used for the problems warning icon.\"));\nexport const problemsInfoIconForeground = registerColor('problemsInfoIcon.foreground', { dark: editorInfoForeground, light: editorInfoForeground, hcDark: editorInfoForeground, hcLight: editorInfoForeground }, nls.localize('problemsInfoIconForeground', \"The color used for the problems info icon.\"));\n", "/*---------------------------------------------------------------------------------------------\n * 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 * as nls from '../../../../nls.js';\n// Import the effects we need\nimport { Color, RGBA } from '../../../../base/common/color.js';\nimport { registerColor, transparent } from '../colorUtils.js';\n// Import the colors we need\nimport { editorInfoForeground, editorWarningForeground, editorWarningBorder, editorInfoBorder } from './editorColors.js';\nimport { scrollbarSliderBackground, scrollbarSliderHoverBackground, scrollbarSliderActiveBackground } from './miscColors.js';\nexport const minimapFindMatch = registerColor('minimap.findMatchHighlight', { light: '#d18616', dark: '#d18616', hcDark: '#AB5A00', hcLight: '#0F4A85' }, nls.localize('minimapFindMatchHighlight', 'Minimap marker color for find matches.'), true);\nexport const minimapSelectionOccurrenceHighlight = registerColor('minimap.selectionOccurrenceHighlight', { light: '#c9c9c9', dark: '#676767', hcDark: '#ffffff', hcLight: '#0F4A85' }, nls.localize('minimapSelectionOccurrenceHighlight', 'Minimap marker color for repeating editor selections.'), true);\nexport const minimapSelection = registerColor('minimap.selectionHighlight', { light: '#ADD6FF', dark: '#264F78', hcDark: '#ffffff', hcLight: '#0F4A85' }, nls.localize('minimapSelectionHighlight', 'Minimap marker color for the editor selection.'), true);\nexport const minimapInfo = registerColor('minimap.infoHighlight', { dark: editorInfoForeground, light: editorInfoForeground, hcDark: editorInfoBorder, hcLight: editorInfoBorder }, nls.localize('minimapInfo', 'Minimap marker color for infos.'));\nexport const minimapWarning = registerColor('minimap.warningHighlight', { dark: editorWarningForeground, light: editorWarningForeground, hcDark: editorWarningBorder, hcLight: editorWarningBorder }, nls.localize('overviewRuleWarning', 'Minimap marker color for warnings.'));\nexport const minimapError = registerColor('minimap.errorHighlight', { dark: new Color(new RGBA(255, 18, 18, 0.7)), light: new Color(new RGBA(255, 18, 18, 0.7)), hcDark: new Color(new RGBA(255, 50, 50, 1)), hcLight: '#B5200D' }, nls.localize('minimapError', 'Minimap marker color for errors.'));\nexport const minimapBackground = registerColor('minimap.background', { dark: null, light: null, hcDark: null, hcLight: null }, nls.localize('minimapBackground', \"Minimap background color.\"));\nexport const minimapForegroundOpacity = registerColor('minimap.foregroundOpacity', { dark: Color.fromHex('#000f'), light: Color.fromHex('#000f'), hcDark: Color.fromHex('#000f'), hcLight: Color.fromHex('#000f') }, nls.localize('minimapForegroundOpacity', 'Opacity of foreground elements rendered in the minimap. For example, \"#000000c0\" will render the elements with 75% opacity.'));\nexport const minimapSliderBackground = registerColor('minimapSlider.background', { light: transparent(scrollbarSliderBackground, 0.5), dark: transparent(scrollbarSliderBackground, 0.5), hcDark: transparent(scrollbarSliderBackground, 0.5), hcLight: transparent(scrollbarSliderBackground, 0.5) }, nls.localize('minimapSliderBackground', \"Minimap slider background color.\"));\nexport const minimapSliderHoverBackground = registerColor('minimapSlider.hoverBackground', { light: transparent(scrollbarSliderHoverBackground, 0.5), dark: transparent(scrollbarSliderHoverBackground, 0.5), hcDark: transparent(scrollbarSliderHoverBackground, 0.5), hcLight: transparent(scrollbarSliderHoverBackground, 0.5) }, nls.localize('minimapSliderHoverBackground', \"Minimap slider background color when hovering.\"));\nexport const minimapSliderActiveBackground = registerColor('minimapSlider.activeBackground', { light: transparent(scrollbarSliderActiveBackground, 0.5), dark: transparent(scrollbarSliderActiveBackground, 0.5), hcDark: transparent(scrollbarSliderActiveBackground, 0.5), hcLight: transparent(scrollbarSliderActiveBackground, 0.5) }, nls.localize('minimapSliderActiveBackground', \"Minimap slider background color when clicked on.\"));\n", "/*---------------------------------------------------------------------------------------------\n * 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 * as nls from '../../../../nls.js';\nimport { registerColor, transparent } from '../colorUtils.js';\nimport { foreground } from './baseColors.js';\nimport { editorErrorForeground, editorInfoForeground, editorWarningForeground } from './editorColors.js';\nimport { minimapFindMatch } from './minimapColors.js';\nexport const chartsForeground = registerColor('charts.foreground', { dark: foreground, light: foreground, hcDark: foreground, hcLight: foreground }, nls.localize('chartsForeground', \"The foreground color used in charts.\"));\nexport const chartsLines = registerColor('charts.lines', { dark: transparent(foreground, .5), light: transparent(foreground, .5), hcDark: transparent(foreground, .5), hcLight: transparent(foreground, .5) }, nls.localize('chartsLines', \"The color used for horizontal lines in charts.\"));\nexport const chartsRed = registerColor('charts.red', { dark: editorErrorForeground, light: editorErrorForeground, hcDark: editorErrorForeground, hcLight: editorErrorForeground }, nls.localize('chartsRed', \"The red color used in chart visualizations.\"));\nexport const chartsBlue = registerColor('charts.blue', { dark: editorInfoForeground, light: editorInfoForeground, hcDark: editorInfoForeground, hcLight: editorInfoForeground }, nls.localize('chartsBlue', \"The blue color used in chart visualizations.\"));\nexport const chartsYellow = registerColor('charts.yellow', { dark: editorWarningForeground, light: editorWarningForeground, hcDark: editorWarningForeground, hcLight: editorWarningForeground }, nls.localize('chartsYellow', \"The yellow color used in chart visualizations.\"));\nexport const chartsOrange = registerColor('charts.orange', { dark: minimapFindMatch, light: minimapFindMatch, hcDark: minimapFindMatch, hcLight: minimapFindMatch }, nls.localize('chartsOrange', \"The orange color used in chart visualizations.\"));\nexport const chartsGreen = registerColor('charts.green', { dark: '#89D185', light: '#388A34', hcDark: '#89D185', hcLight: '#374e06' }, nls.localize('chartsGreen', \"The green color used in chart visualizations.\"));\nexport const chartsPurple = registerColor('charts.purple', { dark: '#B180D7', light: '#652D90', hcDark: '#B180D7', hcLight: '#652D90' }, nls.localize('chartsPurple', \"The purple color used in chart visualizations.\"));\n", "/*---------------------------------------------------------------------------------------------\n * 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 * as nls from '../../../../nls.js';\n// Import the effects we need\nimport { Color, RGBA } from '../../../../base/common/color.js';\nimport { registerColor, transparent, lighten, darken } from '../colorUtils.js';\n// Import the colors we need\nimport { foreground, contrastBorder, focusBorder, iconForeground } from './baseColors.js';\nimport { editorWidgetBackground } from './editorColors.js';\n// ----- input\nexport const inputBackground = registerColor('input.background', { dark: '#3C3C3C', light: Color.white, hcDark: Color.black, hcLight: Color.white }, nls.localize('inputBoxBackground', \"Input box background.\"));\nexport const inputForeground = registerColor('input.foreground', { dark: foreground, light: foreground, hcDark: foreground, hcLight: foreground }, nls.localize('inputBoxForeground', \"Input box foreground.\"));\nexport const inputBorder = registerColor('input.border', { dark: null, light: null, hcDark: contrastBorder, hcLight: contrastBorder }, nls.localize('inputBoxBorder', \"Input box border.\"));\nexport const inputActiveOptionBorder = registerColor('inputOption.activeBorder', { dark: '#007ACC', light: '#007ACC', hcDark: contrastBorder, hcLight: contrastBorder }, nls.localize('inputBoxActiveOptionBorder', \"Border color of activated options in input fields.\"));\nexport const inputActiveOptionHoverBackground = registerColor('inputOption.hoverBackground', { dark: '#5a5d5e80', light: '#b8b8b850', hcDark: null, hcLight: null }, nls.localize('inputOption.hoverBackground', \"Background color of activated options in input fields.\"));\nexport const inputActiveOptionBackground = registerColor('inputOption.activeBackground', { dark: transparent(focusBorder, 0.4), light: transparent(focusBorder, 0.2), hcDark: Color.transparent, hcLight: Color.transparent }, nls.localize('inputOption.activeBackground', \"Background hover color of options in input fields.\"));\nexport const inputActiveOptionForeground = registerColor('inputOption.activeForeground', { dark: Color.white, light: Color.black, hcDark: foreground, hcLight: foreground }, nls.localize('inputOption.activeForeground', \"Foreground color of activated options in input fields.\"));\nexport const inputPlaceholderForeground = registerColor('input.placeholderForeground', { light: transparent(foreground, 0.5), dark: transparent(foreground, 0.5), hcDark: transparent(foreground, 0.7), hcLight: transparent(foreground, 0.7) }, nls.localize('inputPlaceholderForeground', \"Input box foreground color for placeholder text.\"));\n// ----- input validation\nexport const inputValidationInfoBackground = registerColor('inputValidation.infoBackground', { dark: '#063B49', light: '#D6ECF2', hcDark: Color.black, hcLight: Color.white }, nls.localize('inputValidationInfoBackground', \"Input validation background color for information severity.\"));\nexport const inputValidationInfoForeground = registerColor('inputValidation.infoForeground', { dark: null, light: null, hcDark: null, hcLight: foreground }, nls.localize('inputValidationInfoForeground', \"Input validation foreground color for information severity.\"));\nexport const inputValidationInfoBorder = registerColor('inputValidation.infoBorder', { dark: '#007acc', light: '#007acc', hcDark: contrastBorder, hcLight: contrastBorder }, nls.localize('inputValidationInfoBorder', \"Input validation border color for information severity.\"));\nexport const inputValidationWarningBackground = registerColor('inputValidation.warningBackground', { dark: '#352A05', light: '#F6F5D2', hcDark: Color.black, hcLight: Color.white }, nls.localize('inputValidationWarningBackground', \"Input validation background color for warning severity.\"));\nexport const inputValidationWarningForeground = registerColor('inputValidation.warningForeground', { dark: null, light: null, hcDark: null, hcLight: foreground }, nls.localize('inputValidationWarningForeground', \"Input validation foreground color for warning severity.\"));\nexport const inputValidationWarningBorder = registerColor('inputValidation.warningBorder', { dark: '#B89500', light: '#B89500', hcDark: contrastBorder, hcLight: contrastBorder }, nls.localize('inputValidationWarningBorder', \"Input validation border color for warning severity.\"));\nexport const inputValidationErrorBackground = registerColor('inputValidation.errorBackground', { dark: '#5A1D1D', light: '#F2DEDE', hcDark: Color.black, hcLight: Color.white }, nls.localize('inputValidationErrorBackground', \"Input validation background color for error severity.\"));\nexport const inputValidationErrorForeground = registerColor('inputValidation.errorForeground', { dark: null, light: null, hcDark: null, hcLight: foreground }, nls.localize('inputValidationErrorForeground', \"Input validation foreground color for error severity.\"));\nexport const inputValidationErrorBorder = registerColor('inputValidation.errorBorder', { dark: '#BE1100', light: '#BE1100', hcDark: contrastBorder, hcLight: contrastBorder }, nls.localize('inputValidationErrorBorder', \"Input validation border color for error severity.\"));\n// ----- select\nexport const selectBackground = registerColor('dropdown.background', { dark: '#3C3C3C', light: Color.white, hcDark: Color.black, hcLight: Color.white }, nls.localize('dropdownBackground', \"Dropdown background.\"));\nexport const selectListBackground = registerColor('dropdown.listBackground', { dark: null, light: null, hcDark: Color.black, hcLight: Color.white }, nls.localize('dropdownListBackground', \"Dropdown list background.\"));\nexport const selectForeground = registerColor('dropdown.foreground', { dark: '#F0F0F0', light: foreground, hcDark: Color.white, hcLight: foreground }, nls.localize('dropdownForeground', \"Dropdown foreground.\"));\nexport const selectBorder = registerColor('dropdown.border', { dark: selectBackground, light: '#CECECE', hcDark: contrastBorder, hcLight: contrastBorder }, nls.localize('dropdownBorder', \"Dropdown border.\"));\n// ------ button\nexport const buttonForeground = registerColor('button.foreground', { dark: Color.white, light: Color.white, hcDark: Color.white, hcLight: Color.white }, nls.localize('buttonForeground', \"Button foreground color.\"));\nexport const buttonSeparator = registerColor('button.separator', { dark: transparent(buttonForeground, .4), light: transparent(buttonForeground, .4), hcDark: transparent(buttonForeground, .4), hcLight: transparent(buttonForeground, .4) }, nls.localize('buttonSeparator', \"Button separator color.\"));\nexport const buttonBackground = registerColor('button.background', { dark: '#0E639C', light: '#007ACC', hcDark: null, hcLight: '#0F4A85' }, nls.localize('buttonBackground', \"Button background color.\"));\nexport const buttonHoverBackground = registerColor('button.hoverBackground', { dark: lighten(buttonBackground, 0.2), light: darken(buttonBackground, 0.2), hcDark: buttonBackground, hcLight: buttonBackground }, nls.localize('buttonHoverBackground', \"Button background color when hovering.\"));\nexport const buttonBorder = registerColor('button.border', { dark: contrastBorder, light: contrastBorder, hcDark: contrastBorder, hcLight: contrastBorder }, nls.localize('buttonBorder', \"Button border color.\"));\nexport const buttonSecondaryForeground = registerColor('button.secondaryForeground', { dark: Color.white, light: Color.white, hcDark: Color.white, hcLight: foreground }, nls.localize('buttonSecondaryForeground', \"Secondary button foreground color.\"));\nexport const buttonSecondaryBackground = registerColor('button.secondaryBackground', { dark: '#3A3D41', light: '#5F6A79', hcDark: null, hcLight: Color.white }, nls.localize('buttonSecondaryBackground', \"Secondary button background color.\"));\nexport const buttonSecondaryHoverBackground = registerColor('button.secondaryHoverBackground', { dark: lighten(buttonSecondaryBackground, 0.2), light: darken(buttonSecondaryBackground, 0.2), hcDark: null, hcLight: null }, nls.localize('buttonSecondaryHoverBackground', \"Secondary button background color when hovering.\"));\n// ------ checkbox\nexport const checkboxBackground = registerColor('checkbox.background', { dark: selectBackground, light: selectBackground, hcDark: selectBackground, hcLight: selectBackground }, nls.localize('checkbox.background', \"Background color of checkbox widget.\"));\nexport const checkboxSelectBackground = registerColor('checkbox.selectBackground', { dark: editorWidgetBackground, light: editorWidgetBackground, hcDark: editorWidgetBackground, hcLight: editorWidgetBackground }, nls.localize('checkbox.select.background', \"Background color of checkbox widget when the element it's in is selected.\"));\nexport const checkboxForeground = registerColor('checkbox.foreground', { dark: selectForeground, light: selectForeground, hcDark: selectForeground, hcLight: selectForeground }, nls.localize('checkbox.foreground', \"Foreground color of checkbox widget.\"));\nexport const checkboxBorder = registerColor('checkbox.border', { dark: selectBorder, light: selectBorder, hcDark: selectBorder, hcLight: selectBorder }, nls.localize('checkbox.border', \"Border color of checkbox widget.\"));\nexport const checkboxSelectBorder = registerColor('checkbox.selectBorder', { dark: iconForeground, light: iconForeground, hcDark: iconForeground, hcLight: iconForeground }, nls.localize('checkbox.select.border', \"Border color of checkbox widget when the element it's in is selected.\"));\n// ------ keybinding label\nexport const keybindingLabelBackground = registerColor('keybindingLabel.background', { dark: new Color(new RGBA(128, 128, 128, 0.17)), light: new Color(new RGBA(221, 221, 221, 0.4)), hcDark: Color.transparent, hcLight: Color.transparent }, nls.localize('keybindingLabelBackground', \"Keybinding label background color. The keybinding label is used to represent a keyboard shortcut.\"));\nexport const keybindingLabelForeground = registerColor('keybindingLabel.foreground', { dark: Color.fromHex('#CCCCCC'), light: Color.fromHex('#555555'), hcDark: Color.white, hcLight: foreground }, nls.localize('keybindingLabelForeground', \"Keybinding label foreground color. The keybinding label is used to represent a keyboard shortcut.\"));\nexport const keybindingLabelBorder = registerColor('keybindingLabel.border', { dark: new Color(new RGBA(51, 51, 51, 0.6)), light: new Color(new RGBA(204, 204, 204, 0.4)), hcDark: new Color(new RGBA(111, 195, 223)), hcLight: contrastBorder }, nls.localize('keybindingLabelBorder', \"Keybinding label border color. The keybinding label is used to represent a keyboard shortcut.\"));\nexport const keybindingLabelBottomBorder = registerColor('keybindingLabel.bottomBorder', { dark: new Color(new RGBA(68, 68, 68, 0.6)), light: new Color(new RGBA(187, 187, 187, 0.4)), hcDark: new Color(new RGBA(111, 195, 223)), hcLight: foreground }, nls.localize('keybindingLabelBottomBorder', \"Keybinding label border bottom color. The keybinding label is used to represent a keyboard shortcut.\"));\n", "/*---------------------------------------------------------------------------------------------\n * 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 * as nls from '../../../../nls.js';\n// Import the effects we need\nimport { Color } from '../../../../base/common/color.js';\nimport { registerColor, darken, lighten, transparent, ifDefinedThenElse } from '../colorUtils.js';\n// Import the colors we need\nimport { foreground, contrastBorder, activeContrastBorder, focusBorder, iconForeground } from './baseColors.js';\nimport { editorWidgetBackground, editorFindMatchHighlightBorder, editorFindMatchHighlight, widgetShadow } from './editorColors.js';\nexport const listFocusBackground = registerColor('list.focusBackground', { dark: null, light: null, hcDark: null, hcLight: null }, nls.localize('listFocusBackground', \"List/Tree background color for the focused item when the list/tree is active. An active list/tree has keyboard focus, an inactive does not.\"));\nexport const listFocusForeground = registerColor('list.focusForeground', { dark: null, light: null, hcDark: null, hcLight: null }, nls.localize('listFocusForeground', \"List/Tree foreground color for the focused item when the list/tree is active. An active list/tree has keyboard focus, an inactive does not.\"));\nexport const listFocusOutline = registerColor('list.focusOutline', { dark: focusBorder, light: focusBorder, hcDark: activeContrastBorder, hcLight: activeContrastBorder }, nls.localize('listFocusOutline', \"List/Tree outline color for the focused item when the list/tree is active. An active list/tree has keyboard focus, an inactive does not.\"));\nexport const listFocusAndSelectionOutline = registerColor('list.focusAndSelectionOutline', { dark: null, light: null, hcDark: null, hcLight: null }, nls.localize('listFocusAndSelectionOutline', \"List/Tree outline color for the focused item when the list/tree is active and selected. An active list/tree has keyboard focus, an inactive does not.\"));\nexport const listActiveSelectionBackground = registerColor('list.activeSelectionBackground', { dark: '#04395E', light: '#0060C0', hcDark: null, hcLight: Color.fromHex('#0F4A85').transparent(0.1) }, nls.localize('listActiveSelectionBackground', \"List/Tree background color for the selected item when the list/tree is active. An active list/tree has keyboard focus, an inactive does not.\"));\nexport const listActiveSelectionForeground = registerColor('list.activeSelectionForeground', { dark: Color.white, light: Color.white, hcDark: null, hcLight: null }, nls.localize('listActiveSelectionForeground', \"List/Tree foreground color for the selected item when the list/tree is active. An active list/tree has keyboard focus, an inactive does not.\"));\nexport const listActiveSelectionIconForeground = registerColor('list.activeSelectionIconForeground', { dark: null, light: null, hcDark: null, hcLight: null }, nls.localize('listActiveSelectionIconForeground', \"List/Tree icon foreground color for the selected item when the list/tree is active. An active list/tree has keyboard focus, an inactive does not.\"));\nexport const listInactiveSelectionBackground = registerColor('list.inactiveSelectionBackground', { dark: '#37373D', light: '#E4E6F1', hcDark: null, hcLight: Color.fromHex('#0F4A85').transparent(0.1) }, nls.localize('listInactiveSelectionBackground', \"List/Tree background color for the selected item when the list/tree is inactive. An active list/tree has keyboard focus, an inactive does not.\"));\nexport const listInactiveSelectionForeground = registerColor('list.inactiveSelectionForeground', { dark: null, light: null, hcDark: null, hcLight: null }, nls.localize('listInactiveSelectionForeground', \"List/Tree foreground color for the selected item when the list/tree is inactive. An active list/tree has keyboard focus, an inactive does not.\"));\nexport const listInactiveSelectionIconForeground = registerColor('list.inactiveSelectionIconForeground', { dark: null, light: null, hcDark: null, hcLight: null }, nls.localize('listInactiveSelectionIconForeground', \"List/Tree icon foreground color for the selected item when the list/tree is inactive. An active list/tree has keyboard focus, an inactive does not.\"));\nexport const listInactiveFocusBackground = registerColor('list.inactiveFocusBackground', { dark: null, light: null, hcDark: null, hcLight: null }, nls.localize('listInactiveFocusBackground', \"List/Tree background color for the focused item when the list/tree is inactive. An active list/tree has keyboard focus, an inactive does not.\"));\nexport const listInactiveFocusOutline = registerColor('list.inactiveFocusOutline', { dark: null, light: null, hcDark: null, hcLight: null }, nls.localize('listInactiveFocusOutline', \"List/Tree outline color for the focused item when the list/tree is inactive. An active list/tree has keyboard focus, an inactive does not.\"));\nexport const listHoverBackground = registerColor('list.hoverBackground', { dark: '#2A2D2E', light: '#F0F0F0', hcDark: Color.white.transparent(0.1), hcLight: Color.fromHex('#0F4A85').transparent(0.1) }, nls.localize('listHoverBackground', \"List/Tree background when hovering over items using the mouse.\"));\nexport const listHoverForeground = registerColor('list.hoverForeground', { dark: null, light: null, hcDark: null, hcLight: null }, nls.localize('listHoverForeground', \"List/Tree foreground when hovering over items using the mouse.\"));\nexport const listDropOverBackground = registerColor('list.dropBackground', { dark: '#062F4A', light: '#D6EBFF', hcDark: null, hcLight: null }, nls.localize('listDropBackground', \"List/Tree drag and drop background when moving items over other items when using the mouse.\"));\nexport const listDropBetweenBackground = registerColor('list.dropBetweenBackground', { dark: iconForeground, light: iconForeground, hcDark: null, hcLight: null }, nls.localize('listDropBetweenBackground', \"List/Tree drag and drop border color when moving items between items when using the mouse.\"));\nexport const listHighlightForeground = registerColor('list.highlightForeground', { dark: '#2AAAFF', light: '#0066BF', hcDark: focusBorder, hcLight: focusBorder }, nls.localize('highlight', 'List/Tree foreground color of the match highlights when searching inside the list/tree.'));\nexport const listFocusHighlightForeground = registerColor('list.focusHighlightForeground', { dark: listHighlightForeground, light: ifDefinedThenElse(listActiveSelectionBackground, listHighlightForeground, '#BBE7FF'), hcDark: listHighlightForeground, hcLight: listHighlightForeground }, nls.localize('listFocusHighlightForeground', 'List/Tree foreground color of the match highlights on actively focused items when searching inside the list/tree.'));\nexport const listInvalidItemForeground = registerColor('list.invalidItemForeground', { dark: '#B89500', light: '#B89500', hcDark: '#B89500', hcLight: '#B5200D' }, nls.localize('invalidItemForeground', 'List/Tree foreground color for invalid items, for example an unresolved root in explorer.'));\nexport const listErrorForeground = registerColor('list.errorForeground', { dark: '#F88070', light: '#B01011', hcDark: null, hcLight: null }, nls.localize('listErrorForeground', 'Foreground color of list items containing errors.'));\nexport const listWarningForeground = registerColor('list.warningForeground', { dark: '#CCA700', light: '#855F00', hcDark: null, hcLight: null }, nls.localize('listWarningForeground', 'Foreground color of list items containing warnings.'));\nexport const listFilterWidgetBackground = registerColor('listFilterWidget.background', { light: darken(editorWidgetBackground, 0), dark: lighten(editorWidgetBackground, 0), hcDark: editorWidgetBackground, hcLight: editorWidgetBackground }, nls.localize('listFilterWidgetBackground', 'Background color of the type filter widget in lists and trees.'));\nexport const listFilterWidgetOutline = registerColor('listFilterWidget.outline', { dark: Color.transparent, light: Color.transparent, hcDark: '#f38518', hcLight: '#007ACC' }, nls.localize('listFilterWidgetOutline', 'Outline color of the type filter widget in lists and trees.'));\nexport const listFilterWidgetNoMatchesOutline = registerColor('listFilterWidget.noMatchesOutline', { dark: '#BE1100', light: '#BE1100', hcDark: contrastBorder, hcLight: contrastBorder }, nls.localize('listFilterWidgetNoMatchesOutline', 'Outline color of the type filter widget in lists and trees, when there are no matches.'));\nexport const listFilterWidgetShadow = registerColor('listFilterWidget.shadow', { dark: widgetShadow, light: widgetShadow, hcDark: widgetShadow, hcLight: widgetShadow }, nls.localize('listFilterWidgetShadow', 'Shadow color of the type filter widget in lists and trees.'));\nexport const listFilterMatchHighlight = registerColor('list.filterMatchBackground', { dark: editorFindMatchHighlight, light: editorFindMatchHighlight, hcDark: null, hcLight: null }, nls.localize('listFilterMatchHighlight', 'Background color of the filtered match.'));\nexport const listFilterMatchHighlightBorder = registerColor('list.filterMatchBorder', { dark: editorFindMatchHighlightBorder, light: editorFindMatchHighlightBorder, hcDark: contrastBorder, hcLight: activeContrastBorder }, nls.localize('listFilterMatchHighlightBorder', 'Border color of the filtered match.'));\nexport const listDeemphasizedForeground = registerColor('list.deemphasizedForeground', { dark: '#8C8C8C', light: '#8E8E90', hcDark: '#A7A8A9', hcLight: '#666666' }, nls.localize('listDeemphasizedForeground', \"List/Tree foreground color for items that are deemphasized.\"));\n// ------ tree\nexport const treeIndentGuidesStroke = registerColor('tree.indentGuidesStroke', { dark: '#585858', light: '#a9a9a9', hcDark: '#a9a9a9', hcLight: '#a5a5a5' }, nls.localize('treeIndentGuidesStroke', \"Tree stroke color for the indentation guides.\"));\nexport const treeInactiveIndentGuidesStroke = registerColor('tree.inactiveIndentGuidesStroke', { dark: transparent(treeIndentGuidesStroke, 0.4), light: transparent(treeIndentGuidesStroke, 0.4), hcDark: transparent(treeIndentGuidesStroke, 0.4), hcLight: transparent(treeIndentGuidesStroke, 0.4) }, nls.localize('treeInactiveIndentGuidesStroke', \"Tree stroke color for the indentation guides that are not active.\"));\n// ------ table\nexport const tableColumnsBorder = registerColor('tree.tableColumnsBorder', { dark: '#CCCCCC20', light: '#61616120', hcDark: null, hcLight: null }, nls.localize('tableColumnsBorder', \"Table border color between columns.\"));\nexport const tableOddRowsBackgroundColor = registerColor('tree.tableOddRowsBackground', { dark: transparent(foreground, 0.04), light: transparent(foreground, 0.04), hcDark: null, hcLight: null }, nls.localize('tableOddRowsBackgroundColor', \"Background color for odd table rows.\"));\n", "/*---------------------------------------------------------------------------------------------\n * 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 * as nls from '../../../../nls.js';\n// Import the effects we need\nimport { registerColor } from '../colorUtils.js';\n// Import the colors we need\nimport { contrastBorder, activeContrastBorder } from './baseColors.js';\nimport { selectForeground, selectBackground } from './inputColors.js';\nimport { listActiveSelectionBackground, listActiveSelectionForeground } from './listColors.js';\nexport const menuBorder = registerColor('menu.border', { dark: null, light: null, hcDark: contrastBorder, hcLight: contrastBorder }, nls.localize('menuBorder', \"Border color of menus.\"));\nexport const menuForeground = registerColor('menu.foreground', { dark: selectForeground, light: selectForeground, hcDark: selectForeground, hcLight: selectForeground }, nls.localize('menuForeground', \"Foreground color of menu items.\"));\nexport const menuBackground = registerColor('menu.background', { dark: selectBackground, light: selectBackground, hcDark: selectBackground, hcLight: selectBackground }, nls.localize('menuBackground', \"Background color of menu items.\"));\nexport const menuSelectionForeground = registerColor('menu.selectionForeground', { dark: listActiveSelectionForeground, light: listActiveSelectionForeground, hcDark: listActiveSelectionForeground, hcLight: listActiveSelectionForeground }, nls.localize('menuSelectionForeground', \"Foreground color of the selected menu item in menus.\"));\nexport const menuSelectionBackground = registerColor('menu.selectionBackground', { dark: listActiveSelectionBackground, light: listActiveSelectionBackground, hcDark: listActiveSelectionBackground, hcLight: listActiveSelectionBackground }, nls.localize('menuSelectionBackground', \"Background color of the selected menu item in menus.\"));\nexport const menuSelectionBorder = registerColor('menu.selectionBorder', { dark: null, light: null, hcDark: activeContrastBorder, hcLight: activeContrastBorder }, nls.localize('menuSelectionBorder', \"Border color of the selected menu item in menus.\"));\nexport const menuSeparatorBackground = registerColor('menu.separatorBackground', { dark: '#606060', light: '#D4D4D4', hcDark: contrastBorder, hcLight: contrastBorder }, nls.localize('menuSeparatorBackground', \"Color of a separator menu item in menus.\"));\n", "/*---------------------------------------------------------------------------------------------\n * 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 * as nls from '../../../../nls.js';\n// Import the effects we need\nimport { Color, RGBA } from '../../../../base/common/color.js';\nimport { registerColor, oneOf } from '../colorUtils.js';\n// Import the colors we need\nimport { editorWidgetBackground, editorWidgetForeground } from './editorColors.js';\nimport { listActiveSelectionBackground, listActiveSelectionForeground, listActiveSelectionIconForeground } from './listColors.js';\nexport const quickInputBackground = registerColor('quickInput.background', { dark: editorWidgetBackground, light: editorWidgetBackground, hcDark: editorWidgetBackground, hcLight: editorWidgetBackground }, nls.localize('pickerBackground', \"Quick picker background color. The quick picker widget is the container for pickers like the command palette.\"));\nexport const quickInputForeground = registerColor('quickInput.foreground', { dark: editorWidgetForeground, light: editorWidgetForeground, hcDark: editorWidgetForeground, hcLight: editorWidgetForeground }, nls.localize('pickerForeground', \"Quick picker foreground color. The quick picker widget is the container for pickers like the command palette.\"));\nexport const quickInputTitleBackground = registerColor('quickInputTitle.background', { dark: new Color(new RGBA(255, 255, 255, 0.105)), light: new Color(new RGBA(0, 0, 0, 0.06)), hcDark: '#000000', hcLight: Color.white }, nls.localize('pickerTitleBackground', \"Quick picker title background color. The quick picker widget is the container for pickers like the command palette.\"));\nexport const pickerGroupForeground = registerColor('pickerGroup.foreground', { dark: '#3794FF', light: '#0066BF', hcDark: Color.white, hcLight: '#0F4A85' }, nls.localize('pickerGroupForeground', \"Quick picker color for grouping labels.\"));\nexport const pickerGroupBorder = registerColor('pickerGroup.border', { dark: '#3F3F46', light: '#CCCEDB', hcDark: Color.white, hcLight: '#0F4A85' }, nls.localize('pickerGroupBorder', \"Quick picker color for grouping borders.\"));\nexport const _deprecatedQuickInputListFocusBackground = registerColor('quickInput.list.focusBackground', { dark: null, light: null, hcDark: null, hcLight: null }, '', undefined, nls.localize('quickInput.list.focusBackground deprecation', \"Please use quickInputList.focusBackground instead\"));\nexport const quickInputListFocusForeground = registerColor('quickInputList.focusForeground', { dark: listActiveSelectionForeground, light: listActiveSelectionForeground, hcDark: listActiveSelectionForeground, hcLight: listActiveSelectionForeground }, nls.localize('quickInput.listFocusForeground', \"Quick picker foreground color for the focused item.\"));\nexport const quickInputListFocusIconForeground = registerColor('quickInputList.focusIconForeground', { dark: listActiveSelectionIconForeground, light: listActiveSelectionIconForeground, hcDark: listActiveSelectionIconForeground, hcLight: listActiveSelectionIconForeground }, nls.localize('quickInput.listFocusIconForeground', \"Quick picker icon foreground color for the focused item.\"));\nexport const quickInputListFocusBackground = registerColor('quickInputList.focusBackground', { dark: oneOf(_deprecatedQuickInputListFocusBackground, listActiveSelectionBackground), light: oneOf(_deprecatedQuickInputListFocusBackground, listActiveSelectionBackground), hcDark: null, hcLight: null }, nls.localize('quickInput.listFocusBackground', \"Quick picker background color for the focused item.\"));\n", "/*---------------------------------------------------------------------------------------------\n * 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 * as nls from '../../../../nls.js';\n// Import the effects we need\nimport { registerColor, transparent } from '../colorUtils.js';\n// Import the colors we need\nimport { foreground } from './baseColors.js';\nimport { editorFindMatchHighlight, editorFindMatchHighlightBorder } from './editorColors.js';\nexport const searchResultsInfoForeground = registerColor('search.resultsInfoForeground', { light: foreground, dark: transparent(foreground, 0.65), hcDark: foreground, hcLight: foreground }, nls.localize('search.resultsInfoForeground', \"Color of the text in the search viewlet's completion message.\"));\n// ----- search editor (Distinct from normal editor find match to allow for better differentiation)\nexport const searchEditorFindMatch = registerColor('searchEditor.findMatchBackground', { light: transparent(editorFindMatchHighlight, 0.66), dark: transparent(editorFindMatchHighlight, 0.66), hcDark: editorFindMatchHighlight, hcLight: editorFindMatchHighlight }, nls.localize('searchEditor.queryMatch', \"Color of the Search Editor query matches.\"));\nexport const searchEditorFindMatchBorder = registerColor('searchEditor.findMatchBorder', { light: transparent(editorFindMatchHighlightBorder, 0.66), dark: transparent(editorFindMatchHighlightBorder, 0.66), hcDark: editorFindMatchHighlightBorder, hcLight: editorFindMatchHighlightBorder }, nls.localize('searchEditor.editorFindMatchBorder', \"Border color of the Search Editor query matches.\"));\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nexport * from './colorUtils.js';\n// Make sure all color files are exported\nexport * from './colors/baseColors.js';\nexport * from './colors/chartsColors.js';\nexport * from './colors/editorColors.js';\nexport * from './colors/inputColors.js';\nexport * from './colors/listColors.js';\nexport * from './colors/menuColors.js';\nexport * from './colors/minimapColors.js';\nexport * from './colors/miscColors.js';\nexport * from './colors/quickpickColors.js';\nexport * from './colors/searchColors.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/**\n * Color scheme used by the OS and by color themes.\n */\nexport var ColorScheme;\n(function (ColorScheme) {\n ColorScheme[\"DARK\"] = \"dark\";\n ColorScheme[\"LIGHT\"] = \"light\";\n ColorScheme[\"HIGH_CONTRAST_DARK\"] = \"hcDark\";\n ColorScheme[\"HIGH_CONTRAST_LIGHT\"] = \"hcLight\";\n})(ColorScheme || (ColorScheme = {}));\nexport function isHighContrast(scheme) {\n return scheme === ColorScheme.HIGH_CONTRAST_DARK || scheme === ColorScheme.HIGH_CONTRAST_LIGHT;\n}\nexport function isDark(scheme) {\n return scheme === ColorScheme.DARK || scheme === ColorScheme.HIGH_CONTRAST_DARK;\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 * as strings from '../../../base/common/strings.js';\n/**\n * A column in a position is the gap between two adjacent characters. The methods here\n * work with a concept called \"visible column\". A visible column is a very rough approximation\n * of the horizontal screen position of a column. For example, using a tab size of 4:\n * ```txt\n * |||T|ext\n * | | | \\---- column = 4, visible column = 9\n * | | \\------ column = 3, visible column = 8\n * | \\------------ column = 2, visible column = 4\n * \\------------------ column = 1, visible column = 0\n * ```\n *\n * **NOTE**: Visual columns do not work well for RTL text or variable-width fonts or characters.\n *\n * **NOTE**: These methods work and make sense both on the model and on the view model.\n */\nexport class CursorColumns {\n static _nextVisibleColumn(codePoint, visibleColumn, tabSize) {\n if (codePoint === 9 /* CharCode.Tab */) {\n return CursorColumns.nextRenderTabStop(visibleColumn, tabSize);\n }\n if (strings.isFullWidthCharacter(codePoint) || strings.isEmojiImprecise(codePoint)) {\n return visibleColumn + 2;\n }\n return visibleColumn + 1;\n }\n /**\n * Returns a visible column from a column.\n * @see {@link CursorColumns}\n */\n static visibleColumnFromColumn(lineContent, column, tabSize) {\n const textLen = Math.min(column - 1, lineContent.length);\n const text = lineContent.substring(0, textLen);\n const iterator = new strings.GraphemeIterator(text);\n let result = 0;\n while (!iterator.eol()) {\n const codePoint = strings.getNextCodePoint(text, textLen, iterator.offset);\n iterator.nextGraphemeLength();\n result = this._nextVisibleColumn(codePoint, result, tabSize);\n }\n return result;\n }\n /**\n * Returns a column from a visible column.\n * @see {@link CursorColumns}\n */\n static columnFromVisibleColumn(lineContent, visibleColumn, tabSize) {\n if (visibleColumn <= 0) {\n return 1;\n }\n const lineContentLength = lineContent.length;\n const iterator = new strings.GraphemeIterator(lineContent);\n let beforeVisibleColumn = 0;\n let beforeColumn = 1;\n while (!iterator.eol()) {\n const codePoint = strings.getNextCodePoint(lineContent, lineContentLength, iterator.offset);\n iterator.nextGraphemeLength();\n const afterVisibleColumn = this._nextVisibleColumn(codePoint, beforeVisibleColumn, tabSize);\n const afterColumn = iterator.offset + 1;\n if (afterVisibleColumn >= visibleColumn) {\n const beforeDelta = visibleColumn - beforeVisibleColumn;\n const afterDelta = afterVisibleColumn - visibleColumn;\n if (afterDelta < beforeDelta) {\n return afterColumn;\n }\n else {\n return beforeColumn;\n }\n }\n beforeVisibleColumn = afterVisibleColumn;\n beforeColumn = afterColumn;\n }\n // walked the entire string\n return lineContentLength + 1;\n }\n /**\n * ATTENTION: This works with 0-based columns (as opposed to the regular 1-based columns)\n * @see {@link CursorColumns}\n */\n static nextRenderTabStop(visibleColumn, tabSize) {\n return visibleColumn + tabSize - visibleColumn % tabSize;\n }\n /**\n * ATTENTION: This works with 0-based columns (as opposed to the regular 1-based columns)\n * @see {@link CursorColumns}\n */\n static nextIndentTabStop(visibleColumn, indentSize) {\n return visibleColumn + indentSize - visibleColumn % indentSize;\n }\n /**\n * ATTENTION: This works with 0-based columns (as opposed to the regular 1-based columns)\n * @see {@link CursorColumns}\n */\n static prevRenderTabStop(column, tabSize) {\n return Math.max(0, column - 1 - (column - 1) % tabSize);\n }\n /**\n * ATTENTION: This works with 0-based columns (as opposed to the regular 1-based columns)\n * @see {@link CursorColumns}\n */\n static prevIndentTabStop(column, indentSize) {\n return Math.max(0, column - 1 - (column - 1) % indentSize);\n }\n}\n", "import { Emitter } from '../../../base/common/event.js';\nimport { Disposable, toDisposable } from '../../../base/common/lifecycle.js';\nimport { createDecorator } from '../../instantiation/common/instantiation.js';\nimport * as platform from '../../registry/common/platform.js';\nimport { ColorScheme } from './theme.js';\nexport const IThemeService = createDecorator('themeService');\nexport function themeColorFromId(id) {\n return { id };\n}\nexport function getThemeTypeSelector(type) {\n switch (type) {\n case ColorScheme.DARK: return 'vs-dark';\n case ColorScheme.HIGH_CONTRAST_DARK: return 'hc-black';\n case ColorScheme.HIGH_CONTRAST_LIGHT: return 'hc-light';\n default: return 'vs';\n }\n}\n// static theming participant\nexport const Extensions = {\n ThemingContribution: 'base.contributions.theming'\n};\nclass ThemingRegistry {\n constructor() {\n this.themingParticipants = [];\n this.themingParticipants = [];\n this.onThemingParticipantAddedEmitter = new Emitter();\n }\n onColorThemeChange(participant) {\n this.themingParticipants.push(participant);\n this.onThemingParticipantAddedEmitter.fire(participant);\n return toDisposable(() => {\n const idx = this.themingParticipants.indexOf(participant);\n this.themingParticipants.splice(idx, 1);\n });\n }\n getThemingParticipants() {\n return this.themingParticipants;\n }\n}\nconst themingRegistry = new ThemingRegistry();\nplatform.Registry.add(Extensions.ThemingContribution, themingRegistry);\nexport function registerThemingParticipant(participant) {\n return themingRegistry.onColorThemeChange(participant);\n}\n/**\n * Utility base class for all themable components.\n */\nexport class Themable extends Disposable {\n constructor(themeService) {\n super();\n this.themeService = themeService;\n this.theme = themeService.getColorTheme();\n // Hook up to theme changes\n this._register(this.themeService.onDidColorThemeChange(theme => this.onThemeChange(theme)));\n }\n onThemeChange(theme) {\n this.theme = theme;\n this.updateStyles();\n }\n updateStyles() {\n // Subclasses to override\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 *--------------------------------------------------------------------------------------------*/\nimport * as nls from '../../../nls.js';\nimport { Color, RGBA } from '../../../base/common/color.js';\nimport { activeContrastBorder, editorBackground, registerColor, editorWarningForeground, editorInfoForeground, editorWarningBorder, editorInfoBorder, contrastBorder, editorFindMatchHighlight, editorWarningBackground } from '../../../platform/theme/common/colorRegistry.js';\nimport { registerThemingParticipant } from '../../../platform/theme/common/themeService.js';\n/**\n * Definition of the editor colors\n */\nexport const editorLineHighlight = registerColor('editor.lineHighlightBackground', { dark: null, light: null, hcDark: null, hcLight: null }, nls.localize('lineHighlight', 'Background color for the highlight of line at the cursor position.'));\nexport const editorLineHighlightBorder = registerColor('editor.lineHighlightBorder', { dark: '#282828', light: '#eeeeee', hcDark: '#f38518', hcLight: contrastBorder }, nls.localize('lineHighlightBorderBox', 'Background color for the border around the line at the cursor position.'));\nexport const editorRangeHighlight = registerColor('editor.rangeHighlightBackground', { dark: '#ffffff0b', light: '#fdff0033', hcDark: null, hcLight: null }, nls.localize('rangeHighlight', 'Background color of highlighted ranges, like by quick open and find features. The color must not be opaque so as not to hide underlying decorations.'), true);\nexport const editorRangeHighlightBorder = registerColor('editor.rangeHighlightBorder', { dark: null, light: null, hcDark: activeContrastBorder, hcLight: activeContrastBorder }, nls.localize('rangeHighlightBorder', 'Background color of the border around highlighted ranges.'));\nexport const editorSymbolHighlight = registerColor('editor.symbolHighlightBackground', { dark: editorFindMatchHighlight, light: editorFindMatchHighlight, hcDark: null, hcLight: null }, nls.localize('symbolHighlight', 'Background color of highlighted symbol, like for go to definition or go next/previous symbol. The color must not be opaque so as not to hide underlying decorations.'), true);\nexport const editorSymbolHighlightBorder = registerColor('editor.symbolHighlightBorder', { dark: null, light: null, hcDark: activeContrastBorder, hcLight: activeContrastBorder }, nls.localize('symbolHighlightBorder', 'Background color of the border around highlighted symbols.'));\nexport const editorCursorForeground = registerColor('editorCursor.foreground', { dark: '#AEAFAD', light: Color.black, hcDark: Color.white, hcLight: '#0F4A85' }, nls.localize('caret', 'Color of the editor cursor.'));\nexport const editorCursorBackground = registerColor('editorCursor.background', null, nls.localize('editorCursorBackground', 'The background color of the editor cursor. Allows customizing the color of a character overlapped by a block cursor.'));\nexport const editorMultiCursorPrimaryForeground = registerColor('editorMultiCursor.primary.foreground', { dark: editorCursorForeground, light: editorCursorForeground, hcDark: editorCursorForeground, hcLight: editorCursorForeground }, nls.localize('editorMultiCursorPrimaryForeground', 'Color of the primary editor cursor when multiple cursors are present.'));\nexport const editorMultiCursorPrimaryBackground = registerColor('editorMultiCursor.primary.background', { dark: editorCursorBackground, light: editorCursorBackground, hcDark: editorCursorBackground, hcLight: editorCursorBackground }, nls.localize('editorMultiCursorPrimaryBackground', 'The background color of the primary editor cursor when multiple cursors are present. Allows customizing the color of a character overlapped by a block cursor.'));\nexport const editorMultiCursorSecondaryForeground = registerColor('editorMultiCursor.secondary.foreground', { dark: editorCursorForeground, light: editorCursorForeground, hcDark: editorCursorForeground, hcLight: editorCursorForeground }, nls.localize('editorMultiCursorSecondaryForeground', 'Color of secondary editor cursors when multiple cursors are present.'));\nexport const editorMultiCursorSecondaryBackground = registerColor('editorMultiCursor.secondary.background', { dark: editorCursorBackground, light: editorCursorBackground, hcDark: editorCursorBackground, hcLight: editorCursorBackground }, nls.localize('editorMultiCursorSecondaryBackground', 'The background color of secondary editor cursors when multiple cursors are present. Allows customizing the color of a character overlapped by a block cursor.'));\nexport const editorWhitespaces = registerColor('editorWhitespace.foreground', { dark: '#e3e4e229', light: '#33333333', hcDark: '#e3e4e229', hcLight: '#CCCCCC' }, nls.localize('editorWhitespaces', 'Color of whitespace characters in the editor.'));\nexport const editorLineNumbers = registerColor('editorLineNumber.foreground', { dark: '#858585', light: '#237893', hcDark: Color.white, hcLight: '#292929' }, nls.localize('editorLineNumbers', 'Color of editor line numbers.'));\nexport const deprecatedEditorIndentGuides = registerColor('editorIndentGuide.background', { dark: editorWhitespaces, light: editorWhitespaces, hcDark: editorWhitespaces, hcLight: editorWhitespaces }, nls.localize('editorIndentGuides', 'Color of the editor indentation guides.'), false, nls.localize('deprecatedEditorIndentGuides', '\\'editorIndentGuide.background\\' is deprecated. Use \\'editorIndentGuide.background1\\' instead.'));\nexport const deprecatedEditorActiveIndentGuides = registerColor('editorIndentGuide.activeBackground', { dark: editorWhitespaces, light: editorWhitespaces, hcDark: editorWhitespaces, hcLight: editorWhitespaces }, nls.localize('editorActiveIndentGuide', 'Color of the active editor indentation guides.'), false, nls.localize('deprecatedEditorActiveIndentGuide', '\\'editorIndentGuide.activeBackground\\' is deprecated. Use \\'editorIndentGuide.activeBackground1\\' instead.'));\nexport const editorIndentGuide1 = registerColor('editorIndentGuide.background1', { dark: deprecatedEditorIndentGuides, light: deprecatedEditorIndentGuides, hcDark: deprecatedEditorIndentGuides, hcLight: deprecatedEditorIndentGuides }, nls.localize('editorIndentGuides1', 'Color of the editor indentation guides (1).'));\nexport const editorIndentGuide2 = registerColor('editorIndentGuide.background2', { dark: '#00000000', light: '#00000000', hcDark: '#00000000', hcLight: '#00000000' }, nls.localize('editorIndentGuides2', 'Color of the editor indentation guides (2).'));\nexport const editorIndentGuide3 = registerColor('editorIndentGuide.background3', { dark: '#00000000', light: '#00000000', hcDark: '#00000000', hcLight: '#00000000' }, nls.localize('editorIndentGuides3', 'Color of the editor indentation guides (3).'));\nexport const editorIndentGuide4 = registerColor('editorIndentGuide.background4', { dark: '#00000000', light: '#00000000', hcDark: '#00000000', hcLight: '#00000000' }, nls.localize('editorIndentGuides4', 'Color of the editor indentation guides (4).'));\nexport const editorIndentGuide5 = registerColor('editorIndentGuide.background5', { dark: '#00000000', light: '#00000000', hcDark: '#00000000', hcLight: '#00000000' }, nls.localize('editorIndentGuides5', 'Color of the editor indentation guides (5).'));\nexport const editorIndentGuide6 = registerColor('editorIndentGuide.background6', { dark: '#00000000', light: '#00000000', hcDark: '#00000000', hcLight: '#00000000' }, nls.localize('editorIndentGuides6', 'Color of the editor indentation guides (6).'));\nexport const editorActiveIndentGuide1 = registerColor('editorIndentGuide.activeBackground1', { dark: deprecatedEditorActiveIndentGuides, light: deprecatedEditorActiveIndentGuides, hcDark: deprecatedEditorActiveIndentGuides, hcLight: deprecatedEditorActiveIndentGuides }, nls.localize('editorActiveIndentGuide1', 'Color of the active editor indentation guides (1).'));\nexport const editorActiveIndentGuide2 = registerColor('editorIndentGuide.activeBackground2', { dark: '#00000000', light: '#00000000', hcDark: '#00000000', hcLight: '#00000000' }, nls.localize('editorActiveIndentGuide2', 'Color of the active editor indentation guides (2).'));\nexport const editorActiveIndentGuide3 = registerColor('editorIndentGuide.activeBackground3', { dark: '#00000000', light: '#00000000', hcDark: '#00000000', hcLight: '#00000000' }, nls.localize('editorActiveIndentGuide3', 'Color of the active editor indentation guides (3).'));\nexport const editorActiveIndentGuide4 = registerColor('editorIndentGuide.activeBackground4', { dark: '#00000000', light: '#00000000', hcDark: '#00000000', hcLight: '#00000000' }, nls.localize('editorActiveIndentGuide4', 'Color of the active editor indentation guides (4).'));\nexport const editorActiveIndentGuide5 = registerColor('editorIndentGuide.activeBackground5', { dark: '#00000000', light: '#00000000', hcDark: '#00000000', hcLight: '#00000000' }, nls.localize('editorActiveIndentGuide5', 'Color of the active editor indentation guides (5).'));\nexport const editorActiveIndentGuide6 = registerColor('editorIndentGuide.activeBackground6', { dark: '#00000000', light: '#00000000', hcDark: '#00000000', hcLight: '#00000000' }, nls.localize('editorActiveIndentGuide6', 'Color of the active editor indentation guides (6).'));\nconst deprecatedEditorActiveLineNumber = registerColor('editorActiveLineNumber.foreground', { dark: '#c6c6c6', light: '#0B216F', hcDark: activeContrastBorder, hcLight: activeContrastBorder }, nls.localize('editorActiveLineNumber', 'Color of editor active line number'), false, nls.localize('deprecatedEditorActiveLineNumber', 'Id is deprecated. Use \\'editorLineNumber.activeForeground\\' instead.'));\nexport const editorActiveLineNumber = registerColor('editorLineNumber.activeForeground', { dark: deprecatedEditorActiveLineNumber, light: deprecatedEditorActiveLineNumber, hcDark: deprecatedEditorActiveLineNumber, hcLight: deprecatedEditorActiveLineNumber }, nls.localize('editorActiveLineNumber', 'Color of editor active line number'));\nexport const editorDimmedLineNumber = registerColor('editorLineNumber.dimmedForeground', { dark: null, light: null, hcDark: null, hcLight: null }, nls.localize('editorDimmedLineNumber', 'Color of the final editor line when editor.renderFinalNewline is set to dimmed.'));\nexport const editorRuler = registerColor('editorRuler.foreground', { dark: '#5A5A5A', light: Color.lightgrey, hcDark: Color.white, hcLight: '#292929' }, nls.localize('editorRuler', 'Color of the editor rulers.'));\nexport const editorCodeLensForeground = registerColor('editorCodeLens.foreground', { dark: '#999999', light: '#919191', hcDark: '#999999', hcLight: '#292929' }, nls.localize('editorCodeLensForeground', 'Foreground color of editor CodeLens'));\nexport const editorBracketMatchBackground = registerColor('editorBracketMatch.background', { dark: '#0064001a', light: '#0064001a', hcDark: '#0064001a', hcLight: '#0000' }, nls.localize('editorBracketMatchBackground', 'Background color behind matching brackets'));\nexport const editorBracketMatchBorder = registerColor('editorBracketMatch.border', { dark: '#888', light: '#B9B9B9', hcDark: contrastBorder, hcLight: contrastBorder }, nls.localize('editorBracketMatchBorder', 'Color for matching brackets boxes'));\nexport const editorOverviewRulerBorder = registerColor('editorOverviewRuler.border', { dark: '#7f7f7f4d', light: '#7f7f7f4d', hcDark: '#7f7f7f4d', hcLight: '#666666' }, nls.localize('editorOverviewRulerBorder', 'Color of the overview ruler border.'));\nexport const editorOverviewRulerBackground = registerColor('editorOverviewRuler.background', null, nls.localize('editorOverviewRulerBackground', 'Background color of the editor overview ruler.'));\nexport const editorGutter = registerColor('editorGutter.background', { dark: editorBackground, light: editorBackground, hcDark: editorBackground, hcLight: editorBackground }, nls.localize('editorGutter', 'Background color of the editor gutter. The gutter contains the glyph margins and the line numbers.'));\nexport const editorUnnecessaryCodeBorder = registerColor('editorUnnecessaryCode.border', { dark: null, light: null, hcDark: Color.fromHex('#fff').transparent(0.8), hcLight: contrastBorder }, nls.localize('unnecessaryCodeBorder', 'Border color of unnecessary (unused) source code in the editor.'));\nexport const editorUnnecessaryCodeOpacity = registerColor('editorUnnecessaryCode.opacity', { dark: Color.fromHex('#000a'), light: Color.fromHex('#0007'), hcDark: null, hcLight: null }, nls.localize('unnecessaryCodeOpacity', 'Opacity of unnecessary (unused) source code in the editor. For example, \"#000000c0\" will render the code with 75% opacity. For high contrast themes, use the \\'editorUnnecessaryCode.border\\' theme color to underline unnecessary code instead of fading it out.'));\nexport const ghostTextBorder = registerColor('editorGhostText.border', { dark: null, light: null, hcDark: Color.fromHex('#fff').transparent(0.8), hcLight: Color.fromHex('#292929').transparent(0.8) }, nls.localize('editorGhostTextBorder', 'Border color of ghost text in the editor.'));\nexport const ghostTextForeground = registerColor('editorGhostText.foreground', { dark: Color.fromHex('#ffffff56'), light: Color.fromHex('#0007'), hcDark: null, hcLight: null }, nls.localize('editorGhostTextForeground', 'Foreground color of the ghost text in the editor.'));\nexport const ghostTextBackground = registerColor('editorGhostText.background', { dark: null, light: null, hcDark: null, hcLight: null }, nls.localize('editorGhostTextBackground', 'Background color of the ghost text in the editor.'));\nconst rulerRangeDefault = new Color(new RGBA(0, 122, 204, 0.6));\nexport const overviewRulerRangeHighlight = registerColor('editorOverviewRuler.rangeHighlightForeground', { dark: rulerRangeDefault, light: rulerRangeDefault, hcDark: rulerRangeDefault, hcLight: rulerRangeDefault }, nls.localize('overviewRulerRangeHighlight', 'Overview ruler marker color for range highlights. The color must not be opaque so as not to hide underlying decorations.'), true);\nexport const overviewRulerError = registerColor('editorOverviewRuler.errorForeground', { dark: new Color(new RGBA(255, 18, 18, 0.7)), light: new Color(new RGBA(255, 18, 18, 0.7)), hcDark: new Color(new RGBA(255, 50, 50, 1)), hcLight: '#B5200D' }, nls.localize('overviewRuleError', 'Overview ruler marker color for errors.'));\nexport const overviewRulerWarning = registerColor('editorOverviewRuler.warningForeground', { dark: editorWarningForeground, light: editorWarningForeground, hcDark: editorWarningBorder, hcLight: editorWarningBorder }, nls.localize('overviewRuleWarning', 'Overview ruler marker color for warnings.'));\nexport const overviewRulerInfo = registerColor('editorOverviewRuler.infoForeground', { dark: editorInfoForeground, light: editorInfoForeground, hcDark: editorInfoBorder, hcLight: editorInfoBorder }, nls.localize('overviewRuleInfo', 'Overview ruler marker color for infos.'));\nexport const editorBracketHighlightingForeground1 = registerColor('editorBracketHighlight.foreground1', { dark: '#FFD700', light: '#0431FAFF', hcDark: '#FFD700', hcLight: '#0431FAFF' }, nls.localize('editorBracketHighlightForeground1', 'Foreground color of brackets (1). Requires enabling bracket pair colorization.'));\nexport const editorBracketHighlightingForeground2 = registerColor('editorBracketHighlight.foreground2', { dark: '#DA70D6', light: '#319331FF', hcDark: '#DA70D6', hcLight: '#319331FF' }, nls.localize('editorBracketHighlightForeground2', 'Foreground color of brackets (2). Requires enabling bracket pair colorization.'));\nexport const editorBracketHighlightingForeground3 = registerColor('editorBracketHighlight.foreground3', { dark: '#179FFF', light: '#7B3814FF', hcDark: '#87CEFA', hcLight: '#7B3814FF' }, nls.localize('editorBracketHighlightForeground3', 'Foreground color of brackets (3). Requires enabling bracket pair colorization.'));\nexport const editorBracketHighlightingForeground4 = registerColor('editorBracketHighlight.foreground4', { dark: '#00000000', light: '#00000000', hcDark: '#00000000', hcLight: '#00000000' }, nls.localize('editorBracketHighlightForeground4', 'Foreground color of brackets (4). Requires enabling bracket pair colorization.'));\nexport const editorBracketHighlightingForeground5 = registerColor('editorBracketHighlight.foreground5', { dark: '#00000000', light: '#00000000', hcDark: '#00000000', hcLight: '#00000000' }, nls.localize('editorBracketHighlightForeground5', 'Foreground color of brackets (5). Requires enabling bracket pair colorization.'));\nexport const editorBracketHighlightingForeground6 = registerColor('editorBracketHighlight.foreground6', { dark: '#00000000', light: '#00000000', hcDark: '#00000000', hcLight: '#00000000' }, nls.localize('editorBracketHighlightForeground6', 'Foreground color of brackets (6). Requires enabling bracket pair colorization.'));\nexport const editorBracketHighlightingUnexpectedBracketForeground = registerColor('editorBracketHighlight.unexpectedBracket.foreground', { dark: new Color(new RGBA(255, 18, 18, 0.8)), light: new Color(new RGBA(255, 18, 18, 0.8)), hcDark: new Color(new RGBA(255, 50, 50, 1)), hcLight: '' }, nls.localize('editorBracketHighlightUnexpectedBracketForeground', 'Foreground color of unexpected brackets.'));\nexport const editorBracketPairGuideBackground1 = registerColor('editorBracketPairGuide.background1', { dark: '#00000000', light: '#00000000', hcDark: '#00000000', hcLight: '#00000000' }, nls.localize('editorBracketPairGuide.background1', 'Background color of inactive bracket pair guides (1). Requires enabling bracket pair guides.'));\nexport const editorBracketPairGuideBackground2 = registerColor('editorBracketPairGuide.background2', { dark: '#00000000', light: '#00000000', hcDark: '#00000000', hcLight: '#00000000' }, nls.localize('editorBracketPairGuide.background2', 'Background color of inactive bracket pair guides (2). Requires enabling bracket pair guides.'));\nexport const editorBracketPairGuideBackground3 = registerColor('editorBracketPairGuide.background3', { dark: '#00000000', light: '#00000000', hcDark: '#00000000', hcLight: '#00000000' }, nls.localize('editorBracketPairGuide.background3', 'Background color of inactive bracket pair guides (3). Requires enabling bracket pair guides.'));\nexport const editorBracketPairGuideBackground4 = registerColor('editorBracketPairGuide.background4', { dark: '#00000000', light: '#00000000', hcDark: '#00000000', hcLight: '#00000000' }, nls.localize('editorBracketPairGuide.background4', 'Background color of inactive bracket pair guides (4). Requires enabling bracket pair guides.'));\nexport const editorBracketPairGuideBackground5 = registerColor('editorBracketPairGuide.background5', { dark: '#00000000', light: '#00000000', hcDark: '#00000000', hcLight: '#00000000' }, nls.localize('editorBracketPairGuide.background5', 'Background color of inactive bracket pair guides (5). Requires enabling bracket pair guides.'));\nexport const editorBracketPairGuideBackground6 = registerColor('editorBracketPairGuide.background6', { dark: '#00000000', light: '#00000000', hcDark: '#00000000', hcLight: '#00000000' }, nls.localize('editorBracketPairGuide.background6', 'Background color of inactive bracket pair guides (6). Requires enabling bracket pair guides.'));\nexport const editorBracketPairGuideActiveBackground1 = registerColor('editorBracketPairGuide.activeBackground1', { dark: '#00000000', light: '#00000000', hcDark: '#00000000', hcLight: '#00000000' }, nls.localize('editorBracketPairGuide.activeBackground1', 'Background color of active bracket pair guides (1). Requires enabling bracket pair guides.'));\nexport const editorBracketPairGuideActiveBackground2 = registerColor('editorBracketPairGuide.activeBackground2', { dark: '#00000000', light: '#00000000', hcDark: '#00000000', hcLight: '#00000000' }, nls.localize('editorBracketPairGuide.activeBackground2', 'Background color of active bracket pair guides (2). Requires enabling bracket pair guides.'));\nexport const editorBracketPairGuideActiveBackground3 = registerColor('editorBracketPairGuide.activeBackground3', { dark: '#00000000', light: '#00000000', hcDark: '#00000000', hcLight: '#00000000' }, nls.localize('editorBracketPairGuide.activeBackground3', 'Background color of active bracket pair guides (3). Requires enabling bracket pair guides.'));\nexport const editorBracketPairGuideActiveBackground4 = registerColor('editorBracketPairGuide.activeBackground4', { dark: '#00000000', light: '#00000000', hcDark: '#00000000', hcLight: '#00000000' }, nls.localize('editorBracketPairGuide.activeBackground4', 'Background color of active bracket pair guides (4). Requires enabling bracket pair guides.'));\nexport const editorBracketPairGuideActiveBackground5 = registerColor('editorBracketPairGuide.activeBackground5', { dark: '#00000000', light: '#00000000', hcDark: '#00000000', hcLight: '#00000000' }, nls.localize('editorBracketPairGuide.activeBackground5', 'Background color of active bracket pair guides (5). Requires enabling bracket pair guides.'));\nexport const editorBracketPairGuideActiveBackground6 = registerColor('editorBracketPairGuide.activeBackground6', { dark: '#00000000', light: '#00000000', hcDark: '#00000000', hcLight: '#00000000' }, nls.localize('editorBracketPairGuide.activeBackground6', 'Background color of active bracket pair guides (6). Requires enabling bracket pair guides.'));\nexport const editorUnicodeHighlightBorder = registerColor('editorUnicodeHighlight.border', { dark: editorWarningForeground, light: editorWarningForeground, hcDark: editorWarningForeground, hcLight: editorWarningForeground }, nls.localize('editorUnicodeHighlight.border', 'Border color used to highlight unicode characters.'));\nexport const editorUnicodeHighlightBackground = registerColor('editorUnicodeHighlight.background', { dark: editorWarningBackground, light: editorWarningBackground, hcDark: editorWarningBackground, hcLight: editorWarningBackground }, nls.localize('editorUnicodeHighlight.background', 'Background color used to highlight unicode characters.'));\n// contains all color rules that used to defined in editor/browser/widget/editor.css\nregisterThemingParticipant((theme, collector) => {\n const background = theme.getColor(editorBackground);\n const lineHighlight = theme.getColor(editorLineHighlight);\n const imeBackground = (lineHighlight && !lineHighlight.isTransparent() ? lineHighlight : background);\n if (imeBackground) {\n collector.addRule(`.monaco-editor .inputarea.ime-input { background-color: ${imeBackground}; }`);\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 *--------------------------------------------------------------------------------------------*/\nimport * as strings from '../../../base/common/strings.js';\nimport { CursorColumns } from './cursorColumns.js';\nfunction _normalizeIndentationFromWhitespace(str, indentSize, insertSpaces) {\n let spacesCnt = 0;\n for (let i = 0; i < str.length; i++) {\n if (str.charAt(i) === '\\t') {\n spacesCnt = CursorColumns.nextIndentTabStop(spacesCnt, indentSize);\n }\n else {\n spacesCnt++;\n }\n }\n let result = '';\n if (!insertSpaces) {\n const tabsCnt = Math.floor(spacesCnt / indentSize);\n spacesCnt = spacesCnt % indentSize;\n for (let i = 0; i < tabsCnt; i++) {\n result += '\\t';\n }\n }\n for (let i = 0; i < spacesCnt; i++) {\n result += ' ';\n }\n return result;\n}\nexport function normalizeIndentation(str, indentSize, insertSpaces) {\n let firstNonWhitespaceIndex = strings.firstNonWhitespaceIndex(str);\n if (firstNonWhitespaceIndex === -1) {\n firstNonWhitespaceIndex = str.length;\n }\n return _normalizeIndentationFromWhitespace(str.substring(0, firstNonWhitespaceIndex), indentSize, insertSpaces) + str.substring(firstNonWhitespaceIndex);\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 * as nls from '../../nls.js';\nimport { RawContextKey } from '../../platform/contextkey/common/contextkey.js';\nexport var EditorContextKeys;\n(function (EditorContextKeys) {\n EditorContextKeys.editorSimpleInput = new RawContextKey('editorSimpleInput', false, true);\n /**\n * A context key that is set when the editor's text has focus (cursor is blinking).\n * Is false when focus is in simple editor widgets (repl input, scm commit input).\n */\n EditorContextKeys.editorTextFocus = new RawContextKey('editorTextFocus', false, nls.localize('editorTextFocus', \"Whether the editor text has focus (cursor is blinking)\"));\n /**\n * A context key that is set when the editor's text or an editor's widget has focus.\n */\n EditorContextKeys.focus = new RawContextKey('editorFocus', false, nls.localize('editorFocus', \"Whether the editor or an editor widget has focus (e.g. focus is in the find widget)\"));\n /**\n * A context key that is set when any editor input has focus (regular editor, repl input...).\n */\n EditorContextKeys.textInputFocus = new RawContextKey('textInputFocus', false, nls.localize('textInputFocus', \"Whether an editor or a rich text input has focus (cursor is blinking)\"));\n EditorContextKeys.readOnly = new RawContextKey('editorReadonly', false, nls.localize('editorReadonly', \"Whether the editor is read-only\"));\n EditorContextKeys.inDiffEditor = new RawContextKey('inDiffEditor', false, nls.localize('inDiffEditor', \"Whether the context is a diff editor\"));\n EditorContextKeys.isEmbeddedDiffEditor = new RawContextKey('isEmbeddedDiffEditor', false, nls.localize('isEmbeddedDiffEditor', \"Whether the context is an embedded diff editor\"));\n EditorContextKeys.inMultiDiffEditor = new RawContextKey('inMultiDiffEditor', false, nls.localize('inMultiDiffEditor', \"Whether the context is a multi diff editor\"));\n EditorContextKeys.multiDiffEditorAllCollapsed = new RawContextKey('multiDiffEditorAllCollapsed', undefined, nls.localize('multiDiffEditorAllCollapsed', \"Whether all files in multi diff editor are collapsed\"));\n EditorContextKeys.hasChanges = new RawContextKey('diffEditorHasChanges', false, nls.localize('diffEditorHasChanges', \"Whether the diff editor has changes\"));\n EditorContextKeys.comparingMovedCode = new RawContextKey('comparingMovedCode', false, nls.localize('comparingMovedCode', \"Whether a moved code block is selected for comparison\"));\n EditorContextKeys.accessibleDiffViewerVisible = new RawContextKey('accessibleDiffViewerVisible', false, nls.localize('accessibleDiffViewerVisible', \"Whether the accessible diff viewer is visible\"));\n EditorContextKeys.diffEditorRenderSideBySideInlineBreakpointReached = new RawContextKey('diffEditorRenderSideBySideInlineBreakpointReached', false, nls.localize('diffEditorRenderSideBySideInlineBreakpointReached', \"Whether the diff editor render side by side inline breakpoint is reached\"));\n EditorContextKeys.diffEditorInlineMode = new RawContextKey('diffEditorInlineMode', false, nls.localize('diffEditorInlineMode', \"Whether inline mode is active\"));\n EditorContextKeys.diffEditorOriginalWritable = new RawContextKey('diffEditorOriginalWritable', false, nls.localize('diffEditorOriginalWritable', \"Whether modified is writable in the diff editor\"));\n EditorContextKeys.diffEditorModifiedWritable = new RawContextKey('diffEditorModifiedWritable', false, nls.localize('diffEditorModifiedWritable', \"Whether modified is writable in the diff editor\"));\n EditorContextKeys.diffEditorOriginalUri = new RawContextKey('diffEditorOriginalUri', '', nls.localize('diffEditorOriginalUri', \"The uri of the original document\"));\n EditorContextKeys.diffEditorModifiedUri = new RawContextKey('diffEditorModifiedUri', '', nls.localize('diffEditorModifiedUri', \"The uri of the modified document\"));\n EditorContextKeys.columnSelection = new RawContextKey('editorColumnSelection', false, nls.localize('editorColumnSelection', \"Whether `editor.columnSelection` is enabled\"));\n EditorContextKeys.writable = EditorContextKeys.readOnly.toNegated();\n EditorContextKeys.hasNonEmptySelection = new RawContextKey('editorHasSelection', false, nls.localize('editorHasSelection', \"Whether the editor has text selected\"));\n EditorContextKeys.hasOnlyEmptySelection = EditorContextKeys.hasNonEmptySelection.toNegated();\n EditorContextKeys.hasMultipleSelections = new RawContextKey('editorHasMultipleSelections', false, nls.localize('editorHasMultipleSelections', \"Whether the editor has multiple selections\"));\n EditorContextKeys.hasSingleSelection = EditorContextKeys.hasMultipleSelections.toNegated();\n EditorContextKeys.tabMovesFocus = new RawContextKey('editorTabMovesFocus', false, nls.localize('editorTabMovesFocus', \"Whether `Tab` will move focus out of the editor\"));\n EditorContextKeys.tabDoesNotMoveFocus = EditorContextKeys.tabMovesFocus.toNegated();\n EditorContextKeys.isInEmbeddedEditor = new RawContextKey('isInEmbeddedEditor', false, true);\n EditorContextKeys.canUndo = new RawContextKey('canUndo', false, true);\n EditorContextKeys.canRedo = new RawContextKey('canRedo', false, true);\n EditorContextKeys.hoverVisible = new RawContextKey('editorHoverVisible', false, nls.localize('editorHoverVisible', \"Whether the editor hover is visible\"));\n EditorContextKeys.hoverFocused = new RawContextKey('editorHoverFocused', false, nls.localize('editorHoverFocused', \"Whether the editor hover is focused\"));\n EditorContextKeys.stickyScrollFocused = new RawContextKey('stickyScrollFocused', false, nls.localize('stickyScrollFocused', \"Whether the sticky scroll is focused\"));\n EditorContextKeys.stickyScrollVisible = new RawContextKey('stickyScrollVisible', false, nls.localize('stickyScrollVisible', \"Whether the sticky scroll is visible\"));\n EditorContextKeys.standaloneColorPickerVisible = new RawContextKey('standaloneColorPickerVisible', false, nls.localize('standaloneColorPickerVisible', \"Whether the standalone color picker is visible\"));\n EditorContextKeys.standaloneColorPickerFocused = new RawContextKey('standaloneColorPickerFocused', false, nls.localize('standaloneColorPickerFocused', \"Whether the standalone color picker is focused\"));\n /**\n * A context key that is set when an editor is part of a larger editor, like notebooks or\n * (future) a diff editor\n */\n EditorContextKeys.inCompositeEditor = new RawContextKey('inCompositeEditor', undefined, nls.localize('inCompositeEditor', \"Whether the editor is part of a larger editor (e.g. notebooks)\"));\n EditorContextKeys.notInCompositeEditor = EditorContextKeys.inCompositeEditor.toNegated();\n // -- mode context keys\n EditorContextKeys.languageId = new RawContextKey('editorLangId', '', nls.localize('editorLangId', \"The language identifier of the editor\"));\n EditorContextKeys.hasCompletionItemProvider = new RawContextKey('editorHasCompletionItemProvider', false, nls.localize('editorHasCompletionItemProvider', \"Whether the editor has a completion item provider\"));\n EditorContextKeys.hasCodeActionsProvider = new RawContextKey('editorHasCodeActionsProvider', false, nls.localize('editorHasCodeActionsProvider', \"Whether the editor has a code actions provider\"));\n EditorContextKeys.hasCodeLensProvider = new RawContextKey('editorHasCodeLensProvider', false, nls.localize('editorHasCodeLensProvider', \"Whether the editor has a code lens provider\"));\n EditorContextKeys.hasDefinitionProvider = new RawContextKey('editorHasDefinitionProvider', false, nls.localize('editorHasDefinitionProvider', \"Whether the editor has a definition provider\"));\n EditorContextKeys.hasDeclarationProvider = new RawContextKey('editorHasDeclarationProvider', false, nls.localize('editorHasDeclarationProvider', \"Whether the editor has a declaration provider\"));\n EditorContextKeys.hasImplementationProvider = new RawContextKey('editorHasImplementationProvider', false, nls.localize('editorHasImplementationProvider', \"Whether the editor has an implementation provider\"));\n EditorContextKeys.hasTypeDefinitionProvider = new RawContextKey('editorHasTypeDefinitionProvider', false, nls.localize('editorHasTypeDefinitionProvider', \"Whether the editor has a type definition provider\"));\n EditorContextKeys.hasHoverProvider = new RawContextKey('editorHasHoverProvider', false, nls.localize('editorHasHoverProvider', \"Whether the editor has a hover provider\"));\n EditorContextKeys.hasDocumentHighlightProvider = new RawContextKey('editorHasDocumentHighlightProvider', false, nls.localize('editorHasDocumentHighlightProvider', \"Whether the editor has a document highlight provider\"));\n EditorContextKeys.hasDocumentSymbolProvider = new RawContextKey('editorHasDocumentSymbolProvider', false, nls.localize('editorHasDocumentSymbolProvider', \"Whether the editor has a document symbol provider\"));\n EditorContextKeys.hasReferenceProvider = new RawContextKey('editorHasReferenceProvider', false, nls.localize('editorHasReferenceProvider', \"Whether the editor has a reference provider\"));\n EditorContextKeys.hasRenameProvider = new RawContextKey('editorHasRenameProvider', false, nls.localize('editorHasRenameProvider', \"Whether the editor has a rename provider\"));\n EditorContextKeys.hasSignatureHelpProvider = new RawContextKey('editorHasSignatureHelpProvider', false, nls.localize('editorHasSignatureHelpProvider', \"Whether the editor has a signature help provider\"));\n EditorContextKeys.hasInlayHintsProvider = new RawContextKey('editorHasInlayHintsProvider', false, nls.localize('editorHasInlayHintsProvider', \"Whether the editor has an inline hints provider\"));\n // -- mode context keys: formatting\n EditorContextKeys.hasDocumentFormattingProvider = new RawContextKey('editorHasDocumentFormattingProvider', false, nls.localize('editorHasDocumentFormattingProvider', \"Whether the editor has a document formatting provider\"));\n EditorContextKeys.hasDocumentSelectionFormattingProvider = new RawContextKey('editorHasDocumentSelectionFormattingProvider', false, nls.localize('editorHasDocumentSelectionFormattingProvider', \"Whether the editor has a document selection formatting provider\"));\n EditorContextKeys.hasMultipleDocumentFormattingProvider = new RawContextKey('editorHasMultipleDocumentFormattingProvider', false, nls.localize('editorHasMultipleDocumentFormattingProvider', \"Whether the editor has multiple document formatting providers\"));\n EditorContextKeys.hasMultipleDocumentSelectionFormattingProvider = new RawContextKey('editorHasMultipleDocumentSelectionFormattingProvider', false, nls.localize('editorHasMultipleDocumentSelectionFormattingProvider', \"Whether the editor has multiple document selection formatting providers\"));\n})(EditorContextKeys || (EditorContextKeys = {}));\n", "/*---------------------------------------------------------------------------------------------\n * 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 { Disposable } from '../../../base/common/lifecycle.js';\nexport class TextModelPart extends Disposable {\n constructor() {\n super(...arguments);\n this._isDisposed = false;\n }\n dispose() {\n super.dispose();\n this._isDisposed = true;\n }\n assertNotDisposed() {\n if (this._isDisposed) {\n throw new Error('TextModelPart is disposed!');\n }\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 * Returns:\n * - -1 => the line consists of whitespace\n * - otherwise => the indent level is returned value\n */\nexport function computeIndentLevel(line, tabSize) {\n let indent = 0;\n let i = 0;\n const len = line.length;\n while (i < len) {\n const chCode = line.charCodeAt(i);\n if (chCode === 32 /* CharCode.Space */) {\n indent++;\n }\n else if (chCode === 9 /* CharCode.Tab */) {\n indent = indent - indent % tabSize + tabSize;\n }\n else {\n break;\n }\n i++;\n }\n if (i === len) {\n return -1; // line only consists of whitespace\n }\n return indent;\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 *--------------------------------------------------------------------------------------------*/\nexport var HorizontalGuidesState;\n(function (HorizontalGuidesState) {\n HorizontalGuidesState[HorizontalGuidesState[\"Disabled\"] = 0] = \"Disabled\";\n HorizontalGuidesState[HorizontalGuidesState[\"EnabledForActive\"] = 1] = \"EnabledForActive\";\n HorizontalGuidesState[HorizontalGuidesState[\"Enabled\"] = 2] = \"Enabled\";\n})(HorizontalGuidesState || (HorizontalGuidesState = {}));\nexport class IndentGuide {\n constructor(visibleColumn, column, className, \n /**\n * If set, this indent guide is a horizontal guide (no vertical part).\n * It starts at visibleColumn and continues until endColumn.\n */\n horizontalLine, \n /**\n * If set (!= -1), only show this guide for wrapped lines that don't contain this model column, but are after it.\n */\n forWrappedLinesAfterColumn, forWrappedLinesBeforeOrAtColumn) {\n this.visibleColumn = visibleColumn;\n this.column = column;\n this.className = className;\n this.horizontalLine = horizontalLine;\n this.forWrappedLinesAfterColumn = forWrappedLinesAfterColumn;\n this.forWrappedLinesBeforeOrAtColumn = forWrappedLinesBeforeOrAtColumn;\n if ((visibleColumn !== -1) === (column !== -1)) {\n throw new Error();\n }\n }\n}\nexport class IndentGuideHorizontalLine {\n constructor(top, endColumn) {\n this.top = top;\n this.endColumn = endColumn;\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 *--------------------------------------------------------------------------------------------*/\nimport { findLast } from '../../../base/common/arraysFind.js';\nimport * as strings from '../../../base/common/strings.js';\nimport { CursorColumns } from '../core/cursorColumns.js';\nimport { Range } from '../core/range.js';\nimport { TextModelPart } from './textModelPart.js';\nimport { computeIndentLevel } from './utils.js';\nimport { HorizontalGuidesState, IndentGuide, IndentGuideHorizontalLine } from '../textModelGuides.js';\nimport { BugIndicatingError } from '../../../base/common/errors.js';\nexport class GuidesTextModelPart extends TextModelPart {\n constructor(textModel, languageConfigurationService) {\n super();\n this.textModel = textModel;\n this.languageConfigurationService = languageConfigurationService;\n }\n getLanguageConfiguration(languageId) {\n return this.languageConfigurationService.getLanguageConfiguration(languageId);\n }\n _computeIndentLevel(lineIndex) {\n return computeIndentLevel(this.textModel.getLineContent(lineIndex + 1), this.textModel.getOptions().tabSize);\n }\n getActiveIndentGuide(lineNumber, minLineNumber, maxLineNumber) {\n this.assertNotDisposed();\n const lineCount = this.textModel.getLineCount();\n if (lineNumber < 1 || lineNumber > lineCount) {\n throw new BugIndicatingError('Illegal value for lineNumber');\n }\n const foldingRules = this.getLanguageConfiguration(this.textModel.getLanguageId()).foldingRules;\n const offSide = Boolean(foldingRules && foldingRules.offSide);\n let up_aboveContentLineIndex = -2; /* -2 is a marker for not having computed it */\n let up_aboveContentLineIndent = -1;\n let up_belowContentLineIndex = -2; /* -2 is a marker for not having computed it */\n let up_belowContentLineIndent = -1;\n const up_resolveIndents = (lineNumber) => {\n if (up_aboveContentLineIndex !== -1 &&\n (up_aboveContentLineIndex === -2 ||\n up_aboveContentLineIndex > lineNumber - 1)) {\n up_aboveContentLineIndex = -1;\n up_aboveContentLineIndent = -1;\n // must find previous line with content\n for (let lineIndex = lineNumber - 2; lineIndex >= 0; lineIndex--) {\n const indent = this._computeIndentLevel(lineIndex);\n if (indent >= 0) {\n up_aboveContentLineIndex = lineIndex;\n up_aboveContentLineIndent = indent;\n break;\n }\n }\n }\n if (up_belowContentLineIndex === -2) {\n up_belowContentLineIndex = -1;\n up_belowContentLineIndent = -1;\n // must find next line with content\n for (let lineIndex = lineNumber; lineIndex < lineCount; lineIndex++) {\n const indent = this._computeIndentLevel(lineIndex);\n if (indent >= 0) {\n up_belowContentLineIndex = lineIndex;\n up_belowContentLineIndent = indent;\n break;\n }\n }\n }\n };\n let down_aboveContentLineIndex = -2; /* -2 is a marker for not having computed it */\n let down_aboveContentLineIndent = -1;\n let down_belowContentLineIndex = -2; /* -2 is a marker for not having computed it */\n let down_belowContentLineIndent = -1;\n const down_resolveIndents = (lineNumber) => {\n if (down_aboveContentLineIndex === -2) {\n down_aboveContentLineIndex = -1;\n down_aboveContentLineIndent = -1;\n // must find previous line with content\n for (let lineIndex = lineNumber - 2; lineIndex >= 0; lineIndex--) {\n const indent = this._computeIndentLevel(lineIndex);\n if (indent >= 0) {\n down_aboveContentLineIndex = lineIndex;\n down_aboveContentLineIndent = indent;\n break;\n }\n }\n }\n if (down_belowContentLineIndex !== -1 &&\n (down_belowContentLineIndex === -2 ||\n down_belowContentLineIndex < lineNumber - 1)) {\n down_belowContentLineIndex = -1;\n down_belowContentLineIndent = -1;\n // must find next line with content\n for (let lineIndex = lineNumber; lineIndex < lineCount; lineIndex++) {\n const indent = this._computeIndentLevel(lineIndex);\n if (indent >= 0) {\n down_belowContentLineIndex = lineIndex;\n down_belowContentLineIndent = indent;\n break;\n }\n }\n }\n };\n let startLineNumber = 0;\n let goUp = true;\n let endLineNumber = 0;\n let goDown = true;\n let indent = 0;\n let initialIndent = 0;\n for (let distance = 0; goUp || goDown; distance++) {\n const upLineNumber = lineNumber - distance;\n const downLineNumber = lineNumber + distance;\n if (distance > 1 && (upLineNumber < 1 || upLineNumber < minLineNumber)) {\n goUp = false;\n }\n if (distance > 1 &&\n (downLineNumber > lineCount || downLineNumber > maxLineNumber)) {\n goDown = false;\n }\n if (distance > 50000) {\n // stop processing\n goUp = false;\n goDown = false;\n }\n let upLineIndentLevel = -1;\n if (goUp && upLineNumber >= 1) {\n // compute indent level going up\n const currentIndent = this._computeIndentLevel(upLineNumber - 1);\n if (currentIndent >= 0) {\n // This line has content (besides whitespace)\n // Use the line's indent\n up_belowContentLineIndex = upLineNumber - 1;\n up_belowContentLineIndent = currentIndent;\n upLineIndentLevel = Math.ceil(currentIndent / this.textModel.getOptions().indentSize);\n }\n else {\n up_resolveIndents(upLineNumber);\n upLineIndentLevel = this._getIndentLevelForWhitespaceLine(offSide, up_aboveContentLineIndent, up_belowContentLineIndent);\n }\n }\n let downLineIndentLevel = -1;\n if (goDown && downLineNumber <= lineCount) {\n // compute indent level going down\n const currentIndent = this._computeIndentLevel(downLineNumber - 1);\n if (currentIndent >= 0) {\n // This line has content (besides whitespace)\n // Use the line's indent\n down_aboveContentLineIndex = downLineNumber - 1;\n down_aboveContentLineIndent = currentIndent;\n downLineIndentLevel = Math.ceil(currentIndent / this.textModel.getOptions().indentSize);\n }\n else {\n down_resolveIndents(downLineNumber);\n downLineIndentLevel = this._getIndentLevelForWhitespaceLine(offSide, down_aboveContentLineIndent, down_belowContentLineIndent);\n }\n }\n if (distance === 0) {\n initialIndent = upLineIndentLevel;\n continue;\n }\n if (distance === 1) {\n if (downLineNumber <= lineCount &&\n downLineIndentLevel >= 0 &&\n initialIndent + 1 === downLineIndentLevel) {\n // This is the beginning of a scope, we have special handling here, since we want the\n // child scope indent to be active, not the parent scope\n goUp = false;\n startLineNumber = downLineNumber;\n endLineNumber = downLineNumber;\n indent = downLineIndentLevel;\n continue;\n }\n if (upLineNumber >= 1 &&\n upLineIndentLevel >= 0 &&\n upLineIndentLevel - 1 === initialIndent) {\n // This is the end of a scope, just like above\n goDown = false;\n startLineNumber = upLineNumber;\n endLineNumber = upLineNumber;\n indent = upLineIndentLevel;\n continue;\n }\n startLineNumber = lineNumber;\n endLineNumber = lineNumber;\n indent = initialIndent;\n if (indent === 0) {\n // No need to continue\n return { startLineNumber, endLineNumber, indent };\n }\n }\n if (goUp) {\n if (upLineIndentLevel >= indent) {\n startLineNumber = upLineNumber;\n }\n else {\n goUp = false;\n }\n }\n if (goDown) {\n if (downLineIndentLevel >= indent) {\n endLineNumber = downLineNumber;\n }\n else {\n goDown = false;\n }\n }\n }\n return { startLineNumber, endLineNumber, indent };\n }\n getLinesBracketGuides(startLineNumber, endLineNumber, activePosition, options) {\n var _a;\n const result = [];\n for (let lineNumber = startLineNumber; lineNumber <= endLineNumber; lineNumber++) {\n result.push([]);\n }\n // If requested, this could be made configurable.\n const includeSingleLinePairs = true;\n const bracketPairs = this.textModel.bracketPairs.getBracketPairsInRangeWithMinIndentation(new Range(startLineNumber, 1, endLineNumber, this.textModel.getLineMaxColumn(endLineNumber))).toArray();\n let activeBracketPairRange = undefined;\n if (activePosition && bracketPairs.length > 0) {\n const bracketsContainingActivePosition = (startLineNumber <= activePosition.lineNumber &&\n activePosition.lineNumber <= endLineNumber\n // We don't need to query the brackets again if the cursor is in the viewport\n ? bracketPairs\n : this.textModel.bracketPairs.getBracketPairsInRange(Range.fromPositions(activePosition)).toArray()).filter((bp) => Range.strictContainsPosition(bp.range, activePosition));\n activeBracketPairRange = (_a = findLast(bracketsContainingActivePosition, (i) => includeSingleLinePairs || i.range.startLineNumber !== i.range.endLineNumber)) === null || _a === void 0 ? void 0 : _a.range;\n }\n const independentColorPoolPerBracketType = this.textModel.getOptions().bracketPairColorizationOptions.independentColorPoolPerBracketType;\n const colorProvider = new BracketPairGuidesClassNames();\n for (const pair of bracketPairs) {\n /*\n\n\n {\n |\n }\n\n {\n |\n ----}\n\n ____{\n |test\n ----}\n\n renderHorizontalEndLineAtTheBottom:\n {\n |\n |x}\n --\n renderHorizontalEndLineAtTheBottom:\n ____{\n |test\n | x }\n ----\n */\n if (!pair.closingBracketRange) {\n continue;\n }\n const isActive = activeBracketPairRange && pair.range.equalsRange(activeBracketPairRange);\n if (!isActive && !options.includeInactive) {\n continue;\n }\n const className = colorProvider.getInlineClassName(pair.nestingLevel, pair.nestingLevelOfEqualBracketType, independentColorPoolPerBracketType) +\n (options.highlightActive && isActive\n ? ' ' + colorProvider.activeClassName\n : '');\n const start = pair.openingBracketRange.getStartPosition();\n const end = pair.closingBracketRange.getStartPosition();\n const horizontalGuides = options.horizontalGuides === HorizontalGuidesState.Enabled || (options.horizontalGuides === HorizontalGuidesState.EnabledForActive && isActive);\n if (pair.range.startLineNumber === pair.range.endLineNumber) {\n if (includeSingleLinePairs && horizontalGuides) {\n result[pair.range.startLineNumber - startLineNumber].push(new IndentGuide(-1, pair.openingBracketRange.getEndPosition().column, className, new IndentGuideHorizontalLine(false, end.column), -1, -1));\n }\n continue;\n }\n const endVisibleColumn = this.getVisibleColumnFromPosition(end);\n const startVisibleColumn = this.getVisibleColumnFromPosition(pair.openingBracketRange.getStartPosition());\n const guideVisibleColumn = Math.min(startVisibleColumn, endVisibleColumn, pair.minVisibleColumnIndentation + 1);\n let renderHorizontalEndLineAtTheBottom = false;\n const firstNonWsIndex = strings.firstNonWhitespaceIndex(this.textModel.getLineContent(pair.closingBracketRange.startLineNumber));\n const hasTextBeforeClosingBracket = firstNonWsIndex < pair.closingBracketRange.startColumn - 1;\n if (hasTextBeforeClosingBracket) {\n renderHorizontalEndLineAtTheBottom = true;\n }\n const visibleGuideStartLineNumber = Math.max(start.lineNumber, startLineNumber);\n const visibleGuideEndLineNumber = Math.min(end.lineNumber, endLineNumber);\n const offset = renderHorizontalEndLineAtTheBottom ? 1 : 0;\n for (let l = visibleGuideStartLineNumber; l < visibleGuideEndLineNumber + offset; l++) {\n result[l - startLineNumber].push(new IndentGuide(guideVisibleColumn, -1, className, null, l === start.lineNumber ? start.column : -1, l === end.lineNumber ? end.column : -1));\n }\n if (horizontalGuides) {\n if (start.lineNumber >= startLineNumber && startVisibleColumn > guideVisibleColumn) {\n result[start.lineNumber - startLineNumber].push(new IndentGuide(guideVisibleColumn, -1, className, new IndentGuideHorizontalLine(false, start.column), -1, -1));\n }\n if (end.lineNumber <= endLineNumber && endVisibleColumn > guideVisibleColumn) {\n result[end.lineNumber - startLineNumber].push(new IndentGuide(guideVisibleColumn, -1, className, new IndentGuideHorizontalLine(!renderHorizontalEndLineAtTheBottom, end.column), -1, -1));\n }\n }\n }\n for (const guides of result) {\n guides.sort((a, b) => a.visibleColumn - b.visibleColumn);\n }\n return result;\n }\n getVisibleColumnFromPosition(position) {\n return (CursorColumns.visibleColumnFromColumn(this.textModel.getLineContent(position.lineNumber), position.column, this.textModel.getOptions().tabSize) + 1);\n }\n getLinesIndentGuides(startLineNumber, endLineNumber) {\n this.assertNotDisposed();\n const lineCount = this.textModel.getLineCount();\n if (startLineNumber < 1 || startLineNumber > lineCount) {\n throw new Error('Illegal value for startLineNumber');\n }\n if (endLineNumber < 1 || endLineNumber > lineCount) {\n throw new Error('Illegal value for endLineNumber');\n }\n const options = this.textModel.getOptions();\n const foldingRules = this.getLanguageConfiguration(this.textModel.getLanguageId()).foldingRules;\n const offSide = Boolean(foldingRules && foldingRules.offSide);\n const result = new Array(endLineNumber - startLineNumber + 1);\n let aboveContentLineIndex = -2; /* -2 is a marker for not having computed it */\n let aboveContentLineIndent = -1;\n let belowContentLineIndex = -2; /* -2 is a marker for not having computed it */\n let belowContentLineIndent = -1;\n for (let lineNumber = startLineNumber; lineNumber <= endLineNumber; lineNumber++) {\n const resultIndex = lineNumber - startLineNumber;\n const currentIndent = this._computeIndentLevel(lineNumber - 1);\n if (currentIndent >= 0) {\n // This line has content (besides whitespace)\n // Use the line's indent\n aboveContentLineIndex = lineNumber - 1;\n aboveContentLineIndent = currentIndent;\n result[resultIndex] = Math.ceil(currentIndent / options.indentSize);\n continue;\n }\n if (aboveContentLineIndex === -2) {\n aboveContentLineIndex = -1;\n aboveContentLineIndent = -1;\n // must find previous line with content\n for (let lineIndex = lineNumber - 2; lineIndex >= 0; lineIndex--) {\n const indent = this._computeIndentLevel(lineIndex);\n if (indent >= 0) {\n aboveContentLineIndex = lineIndex;\n aboveContentLineIndent = indent;\n break;\n }\n }\n }\n if (belowContentLineIndex !== -1 &&\n (belowContentLineIndex === -2 || belowContentLineIndex < lineNumber - 1)) {\n belowContentLineIndex = -1;\n belowContentLineIndent = -1;\n // must find next line with content\n for (let lineIndex = lineNumber; lineIndex < lineCount; lineIndex++) {\n const indent = this._computeIndentLevel(lineIndex);\n if (indent >= 0) {\n belowContentLineIndex = lineIndex;\n belowContentLineIndent = indent;\n break;\n }\n }\n }\n result[resultIndex] = this._getIndentLevelForWhitespaceLine(offSide, aboveContentLineIndent, belowContentLineIndent);\n }\n return result;\n }\n _getIndentLevelForWhitespaceLine(offSide, aboveContentLineIndent, belowContentLineIndent) {\n const options = this.textModel.getOptions();\n if (aboveContentLineIndent === -1 || belowContentLineIndent === -1) {\n // At the top or bottom of the file\n return 0;\n }\n else if (aboveContentLineIndent < belowContentLineIndent) {\n // we are inside the region above\n return 1 + Math.floor(aboveContentLineIndent / options.indentSize);\n }\n else if (aboveContentLineIndent === belowContentLineIndent) {\n // we are in between two regions\n return Math.ceil(belowContentLineIndent / options.indentSize);\n }\n else {\n if (offSide) {\n // same level as region below\n return Math.ceil(belowContentLineIndent / options.indentSize);\n }\n else {\n // we are inside the region that ends below\n return 1 + Math.floor(belowContentLineIndent / options.indentSize);\n }\n }\n }\n}\nexport class BracketPairGuidesClassNames {\n constructor() {\n this.activeClassName = 'indent-active';\n }\n getInlineClassName(nestingLevel, nestingLevelOfEqualBracketType, independentColorPoolPerBracketType) {\n return this.getInlineClassNameOfLevel(independentColorPoolPerBracketType ? nestingLevelOfEqualBracketType : nestingLevel);\n }\n getInlineClassNameOfLevel(level) {\n // To support a dynamic amount of colors up to 6 colors,\n // we use a number that is a lcm of all numbers from 1 to 6.\n return `bracket-indent-guide lvl-${level % 30}`;\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 * An event describing that a model has been reset to a new value.\n * @internal\n */\nexport class ModelRawFlush {\n constructor() {\n this.changeType = 1 /* RawContentChangedType.Flush */;\n }\n}\n/**\n * Represents text injected on a line\n * @internal\n */\nexport class LineInjectedText {\n static applyInjectedText(lineText, injectedTexts) {\n if (!injectedTexts || injectedTexts.length === 0) {\n return lineText;\n }\n let result = '';\n let lastOriginalOffset = 0;\n for (const injectedText of injectedTexts) {\n result += lineText.substring(lastOriginalOffset, injectedText.column - 1);\n lastOriginalOffset = injectedText.column - 1;\n result += injectedText.options.content;\n }\n result += lineText.substring(lastOriginalOffset);\n return result;\n }\n static fromDecorations(decorations) {\n const result = [];\n for (const decoration of decorations) {\n if (decoration.options.before && decoration.options.before.content.length > 0) {\n result.push(new LineInjectedText(decoration.ownerId, decoration.range.startLineNumber, decoration.range.startColumn, decoration.options.before, 0));\n }\n if (decoration.options.after && decoration.options.after.content.length > 0) {\n result.push(new LineInjectedText(decoration.ownerId, decoration.range.endLineNumber, decoration.range.endColumn, decoration.options.after, 1));\n }\n }\n result.sort((a, b) => {\n if (a.lineNumber === b.lineNumber) {\n if (a.column === b.column) {\n return a.order - b.order;\n }\n return a.column - b.column;\n }\n return a.lineNumber - b.lineNumber;\n });\n return result;\n }\n constructor(ownerId, lineNumber, column, options, order) {\n this.ownerId = ownerId;\n this.lineNumber = lineNumber;\n this.column = column;\n this.options = options;\n this.order = order;\n }\n}\n/**\n * An event describing that a line has changed in a model.\n * @internal\n */\nexport class ModelRawLineChanged {\n constructor(lineNumber, detail, injectedText) {\n this.changeType = 2 /* RawContentChangedType.LineChanged */;\n this.lineNumber = lineNumber;\n this.detail = detail;\n this.injectedText = injectedText;\n }\n}\n/**\n * An event describing that line(s) have been deleted in a model.\n * @internal\n */\nexport class ModelRawLinesDeleted {\n constructor(fromLineNumber, toLineNumber) {\n this.changeType = 3 /* RawContentChangedType.LinesDeleted */;\n this.fromLineNumber = fromLineNumber;\n this.toLineNumber = toLineNumber;\n }\n}\n/**\n * An event describing that line(s) have been inserted in a model.\n * @internal\n */\nexport class ModelRawLinesInserted {\n constructor(fromLineNumber, toLineNumber, detail, injectedTexts) {\n this.changeType = 4 /* RawContentChangedType.LinesInserted */;\n this.injectedTexts = injectedTexts;\n this.fromLineNumber = fromLineNumber;\n this.toLineNumber = toLineNumber;\n this.detail = detail;\n }\n}\n/**\n * An event describing that a model has had its EOL changed.\n * @internal\n */\nexport class ModelRawEOLChanged {\n constructor() {\n this.changeType = 5 /* RawContentChangedType.EOLChanged */;\n }\n}\n/**\n * An event describing a change in the text of a model.\n * @internal\n */\nexport class ModelRawContentChangedEvent {\n constructor(changes, versionId, isUndoing, isRedoing) {\n this.changes = changes;\n this.versionId = versionId;\n this.isUndoing = isUndoing;\n this.isRedoing = isRedoing;\n this.resultingSelection = null;\n }\n containsEvent(type) {\n for (let i = 0, len = this.changes.length; i < len; i++) {\n const change = this.changes[i];\n if (change.changeType === type) {\n return true;\n }\n }\n return false;\n }\n static merge(a, b) {\n const changes = [].concat(a.changes).concat(b.changes);\n const versionId = b.versionId;\n const isUndoing = (a.isUndoing || b.isUndoing);\n const isRedoing = (a.isRedoing || b.isRedoing);\n return new ModelRawContentChangedEvent(changes, versionId, isUndoing, isRedoing);\n }\n}\n/**\n * An event describing a change in injected text.\n * @internal\n */\nexport class ModelInjectedTextChangedEvent {\n constructor(changes) {\n this.changes = changes;\n }\n}\n/**\n * @internal\n */\nexport class InternalModelContentChangeEvent {\n constructor(rawContentChangedEvent, contentChangedEvent) {\n this.rawContentChangedEvent = rawContentChangedEvent;\n this.contentChangedEvent = contentChangedEvent;\n }\n merge(other) {\n const rawContentChangedEvent = ModelRawContentChangedEvent.merge(this.rawContentChangedEvent, other.rawContentChangedEvent);\n const contentChangedEvent = InternalModelContentChangeEvent._mergeChangeEvents(this.contentChangedEvent, other.contentChangedEvent);\n return new InternalModelContentChangeEvent(rawContentChangedEvent, contentChangedEvent);\n }\n static _mergeChangeEvents(a, b) {\n const changes = [].concat(a.changes).concat(b.changes);\n const eol = b.eol;\n const versionId = b.versionId;\n const isUndoing = (a.isUndoing || b.isUndoing);\n const isRedoing = (a.isRedoing || b.isRedoing);\n const isFlush = (a.isFlush || b.isFlush);\n const isEolChange = a.isEolChange && b.isEolChange; // both must be true to not confuse listeners who skip such edits\n return {\n changes: changes,\n eol: eol,\n isEolChange: isEolChange,\n versionId: versionId,\n isUndoing: isUndoing,\n isRedoing: isRedoing,\n isFlush: isFlush,\n };\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 *--------------------------------------------------------------------------------------------*/\nexport function countEOL(text) {\n let eolCount = 0;\n let firstLineLength = 0;\n let lastLineStart = 0;\n let eol = 0 /* StringEOL.Unknown */;\n for (let i = 0, len = text.length; i < len; i++) {\n const chr = text.charCodeAt(i);\n if (chr === 13 /* CharCode.CarriageReturn */) {\n if (eolCount === 0) {\n firstLineLength = i;\n }\n eolCount++;\n if (i + 1 < len && text.charCodeAt(i + 1) === 10 /* CharCode.LineFeed */) {\n // \\r\\n... case\n eol |= 2 /* StringEOL.CRLF */;\n i++; // skip \\n\n }\n else {\n // \\r... case\n eol |= 3 /* StringEOL.Invalid */;\n }\n lastLineStart = i + 1;\n }\n else if (chr === 10 /* CharCode.LineFeed */) {\n // \\n... case\n eol |= 1 /* StringEOL.LF */;\n if (eolCount === 0) {\n firstLineLength = i;\n }\n eolCount++;\n lastLineStart = i + 1;\n }\n }\n if (eolCount === 0) {\n firstLineLength = text.length;\n }\n return [eolCount, firstLineLength, text.length - lastLineStart, eol];\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 *--------------------------------------------------------------------------------------------*/\nexport class BracketInfo {\n constructor(range, \n /** 0-based level */\n nestingLevel, nestingLevelOfEqualBracketType, isInvalid) {\n this.range = range;\n this.nestingLevel = nestingLevel;\n this.nestingLevelOfEqualBracketType = nestingLevelOfEqualBracketType;\n this.isInvalid = isInvalid;\n }\n}\nexport class BracketPairInfo {\n constructor(range, openingBracketRange, closingBracketRange, \n /** 0-based */\n nestingLevel, nestingLevelOfEqualBracketType, bracketPairNode) {\n this.range = range;\n this.openingBracketRange = openingBracketRange;\n this.closingBracketRange = closingBracketRange;\n this.nestingLevel = nestingLevel;\n this.nestingLevelOfEqualBracketType = nestingLevelOfEqualBracketType;\n this.bracketPairNode = bracketPairNode;\n }\n get openingBracketInfo() {\n return this.bracketPairNode.openingBracket.bracketInfo;\n }\n}\nexport class BracketPairWithMinIndentationInfo extends BracketPairInfo {\n constructor(range, openingBracketRange, closingBracketRange, \n /**\n * 0-based\n */\n nestingLevel, nestingLevelOfEqualBracketType, bracketPairNode, \n /**\n * -1 if not requested, otherwise the size of the minimum indentation in the bracket pair in terms of visible columns.\n */\n minVisibleColumnIndentation) {\n super(range, openingBracketRange, closingBracketRange, nestingLevel, nestingLevelOfEqualBracketType, bracketPairNode);\n this.minVisibleColumnIndentation = minVisibleColumnIndentation;\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 *--------------------------------------------------------------------------------------------*/\nimport { splitLines } from '../../../../../base/common/strings.js';\nimport { Range } from '../../../core/range.js';\nimport { TextLength } from '../../../core/textLength.js';\n/**\n * The end must be greater than or equal to the start.\n*/\nexport function lengthDiff(startLineCount, startColumnCount, endLineCount, endColumnCount) {\n return (startLineCount !== endLineCount)\n ? toLength(endLineCount - startLineCount, endColumnCount)\n : toLength(0, endColumnCount - startColumnCount);\n}\nexport const lengthZero = 0;\nexport function lengthIsZero(length) {\n return length === 0;\n}\n/*\n * We have 52 bits available in a JS number.\n * We use the upper 26 bits to store the line and the lower 26 bits to store the column.\n */\n///*\nconst factor = 2 ** 26;\n/*/\nconst factor = 1000000;\n// */\nexport function toLength(lineCount, columnCount) {\n // llllllllllllllllllllllllllcccccccccccccccccccccccccc (52 bits)\n // line count (26 bits) column count (26 bits)\n // If there is no overflow (all values/sums below 2^26 = 67108864),\n // we have `toLength(lns1, cols1) + toLength(lns2, cols2) = toLength(lns1 + lns2, cols1 + cols2)`.\n return (lineCount * factor + columnCount);\n}\nexport function lengthToObj(length) {\n const l = length;\n const lineCount = Math.floor(l / factor);\n const columnCount = l - lineCount * factor;\n return new TextLength(lineCount, columnCount);\n}\nexport function lengthGetLineCount(length) {\n return Math.floor(length / factor);\n}\n/**\n * Returns the amount of columns of the given length, assuming that it does not span any line.\n*/\nexport function lengthGetColumnCountIfZeroLineCount(length) {\n return length;\n}\nexport function lengthAdd(l1, l2) {\n let r = l1 + l2;\n if (l2 >= factor) {\n r = r - (l1 % factor);\n }\n return r;\n}\nexport function sumLengths(items, lengthFn) {\n return items.reduce((a, b) => lengthAdd(a, lengthFn(b)), lengthZero);\n}\nexport function lengthEquals(length1, length2) {\n return length1 === length2;\n}\n/**\n * Returns a non negative length `result` such that `lengthAdd(length1, result) = length2`, or zero if such length does not exist.\n */\nexport function lengthDiffNonNegative(length1, length2) {\n const l1 = length1;\n const l2 = length2;\n const diff = l2 - l1;\n if (diff <= 0) {\n // line-count of length1 is higher than line-count of length2\n // or they are equal and column-count of length1 is higher than column-count of length2\n return lengthZero;\n }\n const lineCount1 = Math.floor(l1 / factor);\n const lineCount2 = Math.floor(l2 / factor);\n const colCount2 = l2 - lineCount2 * factor;\n if (lineCount1 === lineCount2) {\n const colCount1 = l1 - lineCount1 * factor;\n return toLength(0, colCount2 - colCount1);\n }\n else {\n return toLength(lineCount2 - lineCount1, colCount2);\n }\n}\nexport function lengthLessThan(length1, length2) {\n // First, compare line counts, then column counts.\n return length1 < length2;\n}\nexport function lengthLessThanEqual(length1, length2) {\n return length1 <= length2;\n}\nexport function lengthGreaterThanEqual(length1, length2) {\n return length1 >= length2;\n}\nexport function positionToLength(position) {\n return toLength(position.lineNumber - 1, position.column - 1);\n}\nexport function lengthsToRange(lengthStart, lengthEnd) {\n const l = lengthStart;\n const lineCount = Math.floor(l / factor);\n const colCount = l - lineCount * factor;\n const l2 = lengthEnd;\n const lineCount2 = Math.floor(l2 / factor);\n const colCount2 = l2 - lineCount2 * factor;\n return new Range(lineCount + 1, colCount + 1, lineCount2 + 1, colCount2 + 1);\n}\nexport function lengthOfString(str) {\n const lines = splitLines(str);\n return toLength(lines.length - 1, lines[lines.length - 1].length);\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 { Range } from '../../../core/range.js';\nimport { lengthAdd, lengthDiffNonNegative, lengthLessThanEqual, lengthOfString, lengthToObj, positionToLength, toLength } from './length.js';\nexport class TextEditInfo {\n static fromModelContentChanges(changes) {\n // Must be sorted in ascending order\n const edits = changes.map(c => {\n const range = Range.lift(c.range);\n return new TextEditInfo(positionToLength(range.getStartPosition()), positionToLength(range.getEndPosition()), lengthOfString(c.text));\n }).reverse();\n return edits;\n }\n constructor(startOffset, endOffset, newLength) {\n this.startOffset = startOffset;\n this.endOffset = endOffset;\n this.newLength = newLength;\n }\n toString() {\n return `[${lengthToObj(this.startOffset)}...${lengthToObj(this.endOffset)}) -> ${lengthToObj(this.newLength)}`;\n }\n}\nexport class BeforeEditPositionMapper {\n /**\n * @param edits Must be sorted by offset in ascending order.\n */\n constructor(edits) {\n this.nextEditIdx = 0;\n this.deltaOldToNewLineCount = 0;\n this.deltaOldToNewColumnCount = 0;\n this.deltaLineIdxInOld = -1;\n this.edits = edits.map(edit => TextEditInfoCache.from(edit));\n }\n /**\n * @param offset Must be equal to or greater than the last offset this method has been called with.\n */\n getOffsetBeforeChange(offset) {\n this.adjustNextEdit(offset);\n return this.translateCurToOld(offset);\n }\n /**\n * @param offset Must be equal to or greater than the last offset this method has been called with.\n * Returns null if there is no edit anymore.\n */\n getDistanceToNextChange(offset) {\n this.adjustNextEdit(offset);\n const nextEdit = this.edits[this.nextEditIdx];\n const nextChangeOffset = nextEdit ? this.translateOldToCur(nextEdit.offsetObj) : null;\n if (nextChangeOffset === null) {\n return null;\n }\n return lengthDiffNonNegative(offset, nextChangeOffset);\n }\n translateOldToCur(oldOffsetObj) {\n if (oldOffsetObj.lineCount === this.deltaLineIdxInOld) {\n return toLength(oldOffsetObj.lineCount + this.deltaOldToNewLineCount, oldOffsetObj.columnCount + this.deltaOldToNewColumnCount);\n }\n else {\n return toLength(oldOffsetObj.lineCount + this.deltaOldToNewLineCount, oldOffsetObj.columnCount);\n }\n }\n translateCurToOld(newOffset) {\n const offsetObj = lengthToObj(newOffset);\n if (offsetObj.lineCount - this.deltaOldToNewLineCount === this.deltaLineIdxInOld) {\n return toLength(offsetObj.lineCount - this.deltaOldToNewLineCount, offsetObj.columnCount - this.deltaOldToNewColumnCount);\n }\n else {\n return toLength(offsetObj.lineCount - this.deltaOldToNewLineCount, offsetObj.columnCount);\n }\n }\n adjustNextEdit(offset) {\n while (this.nextEditIdx < this.edits.length) {\n const nextEdit = this.edits[this.nextEditIdx];\n // After applying the edit, what is its end offset (considering all previous edits)?\n const nextEditEndOffsetInCur = this.translateOldToCur(nextEdit.endOffsetAfterObj);\n if (lengthLessThanEqual(nextEditEndOffsetInCur, offset)) {\n // We are after the edit, skip it\n this.nextEditIdx++;\n const nextEditEndOffsetInCurObj = lengthToObj(nextEditEndOffsetInCur);\n // Before applying the edit, what is its end offset (considering all previous edits)?\n const nextEditEndOffsetBeforeInCurObj = lengthToObj(this.translateOldToCur(nextEdit.endOffsetBeforeObj));\n const lineDelta = nextEditEndOffsetInCurObj.lineCount - nextEditEndOffsetBeforeInCurObj.lineCount;\n this.deltaOldToNewLineCount += lineDelta;\n const previousColumnDelta = this.deltaLineIdxInOld === nextEdit.endOffsetBeforeObj.lineCount ? this.deltaOldToNewColumnCount : 0;\n const columnDelta = nextEditEndOffsetInCurObj.columnCount - nextEditEndOffsetBeforeInCurObj.columnCount;\n this.deltaOldToNewColumnCount = previousColumnDelta + columnDelta;\n this.deltaLineIdxInOld = nextEdit.endOffsetBeforeObj.lineCount;\n }\n else {\n // We are in or before the edit.\n break;\n }\n }\n }\n}\nclass TextEditInfoCache {\n static from(edit) {\n return new TextEditInfoCache(edit.startOffset, edit.endOffset, edit.newLength);\n }\n constructor(startOffset, endOffset, textLength) {\n this.endOffsetBeforeObj = lengthToObj(endOffset);\n this.endOffsetAfterObj = lengthToObj(lengthAdd(startOffset, textLength));\n this.offsetObj = lengthToObj(startOffset);\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 *--------------------------------------------------------------------------------------------*/\nconst emptyArr = [];\n/**\n * Represents an immutable set that works best for a small number of elements (less than 32).\n * It uses bits to encode element membership efficiently.\n*/\nexport class SmallImmutableSet {\n static create(items, additionalItems) {\n if (items <= 128 && additionalItems.length === 0) {\n // We create a cache of 128=2^7 elements to cover all sets with up to 7 (dense) elements.\n let cached = SmallImmutableSet.cache[items];\n if (!cached) {\n cached = new SmallImmutableSet(items, additionalItems);\n SmallImmutableSet.cache[items] = cached;\n }\n return cached;\n }\n return new SmallImmutableSet(items, additionalItems);\n }\n static getEmpty() {\n return this.empty;\n }\n constructor(items, additionalItems) {\n this.items = items;\n this.additionalItems = additionalItems;\n }\n add(value, keyProvider) {\n const key = keyProvider.getKey(value);\n let idx = key >> 5; // divided by 32\n if (idx === 0) {\n // fast path\n const newItem = (1 << key) | this.items;\n if (newItem === this.items) {\n return this;\n }\n return SmallImmutableSet.create(newItem, this.additionalItems);\n }\n idx--;\n const newItems = this.additionalItems.slice(0);\n while (newItems.length < idx) {\n newItems.push(0);\n }\n newItems[idx] |= 1 << (key & 31);\n return SmallImmutableSet.create(this.items, newItems);\n }\n merge(other) {\n const merged = this.items | other.items;\n if (this.additionalItems === emptyArr && other.additionalItems === emptyArr) {\n // fast path\n if (merged === this.items) {\n return this;\n }\n if (merged === other.items) {\n return other;\n }\n return SmallImmutableSet.create(merged, emptyArr);\n }\n // This can be optimized, but it's not a common case\n const newItems = [];\n for (let i = 0; i < Math.max(this.additionalItems.length, other.additionalItems.length); i++) {\n const item1 = this.additionalItems[i] || 0;\n const item2 = other.additionalItems[i] || 0;\n newItems.push(item1 | item2);\n }\n return SmallImmutableSet.create(merged, newItems);\n }\n intersects(other) {\n if ((this.items & other.items) !== 0) {\n return true;\n }\n for (let i = 0; i < Math.min(this.additionalItems.length, other.additionalItems.length); i++) {\n if ((this.additionalItems[i] & other.additionalItems[i]) !== 0) {\n return true;\n }\n }\n return false;\n }\n}\nSmallImmutableSet.cache = new Array(129);\nSmallImmutableSet.empty = SmallImmutableSet.create(0, emptyArr);\nexport const identityKeyProvider = {\n getKey(value) {\n return value;\n }\n};\n/**\n * Assigns values a unique incrementing key.\n*/\nexport class DenseKeyProvider {\n constructor() {\n this.items = new Map();\n }\n getKey(value) {\n let existing = this.items.get(value);\n if (existing === undefined) {\n existing = this.items.size;\n this.items.set(value, existing);\n }\n return existing;\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 *--------------------------------------------------------------------------------------------*/\nimport { BugIndicatingError } from '../../../../../base/common/errors.js';\nimport { CursorColumns } from '../../../core/cursorColumns.js';\nimport { lengthAdd, lengthGetLineCount, lengthToObj, lengthZero } from './length.js';\nimport { SmallImmutableSet } from './smallImmutableSet.js';\n/**\n * The base implementation for all AST nodes.\n*/\nclass BaseAstNode {\n /**\n * The length of the entire node, which should equal the sum of lengths of all children.\n */\n get length() {\n return this._length;\n }\n constructor(length) {\n this._length = length;\n }\n}\n/**\n * Represents a bracket pair including its child (e.g. `{ ... }`).\n * Might be unclosed.\n * Immutable, if all children are immutable.\n*/\nexport class PairAstNode extends BaseAstNode {\n static create(openingBracket, child, closingBracket) {\n let length = openingBracket.length;\n if (child) {\n length = lengthAdd(length, child.length);\n }\n if (closingBracket) {\n length = lengthAdd(length, closingBracket.length);\n }\n return new PairAstNode(length, openingBracket, child, closingBracket, child ? child.missingOpeningBracketIds : SmallImmutableSet.getEmpty());\n }\n get kind() {\n return 2 /* AstNodeKind.Pair */;\n }\n get listHeight() {\n return 0;\n }\n get childrenLength() {\n return 3;\n }\n getChild(idx) {\n switch (idx) {\n case 0: return this.openingBracket;\n case 1: return this.child;\n case 2: return this.closingBracket;\n }\n throw new Error('Invalid child index');\n }\n /**\n * Avoid using this property, it allocates an array!\n */\n get children() {\n const result = [];\n result.push(this.openingBracket);\n if (this.child) {\n result.push(this.child);\n }\n if (this.closingBracket) {\n result.push(this.closingBracket);\n }\n return result;\n }\n constructor(length, openingBracket, child, closingBracket, missingOpeningBracketIds) {\n super(length);\n this.openingBracket = openingBracket;\n this.child = child;\n this.closingBracket = closingBracket;\n this.missingOpeningBracketIds = missingOpeningBracketIds;\n }\n canBeReused(openBracketIds) {\n if (this.closingBracket === null) {\n // Unclosed pair ast nodes only\n // end at the end of the document\n // or when a parent node is closed.\n // This could be improved:\n // Only return false if some next token is neither \"undefined\" nor a bracket that closes a parent.\n return false;\n }\n if (openBracketIds.intersects(this.missingOpeningBracketIds)) {\n return false;\n }\n return true;\n }\n deepClone() {\n return new PairAstNode(this.length, this.openingBracket.deepClone(), this.child && this.child.deepClone(), this.closingBracket && this.closingBracket.deepClone(), this.missingOpeningBracketIds);\n }\n computeMinIndentation(offset, textModel) {\n return this.child ? this.child.computeMinIndentation(lengthAdd(offset, this.openingBracket.length), textModel) : Number.MAX_SAFE_INTEGER;\n }\n}\nexport class ListAstNode extends BaseAstNode {\n /**\n * This method uses more memory-efficient list nodes that can only store 2 or 3 children.\n */\n static create23(item1, item2, item3, immutable = false) {\n let length = item1.length;\n let missingBracketIds = item1.missingOpeningBracketIds;\n if (item1.listHeight !== item2.listHeight) {\n throw new Error('Invalid list heights');\n }\n length = lengthAdd(length, item2.length);\n missingBracketIds = missingBracketIds.merge(item2.missingOpeningBracketIds);\n if (item3) {\n if (item1.listHeight !== item3.listHeight) {\n throw new Error('Invalid list heights');\n }\n length = lengthAdd(length, item3.length);\n missingBracketIds = missingBracketIds.merge(item3.missingOpeningBracketIds);\n }\n return immutable\n ? new Immutable23ListAstNode(length, item1.listHeight + 1, item1, item2, item3, missingBracketIds)\n : new TwoThreeListAstNode(length, item1.listHeight + 1, item1, item2, item3, missingBracketIds);\n }\n static getEmpty() {\n return new ImmutableArrayListAstNode(lengthZero, 0, [], SmallImmutableSet.getEmpty());\n }\n get kind() {\n return 4 /* AstNodeKind.List */;\n }\n get missingOpeningBracketIds() {\n return this._missingOpeningBracketIds;\n }\n /**\n * Use ListAstNode.create.\n */\n constructor(length, listHeight, _missingOpeningBracketIds) {\n super(length);\n this.listHeight = listHeight;\n this._missingOpeningBracketIds = _missingOpeningBracketIds;\n this.cachedMinIndentation = -1;\n }\n throwIfImmutable() {\n // NOOP\n }\n makeLastElementMutable() {\n this.throwIfImmutable();\n const childCount = this.childrenLength;\n if (childCount === 0) {\n return undefined;\n }\n const lastChild = this.getChild(childCount - 1);\n const mutable = lastChild.kind === 4 /* AstNodeKind.List */ ? lastChild.toMutable() : lastChild;\n if (lastChild !== mutable) {\n this.setChild(childCount - 1, mutable);\n }\n return mutable;\n }\n makeFirstElementMutable() {\n this.throwIfImmutable();\n const childCount = this.childrenLength;\n if (childCount === 0) {\n return undefined;\n }\n const firstChild = this.getChild(0);\n const mutable = firstChild.kind === 4 /* AstNodeKind.List */ ? firstChild.toMutable() : firstChild;\n if (firstChild !== mutable) {\n this.setChild(0, mutable);\n }\n return mutable;\n }\n canBeReused(openBracketIds) {\n if (openBracketIds.intersects(this.missingOpeningBracketIds)) {\n return false;\n }\n if (this.childrenLength === 0) {\n // Don't reuse empty lists.\n return false;\n }\n let lastChild = this;\n while (lastChild.kind === 4 /* AstNodeKind.List */) {\n const lastLength = lastChild.childrenLength;\n if (lastLength === 0) {\n // Empty lists should never be contained in other lists.\n throw new BugIndicatingError();\n }\n lastChild = lastChild.getChild(lastLength - 1);\n }\n return lastChild.canBeReused(openBracketIds);\n }\n handleChildrenChanged() {\n this.throwIfImmutable();\n const count = this.childrenLength;\n let length = this.getChild(0).length;\n let unopenedBrackets = this.getChild(0).missingOpeningBracketIds;\n for (let i = 1; i < count; i++) {\n const child = this.getChild(i);\n length = lengthAdd(length, child.length);\n unopenedBrackets = unopenedBrackets.merge(child.missingOpeningBracketIds);\n }\n this._length = length;\n this._missingOpeningBracketIds = unopenedBrackets;\n this.cachedMinIndentation = -1;\n }\n computeMinIndentation(offset, textModel) {\n if (this.cachedMinIndentation !== -1) {\n return this.cachedMinIndentation;\n }\n let minIndentation = Number.MAX_SAFE_INTEGER;\n let childOffset = offset;\n for (let i = 0; i < this.childrenLength; i++) {\n const child = this.getChild(i);\n if (child) {\n minIndentation = Math.min(minIndentation, child.computeMinIndentation(childOffset, textModel));\n childOffset = lengthAdd(childOffset, child.length);\n }\n }\n this.cachedMinIndentation = minIndentation;\n return minIndentation;\n }\n}\nclass TwoThreeListAstNode extends ListAstNode {\n get childrenLength() {\n return this._item3 !== null ? 3 : 2;\n }\n getChild(idx) {\n switch (idx) {\n case 0: return this._item1;\n case 1: return this._item2;\n case 2: return this._item3;\n }\n throw new Error('Invalid child index');\n }\n setChild(idx, node) {\n switch (idx) {\n case 0:\n this._item1 = node;\n return;\n case 1:\n this._item2 = node;\n return;\n case 2:\n this._item3 = node;\n return;\n }\n throw new Error('Invalid child index');\n }\n get children() {\n return this._item3 ? [this._item1, this._item2, this._item3] : [this._item1, this._item2];\n }\n get item1() {\n return this._item1;\n }\n get item2() {\n return this._item2;\n }\n get item3() {\n return this._item3;\n }\n constructor(length, listHeight, _item1, _item2, _item3, missingOpeningBracketIds) {\n super(length, listHeight, missingOpeningBracketIds);\n this._item1 = _item1;\n this._item2 = _item2;\n this._item3 = _item3;\n }\n deepClone() {\n return new TwoThreeListAstNode(this.length, this.listHeight, this._item1.deepClone(), this._item2.deepClone(), this._item3 ? this._item3.deepClone() : null, this.missingOpeningBracketIds);\n }\n appendChildOfSameHeight(node) {\n if (this._item3) {\n throw new Error('Cannot append to a full (2,3) tree node');\n }\n this.throwIfImmutable();\n this._item3 = node;\n this.handleChildrenChanged();\n }\n unappendChild() {\n if (!this._item3) {\n throw new Error('Cannot remove from a non-full (2,3) tree node');\n }\n this.throwIfImmutable();\n const result = this._item3;\n this._item3 = null;\n this.handleChildrenChanged();\n return result;\n }\n prependChildOfSameHeight(node) {\n if (this._item3) {\n throw new Error('Cannot prepend to a full (2,3) tree node');\n }\n this.throwIfImmutable();\n this._item3 = this._item2;\n this._item2 = this._item1;\n this._item1 = node;\n this.handleChildrenChanged();\n }\n unprependChild() {\n if (!this._item3) {\n throw new Error('Cannot remove from a non-full (2,3) tree node');\n }\n this.throwIfImmutable();\n const result = this._item1;\n this._item1 = this._item2;\n this._item2 = this._item3;\n this._item3 = null;\n this.handleChildrenChanged();\n return result;\n }\n toMutable() {\n return this;\n }\n}\n/**\n * Immutable, if all children are immutable.\n*/\nclass Immutable23ListAstNode extends TwoThreeListAstNode {\n toMutable() {\n return new TwoThreeListAstNode(this.length, this.listHeight, this.item1, this.item2, this.item3, this.missingOpeningBracketIds);\n }\n throwIfImmutable() {\n throw new Error('this instance is immutable');\n }\n}\n/**\n * For debugging.\n*/\nclass ArrayListAstNode extends ListAstNode {\n get childrenLength() {\n return this._children.length;\n }\n getChild(idx) {\n return this._children[idx];\n }\n setChild(idx, child) {\n this._children[idx] = child;\n }\n get children() {\n return this._children;\n }\n constructor(length, listHeight, _children, missingOpeningBracketIds) {\n super(length, listHeight, missingOpeningBracketIds);\n this._children = _children;\n }\n deepClone() {\n const children = new Array(this._children.length);\n for (let i = 0; i < this._children.length; i++) {\n children[i] = this._children[i].deepClone();\n }\n return new ArrayListAstNode(this.length, this.listHeight, children, this.missingOpeningBracketIds);\n }\n appendChildOfSameHeight(node) {\n this.throwIfImmutable();\n this._children.push(node);\n this.handleChildrenChanged();\n }\n unappendChild() {\n this.throwIfImmutable();\n const item = this._children.pop();\n this.handleChildrenChanged();\n return item;\n }\n prependChildOfSameHeight(node) {\n this.throwIfImmutable();\n this._children.unshift(node);\n this.handleChildrenChanged();\n }\n unprependChild() {\n this.throwIfImmutable();\n const item = this._children.shift();\n this.handleChildrenChanged();\n return item;\n }\n toMutable() {\n return this;\n }\n}\n/**\n * Immutable, if all children are immutable.\n*/\nclass ImmutableArrayListAstNode extends ArrayListAstNode {\n toMutable() {\n return new ArrayListAstNode(this.length, this.listHeight, [...this.children], this.missingOpeningBracketIds);\n }\n throwIfImmutable() {\n throw new Error('this instance is immutable');\n }\n}\nconst emptyArray = [];\nclass ImmutableLeafAstNode extends BaseAstNode {\n get listHeight() {\n return 0;\n }\n get childrenLength() {\n return 0;\n }\n getChild(idx) {\n return null;\n }\n get children() {\n return emptyArray;\n }\n deepClone() {\n return this;\n }\n}\nexport class TextAstNode extends ImmutableLeafAstNode {\n get kind() {\n return 0 /* AstNodeKind.Text */;\n }\n get missingOpeningBracketIds() {\n return SmallImmutableSet.getEmpty();\n }\n canBeReused(_openedBracketIds) {\n return true;\n }\n computeMinIndentation(offset, textModel) {\n const start = lengthToObj(offset);\n // Text ast nodes don't have partial indentation (ensured by the tokenizer).\n // Thus, if this text node does not start at column 0, the first line cannot have any indentation at all.\n const startLineNumber = (start.columnCount === 0 ? start.lineCount : start.lineCount + 1) + 1;\n const endLineNumber = lengthGetLineCount(lengthAdd(offset, this.length)) + 1;\n let result = Number.MAX_SAFE_INTEGER;\n for (let lineNumber = startLineNumber; lineNumber <= endLineNumber; lineNumber++) {\n const firstNonWsColumn = textModel.getLineFirstNonWhitespaceColumn(lineNumber);\n const lineContent = textModel.getLineContent(lineNumber);\n if (firstNonWsColumn === 0) {\n continue;\n }\n const visibleColumn = CursorColumns.visibleColumnFromColumn(lineContent, firstNonWsColumn, textModel.getOptions().tabSize);\n result = Math.min(result, visibleColumn);\n }\n return result;\n }\n}\nexport class BracketAstNode extends ImmutableLeafAstNode {\n static create(length, bracketInfo, bracketIds) {\n const node = new BracketAstNode(length, bracketInfo, bracketIds);\n return node;\n }\n get kind() {\n return 1 /* AstNodeKind.Bracket */;\n }\n get missingOpeningBracketIds() {\n return SmallImmutableSet.getEmpty();\n }\n constructor(length, bracketInfo, \n /**\n * In case of a opening bracket, this is the id of the opening bracket.\n * In case of a closing bracket, this contains the ids of all opening brackets it can close.\n */\n bracketIds) {\n super(length);\n this.bracketInfo = bracketInfo;\n this.bracketIds = bracketIds;\n }\n get text() {\n return this.bracketInfo.bracketText;\n }\n get languageId() {\n return this.bracketInfo.languageId;\n }\n canBeReused(_openedBracketIds) {\n // These nodes could be reused,\n // but not in a general way.\n // Their parent may be reused.\n return false;\n }\n computeMinIndentation(offset, textModel) {\n return Number.MAX_SAFE_INTEGER;\n }\n}\nexport class InvalidBracketAstNode extends ImmutableLeafAstNode {\n get kind() {\n return 3 /* AstNodeKind.UnexpectedClosingBracket */;\n }\n constructor(closingBrackets, length) {\n super(length);\n this.missingOpeningBracketIds = closingBrackets;\n }\n canBeReused(openedBracketIds) {\n return !openedBracketIds.intersects(this.missingOpeningBracketIds);\n }\n computeMinIndentation(offset, textModel) {\n return Number.MAX_SAFE_INTEGER;\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 *--------------------------------------------------------------------------------------------*/\nimport { NotSupportedError } from '../../../../../base/common/errors.js';\nimport { TokenMetadata } from '../../../encodedTokenAttributes.js';\nimport { TextAstNode } from './ast.js';\nimport { lengthAdd, lengthDiff, lengthGetColumnCountIfZeroLineCount, lengthToObj, lengthZero, toLength } from './length.js';\nimport { SmallImmutableSet } from './smallImmutableSet.js';\nexport class Token {\n constructor(length, kind, \n /**\n * If this token is an opening bracket, this is the id of the opening bracket.\n * If this token is a closing bracket, this is the id of the first opening bracket that is closed by this bracket.\n * Otherwise, it is -1.\n */\n bracketId, \n /**\n * If this token is an opening bracket, this just contains `bracketId`.\n * If this token is a closing bracket, this lists all opening bracket ids, that it closes.\n * Otherwise, it is empty.\n */\n bracketIds, astNode) {\n this.length = length;\n this.kind = kind;\n this.bracketId = bracketId;\n this.bracketIds = bracketIds;\n this.astNode = astNode;\n }\n}\nexport class TextBufferTokenizer {\n constructor(textModel, bracketTokens) {\n this.textModel = textModel;\n this.bracketTokens = bracketTokens;\n this.reader = new NonPeekableTextBufferTokenizer(this.textModel, this.bracketTokens);\n this._offset = lengthZero;\n this.didPeek = false;\n this.peeked = null;\n this.textBufferLineCount = textModel.getLineCount();\n this.textBufferLastLineLength = textModel.getLineLength(this.textBufferLineCount);\n }\n get offset() {\n return this._offset;\n }\n get length() {\n return toLength(this.textBufferLineCount - 1, this.textBufferLastLineLength);\n }\n skip(length) {\n this.didPeek = false;\n this._offset = lengthAdd(this._offset, length);\n const obj = lengthToObj(this._offset);\n this.reader.setPosition(obj.lineCount, obj.columnCount);\n }\n read() {\n let token;\n if (this.peeked) {\n this.didPeek = false;\n token = this.peeked;\n }\n else {\n token = this.reader.read();\n }\n if (token) {\n this._offset = lengthAdd(this._offset, token.length);\n }\n return token;\n }\n peek() {\n if (!this.didPeek) {\n this.peeked = this.reader.read();\n this.didPeek = true;\n }\n return this.peeked;\n }\n}\n/**\n * Does not support peek.\n*/\nclass NonPeekableTextBufferTokenizer {\n constructor(textModel, bracketTokens) {\n this.textModel = textModel;\n this.bracketTokens = bracketTokens;\n this.lineIdx = 0;\n this.line = null;\n this.lineCharOffset = 0;\n this.lineTokens = null;\n this.lineTokenOffset = 0;\n /** Must be a zero line token. The end of the document cannot be peeked. */\n this.peekedToken = null;\n this.textBufferLineCount = textModel.getLineCount();\n this.textBufferLastLineLength = textModel.getLineLength(this.textBufferLineCount);\n }\n setPosition(lineIdx, column) {\n // We must not jump into a token!\n if (lineIdx === this.lineIdx) {\n this.lineCharOffset = column;\n if (this.line !== null) {\n this.lineTokenOffset = this.lineCharOffset === 0 ? 0 : this.lineTokens.findTokenIndexAtOffset(this.lineCharOffset);\n }\n }\n else {\n this.lineIdx = lineIdx;\n this.lineCharOffset = column;\n this.line = null;\n }\n this.peekedToken = null;\n }\n read() {\n if (this.peekedToken) {\n const token = this.peekedToken;\n this.peekedToken = null;\n this.lineCharOffset += lengthGetColumnCountIfZeroLineCount(token.length);\n return token;\n }\n if (this.lineIdx > this.textBufferLineCount - 1 || (this.lineIdx === this.textBufferLineCount - 1 && this.lineCharOffset >= this.textBufferLastLineLength)) {\n // We are after the end\n return null;\n }\n if (this.line === null) {\n this.lineTokens = this.textModel.tokenization.getLineTokens(this.lineIdx + 1);\n this.line = this.lineTokens.getLineContent();\n this.lineTokenOffset = this.lineCharOffset === 0 ? 0 : this.lineTokens.findTokenIndexAtOffset(this.lineCharOffset);\n }\n const startLineIdx = this.lineIdx;\n const startLineCharOffset = this.lineCharOffset;\n // limits the length of text tokens.\n // If text tokens get too long, incremental updates will be slow\n let lengthHeuristic = 0;\n while (true) {\n const lineTokens = this.lineTokens;\n const tokenCount = lineTokens.getCount();\n let peekedBracketToken = null;\n if (this.lineTokenOffset < tokenCount) {\n const tokenMetadata = lineTokens.getMetadata(this.lineTokenOffset);\n while (this.lineTokenOffset + 1 < tokenCount && tokenMetadata === lineTokens.getMetadata(this.lineTokenOffset + 1)) {\n // Skip tokens that are identical.\n // Sometimes, (bracket) identifiers are split up into multiple tokens.\n this.lineTokenOffset++;\n }\n const isOther = TokenMetadata.getTokenType(tokenMetadata) === 0 /* StandardTokenType.Other */;\n const containsBracketType = TokenMetadata.containsBalancedBrackets(tokenMetadata);\n const endOffset = lineTokens.getEndOffset(this.lineTokenOffset);\n // Is there a bracket token next? Only consume text.\n if (containsBracketType && isOther && this.lineCharOffset < endOffset) {\n const languageId = lineTokens.getLanguageId(this.lineTokenOffset);\n const text = this.line.substring(this.lineCharOffset, endOffset);\n const brackets = this.bracketTokens.getSingleLanguageBracketTokens(languageId);\n const regexp = brackets.regExpGlobal;\n if (regexp) {\n regexp.lastIndex = 0;\n const match = regexp.exec(text);\n if (match) {\n peekedBracketToken = brackets.getToken(match[0]);\n if (peekedBracketToken) {\n // Consume leading text of the token\n this.lineCharOffset += match.index;\n }\n }\n }\n }\n lengthHeuristic += endOffset - this.lineCharOffset;\n if (peekedBracketToken) {\n // Don't skip the entire token, as a single token could contain multiple brackets.\n if (startLineIdx !== this.lineIdx || startLineCharOffset !== this.lineCharOffset) {\n // There is text before the bracket\n this.peekedToken = peekedBracketToken;\n break;\n }\n else {\n // Consume the peeked token\n this.lineCharOffset += lengthGetColumnCountIfZeroLineCount(peekedBracketToken.length);\n return peekedBracketToken;\n }\n }\n else {\n // Skip the entire token, as the token contains no brackets at all.\n this.lineTokenOffset++;\n this.lineCharOffset = endOffset;\n }\n }\n else {\n if (this.lineIdx === this.textBufferLineCount - 1) {\n break;\n }\n this.lineIdx++;\n this.lineTokens = this.textModel.tokenization.getLineTokens(this.lineIdx + 1);\n this.lineTokenOffset = 0;\n this.line = this.lineTokens.getLineContent();\n this.lineCharOffset = 0;\n lengthHeuristic += 33; // max 1000/33 = 30 lines\n // This limits the amount of work to recompute min-indentation\n if (lengthHeuristic > 1000) {\n // only break (automatically) at the end of line.\n break;\n }\n }\n if (lengthHeuristic > 1500) {\n // Eventually break regardless of the line length so that\n // very long lines do not cause bad performance.\n // This effective limits max indentation to 500, as\n // indentation is not computed across multiple text nodes.\n break;\n }\n }\n // If a token contains some proper indentation, it also contains \\n{INDENTATION+}(?!{INDENTATION}),\n // unless the line is too long.\n // Thus, the min indentation of the document is the minimum min indentation of every text node.\n const length = lengthDiff(startLineIdx, startLineCharOffset, this.lineIdx, this.lineCharOffset);\n return new Token(length, 0 /* TokenKind.Text */, -1, SmallImmutableSet.getEmpty(), new TextAstNode(length));\n }\n}\nexport class FastTokenizer {\n constructor(text, brackets) {\n this.text = text;\n this._offset = lengthZero;\n this.idx = 0;\n const regExpStr = brackets.getRegExpStr();\n const regexp = regExpStr ? new RegExp(regExpStr + '|\\n', 'gi') : null;\n const tokens = [];\n let match;\n let curLineCount = 0;\n let lastLineBreakOffset = 0;\n let lastTokenEndOffset = 0;\n let lastTokenEndLine = 0;\n const smallTextTokens0Line = [];\n for (let i = 0; i < 60; i++) {\n smallTextTokens0Line.push(new Token(toLength(0, i), 0 /* TokenKind.Text */, -1, SmallImmutableSet.getEmpty(), new TextAstNode(toLength(0, i))));\n }\n const smallTextTokens1Line = [];\n for (let i = 0; i < 60; i++) {\n smallTextTokens1Line.push(new Token(toLength(1, i), 0 /* TokenKind.Text */, -1, SmallImmutableSet.getEmpty(), new TextAstNode(toLength(1, i))));\n }\n if (regexp) {\n regexp.lastIndex = 0;\n // If a token contains indentation, it also contains \\n{INDENTATION+}(?!{INDENTATION})\n while ((match = regexp.exec(text)) !== null) {\n const curOffset = match.index;\n const value = match[0];\n if (value === '\\n') {\n curLineCount++;\n lastLineBreakOffset = curOffset + 1;\n }\n else {\n if (lastTokenEndOffset !== curOffset) {\n let token;\n if (lastTokenEndLine === curLineCount) {\n const colCount = curOffset - lastTokenEndOffset;\n if (colCount < smallTextTokens0Line.length) {\n token = smallTextTokens0Line[colCount];\n }\n else {\n const length = toLength(0, colCount);\n token = new Token(length, 0 /* TokenKind.Text */, -1, SmallImmutableSet.getEmpty(), new TextAstNode(length));\n }\n }\n else {\n const lineCount = curLineCount - lastTokenEndLine;\n const colCount = curOffset - lastLineBreakOffset;\n if (lineCount === 1 && colCount < smallTextTokens1Line.length) {\n token = smallTextTokens1Line[colCount];\n }\n else {\n const length = toLength(lineCount, colCount);\n token = new Token(length, 0 /* TokenKind.Text */, -1, SmallImmutableSet.getEmpty(), new TextAstNode(length));\n }\n }\n tokens.push(token);\n }\n // value is matched by regexp, so the token must exist\n tokens.push(brackets.getToken(value));\n lastTokenEndOffset = curOffset + value.length;\n lastTokenEndLine = curLineCount;\n }\n }\n }\n const offset = text.length;\n if (lastTokenEndOffset !== offset) {\n const length = (lastTokenEndLine === curLineCount)\n ? toLength(0, offset - lastTokenEndOffset)\n : toLength(curLineCount - lastTokenEndLine, offset - lastLineBreakOffset);\n tokens.push(new Token(length, 0 /* TokenKind.Text */, -1, SmallImmutableSet.getEmpty(), new TextAstNode(length)));\n }\n this.length = toLength(curLineCount, offset - lastLineBreakOffset);\n this.tokens = tokens;\n }\n get offset() {\n return this._offset;\n }\n read() {\n return this.tokens[this.idx++] || null;\n }\n peek() {\n return this.tokens[this.idx] || null;\n }\n skip(length) {\n throw new NotSupportedError();\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 *--------------------------------------------------------------------------------------------*/\nimport { escapeRegExpCharacters } from '../../../../../base/common/strings.js';\nimport { BracketAstNode } from './ast.js';\nimport { toLength } from './length.js';\nimport { identityKeyProvider, SmallImmutableSet } from './smallImmutableSet.js';\nimport { Token } from './tokenizer.js';\nexport class BracketTokens {\n static createFromLanguage(configuration, denseKeyProvider) {\n function getId(bracketInfo) {\n return denseKeyProvider.getKey(`${bracketInfo.languageId}:::${bracketInfo.bracketText}`);\n }\n const map = new Map();\n for (const openingBracket of configuration.bracketsNew.openingBrackets) {\n const length = toLength(0, openingBracket.bracketText.length);\n const openingTextId = getId(openingBracket);\n const bracketIds = SmallImmutableSet.getEmpty().add(openingTextId, identityKeyProvider);\n map.set(openingBracket.bracketText, new Token(length, 1 /* TokenKind.OpeningBracket */, openingTextId, bracketIds, BracketAstNode.create(length, openingBracket, bracketIds)));\n }\n for (const closingBracket of configuration.bracketsNew.closingBrackets) {\n const length = toLength(0, closingBracket.bracketText.length);\n let bracketIds = SmallImmutableSet.getEmpty();\n const closingBrackets = closingBracket.getOpeningBrackets();\n for (const bracket of closingBrackets) {\n bracketIds = bracketIds.add(getId(bracket), identityKeyProvider);\n }\n map.set(closingBracket.bracketText, new Token(length, 2 /* TokenKind.ClosingBracket */, getId(closingBrackets[0]), bracketIds, BracketAstNode.create(length, closingBracket, bracketIds)));\n }\n return new BracketTokens(map);\n }\n constructor(map) {\n this.map = map;\n this.hasRegExp = false;\n this._regExpGlobal = null;\n }\n getRegExpStr() {\n if (this.isEmpty) {\n return null;\n }\n else {\n const keys = [...this.map.keys()];\n keys.sort();\n keys.reverse();\n return keys.map(k => prepareBracketForRegExp(k)).join('|');\n }\n }\n /**\n * Returns null if there is no such regexp (because there are no brackets).\n */\n get regExpGlobal() {\n if (!this.hasRegExp) {\n const regExpStr = this.getRegExpStr();\n this._regExpGlobal = regExpStr ? new RegExp(regExpStr, 'gi') : null;\n this.hasRegExp = true;\n }\n return this._regExpGlobal;\n }\n getToken(value) {\n return this.map.get(value.toLowerCase());\n }\n findClosingTokenText(openingBracketIds) {\n for (const [closingText, info] of this.map) {\n if (info.kind === 2 /* TokenKind.ClosingBracket */ && info.bracketIds.intersects(openingBracketIds)) {\n return closingText;\n }\n }\n return undefined;\n }\n get isEmpty() {\n return this.map.size === 0;\n }\n}\nfunction prepareBracketForRegExp(str) {\n let escaped = escapeRegExpCharacters(str);\n // These bracket pair delimiters start or end with letters\n // see https://github.com/microsoft/vscode/issues/132162 https://github.com/microsoft/vscode/issues/150440\n if (/^[\\w ]+/.test(str)) {\n escaped = `\\\\b${escaped}`;\n }\n if (/[\\w ]+$/.test(str)) {\n escaped = `${escaped}\\\\b`;\n }\n return escaped;\n}\nexport class LanguageAgnosticBracketTokens {\n constructor(denseKeyProvider, getLanguageConfiguration) {\n this.denseKeyProvider = denseKeyProvider;\n this.getLanguageConfiguration = getLanguageConfiguration;\n this.languageIdToBracketTokens = new Map();\n }\n didLanguageChange(languageId) {\n // Report a change whenever the language configuration updates.\n return this.languageIdToBracketTokens.has(languageId);\n }\n getSingleLanguageBracketTokens(languageId) {\n let singleLanguageBracketTokens = this.languageIdToBracketTokens.get(languageId);\n if (!singleLanguageBracketTokens) {\n singleLanguageBracketTokens = BracketTokens.createFromLanguage(this.getLanguageConfiguration(languageId), this.denseKeyProvider);\n this.languageIdToBracketTokens.set(languageId, singleLanguageBracketTokens);\n }\n return singleLanguageBracketTokens;\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 *--------------------------------------------------------------------------------------------*/\nimport { ListAstNode } from './ast.js';\n/**\n * Concatenates a list of (2,3) AstNode's into a single (2,3) AstNode.\n * This mutates the items of the input array!\n * If all items have the same height, this method has runtime O(items.length).\n * Otherwise, it has runtime O(items.length * max(log(items.length), items.max(i => i.height))).\n*/\nexport function concat23Trees(items) {\n if (items.length === 0) {\n return null;\n }\n if (items.length === 1) {\n return items[0];\n }\n let i = 0;\n /**\n * Reads nodes of same height and concatenates them to a single node.\n */\n function readNode() {\n if (i >= items.length) {\n return null;\n }\n const start = i;\n const height = items[start].listHeight;\n i++;\n while (i < items.length && items[i].listHeight === height) {\n i++;\n }\n if (i - start >= 2) {\n return concat23TreesOfSameHeight(start === 0 && i === items.length ? items : items.slice(start, i), false);\n }\n else {\n return items[start];\n }\n }\n // The items might not have the same height.\n // We merge all items by using a binary concat operator.\n let first = readNode(); // There must be a first item\n let second = readNode();\n if (!second) {\n return first;\n }\n for (let item = readNode(); item; item = readNode()) {\n // Prefer concatenating smaller trees, as the runtime of concat depends on the tree height.\n if (heightDiff(first, second) <= heightDiff(second, item)) {\n first = concat(first, second);\n second = item;\n }\n else {\n second = concat(second, item);\n }\n }\n const result = concat(first, second);\n return result;\n}\nexport function concat23TreesOfSameHeight(items, createImmutableLists = false) {\n if (items.length === 0) {\n return null;\n }\n if (items.length === 1) {\n return items[0];\n }\n let length = items.length;\n // All trees have same height, just create parent nodes.\n while (length > 3) {\n const newLength = length >> 1;\n for (let i = 0; i < newLength; i++) {\n const j = i << 1;\n items[i] = ListAstNode.create23(items[j], items[j + 1], j + 3 === length ? items[j + 2] : null, createImmutableLists);\n }\n length = newLength;\n }\n return ListAstNode.create23(items[0], items[1], length >= 3 ? items[2] : null, createImmutableLists);\n}\nfunction heightDiff(node1, node2) {\n return Math.abs(node1.listHeight - node2.listHeight);\n}\nfunction concat(node1, node2) {\n if (node1.listHeight === node2.listHeight) {\n return ListAstNode.create23(node1, node2, null, false);\n }\n else if (node1.listHeight > node2.listHeight) {\n // node1 is the tree we want to insert into\n return append(node1, node2);\n }\n else {\n return prepend(node2, node1);\n }\n}\n/**\n * Appends the given node to the end of this (2,3) tree.\n * Returns the new root.\n*/\nfunction append(list, nodeToAppend) {\n list = list.toMutable();\n let curNode = list;\n const parents = [];\n let nodeToAppendOfCorrectHeight;\n while (true) {\n // assert nodeToInsert.listHeight <= curNode.listHeight\n if (nodeToAppend.listHeight === curNode.listHeight) {\n nodeToAppendOfCorrectHeight = nodeToAppend;\n break;\n }\n // assert 0 <= nodeToInsert.listHeight < curNode.listHeight\n if (curNode.kind !== 4 /* AstNodeKind.List */) {\n throw new Error('unexpected');\n }\n parents.push(curNode);\n // assert 2 <= curNode.childrenLength <= 3\n curNode = curNode.makeLastElementMutable();\n }\n // assert nodeToAppendOfCorrectHeight!.listHeight === curNode.listHeight\n for (let i = parents.length - 1; i >= 0; i--) {\n const parent = parents[i];\n if (nodeToAppendOfCorrectHeight) {\n // Can we take the element?\n if (parent.childrenLength >= 3) {\n // assert parent.childrenLength === 3 && parent.listHeight === nodeToAppendOfCorrectHeight.listHeight + 1\n // we need to split to maintain (2,3)-tree property.\n // Send the third element + the new element to the parent.\n nodeToAppendOfCorrectHeight = ListAstNode.create23(parent.unappendChild(), nodeToAppendOfCorrectHeight, null, false);\n }\n else {\n parent.appendChildOfSameHeight(nodeToAppendOfCorrectHeight);\n nodeToAppendOfCorrectHeight = undefined;\n }\n }\n else {\n parent.handleChildrenChanged();\n }\n }\n if (nodeToAppendOfCorrectHeight) {\n return ListAstNode.create23(list, nodeToAppendOfCorrectHeight, null, false);\n }\n else {\n return list;\n }\n}\n/**\n * Prepends the given node to the end of this (2,3) tree.\n * Returns the new root.\n*/\nfunction prepend(list, nodeToAppend) {\n list = list.toMutable();\n let curNode = list;\n const parents = [];\n // assert nodeToInsert.listHeight <= curNode.listHeight\n while (nodeToAppend.listHeight !== curNode.listHeight) {\n // assert 0 <= nodeToInsert.listHeight < curNode.listHeight\n if (curNode.kind !== 4 /* AstNodeKind.List */) {\n throw new Error('unexpected');\n }\n parents.push(curNode);\n // assert 2 <= curNode.childrenFast.length <= 3\n curNode = curNode.makeFirstElementMutable();\n }\n let nodeToPrependOfCorrectHeight = nodeToAppend;\n // assert nodeToAppendOfCorrectHeight!.listHeight === curNode.listHeight\n for (let i = parents.length - 1; i >= 0; i--) {\n const parent = parents[i];\n if (nodeToPrependOfCorrectHeight) {\n // Can we take the element?\n if (parent.childrenLength >= 3) {\n // assert parent.childrenLength === 3 && parent.listHeight === nodeToAppendOfCorrectHeight.listHeight + 1\n // we need to split to maintain (2,3)-tree property.\n // Send the third element + the new element to the parent.\n nodeToPrependOfCorrectHeight = ListAstNode.create23(nodeToPrependOfCorrectHeight, parent.unprependChild(), null, false);\n }\n else {\n parent.prependChildOfSameHeight(nodeToPrependOfCorrectHeight);\n nodeToPrependOfCorrectHeight = undefined;\n }\n }\n else {\n parent.handleChildrenChanged();\n }\n }\n if (nodeToPrependOfCorrectHeight) {\n return ListAstNode.create23(nodeToPrependOfCorrectHeight, list, null, false);\n }\n else {\n return list;\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 *--------------------------------------------------------------------------------------------*/\nimport { lengthAdd, lengthZero, lengthLessThan } from './length.js';\n/**\n * Allows to efficiently find a longest child at a given offset in a fixed node.\n * The requested offsets must increase monotonously.\n*/\nexport class NodeReader {\n constructor(node) {\n this.lastOffset = lengthZero;\n this.nextNodes = [node];\n this.offsets = [lengthZero];\n this.idxs = [];\n }\n /**\n * Returns the longest node at `offset` that satisfies the predicate.\n * @param offset must be greater than or equal to the last offset this method has been called with!\n */\n readLongestNodeAt(offset, predicate) {\n if (lengthLessThan(offset, this.lastOffset)) {\n throw new Error('Invalid offset');\n }\n this.lastOffset = offset;\n // Find the longest node of all those that are closest to the current offset.\n while (true) {\n const curNode = lastOrUndefined(this.nextNodes);\n if (!curNode) {\n return undefined;\n }\n const curNodeOffset = lastOrUndefined(this.offsets);\n if (lengthLessThan(offset, curNodeOffset)) {\n // The next best node is not here yet.\n // The reader must advance before a cached node is hit.\n return undefined;\n }\n if (lengthLessThan(curNodeOffset, offset)) {\n // The reader is ahead of the current node.\n if (lengthAdd(curNodeOffset, curNode.length) <= offset) {\n // The reader is after the end of the current node.\n this.nextNodeAfterCurrent();\n }\n else {\n // The reader is somewhere in the current node.\n const nextChildIdx = getNextChildIdx(curNode);\n if (nextChildIdx !== -1) {\n // Go to the first child and repeat.\n this.nextNodes.push(curNode.getChild(nextChildIdx));\n this.offsets.push(curNodeOffset);\n this.idxs.push(nextChildIdx);\n }\n else {\n // We don't have children\n this.nextNodeAfterCurrent();\n }\n }\n }\n else {\n // readerOffsetBeforeChange === curNodeOffset\n if (predicate(curNode)) {\n this.nextNodeAfterCurrent();\n return curNode;\n }\n else {\n const nextChildIdx = getNextChildIdx(curNode);\n // look for shorter node\n if (nextChildIdx === -1) {\n // There is no shorter node.\n this.nextNodeAfterCurrent();\n return undefined;\n }\n else {\n // Descend into first child & repeat.\n this.nextNodes.push(curNode.getChild(nextChildIdx));\n this.offsets.push(curNodeOffset);\n this.idxs.push(nextChildIdx);\n }\n }\n }\n }\n }\n // Navigates to the longest node that continues after the current node.\n nextNodeAfterCurrent() {\n while (true) {\n const currentOffset = lastOrUndefined(this.offsets);\n const currentNode = lastOrUndefined(this.nextNodes);\n this.nextNodes.pop();\n this.offsets.pop();\n if (this.idxs.length === 0) {\n // We just popped the root node, there is no next node.\n break;\n }\n // Parent is not undefined, because idxs is not empty\n const parent = lastOrUndefined(this.nextNodes);\n const nextChildIdx = getNextChildIdx(parent, this.idxs[this.idxs.length - 1]);\n if (nextChildIdx !== -1) {\n this.nextNodes.push(parent.getChild(nextChildIdx));\n this.offsets.push(lengthAdd(currentOffset, currentNode.length));\n this.idxs[this.idxs.length - 1] = nextChildIdx;\n break;\n }\n else {\n this.idxs.pop();\n }\n // We fully consumed the parent.\n // Current node is now parent, so call nextNodeAfterCurrent again\n }\n }\n}\nfunction getNextChildIdx(node, curIdx = -1) {\n while (true) {\n curIdx++;\n if (curIdx >= node.childrenLength) {\n return -1;\n }\n if (node.getChild(curIdx)) {\n return curIdx;\n }\n }\n}\nfunction lastOrUndefined(arr) {\n return arr.length > 0 ? arr[arr.length - 1] : 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 *--------------------------------------------------------------------------------------------*/\nimport { InvalidBracketAstNode, ListAstNode, PairAstNode, TextAstNode } from './ast.js';\nimport { BeforeEditPositionMapper } from './beforeEditPositionMapper.js';\nimport { SmallImmutableSet } from './smallImmutableSet.js';\nimport { lengthIsZero, lengthLessThan } from './length.js';\nimport { concat23Trees, concat23TreesOfSameHeight } from './concat23Trees.js';\nimport { NodeReader } from './nodeReader.js';\n/**\n * Non incrementally built ASTs are immutable.\n*/\nexport function parseDocument(tokenizer, edits, oldNode, createImmutableLists) {\n const parser = new Parser(tokenizer, edits, oldNode, createImmutableLists);\n return parser.parseDocument();\n}\n/**\n * Non incrementally built ASTs are immutable.\n*/\nclass Parser {\n constructor(tokenizer, edits, oldNode, createImmutableLists) {\n this.tokenizer = tokenizer;\n this.createImmutableLists = createImmutableLists;\n this._itemsConstructed = 0;\n this._itemsFromCache = 0;\n if (oldNode && createImmutableLists) {\n throw new Error('Not supported');\n }\n this.oldNodeReader = oldNode ? new NodeReader(oldNode) : undefined;\n this.positionMapper = new BeforeEditPositionMapper(edits);\n }\n parseDocument() {\n this._itemsConstructed = 0;\n this._itemsFromCache = 0;\n let result = this.parseList(SmallImmutableSet.getEmpty(), 0);\n if (!result) {\n result = ListAstNode.getEmpty();\n }\n return result;\n }\n parseList(openedBracketIds, level) {\n const items = [];\n while (true) {\n let child = this.tryReadChildFromCache(openedBracketIds);\n if (!child) {\n const token = this.tokenizer.peek();\n if (!token ||\n (token.kind === 2 /* TokenKind.ClosingBracket */ &&\n token.bracketIds.intersects(openedBracketIds))) {\n break;\n }\n child = this.parseChild(openedBracketIds, level + 1);\n }\n if (child.kind === 4 /* AstNodeKind.List */ && child.childrenLength === 0) {\n continue;\n }\n items.push(child);\n }\n // When there is no oldNodeReader, all items are created from scratch and must have the same height.\n const result = this.oldNodeReader ? concat23Trees(items) : concat23TreesOfSameHeight(items, this.createImmutableLists);\n return result;\n }\n tryReadChildFromCache(openedBracketIds) {\n if (this.oldNodeReader) {\n const maxCacheableLength = this.positionMapper.getDistanceToNextChange(this.tokenizer.offset);\n if (maxCacheableLength === null || !lengthIsZero(maxCacheableLength)) {\n const cachedNode = this.oldNodeReader.readLongestNodeAt(this.positionMapper.getOffsetBeforeChange(this.tokenizer.offset), curNode => {\n // The edit could extend the ending token, thus we cannot re-use nodes that touch the edit.\n // If there is no edit anymore, we can re-use the node in any case.\n if (maxCacheableLength !== null && !lengthLessThan(curNode.length, maxCacheableLength)) {\n // Either the node contains edited text or touches edited text.\n // In the latter case, brackets might have been extended (`end` -> `ending`), so even touching nodes cannot be reused.\n return false;\n }\n const canBeReused = curNode.canBeReused(openedBracketIds);\n return canBeReused;\n });\n if (cachedNode) {\n this._itemsFromCache++;\n this.tokenizer.skip(cachedNode.length);\n return cachedNode;\n }\n }\n }\n return undefined;\n }\n parseChild(openedBracketIds, level) {\n this._itemsConstructed++;\n const token = this.tokenizer.read();\n switch (token.kind) {\n case 2 /* TokenKind.ClosingBracket */:\n return new InvalidBracketAstNode(token.bracketIds, token.length);\n case 0 /* TokenKind.Text */:\n return token.astNode;\n case 1 /* TokenKind.OpeningBracket */: {\n if (level > 300) {\n // To prevent stack overflows\n return new TextAstNode(token.length);\n }\n const set = openedBracketIds.merge(token.bracketIds);\n const child = this.parseList(set, level + 1);\n const nextToken = this.tokenizer.peek();\n if (nextToken &&\n nextToken.kind === 2 /* TokenKind.ClosingBracket */ &&\n (nextToken.bracketId === token.bracketId || nextToken.bracketIds.intersects(token.bracketIds))) {\n this.tokenizer.read();\n return PairAstNode.create(token.astNode, child, nextToken.astNode);\n }\n else {\n return PairAstNode.create(token.astNode, child, null);\n }\n }\n default:\n throw new Error('unexpected');\n }\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 *--------------------------------------------------------------------------------------------*/\nimport { ArrayQueue } from '../../../../../base/common/arrays.js';\nimport { TextEditInfo } from './beforeEditPositionMapper.js';\nimport { lengthAdd, lengthDiffNonNegative, lengthEquals, lengthIsZero, lengthToObj, lengthZero, sumLengths } from './length.js';\nexport function combineTextEditInfos(textEditInfoFirst, textEditInfoSecond) {\n if (textEditInfoFirst.length === 0) {\n return textEditInfoSecond;\n }\n if (textEditInfoSecond.length === 0) {\n return textEditInfoFirst;\n }\n // s0: State before any edits\n const s0ToS1Map = new ArrayQueue(toLengthMapping(textEditInfoFirst));\n // s1: State after first edit, but before second edit\n const s1ToS2Map = toLengthMapping(textEditInfoSecond);\n s1ToS2Map.push({ modified: false, lengthBefore: undefined, lengthAfter: undefined }); // Copy everything from old to new\n // s2: State after both edits\n let curItem = s0ToS1Map.dequeue();\n /**\n * @param s1Length Use undefined for length \"infinity\"\n */\n function nextS0ToS1MapWithS1LengthOf(s1Length) {\n if (s1Length === undefined) {\n const arr = s0ToS1Map.takeWhile(v => true) || [];\n if (curItem) {\n arr.unshift(curItem);\n }\n return arr;\n }\n const result = [];\n while (curItem && !lengthIsZero(s1Length)) {\n const [item, remainingItem] = curItem.splitAt(s1Length);\n result.push(item);\n s1Length = lengthDiffNonNegative(item.lengthAfter, s1Length);\n curItem = remainingItem !== null && remainingItem !== void 0 ? remainingItem : s0ToS1Map.dequeue();\n }\n if (!lengthIsZero(s1Length)) {\n result.push(new LengthMapping(false, s1Length, s1Length));\n }\n return result;\n }\n const result = [];\n function pushEdit(startOffset, endOffset, newLength) {\n if (result.length > 0 && lengthEquals(result[result.length - 1].endOffset, startOffset)) {\n const lastResult = result[result.length - 1];\n result[result.length - 1] = new TextEditInfo(lastResult.startOffset, endOffset, lengthAdd(lastResult.newLength, newLength));\n }\n else {\n result.push({ startOffset, endOffset, newLength });\n }\n }\n let s0offset = lengthZero;\n for (const s1ToS2 of s1ToS2Map) {\n const s0ToS1Map = nextS0ToS1MapWithS1LengthOf(s1ToS2.lengthBefore);\n if (s1ToS2.modified) {\n const s0Length = sumLengths(s0ToS1Map, s => s.lengthBefore);\n const s0EndOffset = lengthAdd(s0offset, s0Length);\n pushEdit(s0offset, s0EndOffset, s1ToS2.lengthAfter);\n s0offset = s0EndOffset;\n }\n else {\n for (const s1 of s0ToS1Map) {\n const s0startOffset = s0offset;\n s0offset = lengthAdd(s0offset, s1.lengthBefore);\n if (s1.modified) {\n pushEdit(s0startOffset, s0offset, s1.lengthAfter);\n }\n }\n }\n }\n return result;\n}\nclass LengthMapping {\n constructor(\n /**\n * If false, length before and length after equal.\n */\n modified, lengthBefore, lengthAfter) {\n this.modified = modified;\n this.lengthBefore = lengthBefore;\n this.lengthAfter = lengthAfter;\n }\n splitAt(lengthAfter) {\n const remainingLengthAfter = lengthDiffNonNegative(lengthAfter, this.lengthAfter);\n if (lengthEquals(remainingLengthAfter, lengthZero)) {\n return [this, undefined];\n }\n else if (this.modified) {\n return [\n new LengthMapping(this.modified, this.lengthBefore, lengthAfter),\n new LengthMapping(this.modified, lengthZero, remainingLengthAfter)\n ];\n }\n else {\n return [\n new LengthMapping(this.modified, lengthAfter, lengthAfter),\n new LengthMapping(this.modified, remainingLengthAfter, remainingLengthAfter)\n ];\n }\n }\n toString() {\n return `${this.modified ? 'M' : 'U'}:${lengthToObj(this.lengthBefore)} -> ${lengthToObj(this.lengthAfter)}`;\n }\n}\nfunction toLengthMapping(textEditInfos) {\n const result = [];\n let lastOffset = lengthZero;\n for (const textEditInfo of textEditInfos) {\n const spaceLength = lengthDiffNonNegative(lastOffset, textEditInfo.startOffset);\n if (!lengthIsZero(spaceLength)) {\n result.push(new LengthMapping(false, spaceLength, spaceLength));\n }\n const lengthBefore = lengthDiffNonNegative(textEditInfo.startOffset, textEditInfo.endOffset);\n result.push(new LengthMapping(true, lengthBefore, textEditInfo.newLength));\n lastOffset = textEditInfo.endOffset;\n }\n return 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 *--------------------------------------------------------------------------------------------*/\nimport { Emitter } from '../../../../../base/common/event.js';\nimport { Disposable } from '../../../../../base/common/lifecycle.js';\nimport { BracketInfo, BracketPairWithMinIndentationInfo } from '../../../textModelBracketPairs.js';\nimport { TextEditInfo } from './beforeEditPositionMapper.js';\nimport { LanguageAgnosticBracketTokens } from './brackets.js';\nimport { lengthAdd, lengthGreaterThanEqual, lengthLessThan, lengthLessThanEqual, lengthsToRange, lengthZero, positionToLength, toLength } from './length.js';\nimport { parseDocument } from './parser.js';\nimport { DenseKeyProvider } from './smallImmutableSet.js';\nimport { FastTokenizer, TextBufferTokenizer } from './tokenizer.js';\nimport { CallbackIterable } from '../../../../../base/common/arrays.js';\nimport { combineTextEditInfos } from './combineTextEditInfos.js';\nexport class BracketPairsTree extends Disposable {\n didLanguageChange(languageId) {\n return this.brackets.didLanguageChange(languageId);\n }\n constructor(textModel, getLanguageConfiguration) {\n super();\n this.textModel = textModel;\n this.getLanguageConfiguration = getLanguageConfiguration;\n this.didChangeEmitter = new Emitter();\n this.denseKeyProvider = new DenseKeyProvider();\n this.brackets = new LanguageAgnosticBracketTokens(this.denseKeyProvider, this.getLanguageConfiguration);\n this.onDidChange = this.didChangeEmitter.event;\n this.queuedTextEditsForInitialAstWithoutTokens = [];\n this.queuedTextEdits = [];\n if (!textModel.tokenization.hasTokens) {\n const brackets = this.brackets.getSingleLanguageBracketTokens(this.textModel.getLanguageId());\n const tokenizer = new FastTokenizer(this.textModel.getValue(), brackets);\n this.initialAstWithoutTokens = parseDocument(tokenizer, [], undefined, true);\n this.astWithTokens = this.initialAstWithoutTokens;\n }\n else if (textModel.tokenization.backgroundTokenizationState === 2 /* BackgroundTokenizationState.Completed */) {\n // Skip the initial ast, as there is no flickering.\n // Directly create the tree with token information.\n this.initialAstWithoutTokens = undefined;\n this.astWithTokens = this.parseDocumentFromTextBuffer([], undefined, false);\n }\n else {\n // We missed some token changes already, so we cannot use the fast tokenizer + delta increments\n this.initialAstWithoutTokens = this.parseDocumentFromTextBuffer([], undefined, true);\n this.astWithTokens = this.initialAstWithoutTokens;\n }\n }\n //#region TextModel events\n handleDidChangeBackgroundTokenizationState() {\n if (this.textModel.tokenization.backgroundTokenizationState === 2 /* BackgroundTokenizationState.Completed */) {\n const wasUndefined = this.initialAstWithoutTokens === undefined;\n // Clear the initial tree as we can use the tree with token information now.\n this.initialAstWithoutTokens = undefined;\n if (!wasUndefined) {\n this.didChangeEmitter.fire();\n }\n }\n }\n handleDidChangeTokens({ ranges }) {\n const edits = ranges.map(r => new TextEditInfo(toLength(r.fromLineNumber - 1, 0), toLength(r.toLineNumber, 0), toLength(r.toLineNumber - r.fromLineNumber + 1, 0)));\n this.handleEdits(edits, true);\n if (!this.initialAstWithoutTokens) {\n this.didChangeEmitter.fire();\n }\n }\n handleContentChanged(change) {\n const edits = TextEditInfo.fromModelContentChanges(change.changes);\n this.handleEdits(edits, false);\n }\n handleEdits(edits, tokenChange) {\n // Lazily queue the edits and only apply them when the tree is accessed.\n const result = combineTextEditInfos(this.queuedTextEdits, edits);\n this.queuedTextEdits = result;\n if (this.initialAstWithoutTokens && !tokenChange) {\n this.queuedTextEditsForInitialAstWithoutTokens = combineTextEditInfos(this.queuedTextEditsForInitialAstWithoutTokens, edits);\n }\n }\n //#endregion\n flushQueue() {\n if (this.queuedTextEdits.length > 0) {\n this.astWithTokens = this.parseDocumentFromTextBuffer(this.queuedTextEdits, this.astWithTokens, false);\n this.queuedTextEdits = [];\n }\n if (this.queuedTextEditsForInitialAstWithoutTokens.length > 0) {\n if (this.initialAstWithoutTokens) {\n this.initialAstWithoutTokens = this.parseDocumentFromTextBuffer(this.queuedTextEditsForInitialAstWithoutTokens, this.initialAstWithoutTokens, false);\n }\n this.queuedTextEditsForInitialAstWithoutTokens = [];\n }\n }\n /**\n * @pure (only if isPure = true)\n */\n parseDocumentFromTextBuffer(edits, previousAst, immutable) {\n // Is much faster if `isPure = false`.\n const isPure = false;\n const previousAstClone = isPure ? previousAst === null || previousAst === void 0 ? void 0 : previousAst.deepClone() : previousAst;\n const tokenizer = new TextBufferTokenizer(this.textModel, this.brackets);\n const result = parseDocument(tokenizer, edits, previousAstClone, immutable);\n return result;\n }\n getBracketsInRange(range, onlyColorizedBrackets) {\n this.flushQueue();\n const startOffset = toLength(range.startLineNumber - 1, range.startColumn - 1);\n const endOffset = toLength(range.endLineNumber - 1, range.endColumn - 1);\n return new CallbackIterable(cb => {\n const node = this.initialAstWithoutTokens || this.astWithTokens;\n collectBrackets(node, lengthZero, node.length, startOffset, endOffset, cb, 0, 0, new Map(), onlyColorizedBrackets);\n });\n }\n getBracketPairsInRange(range, includeMinIndentation) {\n this.flushQueue();\n const startLength = positionToLength(range.getStartPosition());\n const endLength = positionToLength(range.getEndPosition());\n return new CallbackIterable(cb => {\n const node = this.initialAstWithoutTokens || this.astWithTokens;\n const context = new CollectBracketPairsContext(cb, includeMinIndentation, this.textModel);\n collectBracketPairs(node, lengthZero, node.length, startLength, endLength, context, 0, new Map());\n });\n }\n getFirstBracketAfter(position) {\n this.flushQueue();\n const node = this.initialAstWithoutTokens || this.astWithTokens;\n return getFirstBracketAfter(node, lengthZero, node.length, positionToLength(position));\n }\n getFirstBracketBefore(position) {\n this.flushQueue();\n const node = this.initialAstWithoutTokens || this.astWithTokens;\n return getFirstBracketBefore(node, lengthZero, node.length, positionToLength(position));\n }\n}\nfunction getFirstBracketBefore(node, nodeOffsetStart, nodeOffsetEnd, position) {\n if (node.kind === 4 /* AstNodeKind.List */ || node.kind === 2 /* AstNodeKind.Pair */) {\n const lengths = [];\n for (const child of node.children) {\n nodeOffsetEnd = lengthAdd(nodeOffsetStart, child.length);\n lengths.push({ nodeOffsetStart, nodeOffsetEnd });\n nodeOffsetStart = nodeOffsetEnd;\n }\n for (let i = lengths.length - 1; i >= 0; i--) {\n const { nodeOffsetStart, nodeOffsetEnd } = lengths[i];\n if (lengthLessThan(nodeOffsetStart, position)) {\n const result = getFirstBracketBefore(node.children[i], nodeOffsetStart, nodeOffsetEnd, position);\n if (result) {\n return result;\n }\n }\n }\n return null;\n }\n else if (node.kind === 3 /* AstNodeKind.UnexpectedClosingBracket */) {\n return null;\n }\n else if (node.kind === 1 /* AstNodeKind.Bracket */) {\n const range = lengthsToRange(nodeOffsetStart, nodeOffsetEnd);\n return {\n bracketInfo: node.bracketInfo,\n range\n };\n }\n return null;\n}\nfunction getFirstBracketAfter(node, nodeOffsetStart, nodeOffsetEnd, position) {\n if (node.kind === 4 /* AstNodeKind.List */ || node.kind === 2 /* AstNodeKind.Pair */) {\n for (const child of node.children) {\n nodeOffsetEnd = lengthAdd(nodeOffsetStart, child.length);\n if (lengthLessThan(position, nodeOffsetEnd)) {\n const result = getFirstBracketAfter(child, nodeOffsetStart, nodeOffsetEnd, position);\n if (result) {\n return result;\n }\n }\n nodeOffsetStart = nodeOffsetEnd;\n }\n return null;\n }\n else if (node.kind === 3 /* AstNodeKind.UnexpectedClosingBracket */) {\n return null;\n }\n else if (node.kind === 1 /* AstNodeKind.Bracket */) {\n const range = lengthsToRange(nodeOffsetStart, nodeOffsetEnd);\n return {\n bracketInfo: node.bracketInfo,\n range\n };\n }\n return null;\n}\nfunction collectBrackets(node, nodeOffsetStart, nodeOffsetEnd, startOffset, endOffset, push, level, nestingLevelOfEqualBracketType, levelPerBracketType, onlyColorizedBrackets, parentPairIsIncomplete = false) {\n if (level > 200) {\n return true;\n }\n whileLoop: while (true) {\n switch (node.kind) {\n case 4 /* AstNodeKind.List */: {\n const childCount = node.childrenLength;\n for (let i = 0; i < childCount; i++) {\n const child = node.getChild(i);\n if (!child) {\n continue;\n }\n nodeOffsetEnd = lengthAdd(nodeOffsetStart, child.length);\n if (lengthLessThanEqual(nodeOffsetStart, endOffset) &&\n lengthGreaterThanEqual(nodeOffsetEnd, startOffset)) {\n const childEndsAfterEnd = lengthGreaterThanEqual(nodeOffsetEnd, endOffset);\n if (childEndsAfterEnd) {\n // No child after this child in the requested window, don't recurse\n node = child;\n continue whileLoop;\n }\n const shouldContinue = collectBrackets(child, nodeOffsetStart, nodeOffsetEnd, startOffset, endOffset, push, level, 0, levelPerBracketType, onlyColorizedBrackets);\n if (!shouldContinue) {\n return false;\n }\n }\n nodeOffsetStart = nodeOffsetEnd;\n }\n return true;\n }\n case 2 /* AstNodeKind.Pair */: {\n const colorize = !onlyColorizedBrackets || !node.closingBracket || node.closingBracket.bracketInfo.closesColorized(node.openingBracket.bracketInfo);\n let levelPerBracket = 0;\n if (levelPerBracketType) {\n let existing = levelPerBracketType.get(node.openingBracket.text);\n if (existing === undefined) {\n existing = 0;\n }\n levelPerBracket = existing;\n if (colorize) {\n existing++;\n levelPerBracketType.set(node.openingBracket.text, existing);\n }\n }\n const childCount = node.childrenLength;\n for (let i = 0; i < childCount; i++) {\n const child = node.getChild(i);\n if (!child) {\n continue;\n }\n nodeOffsetEnd = lengthAdd(nodeOffsetStart, child.length);\n if (lengthLessThanEqual(nodeOffsetStart, endOffset) &&\n lengthGreaterThanEqual(nodeOffsetEnd, startOffset)) {\n const childEndsAfterEnd = lengthGreaterThanEqual(nodeOffsetEnd, endOffset);\n if (childEndsAfterEnd && child.kind !== 1 /* AstNodeKind.Bracket */) {\n // No child after this child in the requested window, don't recurse\n // Don't do this for brackets because of unclosed/unopened brackets\n node = child;\n if (colorize) {\n level++;\n nestingLevelOfEqualBracketType = levelPerBracket + 1;\n }\n else {\n nestingLevelOfEqualBracketType = levelPerBracket;\n }\n continue whileLoop;\n }\n if (colorize || child.kind !== 1 /* AstNodeKind.Bracket */ || !node.closingBracket) {\n const shouldContinue = collectBrackets(child, nodeOffsetStart, nodeOffsetEnd, startOffset, endOffset, push, colorize ? level + 1 : level, colorize ? levelPerBracket + 1 : levelPerBracket, levelPerBracketType, onlyColorizedBrackets, !node.closingBracket);\n if (!shouldContinue) {\n return false;\n }\n }\n }\n nodeOffsetStart = nodeOffsetEnd;\n }\n levelPerBracketType === null || levelPerBracketType === void 0 ? void 0 : levelPerBracketType.set(node.openingBracket.text, levelPerBracket);\n return true;\n }\n case 3 /* AstNodeKind.UnexpectedClosingBracket */: {\n const range = lengthsToRange(nodeOffsetStart, nodeOffsetEnd);\n return push(new BracketInfo(range, level - 1, 0, true));\n }\n case 1 /* AstNodeKind.Bracket */: {\n const range = lengthsToRange(nodeOffsetStart, nodeOffsetEnd);\n return push(new BracketInfo(range, level - 1, nestingLevelOfEqualBracketType - 1, parentPairIsIncomplete));\n }\n case 0 /* AstNodeKind.Text */:\n return true;\n }\n }\n}\nclass CollectBracketPairsContext {\n constructor(push, includeMinIndentation, textModel) {\n this.push = push;\n this.includeMinIndentation = includeMinIndentation;\n this.textModel = textModel;\n }\n}\nfunction collectBracketPairs(node, nodeOffsetStart, nodeOffsetEnd, startOffset, endOffset, context, level, levelPerBracketType) {\n var _a;\n if (level > 200) {\n return true;\n }\n let shouldContinue = true;\n if (node.kind === 2 /* AstNodeKind.Pair */) {\n let levelPerBracket = 0;\n if (levelPerBracketType) {\n let existing = levelPerBracketType.get(node.openingBracket.text);\n if (existing === undefined) {\n existing = 0;\n }\n levelPerBracket = existing;\n existing++;\n levelPerBracketType.set(node.openingBracket.text, existing);\n }\n const openingBracketEnd = lengthAdd(nodeOffsetStart, node.openingBracket.length);\n let minIndentation = -1;\n if (context.includeMinIndentation) {\n minIndentation = node.computeMinIndentation(nodeOffsetStart, context.textModel);\n }\n shouldContinue = context.push(new BracketPairWithMinIndentationInfo(lengthsToRange(nodeOffsetStart, nodeOffsetEnd), lengthsToRange(nodeOffsetStart, openingBracketEnd), node.closingBracket\n ? lengthsToRange(lengthAdd(openingBracketEnd, ((_a = node.child) === null || _a === void 0 ? void 0 : _a.length) || lengthZero), nodeOffsetEnd)\n : undefined, level, levelPerBracket, node, minIndentation));\n nodeOffsetStart = openingBracketEnd;\n if (shouldContinue && node.child) {\n const child = node.child;\n nodeOffsetEnd = lengthAdd(nodeOffsetStart, child.length);\n if (lengthLessThanEqual(nodeOffsetStart, endOffset) &&\n lengthGreaterThanEqual(nodeOffsetEnd, startOffset)) {\n shouldContinue = collectBracketPairs(child, nodeOffsetStart, nodeOffsetEnd, startOffset, endOffset, context, level + 1, levelPerBracketType);\n if (!shouldContinue) {\n return false;\n }\n }\n }\n levelPerBracketType === null || levelPerBracketType === void 0 ? void 0 : levelPerBracketType.set(node.openingBracket.text, levelPerBracket);\n }\n else {\n let curOffset = nodeOffsetStart;\n for (const child of node.children) {\n const childOffset = curOffset;\n curOffset = lengthAdd(curOffset, child.length);\n if (lengthLessThanEqual(childOffset, endOffset) &&\n lengthLessThanEqual(startOffset, curOffset)) {\n shouldContinue = collectBracketPairs(child, childOffset, curOffset, startOffset, endOffset, context, level, levelPerBracketType);\n if (!shouldContinue) {\n return false;\n }\n }\n }\n }\n return shouldContinue;\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 { CallbackIterable, compareBy } from '../../../../base/common/arrays.js';\nimport { Emitter } from '../../../../base/common/event.js';\nimport { Disposable, DisposableStore, MutableDisposable } from '../../../../base/common/lifecycle.js';\nimport { Range } from '../../core/range.js';\nimport { ignoreBracketsInToken } from '../../languages/supports.js';\nimport { BracketsUtils } from '../../languages/supports/richEditBrackets.js';\nimport { BracketPairsTree } from './bracketPairsTree/bracketPairsTree.js';\nexport class BracketPairsTextModelPart extends Disposable {\n get canBuildAST() {\n const maxSupportedDocumentLength = /* max lines */ 50000 * /* average column count */ 100;\n return this.textModel.getValueLength() <= maxSupportedDocumentLength;\n }\n constructor(textModel, languageConfigurationService) {\n super();\n this.textModel = textModel;\n this.languageConfigurationService = languageConfigurationService;\n this.bracketPairsTree = this._register(new MutableDisposable());\n this.onDidChangeEmitter = new Emitter();\n this.onDidChange = this.onDidChangeEmitter.event;\n this.bracketsRequested = false;\n this._register(this.languageConfigurationService.onDidChange(e => {\n var _a;\n if (!e.languageId || ((_a = this.bracketPairsTree.value) === null || _a === void 0 ? void 0 : _a.object.didLanguageChange(e.languageId))) {\n this.bracketPairsTree.clear();\n this.updateBracketPairsTree();\n }\n }));\n }\n //#region TextModel events\n handleDidChangeOptions(e) {\n this.bracketPairsTree.clear();\n this.updateBracketPairsTree();\n }\n handleDidChangeLanguage(e) {\n this.bracketPairsTree.clear();\n this.updateBracketPairsTree();\n }\n handleDidChangeContent(change) {\n var _a;\n (_a = this.bracketPairsTree.value) === null || _a === void 0 ? void 0 : _a.object.handleContentChanged(change);\n }\n handleDidChangeBackgroundTokenizationState() {\n var _a;\n (_a = this.bracketPairsTree.value) === null || _a === void 0 ? void 0 : _a.object.handleDidChangeBackgroundTokenizationState();\n }\n handleDidChangeTokens(e) {\n var _a;\n (_a = this.bracketPairsTree.value) === null || _a === void 0 ? void 0 : _a.object.handleDidChangeTokens(e);\n }\n //#endregion\n updateBracketPairsTree() {\n if (this.bracketsRequested && this.canBuildAST) {\n if (!this.bracketPairsTree.value) {\n const store = new DisposableStore();\n this.bracketPairsTree.value = createDisposableRef(store.add(new BracketPairsTree(this.textModel, (languageId) => {\n return this.languageConfigurationService.getLanguageConfiguration(languageId);\n })), store);\n store.add(this.bracketPairsTree.value.object.onDidChange(e => this.onDidChangeEmitter.fire(e)));\n this.onDidChangeEmitter.fire();\n }\n }\n else {\n if (this.bracketPairsTree.value) {\n this.bracketPairsTree.clear();\n // Important: Don't call fire if there was no change!\n this.onDidChangeEmitter.fire();\n }\n }\n }\n /**\n * Returns all bracket pairs that intersect the given range.\n * The result is sorted by the start position.\n */\n getBracketPairsInRange(range) {\n var _a;\n this.bracketsRequested = true;\n this.updateBracketPairsTree();\n return ((_a = this.bracketPairsTree.value) === null || _a === void 0 ? void 0 : _a.object.getBracketPairsInRange(range, false)) || CallbackIterable.empty;\n }\n getBracketPairsInRangeWithMinIndentation(range) {\n var _a;\n this.bracketsRequested = true;\n this.updateBracketPairsTree();\n return ((_a = this.bracketPairsTree.value) === null || _a === void 0 ? void 0 : _a.object.getBracketPairsInRange(range, true)) || CallbackIterable.empty;\n }\n getBracketsInRange(range, onlyColorizedBrackets = false) {\n var _a;\n this.bracketsRequested = true;\n this.updateBracketPairsTree();\n return ((_a = this.bracketPairsTree.value) === null || _a === void 0 ? void 0 : _a.object.getBracketsInRange(range, onlyColorizedBrackets)) || CallbackIterable.empty;\n }\n findMatchingBracketUp(_bracket, _position, maxDuration) {\n const position = this.textModel.validatePosition(_position);\n const languageId = this.textModel.getLanguageIdAtPosition(position.lineNumber, position.column);\n if (this.canBuildAST) {\n const closingBracketInfo = this.languageConfigurationService\n .getLanguageConfiguration(languageId)\n .bracketsNew.getClosingBracketInfo(_bracket);\n if (!closingBracketInfo) {\n return null;\n }\n const bracketPair = this.getBracketPairsInRange(Range.fromPositions(_position, _position)).findLast((b) => closingBracketInfo.closes(b.openingBracketInfo));\n if (bracketPair) {\n return bracketPair.openingBracketRange;\n }\n return null;\n }\n else {\n // Fallback to old bracket matching code:\n const bracket = _bracket.toLowerCase();\n const bracketsSupport = this.languageConfigurationService.getLanguageConfiguration(languageId).brackets;\n if (!bracketsSupport) {\n return null;\n }\n const data = bracketsSupport.textIsBracket[bracket];\n if (!data) {\n return null;\n }\n return stripBracketSearchCanceled(this._findMatchingBracketUp(data, position, createTimeBasedContinueBracketSearchPredicate(maxDuration)));\n }\n }\n matchBracket(position, maxDuration) {\n if (this.canBuildAST) {\n const bracketPair = this.getBracketPairsInRange(Range.fromPositions(position, position)).filter((item) => item.closingBracketRange !== undefined &&\n (item.openingBracketRange.containsPosition(position) ||\n item.closingBracketRange.containsPosition(position))).findLastMaxBy(compareBy((item) => item.openingBracketRange.containsPosition(position)\n ? item.openingBracketRange\n : item.closingBracketRange, Range.compareRangesUsingStarts));\n if (bracketPair) {\n return [bracketPair.openingBracketRange, bracketPair.closingBracketRange];\n }\n return null;\n }\n else {\n // Fallback to old bracket matching code:\n const continueSearchPredicate = createTimeBasedContinueBracketSearchPredicate(maxDuration);\n return this._matchBracket(this.textModel.validatePosition(position), continueSearchPredicate);\n }\n }\n _establishBracketSearchOffsets(position, lineTokens, modeBrackets, tokenIndex) {\n const tokenCount = lineTokens.getCount();\n const currentLanguageId = lineTokens.getLanguageId(tokenIndex);\n // limit search to not go before `maxBracketLength`\n let searchStartOffset = Math.max(0, position.column - 1 - modeBrackets.maxBracketLength);\n for (let i = tokenIndex - 1; i >= 0; i--) {\n const tokenEndOffset = lineTokens.getEndOffset(i);\n if (tokenEndOffset <= searchStartOffset) {\n break;\n }\n if (ignoreBracketsInToken(lineTokens.getStandardTokenType(i)) || lineTokens.getLanguageId(i) !== currentLanguageId) {\n searchStartOffset = tokenEndOffset;\n break;\n }\n }\n // limit search to not go after `maxBracketLength`\n let searchEndOffset = Math.min(lineTokens.getLineContent().length, position.column - 1 + modeBrackets.maxBracketLength);\n for (let i = tokenIndex + 1; i < tokenCount; i++) {\n const tokenStartOffset = lineTokens.getStartOffset(i);\n if (tokenStartOffset >= searchEndOffset) {\n break;\n }\n if (ignoreBracketsInToken(lineTokens.getStandardTokenType(i)) || lineTokens.getLanguageId(i) !== currentLanguageId) {\n searchEndOffset = tokenStartOffset;\n break;\n }\n }\n return { searchStartOffset, searchEndOffset };\n }\n _matchBracket(position, continueSearchPredicate) {\n const lineNumber = position.lineNumber;\n const lineTokens = this.textModel.tokenization.getLineTokens(lineNumber);\n const lineText = this.textModel.getLineContent(lineNumber);\n const tokenIndex = lineTokens.findTokenIndexAtOffset(position.column - 1);\n if (tokenIndex < 0) {\n return null;\n }\n const currentModeBrackets = this.languageConfigurationService.getLanguageConfiguration(lineTokens.getLanguageId(tokenIndex)).brackets;\n // check that the token is not to be ignored\n if (currentModeBrackets && !ignoreBracketsInToken(lineTokens.getStandardTokenType(tokenIndex))) {\n let { searchStartOffset, searchEndOffset } = this._establishBracketSearchOffsets(position, lineTokens, currentModeBrackets, tokenIndex);\n // it might be the case that [currentTokenStart -> currentTokenEnd] contains multiple brackets\n // `bestResult` will contain the most right-side result\n let bestResult = null;\n while (true) {\n const foundBracket = BracketsUtils.findNextBracketInRange(currentModeBrackets.forwardRegex, lineNumber, lineText, searchStartOffset, searchEndOffset);\n if (!foundBracket) {\n // there are no more brackets in this text\n break;\n }\n // check that we didn't hit a bracket too far away from position\n if (foundBracket.startColumn <= position.column && position.column <= foundBracket.endColumn) {\n const foundBracketText = lineText.substring(foundBracket.startColumn - 1, foundBracket.endColumn - 1).toLowerCase();\n const r = this._matchFoundBracket(foundBracket, currentModeBrackets.textIsBracket[foundBracketText], currentModeBrackets.textIsOpenBracket[foundBracketText], continueSearchPredicate);\n if (r) {\n if (r instanceof BracketSearchCanceled) {\n return null;\n }\n bestResult = r;\n }\n }\n searchStartOffset = foundBracket.endColumn - 1;\n }\n if (bestResult) {\n return bestResult;\n }\n }\n // If position is in between two tokens, try also looking in the previous token\n if (tokenIndex > 0 && lineTokens.getStartOffset(tokenIndex) === position.column - 1) {\n const prevTokenIndex = tokenIndex - 1;\n const prevModeBrackets = this.languageConfigurationService.getLanguageConfiguration(lineTokens.getLanguageId(prevTokenIndex)).brackets;\n // check that previous token is not to be ignored\n if (prevModeBrackets && !ignoreBracketsInToken(lineTokens.getStandardTokenType(prevTokenIndex))) {\n const { searchStartOffset, searchEndOffset } = this._establishBracketSearchOffsets(position, lineTokens, prevModeBrackets, prevTokenIndex);\n const foundBracket = BracketsUtils.findPrevBracketInRange(prevModeBrackets.reversedRegex, lineNumber, lineText, searchStartOffset, searchEndOffset);\n // check that we didn't hit a bracket too far away from position\n if (foundBracket && foundBracket.startColumn <= position.column && position.column <= foundBracket.endColumn) {\n const foundBracketText = lineText.substring(foundBracket.startColumn - 1, foundBracket.endColumn - 1).toLowerCase();\n const r = this._matchFoundBracket(foundBracket, prevModeBrackets.textIsBracket[foundBracketText], prevModeBrackets.textIsOpenBracket[foundBracketText], continueSearchPredicate);\n if (r) {\n if (r instanceof BracketSearchCanceled) {\n return null;\n }\n return r;\n }\n }\n }\n }\n return null;\n }\n _matchFoundBracket(foundBracket, data, isOpen, continueSearchPredicate) {\n if (!data) {\n return null;\n }\n const matched = (isOpen\n ? this._findMatchingBracketDown(data, foundBracket.getEndPosition(), continueSearchPredicate)\n : this._findMatchingBracketUp(data, foundBracket.getStartPosition(), continueSearchPredicate));\n if (!matched) {\n return null;\n }\n if (matched instanceof BracketSearchCanceled) {\n return matched;\n }\n return [foundBracket, matched];\n }\n _findMatchingBracketUp(bracket, position, continueSearchPredicate) {\n // console.log('_findMatchingBracketUp: ', 'bracket: ', JSON.stringify(bracket), 'startPosition: ', String(position));\n const languageId = bracket.languageId;\n const reversedBracketRegex = bracket.reversedRegex;\n let count = -1;\n let totalCallCount = 0;\n const searchPrevMatchingBracketInRange = (lineNumber, lineText, searchStartOffset, searchEndOffset) => {\n while (true) {\n if (continueSearchPredicate && (++totalCallCount) % 100 === 0 && !continueSearchPredicate()) {\n return BracketSearchCanceled.INSTANCE;\n }\n const r = BracketsUtils.findPrevBracketInRange(reversedBracketRegex, lineNumber, lineText, searchStartOffset, searchEndOffset);\n if (!r) {\n break;\n }\n const hitText = lineText.substring(r.startColumn - 1, r.endColumn - 1).toLowerCase();\n if (bracket.isOpen(hitText)) {\n count++;\n }\n else if (bracket.isClose(hitText)) {\n count--;\n }\n if (count === 0) {\n return r;\n }\n searchEndOffset = r.startColumn - 1;\n }\n return null;\n };\n for (let lineNumber = position.lineNumber; lineNumber >= 1; lineNumber--) {\n const lineTokens = this.textModel.tokenization.getLineTokens(lineNumber);\n const tokenCount = lineTokens.getCount();\n const lineText = this.textModel.getLineContent(lineNumber);\n let tokenIndex = tokenCount - 1;\n let searchStartOffset = lineText.length;\n let searchEndOffset = lineText.length;\n if (lineNumber === position.lineNumber) {\n tokenIndex = lineTokens.findTokenIndexAtOffset(position.column - 1);\n searchStartOffset = position.column - 1;\n searchEndOffset = position.column - 1;\n }\n let prevSearchInToken = true;\n for (; tokenIndex >= 0; tokenIndex--) {\n const searchInToken = (lineTokens.getLanguageId(tokenIndex) === languageId && !ignoreBracketsInToken(lineTokens.getStandardTokenType(tokenIndex)));\n if (searchInToken) {\n // this token should be searched\n if (prevSearchInToken) {\n // the previous token should be searched, simply extend searchStartOffset\n searchStartOffset = lineTokens.getStartOffset(tokenIndex);\n }\n else {\n // the previous token should not be searched\n searchStartOffset = lineTokens.getStartOffset(tokenIndex);\n searchEndOffset = lineTokens.getEndOffset(tokenIndex);\n }\n }\n else {\n // this token should not be searched\n if (prevSearchInToken && searchStartOffset !== searchEndOffset) {\n const r = searchPrevMatchingBracketInRange(lineNumber, lineText, searchStartOffset, searchEndOffset);\n if (r) {\n return r;\n }\n }\n }\n prevSearchInToken = searchInToken;\n }\n if (prevSearchInToken && searchStartOffset !== searchEndOffset) {\n const r = searchPrevMatchingBracketInRange(lineNumber, lineText, searchStartOffset, searchEndOffset);\n if (r) {\n return r;\n }\n }\n }\n return null;\n }\n _findMatchingBracketDown(bracket, position, continueSearchPredicate) {\n // console.log('_findMatchingBracketDown: ', 'bracket: ', JSON.stringify(bracket), 'startPosition: ', String(position));\n const languageId = bracket.languageId;\n const bracketRegex = bracket.forwardRegex;\n let count = 1;\n let totalCallCount = 0;\n const searchNextMatchingBracketInRange = (lineNumber, lineText, searchStartOffset, searchEndOffset) => {\n while (true) {\n if (continueSearchPredicate && (++totalCallCount) % 100 === 0 && !continueSearchPredicate()) {\n return BracketSearchCanceled.INSTANCE;\n }\n const r = BracketsUtils.findNextBracketInRange(bracketRegex, lineNumber, lineText, searchStartOffset, searchEndOffset);\n if (!r) {\n break;\n }\n const hitText = lineText.substring(r.startColumn - 1, r.endColumn - 1).toLowerCase();\n if (bracket.isOpen(hitText)) {\n count++;\n }\n else if (bracket.isClose(hitText)) {\n count--;\n }\n if (count === 0) {\n return r;\n }\n searchStartOffset = r.endColumn - 1;\n }\n return null;\n };\n const lineCount = this.textModel.getLineCount();\n for (let lineNumber = position.lineNumber; lineNumber <= lineCount; lineNumber++) {\n const lineTokens = this.textModel.tokenization.getLineTokens(lineNumber);\n const tokenCount = lineTokens.getCount();\n const lineText = this.textModel.getLineContent(lineNumber);\n let tokenIndex = 0;\n let searchStartOffset = 0;\n let searchEndOffset = 0;\n if (lineNumber === position.lineNumber) {\n tokenIndex = lineTokens.findTokenIndexAtOffset(position.column - 1);\n searchStartOffset = position.column - 1;\n searchEndOffset = position.column - 1;\n }\n let prevSearchInToken = true;\n for (; tokenIndex < tokenCount; tokenIndex++) {\n const searchInToken = (lineTokens.getLanguageId(tokenIndex) === languageId && !ignoreBracketsInToken(lineTokens.getStandardTokenType(tokenIndex)));\n if (searchInToken) {\n // this token should be searched\n if (prevSearchInToken) {\n // the previous token should be searched, simply extend searchEndOffset\n searchEndOffset = lineTokens.getEndOffset(tokenIndex);\n }\n else {\n // the previous token should not be searched\n searchStartOffset = lineTokens.getStartOffset(tokenIndex);\n searchEndOffset = lineTokens.getEndOffset(tokenIndex);\n }\n }\n else {\n // this token should not be searched\n if (prevSearchInToken && searchStartOffset !== searchEndOffset) {\n const r = searchNextMatchingBracketInRange(lineNumber, lineText, searchStartOffset, searchEndOffset);\n if (r) {\n return r;\n }\n }\n }\n prevSearchInToken = searchInToken;\n }\n if (prevSearchInToken && searchStartOffset !== searchEndOffset) {\n const r = searchNextMatchingBracketInRange(lineNumber, lineText, searchStartOffset, searchEndOffset);\n if (r) {\n return r;\n }\n }\n }\n return null;\n }\n findPrevBracket(_position) {\n var _a;\n const position = this.textModel.validatePosition(_position);\n if (this.canBuildAST) {\n this.bracketsRequested = true;\n this.updateBracketPairsTree();\n return ((_a = this.bracketPairsTree.value) === null || _a === void 0 ? void 0 : _a.object.getFirstBracketBefore(position)) || null;\n }\n let languageId = null;\n let modeBrackets = null;\n let bracketConfig = null;\n for (let lineNumber = position.lineNumber; lineNumber >= 1; lineNumber--) {\n const lineTokens = this.textModel.tokenization.getLineTokens(lineNumber);\n const tokenCount = lineTokens.getCount();\n const lineText = this.textModel.getLineContent(lineNumber);\n let tokenIndex = tokenCount - 1;\n let searchStartOffset = lineText.length;\n let searchEndOffset = lineText.length;\n if (lineNumber === position.lineNumber) {\n tokenIndex = lineTokens.findTokenIndexAtOffset(position.column - 1);\n searchStartOffset = position.column - 1;\n searchEndOffset = position.column - 1;\n const tokenLanguageId = lineTokens.getLanguageId(tokenIndex);\n if (languageId !== tokenLanguageId) {\n languageId = tokenLanguageId;\n modeBrackets = this.languageConfigurationService.getLanguageConfiguration(languageId).brackets;\n bracketConfig = this.languageConfigurationService.getLanguageConfiguration(languageId).bracketsNew;\n }\n }\n let prevSearchInToken = true;\n for (; tokenIndex >= 0; tokenIndex--) {\n const tokenLanguageId = lineTokens.getLanguageId(tokenIndex);\n if (languageId !== tokenLanguageId) {\n // language id change!\n if (modeBrackets && bracketConfig && prevSearchInToken && searchStartOffset !== searchEndOffset) {\n const r = BracketsUtils.findPrevBracketInRange(modeBrackets.reversedRegex, lineNumber, lineText, searchStartOffset, searchEndOffset);\n if (r) {\n return this._toFoundBracket(bracketConfig, r);\n }\n prevSearchInToken = false;\n }\n languageId = tokenLanguageId;\n modeBrackets = this.languageConfigurationService.getLanguageConfiguration(languageId).brackets;\n bracketConfig = this.languageConfigurationService.getLanguageConfiguration(languageId).bracketsNew;\n }\n const searchInToken = (!!modeBrackets && !ignoreBracketsInToken(lineTokens.getStandardTokenType(tokenIndex)));\n if (searchInToken) {\n // this token should be searched\n if (prevSearchInToken) {\n // the previous token should be searched, simply extend searchStartOffset\n searchStartOffset = lineTokens.getStartOffset(tokenIndex);\n }\n else {\n // the previous token should not be searched\n searchStartOffset = lineTokens.getStartOffset(tokenIndex);\n searchEndOffset = lineTokens.getEndOffset(tokenIndex);\n }\n }\n else {\n // this token should not be searched\n if (bracketConfig && modeBrackets && prevSearchInToken && searchStartOffset !== searchEndOffset) {\n const r = BracketsUtils.findPrevBracketInRange(modeBrackets.reversedRegex, lineNumber, lineText, searchStartOffset, searchEndOffset);\n if (r) {\n return this._toFoundBracket(bracketConfig, r);\n }\n }\n }\n prevSearchInToken = searchInToken;\n }\n if (bracketConfig && modeBrackets && prevSearchInToken && searchStartOffset !== searchEndOffset) {\n const r = BracketsUtils.findPrevBracketInRange(modeBrackets.reversedRegex, lineNumber, lineText, searchStartOffset, searchEndOffset);\n if (r) {\n return this._toFoundBracket(bracketConfig, r);\n }\n }\n }\n return null;\n }\n findNextBracket(_position) {\n var _a;\n const position = this.textModel.validatePosition(_position);\n if (this.canBuildAST) {\n this.bracketsRequested = true;\n this.updateBracketPairsTree();\n return ((_a = this.bracketPairsTree.value) === null || _a === void 0 ? void 0 : _a.object.getFirstBracketAfter(position)) || null;\n }\n const lineCount = this.textModel.getLineCount();\n let languageId = null;\n let modeBrackets = null;\n let bracketConfig = null;\n for (let lineNumber = position.lineNumber; lineNumber <= lineCount; lineNumber++) {\n const lineTokens = this.textModel.tokenization.getLineTokens(lineNumber);\n const tokenCount = lineTokens.getCount();\n const lineText = this.textModel.getLineContent(lineNumber);\n let tokenIndex = 0;\n let searchStartOffset = 0;\n let searchEndOffset = 0;\n if (lineNumber === position.lineNumber) {\n tokenIndex = lineTokens.findTokenIndexAtOffset(position.column - 1);\n searchStartOffset = position.column - 1;\n searchEndOffset = position.column - 1;\n const tokenLanguageId = lineTokens.getLanguageId(tokenIndex);\n if (languageId !== tokenLanguageId) {\n languageId = tokenLanguageId;\n modeBrackets = this.languageConfigurationService.getLanguageConfiguration(languageId).brackets;\n bracketConfig = this.languageConfigurationService.getLanguageConfiguration(languageId).bracketsNew;\n }\n }\n let prevSearchInToken = true;\n for (; tokenIndex < tokenCount; tokenIndex++) {\n const tokenLanguageId = lineTokens.getLanguageId(tokenIndex);\n if (languageId !== tokenLanguageId) {\n // language id change!\n if (bracketConfig && modeBrackets && prevSearchInToken && searchStartOffset !== searchEndOffset) {\n const r = BracketsUtils.findNextBracketInRange(modeBrackets.forwardRegex, lineNumber, lineText, searchStartOffset, searchEndOffset);\n if (r) {\n return this._toFoundBracket(bracketConfig, r);\n }\n prevSearchInToken = false;\n }\n languageId = tokenLanguageId;\n modeBrackets = this.languageConfigurationService.getLanguageConfiguration(languageId).brackets;\n bracketConfig = this.languageConfigurationService.getLanguageConfiguration(languageId).bracketsNew;\n }\n const searchInToken = (!!modeBrackets && !ignoreBracketsInToken(lineTokens.getStandardTokenType(tokenIndex)));\n if (searchInToken) {\n // this token should be searched\n if (prevSearchInToken) {\n // the previous token should be searched, simply extend searchEndOffset\n searchEndOffset = lineTokens.getEndOffset(tokenIndex);\n }\n else {\n // the previous token should not be searched\n searchStartOffset = lineTokens.getStartOffset(tokenIndex);\n searchEndOffset = lineTokens.getEndOffset(tokenIndex);\n }\n }\n else {\n // this token should not be searched\n if (bracketConfig && modeBrackets && prevSearchInToken && searchStartOffset !== searchEndOffset) {\n const r = BracketsUtils.findNextBracketInRange(modeBrackets.forwardRegex, lineNumber, lineText, searchStartOffset, searchEndOffset);\n if (r) {\n return this._toFoundBracket(bracketConfig, r);\n }\n }\n }\n prevSearchInToken = searchInToken;\n }\n if (bracketConfig && modeBrackets && prevSearchInToken && searchStartOffset !== searchEndOffset) {\n const r = BracketsUtils.findNextBracketInRange(modeBrackets.forwardRegex, lineNumber, lineText, searchStartOffset, searchEndOffset);\n if (r) {\n return this._toFoundBracket(bracketConfig, r);\n }\n }\n }\n return null;\n }\n findEnclosingBrackets(_position, maxDuration) {\n const position = this.textModel.validatePosition(_position);\n if (this.canBuildAST) {\n const range = Range.fromPositions(position);\n const bracketPair = this.getBracketPairsInRange(Range.fromPositions(position, position)).findLast((item) => item.closingBracketRange !== undefined && item.range.strictContainsRange(range));\n if (bracketPair) {\n return [bracketPair.openingBracketRange, bracketPair.closingBracketRange];\n }\n return null;\n }\n const continueSearchPredicate = createTimeBasedContinueBracketSearchPredicate(maxDuration);\n const lineCount = this.textModel.getLineCount();\n const savedCounts = new Map();\n let counts = [];\n const resetCounts = (languageId, modeBrackets) => {\n if (!savedCounts.has(languageId)) {\n const tmp = [];\n for (let i = 0, len = modeBrackets ? modeBrackets.brackets.length : 0; i < len; i++) {\n tmp[i] = 0;\n }\n savedCounts.set(languageId, tmp);\n }\n counts = savedCounts.get(languageId);\n };\n let totalCallCount = 0;\n const searchInRange = (modeBrackets, lineNumber, lineText, searchStartOffset, searchEndOffset) => {\n while (true) {\n if (continueSearchPredicate && (++totalCallCount) % 100 === 0 && !continueSearchPredicate()) {\n return BracketSearchCanceled.INSTANCE;\n }\n const r = BracketsUtils.findNextBracketInRange(modeBrackets.forwardRegex, lineNumber, lineText, searchStartOffset, searchEndOffset);\n if (!r) {\n break;\n }\n const hitText = lineText.substring(r.startColumn - 1, r.endColumn - 1).toLowerCase();\n const bracket = modeBrackets.textIsBracket[hitText];\n if (bracket) {\n if (bracket.isOpen(hitText)) {\n counts[bracket.index]++;\n }\n else if (bracket.isClose(hitText)) {\n counts[bracket.index]--;\n }\n if (counts[bracket.index] === -1) {\n return this._matchFoundBracket(r, bracket, false, continueSearchPredicate);\n }\n }\n searchStartOffset = r.endColumn - 1;\n }\n return null;\n };\n let languageId = null;\n let modeBrackets = null;\n for (let lineNumber = position.lineNumber; lineNumber <= lineCount; lineNumber++) {\n const lineTokens = this.textModel.tokenization.getLineTokens(lineNumber);\n const tokenCount = lineTokens.getCount();\n const lineText = this.textModel.getLineContent(lineNumber);\n let tokenIndex = 0;\n let searchStartOffset = 0;\n let searchEndOffset = 0;\n if (lineNumber === position.lineNumber) {\n tokenIndex = lineTokens.findTokenIndexAtOffset(position.column - 1);\n searchStartOffset = position.column - 1;\n searchEndOffset = position.column - 1;\n const tokenLanguageId = lineTokens.getLanguageId(tokenIndex);\n if (languageId !== tokenLanguageId) {\n languageId = tokenLanguageId;\n modeBrackets = this.languageConfigurationService.getLanguageConfiguration(languageId).brackets;\n resetCounts(languageId, modeBrackets);\n }\n }\n let prevSearchInToken = true;\n for (; tokenIndex < tokenCount; tokenIndex++) {\n const tokenLanguageId = lineTokens.getLanguageId(tokenIndex);\n if (languageId !== tokenLanguageId) {\n // language id change!\n if (modeBrackets && prevSearchInToken && searchStartOffset !== searchEndOffset) {\n const r = searchInRange(modeBrackets, lineNumber, lineText, searchStartOffset, searchEndOffset);\n if (r) {\n return stripBracketSearchCanceled(r);\n }\n prevSearchInToken = false;\n }\n languageId = tokenLanguageId;\n modeBrackets = this.languageConfigurationService.getLanguageConfiguration(languageId).brackets;\n resetCounts(languageId, modeBrackets);\n }\n const searchInToken = (!!modeBrackets && !ignoreBracketsInToken(lineTokens.getStandardTokenType(tokenIndex)));\n if (searchInToken) {\n // this token should be searched\n if (prevSearchInToken) {\n // the previous token should be searched, simply extend searchEndOffset\n searchEndOffset = lineTokens.getEndOffset(tokenIndex);\n }\n else {\n // the previous token should not be searched\n searchStartOffset = lineTokens.getStartOffset(tokenIndex);\n searchEndOffset = lineTokens.getEndOffset(tokenIndex);\n }\n }\n else {\n // this token should not be searched\n if (modeBrackets && prevSearchInToken && searchStartOffset !== searchEndOffset) {\n const r = searchInRange(modeBrackets, lineNumber, lineText, searchStartOffset, searchEndOffset);\n if (r) {\n return stripBracketSearchCanceled(r);\n }\n }\n }\n prevSearchInToken = searchInToken;\n }\n if (modeBrackets && prevSearchInToken && searchStartOffset !== searchEndOffset) {\n const r = searchInRange(modeBrackets, lineNumber, lineText, searchStartOffset, searchEndOffset);\n if (r) {\n return stripBracketSearchCanceled(r);\n }\n }\n }\n return null;\n }\n _toFoundBracket(bracketConfig, r) {\n if (!r) {\n return null;\n }\n let text = this.textModel.getValueInRange(r);\n text = text.toLowerCase();\n const bracketInfo = bracketConfig.getBracketInfo(text);\n if (!bracketInfo) {\n return null;\n }\n return {\n range: r,\n bracketInfo\n };\n }\n}\nfunction createDisposableRef(object, disposable) {\n return {\n object,\n dispose: () => disposable === null || disposable === void 0 ? void 0 : disposable.dispose(),\n };\n}\nfunction createTimeBasedContinueBracketSearchPredicate(maxDuration) {\n if (typeof maxDuration === 'undefined') {\n return () => true;\n }\n else {\n const startTime = Date.now();\n return () => {\n return (Date.now() - startTime <= maxDuration);\n };\n }\n}\nclass BracketSearchCanceled {\n constructor() {\n this._searchCanceledBrand = undefined;\n }\n}\nBracketSearchCanceled.INSTANCE = new BracketSearchCanceled();\nfunction stripBracketSearchCanceled(result) {\n if (result instanceof BracketSearchCanceled) {\n return null;\n }\n return 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 *--------------------------------------------------------------------------------------------*/\nimport { Emitter } from '../../../../base/common/event.js';\nimport { Disposable } from '../../../../base/common/lifecycle.js';\nimport { Range } from '../../core/range.js';\nimport { editorBracketHighlightingForeground1, editorBracketHighlightingForeground2, editorBracketHighlightingForeground3, editorBracketHighlightingForeground4, editorBracketHighlightingForeground5, editorBracketHighlightingForeground6, editorBracketHighlightingUnexpectedBracketForeground } from '../../core/editorColorRegistry.js';\nimport { registerThemingParticipant } from '../../../../platform/theme/common/themeService.js';\nexport class ColorizedBracketPairsDecorationProvider extends Disposable {\n constructor(textModel) {\n super();\n this.textModel = textModel;\n this.colorProvider = new ColorProvider();\n this.onDidChangeEmitter = new Emitter();\n this.onDidChange = this.onDidChangeEmitter.event;\n this.colorizationOptions = textModel.getOptions().bracketPairColorizationOptions;\n this._register(textModel.bracketPairs.onDidChange(e => {\n this.onDidChangeEmitter.fire();\n }));\n }\n //#region TextModel events\n handleDidChangeOptions(e) {\n this.colorizationOptions = this.textModel.getOptions().bracketPairColorizationOptions;\n }\n //#endregion\n getDecorationsInRange(range, ownerId, filterOutValidation, onlyMinimapDecorations) {\n if (onlyMinimapDecorations) {\n // Bracket pair colorization decorations are not rendered in the minimap\n return [];\n }\n if (ownerId === undefined) {\n return [];\n }\n if (!this.colorizationOptions.enabled) {\n return [];\n }\n const result = this.textModel.bracketPairs.getBracketsInRange(range, true).map(bracket => ({\n id: `bracket${bracket.range.toString()}-${bracket.nestingLevel}`,\n options: {\n description: 'BracketPairColorization',\n inlineClassName: this.colorProvider.getInlineClassName(bracket, this.colorizationOptions.independentColorPoolPerBracketType),\n },\n ownerId: 0,\n range: bracket.range,\n })).toArray();\n return result;\n }\n getAllDecorations(ownerId, filterOutValidation) {\n if (ownerId === undefined) {\n return [];\n }\n if (!this.colorizationOptions.enabled) {\n return [];\n }\n return this.getDecorationsInRange(new Range(1, 1, this.textModel.getLineCount(), 1), ownerId, filterOutValidation);\n }\n}\nclass ColorProvider {\n constructor() {\n this.unexpectedClosingBracketClassName = 'unexpected-closing-bracket';\n }\n getInlineClassName(bracket, independentColorPoolPerBracketType) {\n if (bracket.isInvalid) {\n return this.unexpectedClosingBracketClassName;\n }\n return this.getInlineClassNameOfLevel(independentColorPoolPerBracketType ? bracket.nestingLevelOfEqualBracketType : bracket.nestingLevel);\n }\n getInlineClassNameOfLevel(level) {\n // To support a dynamic amount of colors up to 6 colors,\n // we use a number that is a lcm of all numbers from 1 to 6.\n return `bracket-highlighting-${level % 30}`;\n }\n}\nregisterThemingParticipant((theme, collector) => {\n const colors = [\n editorBracketHighlightingForeground1,\n editorBracketHighlightingForeground2,\n editorBracketHighlightingForeground3,\n editorBracketHighlightingForeground4,\n editorBracketHighlightingForeground5,\n editorBracketHighlightingForeground6\n ];\n const colorProvider = new ColorProvider();\n collector.addRule(`.monaco-editor .${colorProvider.unexpectedClosingBracketClassName} { color: ${theme.getColor(editorBracketHighlightingUnexpectedBracketForeground)}; }`);\n const colorValues = colors\n .map(c => theme.getColor(c))\n .filter((c) => !!c)\n .filter(c => !c.isTransparent());\n for (let level = 0; level < 30; level++) {\n const color = colorValues[level % colorValues.length];\n collector.addRule(`.monaco-editor .${colorProvider.getInlineClassNameOfLevel(level)} { color: ${color}; }`);\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 *--------------------------------------------------------------------------------------------*/\nimport * as buffer from '../../../base/common/buffer.js';\nimport { decodeUTF16LE } from './stringBuilder.js';\nfunction escapeNewLine(str) {\n return (str\n .replace(/\\n/g, '\\\\n')\n .replace(/\\r/g, '\\\\r'));\n}\nexport class TextChange {\n get oldLength() {\n return this.oldText.length;\n }\n get oldEnd() {\n return this.oldPosition + this.oldText.length;\n }\n get newLength() {\n return this.newText.length;\n }\n get newEnd() {\n return this.newPosition + this.newText.length;\n }\n constructor(oldPosition, oldText, newPosition, newText) {\n this.oldPosition = oldPosition;\n this.oldText = oldText;\n this.newPosition = newPosition;\n this.newText = newText;\n }\n toString() {\n if (this.oldText.length === 0) {\n return `(insert@${this.oldPosition} \"${escapeNewLine(this.newText)}\")`;\n }\n if (this.newText.length === 0) {\n return `(delete@${this.oldPosition} \"${escapeNewLine(this.oldText)}\")`;\n }\n return `(replace@${this.oldPosition} \"${escapeNewLine(this.oldText)}\" with \"${escapeNewLine(this.newText)}\")`;\n }\n static _writeStringSize(str) {\n return (4 + 2 * str.length);\n }\n static _writeString(b, str, offset) {\n const len = str.length;\n buffer.writeUInt32BE(b, len, offset);\n offset += 4;\n for (let i = 0; i < len; i++) {\n buffer.writeUInt16LE(b, str.charCodeAt(i), offset);\n offset += 2;\n }\n return offset;\n }\n static _readString(b, offset) {\n const len = buffer.readUInt32BE(b, offset);\n offset += 4;\n return decodeUTF16LE(b, offset, len);\n }\n writeSize() {\n return (+4 // oldPosition\n + 4 // newPosition\n + TextChange._writeStringSize(this.oldText)\n + TextChange._writeStringSize(this.newText));\n }\n write(b, offset) {\n buffer.writeUInt32BE(b, this.oldPosition, offset);\n offset += 4;\n buffer.writeUInt32BE(b, this.newPosition, offset);\n offset += 4;\n offset = TextChange._writeString(b, this.oldText, offset);\n offset = TextChange._writeString(b, this.newText, offset);\n return offset;\n }\n static read(b, offset, dest) {\n const oldPosition = buffer.readUInt32BE(b, offset);\n offset += 4;\n const newPosition = buffer.readUInt32BE(b, offset);\n offset += 4;\n const oldText = TextChange._readString(b, offset);\n offset += TextChange._writeStringSize(oldText);\n const newText = TextChange._readString(b, offset);\n offset += TextChange._writeStringSize(newText);\n dest.push(new TextChange(oldPosition, oldText, newPosition, newText));\n return offset;\n }\n}\nexport function compressConsecutiveTextChanges(prevEdits, currEdits) {\n if (prevEdits === null || prevEdits.length === 0) {\n return currEdits;\n }\n const compressor = new TextChangeCompressor(prevEdits, currEdits);\n return compressor.compress();\n}\nclass TextChangeCompressor {\n constructor(prevEdits, currEdits) {\n this._prevEdits = prevEdits;\n this._currEdits = currEdits;\n this._result = [];\n this._resultLen = 0;\n this._prevLen = this._prevEdits.length;\n this._prevDeltaOffset = 0;\n this._currLen = this._currEdits.length;\n this._currDeltaOffset = 0;\n }\n compress() {\n let prevIndex = 0;\n let currIndex = 0;\n let prevEdit = this._getPrev(prevIndex);\n let currEdit = this._getCurr(currIndex);\n while (prevIndex < this._prevLen || currIndex < this._currLen) {\n if (prevEdit === null) {\n this._acceptCurr(currEdit);\n currEdit = this._getCurr(++currIndex);\n continue;\n }\n if (currEdit === null) {\n this._acceptPrev(prevEdit);\n prevEdit = this._getPrev(++prevIndex);\n continue;\n }\n if (currEdit.oldEnd <= prevEdit.newPosition) {\n this._acceptCurr(currEdit);\n currEdit = this._getCurr(++currIndex);\n continue;\n }\n if (prevEdit.newEnd <= currEdit.oldPosition) {\n this._acceptPrev(prevEdit);\n prevEdit = this._getPrev(++prevIndex);\n continue;\n }\n if (currEdit.oldPosition < prevEdit.newPosition) {\n const [e1, e2] = TextChangeCompressor._splitCurr(currEdit, prevEdit.newPosition - currEdit.oldPosition);\n this._acceptCurr(e1);\n currEdit = e2;\n continue;\n }\n if (prevEdit.newPosition < currEdit.oldPosition) {\n const [e1, e2] = TextChangeCompressor._splitPrev(prevEdit, currEdit.oldPosition - prevEdit.newPosition);\n this._acceptPrev(e1);\n prevEdit = e2;\n continue;\n }\n // At this point, currEdit.oldPosition === prevEdit.newPosition\n let mergePrev;\n let mergeCurr;\n if (currEdit.oldEnd === prevEdit.newEnd) {\n mergePrev = prevEdit;\n mergeCurr = currEdit;\n prevEdit = this._getPrev(++prevIndex);\n currEdit = this._getCurr(++currIndex);\n }\n else if (currEdit.oldEnd < prevEdit.newEnd) {\n const [e1, e2] = TextChangeCompressor._splitPrev(prevEdit, currEdit.oldLength);\n mergePrev = e1;\n mergeCurr = currEdit;\n prevEdit = e2;\n currEdit = this._getCurr(++currIndex);\n }\n else {\n const [e1, e2] = TextChangeCompressor._splitCurr(currEdit, prevEdit.newLength);\n mergePrev = prevEdit;\n mergeCurr = e1;\n prevEdit = this._getPrev(++prevIndex);\n currEdit = e2;\n }\n this._result[this._resultLen++] = new TextChange(mergePrev.oldPosition, mergePrev.oldText, mergeCurr.newPosition, mergeCurr.newText);\n this._prevDeltaOffset += mergePrev.newLength - mergePrev.oldLength;\n this._currDeltaOffset += mergeCurr.newLength - mergeCurr.oldLength;\n }\n const merged = TextChangeCompressor._merge(this._result);\n const cleaned = TextChangeCompressor._removeNoOps(merged);\n return cleaned;\n }\n _acceptCurr(currEdit) {\n this._result[this._resultLen++] = TextChangeCompressor._rebaseCurr(this._prevDeltaOffset, currEdit);\n this._currDeltaOffset += currEdit.newLength - currEdit.oldLength;\n }\n _getCurr(currIndex) {\n return (currIndex < this._currLen ? this._currEdits[currIndex] : null);\n }\n _acceptPrev(prevEdit) {\n this._result[this._resultLen++] = TextChangeCompressor._rebasePrev(this._currDeltaOffset, prevEdit);\n this._prevDeltaOffset += prevEdit.newLength - prevEdit.oldLength;\n }\n _getPrev(prevIndex) {\n return (prevIndex < this._prevLen ? this._prevEdits[prevIndex] : null);\n }\n static _rebaseCurr(prevDeltaOffset, currEdit) {\n return new TextChange(currEdit.oldPosition - prevDeltaOffset, currEdit.oldText, currEdit.newPosition, currEdit.newText);\n }\n static _rebasePrev(currDeltaOffset, prevEdit) {\n return new TextChange(prevEdit.oldPosition, prevEdit.oldText, prevEdit.newPosition + currDeltaOffset, prevEdit.newText);\n }\n static _splitPrev(edit, offset) {\n const preText = edit.newText.substr(0, offset);\n const postText = edit.newText.substr(offset);\n return [\n new TextChange(edit.oldPosition, edit.oldText, edit.newPosition, preText),\n new TextChange(edit.oldEnd, '', edit.newPosition + offset, postText)\n ];\n }\n static _splitCurr(edit, offset) {\n const preText = edit.oldText.substr(0, offset);\n const postText = edit.oldText.substr(offset);\n return [\n new TextChange(edit.oldPosition, preText, edit.newPosition, edit.newText),\n new TextChange(edit.oldPosition + offset, postText, edit.newEnd, '')\n ];\n }\n static _merge(edits) {\n if (edits.length === 0) {\n return edits;\n }\n const result = [];\n let resultLen = 0;\n let prev = edits[0];\n for (let i = 1; i < edits.length; i++) {\n const curr = edits[i];\n if (prev.oldEnd === curr.oldPosition) {\n // Merge into `prev`\n prev = new TextChange(prev.oldPosition, prev.oldText + curr.oldText, prev.newPosition, prev.newText + curr.newText);\n }\n else {\n result[resultLen++] = prev;\n prev = curr;\n }\n }\n result[resultLen++] = prev;\n return result;\n }\n static _removeNoOps(edits) {\n if (edits.length === 0) {\n return edits;\n }\n const result = [];\n let resultLen = 0;\n for (let i = 0; i < edits.length; i++) {\n const edit = edits[i];\n if (edit.oldText === edit.newText) {\n continue;\n }\n result[resultLen++] = edit;\n }\n return result;\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 *--------------------------------------------------------------------------------------------*/\nimport { posix, sep } from './path.js';\nimport { isWindows } from './platform.js';\nimport { startsWithIgnoreCase } from './strings.js';\nexport function isPathSeparator(code) {\n return code === 47 /* CharCode.Slash */ || code === 92 /* CharCode.Backslash */;\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) {\n return osPath.replace(/[\\\\/]/g, posix.sep);\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) {\n if (osPath.indexOf('/') === -1) {\n osPath = toSlashes(osPath);\n }\n if (/^[a-zA-Z]:(\\/|$)/.test(osPath)) { // starts with a drive letter\n osPath = '/' + osPath;\n }\n return osPath;\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, sep = posix.sep) {\n if (!path) {\n return '';\n }\n const len = path.length;\n const firstLetter = path.charCodeAt(0);\n if (isPathSeparator(firstLetter)) {\n if (isPathSeparator(path.charCodeAt(1))) {\n // UNC candidate \\\\localhost\\shares\\ddd\n // ^^^^^^^^^^^^^^^^^^^\n if (!isPathSeparator(path.charCodeAt(2))) {\n let pos = 3;\n const start = pos;\n for (; pos < len; pos++) {\n if (isPathSeparator(path.charCodeAt(pos))) {\n break;\n }\n }\n if (start !== pos && !isPathSeparator(path.charCodeAt(pos + 1))) {\n pos += 1;\n for (; pos < len; pos++) {\n if (isPathSeparator(path.charCodeAt(pos))) {\n return path.slice(0, pos + 1) // consume this separator\n .replace(/[\\\\/]/g, sep);\n }\n }\n }\n }\n }\n // /user/far\n // ^\n return sep;\n }\n else if (isWindowsDriveLetter(firstLetter)) {\n // check for windows drive letter c:\\ or c:\n if (path.charCodeAt(1) === 58 /* CharCode.Colon */) {\n if (isPathSeparator(path.charCodeAt(2))) {\n // C:\\fff\n // ^^^\n return path.slice(0, 2) + sep;\n }\n else {\n // C:\n // ^^\n return path.slice(0, 2);\n }\n }\n }\n // check for URI\n // scheme://authority/path\n // ^^^^^^^^^^^^^^^^^^^\n let pos = path.indexOf('://');\n if (pos !== -1) {\n pos += 3; // 3 -> \"://\".length\n for (; pos < len; pos++) {\n if (isPathSeparator(path.charCodeAt(pos))) {\n return path.slice(0, pos + 1); // consume this separator\n }\n }\n }\n return '';\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, parentCandidate, ignoreCase, separator = sep) {\n if (base === parentCandidate) {\n return true;\n }\n if (!base || !parentCandidate) {\n return false;\n }\n if (parentCandidate.length > base.length) {\n return false;\n }\n if (ignoreCase) {\n const beginsWith = startsWithIgnoreCase(base, parentCandidate);\n if (!beginsWith) {\n return false;\n }\n if (parentCandidate.length === base.length) {\n return true; // same path, different casing\n }\n let sepOffset = parentCandidate.length;\n if (parentCandidate.charAt(parentCandidate.length - 1) === separator) {\n sepOffset--; // adjust the expected sep offset in case our candidate already ends in separator character\n }\n return base.charAt(sepOffset) === separator;\n }\n if (parentCandidate.charAt(parentCandidate.length - 1) !== separator) {\n parentCandidate += separator;\n }\n return base.indexOf(parentCandidate) === 0;\n}\nexport function isWindowsDriveLetter(char0) {\n return char0 >= 65 /* CharCode.A */ && char0 <= 90 /* CharCode.Z */ || char0 >= 97 /* CharCode.a */ && char0 <= 122 /* CharCode.z */;\n}\nexport function hasDriveLetter(path, isWindowsOS = isWindows) {\n if (isWindowsOS) {\n return isWindowsDriveLetter(path.charCodeAt(0)) && path.charCodeAt(1) === 58 /* CharCode.Colon */;\n }\n 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 *--------------------------------------------------------------------------------------------*/\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';\nexport function originalFSPath(uri) {\n return uriToFsPath(uri, true);\n}\nexport class ExtUri {\n constructor(_ignorePathCasing) {\n this._ignorePathCasing = _ignorePathCasing;\n }\n compare(uri1, uri2, ignoreFragment = false) {\n if (uri1 === uri2) {\n return 0;\n }\n return strCompare(this.getComparisonKey(uri1, ignoreFragment), this.getComparisonKey(uri2, ignoreFragment));\n }\n isEqual(uri1, uri2, ignoreFragment = false) {\n if (uri1 === uri2) {\n return true;\n }\n if (!uri1 || !uri2) {\n return false;\n }\n return this.getComparisonKey(uri1, ignoreFragment) === this.getComparisonKey(uri2, ignoreFragment);\n }\n getComparisonKey(uri, ignoreFragment = false) {\n return uri.with({\n path: this._ignorePathCasing(uri) ? uri.path.toLowerCase() : undefined,\n fragment: ignoreFragment ? null : undefined\n }).toString();\n }\n isEqualOrParent(base, parentCandidate, ignoreFragment = false) {\n if (base.scheme === parentCandidate.scheme) {\n if (base.scheme === Schemas.file) {\n return extpath.isEqualOrParent(originalFSPath(base), originalFSPath(parentCandidate), this._ignorePathCasing(base)) && base.query === parentCandidate.query && (ignoreFragment || base.fragment === parentCandidate.fragment);\n }\n if (isEqualAuthority(base.authority, parentCandidate.authority)) {\n return extpath.isEqualOrParent(base.path, parentCandidate.path, this._ignorePathCasing(base), '/') && base.query === parentCandidate.query && (ignoreFragment || base.fragment === parentCandidate.fragment);\n }\n }\n return false;\n }\n // --- path math\n joinPath(resource, ...pathFragment) {\n return URI.joinPath(resource, ...pathFragment);\n }\n basenameOrAuthority(resource) {\n return basename(resource) || resource.authority;\n }\n basename(resource) {\n return paths.posix.basename(resource.path);\n }\n extname(resource) {\n return paths.posix.extname(resource.path);\n }\n dirname(resource) {\n if (resource.path.length === 0) {\n return resource;\n }\n let dirname;\n if (resource.scheme === Schemas.file) {\n dirname = URI.file(paths.dirname(originalFSPath(resource))).path;\n }\n else {\n dirname = paths.posix.dirname(resource.path);\n if (resource.authority && dirname.length && dirname.charCodeAt(0) !== 47 /* CharCode.Slash */) {\n console.error(`dirname(\"${resource.toString})) resulted in a relative path`);\n dirname = '/'; // If a URI contains an authority component, then the path component must either be empty or begin with a CharCode.Slash (\"/\") character\n }\n }\n return resource.with({\n path: dirname\n });\n }\n normalizePath(resource) {\n if (!resource.path.length) {\n return resource;\n }\n let normalizedPath;\n if (resource.scheme === Schemas.file) {\n normalizedPath = URI.file(paths.normalize(originalFSPath(resource))).path;\n }\n else {\n normalizedPath = paths.posix.normalize(resource.path);\n }\n return resource.with({\n path: normalizedPath\n });\n }\n relativePath(from, to) {\n if (from.scheme !== to.scheme || !isEqualAuthority(from.authority, to.authority)) {\n return undefined;\n }\n if (from.scheme === Schemas.file) {\n const relativePath = paths.relative(originalFSPath(from), originalFSPath(to));\n return isWindows ? extpath.toSlashes(relativePath) : relativePath;\n }\n let fromPath = from.path || '/';\n const toPath = to.path || '/';\n if (this._ignorePathCasing(from)) {\n // make casing of fromPath match toPath\n let i = 0;\n for (const len = Math.min(fromPath.length, toPath.length); i < len; i++) {\n if (fromPath.charCodeAt(i) !== toPath.charCodeAt(i)) {\n if (fromPath.charAt(i).toLowerCase() !== toPath.charAt(i).toLowerCase()) {\n break;\n }\n }\n }\n fromPath = toPath.substr(0, i) + fromPath.substr(i);\n }\n return paths.posix.relative(fromPath, toPath);\n }\n resolvePath(base, path) {\n if (base.scheme === Schemas.file) {\n const newURI = URI.file(paths.resolve(originalFSPath(base), path));\n return base.with({\n authority: newURI.authority,\n path: newURI.path\n });\n }\n path = extpath.toPosixPath(path); // we allow path to be a windows path\n return base.with({\n path: paths.posix.resolve(base.path, path)\n });\n }\n // --- misc\n isAbsolutePath(resource) {\n return !!resource.path && resource.path[0] === '/';\n }\n isEqualAuthority(a1, a2) {\n return a1 === a2 || (a1 !== undefined && a2 !== undefined && equalsIgnoreCase(a1, a2));\n }\n hasTrailingPathSeparator(resource, sep = paths.sep) {\n if (resource.scheme === Schemas.file) {\n const fsp = originalFSPath(resource);\n return fsp.length > extpath.getRoot(fsp).length && fsp[fsp.length - 1] === sep;\n }\n else {\n const p = resource.path;\n return (p.length > 1 && p.charCodeAt(p.length - 1) === 47 /* CharCode.Slash */) && !(/^[a-zA-Z]:(\\/$|\\\\$)/.test(resource.fsPath)); // ignore the slash at offset 0\n }\n }\n removeTrailingPathSeparator(resource, sep = paths.sep) {\n // Make sure that the path isn't a drive letter. A trailing separator there is not removable.\n if (hasTrailingPathSeparator(resource, sep)) {\n return resource.with({ path: resource.path.substr(0, resource.path.length - 1) });\n }\n return resource;\n }\n addTrailingPathSeparator(resource, sep = paths.sep) {\n let isRootSep = false;\n if (resource.scheme === Schemas.file) {\n const fsp = originalFSPath(resource);\n isRootSep = ((fsp !== undefined) && (fsp.length === extpath.getRoot(fsp).length) && (fsp[fsp.length - 1] === sep));\n }\n else {\n sep = '/';\n const p = resource.path;\n isRootSep = p.length === 1 && p.charCodeAt(p.length - 1) === 47 /* CharCode.Slash */;\n }\n if (!isRootSep && !hasTrailingPathSeparator(resource, sep)) {\n return resource.with({ path: resource.path + '/' });\n }\n return resource;\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 * 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 // A file scheme resource is in the same platform as code, so ignore case for non linux platforms\n // Resource can be from another platform. Lowering the case as an hack. Should come from File system provider\n return uri.scheme === Schemas.file ? !isLinux : true;\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);\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 * Data URI related helpers.\n */\nexport var DataUri;\n(function (DataUri) {\n DataUri.META_DATA_LABEL = 'label';\n DataUri.META_DATA_DESCRIPTION = 'description';\n DataUri.META_DATA_SIZE = 'size';\n DataUri.META_DATA_MIME = 'mime';\n function parseMetaData(dataUri) {\n const metadata = new Map();\n // Given a URI of: data:image/png;size:2313;label:SomeLabel;description:SomeDescription;base64,77+9UE5...\n // the metadata is: size:2313;label:SomeLabel;description:SomeDescription\n const meta = dataUri.path.substring(dataUri.path.indexOf(';') + 1, dataUri.path.lastIndexOf(';'));\n meta.split(';').forEach(property => {\n const [key, value] = property.split(':');\n if (key && value) {\n metadata.set(key, value);\n }\n });\n // Given a URI of: data:image/png;size:2313;label:SomeLabel;description:SomeDescription;base64,77+9UE5...\n // the mime is: image/png\n const mime = dataUri.path.substring(0, dataUri.path.indexOf(';'));\n if (mime) {\n metadata.set(DataUri.META_DATA_MIME, mime);\n }\n return metadata;\n }\n DataUri.parseMetaData = parseMetaData;\n})(DataUri || (DataUri = {}));\n", "/*---------------------------------------------------------------------------------------------\n * 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 * as nls from '../../../nls.js';\nimport { onUnexpectedError } from '../../../base/common/errors.js';\nimport { Selection } from '../core/selection.js';\nimport { URI } from '../../../base/common/uri.js';\nimport { TextChange, compressConsecutiveTextChanges } from '../core/textChange.js';\nimport * as buffer from '../../../base/common/buffer.js';\nimport { basename } from '../../../base/common/resources.js';\nfunction uriGetComparisonKey(resource) {\n return resource.toString();\n}\nexport class SingleModelEditStackData {\n static create(model, beforeCursorState) {\n const alternativeVersionId = model.getAlternativeVersionId();\n const eol = getModelEOL(model);\n return new SingleModelEditStackData(alternativeVersionId, alternativeVersionId, eol, eol, beforeCursorState, beforeCursorState, []);\n }\n constructor(beforeVersionId, afterVersionId, beforeEOL, afterEOL, beforeCursorState, afterCursorState, changes) {\n this.beforeVersionId = beforeVersionId;\n this.afterVersionId = afterVersionId;\n this.beforeEOL = beforeEOL;\n this.afterEOL = afterEOL;\n this.beforeCursorState = beforeCursorState;\n this.afterCursorState = afterCursorState;\n this.changes = changes;\n }\n append(model, textChanges, afterEOL, afterVersionId, afterCursorState) {\n if (textChanges.length > 0) {\n this.changes = compressConsecutiveTextChanges(this.changes, textChanges);\n }\n this.afterEOL = afterEOL;\n this.afterVersionId = afterVersionId;\n this.afterCursorState = afterCursorState;\n }\n static _writeSelectionsSize(selections) {\n return 4 + 4 * 4 * (selections ? selections.length : 0);\n }\n static _writeSelections(b, selections, offset) {\n buffer.writeUInt32BE(b, (selections ? selections.length : 0), offset);\n offset += 4;\n if (selections) {\n for (const selection of selections) {\n buffer.writeUInt32BE(b, selection.selectionStartLineNumber, offset);\n offset += 4;\n buffer.writeUInt32BE(b, selection.selectionStartColumn, offset);\n offset += 4;\n buffer.writeUInt32BE(b, selection.positionLineNumber, offset);\n offset += 4;\n buffer.writeUInt32BE(b, selection.positionColumn, offset);\n offset += 4;\n }\n }\n return offset;\n }\n static _readSelections(b, offset, dest) {\n const count = buffer.readUInt32BE(b, offset);\n offset += 4;\n for (let i = 0; i < count; i++) {\n const selectionStartLineNumber = buffer.readUInt32BE(b, offset);\n offset += 4;\n const selectionStartColumn = buffer.readUInt32BE(b, offset);\n offset += 4;\n const positionLineNumber = buffer.readUInt32BE(b, offset);\n offset += 4;\n const positionColumn = buffer.readUInt32BE(b, offset);\n offset += 4;\n dest.push(new Selection(selectionStartLineNumber, selectionStartColumn, positionLineNumber, positionColumn));\n }\n return offset;\n }\n serialize() {\n let necessarySize = (+4 // beforeVersionId\n + 4 // afterVersionId\n + 1 // beforeEOL\n + 1 // afterEOL\n + SingleModelEditStackData._writeSelectionsSize(this.beforeCursorState)\n + SingleModelEditStackData._writeSelectionsSize(this.afterCursorState)\n + 4 // change count\n );\n for (const change of this.changes) {\n necessarySize += change.writeSize();\n }\n const b = new Uint8Array(necessarySize);\n let offset = 0;\n buffer.writeUInt32BE(b, this.beforeVersionId, offset);\n offset += 4;\n buffer.writeUInt32BE(b, this.afterVersionId, offset);\n offset += 4;\n buffer.writeUInt8(b, this.beforeEOL, offset);\n offset += 1;\n buffer.writeUInt8(b, this.afterEOL, offset);\n offset += 1;\n offset = SingleModelEditStackData._writeSelections(b, this.beforeCursorState, offset);\n offset = SingleModelEditStackData._writeSelections(b, this.afterCursorState, offset);\n buffer.writeUInt32BE(b, this.changes.length, offset);\n offset += 4;\n for (const change of this.changes) {\n offset = change.write(b, offset);\n }\n return b.buffer;\n }\n static deserialize(source) {\n const b = new Uint8Array(source);\n let offset = 0;\n const beforeVersionId = buffer.readUInt32BE(b, offset);\n offset += 4;\n const afterVersionId = buffer.readUInt32BE(b, offset);\n offset += 4;\n const beforeEOL = buffer.readUInt8(b, offset);\n offset += 1;\n const afterEOL = buffer.readUInt8(b, offset);\n offset += 1;\n const beforeCursorState = [];\n offset = SingleModelEditStackData._readSelections(b, offset, beforeCursorState);\n const afterCursorState = [];\n offset = SingleModelEditStackData._readSelections(b, offset, afterCursorState);\n const changeCount = buffer.readUInt32BE(b, offset);\n offset += 4;\n const changes = [];\n for (let i = 0; i < changeCount; i++) {\n offset = TextChange.read(b, offset, changes);\n }\n return new SingleModelEditStackData(beforeVersionId, afterVersionId, beforeEOL, afterEOL, beforeCursorState, afterCursorState, changes);\n }\n}\nexport class SingleModelEditStackElement {\n get type() {\n return 0 /* UndoRedoElementType.Resource */;\n }\n get resource() {\n if (URI.isUri(this.model)) {\n return this.model;\n }\n return this.model.uri;\n }\n constructor(label, code, model, beforeCursorState) {\n this.label = label;\n this.code = code;\n this.model = model;\n this._data = SingleModelEditStackData.create(model, beforeCursorState);\n }\n toString() {\n const data = (this._data instanceof SingleModelEditStackData ? this._data : SingleModelEditStackData.deserialize(this._data));\n return data.changes.map(change => change.toString()).join(', ');\n }\n matchesResource(resource) {\n const uri = (URI.isUri(this.model) ? this.model : this.model.uri);\n return (uri.toString() === resource.toString());\n }\n setModel(model) {\n this.model = model;\n }\n canAppend(model) {\n return (this.model === model && this._data instanceof SingleModelEditStackData);\n }\n append(model, textChanges, afterEOL, afterVersionId, afterCursorState) {\n if (this._data instanceof SingleModelEditStackData) {\n this._data.append(model, textChanges, afterEOL, afterVersionId, afterCursorState);\n }\n }\n close() {\n if (this._data instanceof SingleModelEditStackData) {\n this._data = this._data.serialize();\n }\n }\n open() {\n if (!(this._data instanceof SingleModelEditStackData)) {\n this._data = SingleModelEditStackData.deserialize(this._data);\n }\n }\n undo() {\n if (URI.isUri(this.model)) {\n // don't have a model\n throw new Error(`Invalid SingleModelEditStackElement`);\n }\n if (this._data instanceof SingleModelEditStackData) {\n this._data = this._data.serialize();\n }\n const data = SingleModelEditStackData.deserialize(this._data);\n this.model._applyUndo(data.changes, data.beforeEOL, data.beforeVersionId, data.beforeCursorState);\n }\n redo() {\n if (URI.isUri(this.model)) {\n // don't have a model\n throw new Error(`Invalid SingleModelEditStackElement`);\n }\n if (this._data instanceof SingleModelEditStackData) {\n this._data = this._data.serialize();\n }\n const data = SingleModelEditStackData.deserialize(this._data);\n this.model._applyRedo(data.changes, data.afterEOL, data.afterVersionId, data.afterCursorState);\n }\n heapSize() {\n if (this._data instanceof SingleModelEditStackData) {\n this._data = this._data.serialize();\n }\n return this._data.byteLength + 168 /*heap overhead*/;\n }\n}\nexport class MultiModelEditStackElement {\n get resources() {\n return this._editStackElementsArr.map(editStackElement => editStackElement.resource);\n }\n constructor(label, code, editStackElements) {\n this.label = label;\n this.code = code;\n this.type = 1 /* UndoRedoElementType.Workspace */;\n this._isOpen = true;\n this._editStackElementsArr = editStackElements.slice(0);\n this._editStackElementsMap = new Map();\n for (const editStackElement of this._editStackElementsArr) {\n const key = uriGetComparisonKey(editStackElement.resource);\n this._editStackElementsMap.set(key, editStackElement);\n }\n this._delegate = null;\n }\n prepareUndoRedo() {\n if (this._delegate) {\n return this._delegate.prepareUndoRedo(this);\n }\n }\n matchesResource(resource) {\n const key = uriGetComparisonKey(resource);\n return (this._editStackElementsMap.has(key));\n }\n setModel(model) {\n const key = uriGetComparisonKey(URI.isUri(model) ? model : model.uri);\n if (this._editStackElementsMap.has(key)) {\n this._editStackElementsMap.get(key).setModel(model);\n }\n }\n canAppend(model) {\n if (!this._isOpen) {\n return false;\n }\n const key = uriGetComparisonKey(model.uri);\n if (this._editStackElementsMap.has(key)) {\n const editStackElement = this._editStackElementsMap.get(key);\n return editStackElement.canAppend(model);\n }\n return false;\n }\n append(model, textChanges, afterEOL, afterVersionId, afterCursorState) {\n const key = uriGetComparisonKey(model.uri);\n const editStackElement = this._editStackElementsMap.get(key);\n editStackElement.append(model, textChanges, afterEOL, afterVersionId, afterCursorState);\n }\n close() {\n this._isOpen = false;\n }\n open() {\n // cannot reopen\n }\n undo() {\n this._isOpen = false;\n for (const editStackElement of this._editStackElementsArr) {\n editStackElement.undo();\n }\n }\n redo() {\n for (const editStackElement of this._editStackElementsArr) {\n editStackElement.redo();\n }\n }\n heapSize(resource) {\n const key = uriGetComparisonKey(resource);\n if (this._editStackElementsMap.has(key)) {\n const editStackElement = this._editStackElementsMap.get(key);\n return editStackElement.heapSize();\n }\n return 0;\n }\n split() {\n return this._editStackElementsArr;\n }\n toString() {\n const result = [];\n for (const editStackElement of this._editStackElementsArr) {\n result.push(`${basename(editStackElement.resource)}: ${editStackElement}`);\n }\n return `{${result.join(', ')}}`;\n }\n}\nfunction getModelEOL(model) {\n const eol = model.getEOL();\n if (eol === '\\n') {\n return 0 /* EndOfLineSequence.LF */;\n }\n else {\n return 1 /* EndOfLineSequence.CRLF */;\n }\n}\nexport function isEditStackElement(element) {\n if (!element) {\n return false;\n }\n return ((element instanceof SingleModelEditStackElement) || (element instanceof MultiModelEditStackElement));\n}\nexport class EditStack {\n constructor(model, undoRedoService) {\n this._model = model;\n this._undoRedoService = undoRedoService;\n }\n pushStackElement() {\n const lastElement = this._undoRedoService.getLastElement(this._model.uri);\n if (isEditStackElement(lastElement)) {\n lastElement.close();\n }\n }\n popStackElement() {\n const lastElement = this._undoRedoService.getLastElement(this._model.uri);\n if (isEditStackElement(lastElement)) {\n lastElement.open();\n }\n }\n clear() {\n this._undoRedoService.removeElements(this._model.uri);\n }\n _getOrCreateEditStackElement(beforeCursorState, group) {\n const lastElement = this._undoRedoService.getLastElement(this._model.uri);\n if (isEditStackElement(lastElement) && lastElement.canAppend(this._model)) {\n return lastElement;\n }\n const newElement = new SingleModelEditStackElement(nls.localize('edit', \"Typing\"), 'undoredo.textBufferEdit', this._model, beforeCursorState);\n this._undoRedoService.pushElement(newElement, group);\n return newElement;\n }\n pushEOL(eol) {\n const editStackElement = this._getOrCreateEditStackElement(null, undefined);\n this._model.setEOL(eol);\n editStackElement.append(this._model, [], getModelEOL(this._model), this._model.getAlternativeVersionId(), null);\n }\n pushEditOperation(beforeCursorState, editOperations, cursorStateComputer, group) {\n const editStackElement = this._getOrCreateEditStackElement(beforeCursorState, group);\n const inverseEditOperations = this._model.applyEdits(editOperations, true);\n const afterCursorState = EditStack._computeCursorState(cursorStateComputer, inverseEditOperations);\n const textChanges = inverseEditOperations.map((op, index) => ({ index: index, textChange: op.textChange }));\n textChanges.sort((a, b) => {\n if (a.textChange.oldPosition === b.textChange.oldPosition) {\n return a.index - b.index;\n }\n return a.textChange.oldPosition - b.textChange.oldPosition;\n });\n editStackElement.append(this._model, textChanges.map(op => op.textChange), getModelEOL(this._model), this._model.getAlternativeVersionId(), afterCursorState);\n return afterCursorState;\n }\n static _computeCursorState(cursorStateComputer, inverseEditOperations) {\n try {\n return cursorStateComputer ? cursorStateComputer(inverseEditOperations) : null;\n }\n catch (e) {\n onUnexpectedError(e);\n return null;\n }\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 *--------------------------------------------------------------------------------------------*/\nclass SpacesDiffResult {\n constructor() {\n this.spacesDiff = 0;\n this.looksLikeAlignment = false;\n }\n}\n/**\n * Compute the diff in spaces between two line's indentation.\n */\nfunction spacesDiff(a, aLength, b, bLength, result) {\n result.spacesDiff = 0;\n result.looksLikeAlignment = false;\n // This can go both ways (e.g.):\n // - a: \"\\t\"\n // - b: \"\\t \"\n // => This should count 1 tab and 4 spaces\n let i;\n for (i = 0; i < aLength && i < bLength; i++) {\n const aCharCode = a.charCodeAt(i);\n const bCharCode = b.charCodeAt(i);\n if (aCharCode !== bCharCode) {\n break;\n }\n }\n let aSpacesCnt = 0, aTabsCount = 0;\n for (let j = i; j < aLength; j++) {\n const aCharCode = a.charCodeAt(j);\n if (aCharCode === 32 /* CharCode.Space */) {\n aSpacesCnt++;\n }\n else {\n aTabsCount++;\n }\n }\n let bSpacesCnt = 0, bTabsCount = 0;\n for (let j = i; j < bLength; j++) {\n const bCharCode = b.charCodeAt(j);\n if (bCharCode === 32 /* CharCode.Space */) {\n bSpacesCnt++;\n }\n else {\n bTabsCount++;\n }\n }\n if (aSpacesCnt > 0 && aTabsCount > 0) {\n return;\n }\n if (bSpacesCnt > 0 && bTabsCount > 0) {\n return;\n }\n const tabsDiff = Math.abs(aTabsCount - bTabsCount);\n const spacesDiff = Math.abs(aSpacesCnt - bSpacesCnt);\n if (tabsDiff === 0) {\n // check if the indentation difference might be caused by alignment reasons\n // sometime folks like to align their code, but this should not be used as a hint\n result.spacesDiff = spacesDiff;\n if (spacesDiff > 0 && 0 <= bSpacesCnt - 1 && bSpacesCnt - 1 < a.length && bSpacesCnt < b.length) {\n if (b.charCodeAt(bSpacesCnt) !== 32 /* CharCode.Space */ && a.charCodeAt(bSpacesCnt - 1) === 32 /* CharCode.Space */) {\n if (a.charCodeAt(a.length - 1) === 44 /* CharCode.Comma */) {\n // This looks like an alignment desire: e.g.\n // const a = b + c,\n // d = b - c;\n result.looksLikeAlignment = true;\n }\n }\n }\n return;\n }\n if (spacesDiff % tabsDiff === 0) {\n result.spacesDiff = spacesDiff / tabsDiff;\n return;\n }\n}\nexport function guessIndentation(source, defaultTabSize, defaultInsertSpaces) {\n // Look at most at the first 10k lines\n const linesCount = Math.min(source.getLineCount(), 10000);\n let linesIndentedWithTabsCount = 0; // number of lines that contain at least one tab in indentation\n let linesIndentedWithSpacesCount = 0; // number of lines that contain only spaces in indentation\n let previousLineText = ''; // content of latest line that contained non-whitespace chars\n let previousLineIndentation = 0; // index at which latest line contained the first non-whitespace char\n const ALLOWED_TAB_SIZE_GUESSES = [2, 4, 6, 8, 3, 5, 7]; // prefer even guesses for `tabSize`, limit to [2, 8].\n const MAX_ALLOWED_TAB_SIZE_GUESS = 8; // max(ALLOWED_TAB_SIZE_GUESSES) = 8\n const spacesDiffCount = [0, 0, 0, 0, 0, 0, 0, 0, 0]; // `tabSize` scores\n const tmp = new SpacesDiffResult();\n for (let lineNumber = 1; lineNumber <= linesCount; lineNumber++) {\n const currentLineLength = source.getLineLength(lineNumber);\n const currentLineText = source.getLineContent(lineNumber);\n // if the text buffer is chunk based, so long lines are cons-string, v8 will flattern the string when we check charCode.\n // checking charCode on chunks directly is cheaper.\n const useCurrentLineText = (currentLineLength <= 65536);\n let currentLineHasContent = false; // does `currentLineText` contain non-whitespace chars\n let currentLineIndentation = 0; // index at which `currentLineText` contains the first non-whitespace char\n let currentLineSpacesCount = 0; // count of spaces found in `currentLineText` indentation\n let currentLineTabsCount = 0; // count of tabs found in `currentLineText` indentation\n for (let j = 0, lenJ = currentLineLength; j < lenJ; j++) {\n const charCode = (useCurrentLineText ? currentLineText.charCodeAt(j) : source.getLineCharCode(lineNumber, j));\n if (charCode === 9 /* CharCode.Tab */) {\n currentLineTabsCount++;\n }\n else if (charCode === 32 /* CharCode.Space */) {\n currentLineSpacesCount++;\n }\n else {\n // Hit non whitespace character on this line\n currentLineHasContent = true;\n currentLineIndentation = j;\n break;\n }\n }\n // Ignore empty or only whitespace lines\n if (!currentLineHasContent) {\n continue;\n }\n if (currentLineTabsCount > 0) {\n linesIndentedWithTabsCount++;\n }\n else if (currentLineSpacesCount > 1) {\n linesIndentedWithSpacesCount++;\n }\n spacesDiff(previousLineText, previousLineIndentation, currentLineText, currentLineIndentation, tmp);\n if (tmp.looksLikeAlignment) {\n // if defaultInsertSpaces === true && the spaces count == tabSize, we may want to count it as valid indentation\n //\n // - item1\n // - item2\n //\n // otherwise skip this line entirely\n //\n // const a = 1,\n // b = 2;\n if (!(defaultInsertSpaces && defaultTabSize === tmp.spacesDiff)) {\n continue;\n }\n }\n const currentSpacesDiff = tmp.spacesDiff;\n if (currentSpacesDiff <= MAX_ALLOWED_TAB_SIZE_GUESS) {\n spacesDiffCount[currentSpacesDiff]++;\n }\n previousLineText = currentLineText;\n previousLineIndentation = currentLineIndentation;\n }\n let insertSpaces = defaultInsertSpaces;\n if (linesIndentedWithTabsCount !== linesIndentedWithSpacesCount) {\n insertSpaces = (linesIndentedWithTabsCount < linesIndentedWithSpacesCount);\n }\n let tabSize = defaultTabSize;\n // Guess tabSize only if inserting spaces...\n if (insertSpaces) {\n let tabSizeScore = (insertSpaces ? 0 : 0.1 * linesCount);\n // console.log(\"score threshold: \" + tabSizeScore);\n ALLOWED_TAB_SIZE_GUESSES.forEach((possibleTabSize) => {\n const possibleTabSizeScore = spacesDiffCount[possibleTabSize];\n if (possibleTabSizeScore > tabSizeScore) {\n tabSizeScore = possibleTabSizeScore;\n tabSize = possibleTabSize;\n }\n });\n // Let a tabSize of 2 win even if it is not the maximum\n // (only in case 4 was guessed)\n if (tabSize === 4 && spacesDiffCount[4] > 0 && spacesDiffCount[2] > 0 && spacesDiffCount[2] >= spacesDiffCount[4] / 2) {\n tabSize = 2;\n }\n }\n // console.log('--------------------------');\n // console.log('linesIndentedWithTabsCount: ' + linesIndentedWithTabsCount + ', linesIndentedWithSpacesCount: ' + linesIndentedWithSpacesCount);\n // console.log('spacesDiffCount: ' + spacesDiffCount);\n // console.log('tabSize: ' + tabSize + ', tabSizeScore: ' + tabSizeScore);\n return {\n insertSpaces: insertSpaces,\n tabSize: tabSize\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 *--------------------------------------------------------------------------------------------*/\nexport function getNodeColor(node) {\n return ((node.metadata & 1 /* Constants.ColorMask */) >>> 0 /* Constants.ColorOffset */);\n}\nfunction setNodeColor(node, color) {\n node.metadata = ((node.metadata & 254 /* Constants.ColorMaskInverse */) | (color << 0 /* Constants.ColorOffset */));\n}\nfunction getNodeIsVisited(node) {\n return ((node.metadata & 2 /* Constants.IsVisitedMask */) >>> 1 /* Constants.IsVisitedOffset */) === 1;\n}\nfunction setNodeIsVisited(node, value) {\n node.metadata = ((node.metadata & 253 /* Constants.IsVisitedMaskInverse */) | ((value ? 1 : 0) << 1 /* Constants.IsVisitedOffset */));\n}\nfunction getNodeIsForValidation(node) {\n return ((node.metadata & 4 /* Constants.IsForValidationMask */) >>> 2 /* Constants.IsForValidationOffset */) === 1;\n}\nfunction setNodeIsForValidation(node, value) {\n node.metadata = ((node.metadata & 251 /* Constants.IsForValidationMaskInverse */) | ((value ? 1 : 0) << 2 /* Constants.IsForValidationOffset */));\n}\nfunction getNodeIsInGlyphMargin(node) {\n return ((node.metadata & 64 /* Constants.IsMarginMask */) >>> 6 /* Constants.IsMarginOffset */) === 1;\n}\nfunction setNodeIsInGlyphMargin(node, value) {\n node.metadata = ((node.metadata & 191 /* Constants.IsMarginMaskInverse */) | ((value ? 1 : 0) << 6 /* Constants.IsMarginOffset */));\n}\nfunction getNodeStickiness(node) {\n return ((node.metadata & 24 /* Constants.StickinessMask */) >>> 3 /* Constants.StickinessOffset */);\n}\nfunction _setNodeStickiness(node, stickiness) {\n node.metadata = ((node.metadata & 231 /* Constants.StickinessMaskInverse */) | (stickiness << 3 /* Constants.StickinessOffset */));\n}\nfunction getCollapseOnReplaceEdit(node) {\n return ((node.metadata & 32 /* Constants.CollapseOnReplaceEditMask */) >>> 5 /* Constants.CollapseOnReplaceEditOffset */) === 1;\n}\nfunction setCollapseOnReplaceEdit(node, value) {\n node.metadata = ((node.metadata & 223 /* Constants.CollapseOnReplaceEditMaskInverse */) | ((value ? 1 : 0) << 5 /* Constants.CollapseOnReplaceEditOffset */));\n}\nexport class IntervalNode {\n constructor(id, start, end) {\n this.metadata = 0;\n this.parent = this;\n this.left = this;\n this.right = this;\n setNodeColor(this, 1 /* NodeColor.Red */);\n this.start = start;\n this.end = end;\n // FORCE_OVERFLOWING_TEST: this.delta = start;\n this.delta = 0;\n this.maxEnd = end;\n this.id = id;\n this.ownerId = 0;\n this.options = null;\n setNodeIsForValidation(this, false);\n setNodeIsInGlyphMargin(this, false);\n _setNodeStickiness(this, 1 /* TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges */);\n setCollapseOnReplaceEdit(this, false);\n this.cachedVersionId = 0;\n this.cachedAbsoluteStart = start;\n this.cachedAbsoluteEnd = end;\n this.range = null;\n setNodeIsVisited(this, false);\n }\n reset(versionId, start, end, range) {\n this.start = start;\n this.end = end;\n this.maxEnd = end;\n this.cachedVersionId = versionId;\n this.cachedAbsoluteStart = start;\n this.cachedAbsoluteEnd = end;\n this.range = range;\n }\n setOptions(options) {\n this.options = options;\n const className = this.options.className;\n setNodeIsForValidation(this, (className === \"squiggly-error\" /* ClassName.EditorErrorDecoration */\n || className === \"squiggly-warning\" /* ClassName.EditorWarningDecoration */\n || className === \"squiggly-info\" /* ClassName.EditorInfoDecoration */));\n setNodeIsInGlyphMargin(this, this.options.glyphMarginClassName !== null);\n _setNodeStickiness(this, this.options.stickiness);\n setCollapseOnReplaceEdit(this, this.options.collapseOnReplaceEdit);\n }\n setCachedOffsets(absoluteStart, absoluteEnd, cachedVersionId) {\n if (this.cachedVersionId !== cachedVersionId) {\n this.range = null;\n }\n this.cachedVersionId = cachedVersionId;\n this.cachedAbsoluteStart = absoluteStart;\n this.cachedAbsoluteEnd = absoluteEnd;\n }\n detach() {\n this.parent = null;\n this.left = null;\n this.right = null;\n }\n}\nexport const SENTINEL = new IntervalNode(null, 0, 0);\nSENTINEL.parent = SENTINEL;\nSENTINEL.left = SENTINEL;\nSENTINEL.right = SENTINEL;\nsetNodeColor(SENTINEL, 0 /* NodeColor.Black */);\nexport class IntervalTree {\n constructor() {\n this.root = SENTINEL;\n this.requestNormalizeDelta = false;\n }\n intervalSearch(start, end, filterOwnerId, filterOutValidation, cachedVersionId, onlyMarginDecorations) {\n if (this.root === SENTINEL) {\n return [];\n }\n return intervalSearch(this, start, end, filterOwnerId, filterOutValidation, cachedVersionId, onlyMarginDecorations);\n }\n search(filterOwnerId, filterOutValidation, cachedVersionId, onlyMarginDecorations) {\n if (this.root === SENTINEL) {\n return [];\n }\n return search(this, filterOwnerId, filterOutValidation, cachedVersionId, onlyMarginDecorations);\n }\n /**\n * Will not set `cachedAbsoluteStart` nor `cachedAbsoluteEnd` on the returned nodes!\n */\n collectNodesFromOwner(ownerId) {\n return collectNodesFromOwner(this, ownerId);\n }\n /**\n * Will not set `cachedAbsoluteStart` nor `cachedAbsoluteEnd` on the returned nodes!\n */\n collectNodesPostOrder() {\n return collectNodesPostOrder(this);\n }\n insert(node) {\n rbTreeInsert(this, node);\n this._normalizeDeltaIfNecessary();\n }\n delete(node) {\n rbTreeDelete(this, node);\n this._normalizeDeltaIfNecessary();\n }\n resolveNode(node, cachedVersionId) {\n const initialNode = node;\n let delta = 0;\n while (node !== this.root) {\n if (node === node.parent.right) {\n delta += node.parent.delta;\n }\n node = node.parent;\n }\n const nodeStart = initialNode.start + delta;\n const nodeEnd = initialNode.end + delta;\n initialNode.setCachedOffsets(nodeStart, nodeEnd, cachedVersionId);\n }\n acceptReplace(offset, length, textLength, forceMoveMarkers) {\n // Our strategy is to remove all directly impacted nodes, and then add them back to the tree.\n // (1) collect all nodes that are intersecting this edit as nodes of interest\n const nodesOfInterest = searchForEditing(this, offset, offset + length);\n // (2) remove all nodes that are intersecting this edit\n for (let i = 0, len = nodesOfInterest.length; i < len; i++) {\n const node = nodesOfInterest[i];\n rbTreeDelete(this, node);\n }\n this._normalizeDeltaIfNecessary();\n // (3) edit all tree nodes except the nodes of interest\n noOverlapReplace(this, offset, offset + length, textLength);\n this._normalizeDeltaIfNecessary();\n // (4) edit the nodes of interest and insert them back in the tree\n for (let i = 0, len = nodesOfInterest.length; i < len; i++) {\n const node = nodesOfInterest[i];\n node.start = node.cachedAbsoluteStart;\n node.end = node.cachedAbsoluteEnd;\n nodeAcceptEdit(node, offset, (offset + length), textLength, forceMoveMarkers);\n node.maxEnd = node.end;\n rbTreeInsert(this, node);\n }\n this._normalizeDeltaIfNecessary();\n }\n _normalizeDeltaIfNecessary() {\n if (!this.requestNormalizeDelta) {\n return;\n }\n this.requestNormalizeDelta = false;\n normalizeDelta(this);\n }\n}\n//#region Delta Normalization\nfunction normalizeDelta(T) {\n let node = T.root;\n let delta = 0;\n while (node !== SENTINEL) {\n if (node.left !== SENTINEL && !getNodeIsVisited(node.left)) {\n // go left\n node = node.left;\n continue;\n }\n if (node.right !== SENTINEL && !getNodeIsVisited(node.right)) {\n // go right\n delta += node.delta;\n node = node.right;\n continue;\n }\n // handle current node\n node.start = delta + node.start;\n node.end = delta + node.end;\n node.delta = 0;\n recomputeMaxEnd(node);\n setNodeIsVisited(node, true);\n // going up from this node\n setNodeIsVisited(node.left, false);\n setNodeIsVisited(node.right, false);\n if (node === node.parent.right) {\n delta -= node.parent.delta;\n }\n node = node.parent;\n }\n setNodeIsVisited(T.root, false);\n}\nfunction adjustMarkerBeforeColumn(markerOffset, markerStickToPreviousCharacter, checkOffset, moveSemantics) {\n if (markerOffset < checkOffset) {\n return true;\n }\n if (markerOffset > checkOffset) {\n return false;\n }\n if (moveSemantics === 1 /* MarkerMoveSemantics.ForceMove */) {\n return false;\n }\n if (moveSemantics === 2 /* MarkerMoveSemantics.ForceStay */) {\n return true;\n }\n return markerStickToPreviousCharacter;\n}\n/**\n * This is a lot more complicated than strictly necessary to maintain the same behaviour\n * as when decorations were implemented using two markers.\n */\nexport function nodeAcceptEdit(node, start, end, textLength, forceMoveMarkers) {\n const nodeStickiness = getNodeStickiness(node);\n const startStickToPreviousCharacter = (nodeStickiness === 0 /* TrackedRangeStickiness.AlwaysGrowsWhenTypingAtEdges */\n || nodeStickiness === 2 /* TrackedRangeStickiness.GrowsOnlyWhenTypingBefore */);\n const endStickToPreviousCharacter = (nodeStickiness === 1 /* TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges */\n || nodeStickiness === 2 /* TrackedRangeStickiness.GrowsOnlyWhenTypingBefore */);\n const deletingCnt = (end - start);\n const insertingCnt = textLength;\n const commonLength = Math.min(deletingCnt, insertingCnt);\n const nodeStart = node.start;\n let startDone = false;\n const nodeEnd = node.end;\n let endDone = false;\n if (start <= nodeStart && nodeEnd <= end && getCollapseOnReplaceEdit(node)) {\n // This edit encompasses the entire decoration range\n // and the decoration has asked to become collapsed\n node.start = start;\n startDone = true;\n node.end = start;\n endDone = true;\n }\n {\n const moveSemantics = forceMoveMarkers ? 1 /* MarkerMoveSemantics.ForceMove */ : (deletingCnt > 0 ? 2 /* MarkerMoveSemantics.ForceStay */ : 0 /* MarkerMoveSemantics.MarkerDefined */);\n if (!startDone && adjustMarkerBeforeColumn(nodeStart, startStickToPreviousCharacter, start, moveSemantics)) {\n startDone = true;\n }\n if (!endDone && adjustMarkerBeforeColumn(nodeEnd, endStickToPreviousCharacter, start, moveSemantics)) {\n endDone = true;\n }\n }\n if (commonLength > 0 && !forceMoveMarkers) {\n const moveSemantics = (deletingCnt > insertingCnt ? 2 /* MarkerMoveSemantics.ForceStay */ : 0 /* MarkerMoveSemantics.MarkerDefined */);\n if (!startDone && adjustMarkerBeforeColumn(nodeStart, startStickToPreviousCharacter, start + commonLength, moveSemantics)) {\n startDone = true;\n }\n if (!endDone && adjustMarkerBeforeColumn(nodeEnd, endStickToPreviousCharacter, start + commonLength, moveSemantics)) {\n endDone = true;\n }\n }\n {\n const moveSemantics = forceMoveMarkers ? 1 /* MarkerMoveSemantics.ForceMove */ : 0 /* MarkerMoveSemantics.MarkerDefined */;\n if (!startDone && adjustMarkerBeforeColumn(nodeStart, startStickToPreviousCharacter, end, moveSemantics)) {\n node.start = start + insertingCnt;\n startDone = true;\n }\n if (!endDone && adjustMarkerBeforeColumn(nodeEnd, endStickToPreviousCharacter, end, moveSemantics)) {\n node.end = start + insertingCnt;\n endDone = true;\n }\n }\n // Finish\n const deltaColumn = (insertingCnt - deletingCnt);\n if (!startDone) {\n node.start = Math.max(0, nodeStart + deltaColumn);\n }\n if (!endDone) {\n node.end = Math.max(0, nodeEnd + deltaColumn);\n }\n if (node.start > node.end) {\n node.end = node.start;\n }\n}\nfunction searchForEditing(T, start, end) {\n // https://en.wikipedia.org/wiki/Interval_tree#Augmented_tree\n // Now, it is known that two intervals A and B overlap only when both\n // A.low <= B.high and A.high >= B.low. When searching the trees for\n // nodes overlapping with a given interval, you can immediately skip:\n // a) all nodes to the right of nodes whose low value is past the end of the given interval.\n // b) all nodes that have their maximum 'high' value below the start of the given interval.\n let node = T.root;\n let delta = 0;\n let nodeMaxEnd = 0;\n let nodeStart = 0;\n let nodeEnd = 0;\n const result = [];\n let resultLen = 0;\n while (node !== SENTINEL) {\n if (getNodeIsVisited(node)) {\n // going up from this node\n setNodeIsVisited(node.left, false);\n setNodeIsVisited(node.right, false);\n if (node === node.parent.right) {\n delta -= node.parent.delta;\n }\n node = node.parent;\n continue;\n }\n if (!getNodeIsVisited(node.left)) {\n // first time seeing this node\n nodeMaxEnd = delta + node.maxEnd;\n if (nodeMaxEnd < start) {\n // cover case b) from above\n // there is no need to search this node or its children\n setNodeIsVisited(node, true);\n continue;\n }\n if (node.left !== SENTINEL) {\n // go left\n node = node.left;\n continue;\n }\n }\n // handle current node\n nodeStart = delta + node.start;\n if (nodeStart > end) {\n // cover case a) from above\n // there is no need to search this node or its right subtree\n setNodeIsVisited(node, true);\n continue;\n }\n nodeEnd = delta + node.end;\n if (nodeEnd >= start) {\n node.setCachedOffsets(nodeStart, nodeEnd, 0);\n result[resultLen++] = node;\n }\n setNodeIsVisited(node, true);\n if (node.right !== SENTINEL && !getNodeIsVisited(node.right)) {\n // go right\n delta += node.delta;\n node = node.right;\n continue;\n }\n }\n setNodeIsVisited(T.root, false);\n return result;\n}\nfunction noOverlapReplace(T, start, end, textLength) {\n // https://en.wikipedia.org/wiki/Interval_tree#Augmented_tree\n // Now, it is known that two intervals A and B overlap only when both\n // A.low <= B.high and A.high >= B.low. When searching the trees for\n // nodes overlapping with a given interval, you can immediately skip:\n // a) all nodes to the right of nodes whose low value is past the end of the given interval.\n // b) all nodes that have their maximum 'high' value below the start of the given interval.\n let node = T.root;\n let delta = 0;\n let nodeMaxEnd = 0;\n let nodeStart = 0;\n const editDelta = (textLength - (end - start));\n while (node !== SENTINEL) {\n if (getNodeIsVisited(node)) {\n // going up from this node\n setNodeIsVisited(node.left, false);\n setNodeIsVisited(node.right, false);\n if (node === node.parent.right) {\n delta -= node.parent.delta;\n }\n recomputeMaxEnd(node);\n node = node.parent;\n continue;\n }\n if (!getNodeIsVisited(node.left)) {\n // first time seeing this node\n nodeMaxEnd = delta + node.maxEnd;\n if (nodeMaxEnd < start) {\n // cover case b) from above\n // there is no need to search this node or its children\n setNodeIsVisited(node, true);\n continue;\n }\n if (node.left !== SENTINEL) {\n // go left\n node = node.left;\n continue;\n }\n }\n // handle current node\n nodeStart = delta + node.start;\n if (nodeStart > end) {\n node.start += editDelta;\n node.end += editDelta;\n node.delta += editDelta;\n if (node.delta < -1073741824 /* Constants.MIN_SAFE_DELTA */ || node.delta > 1073741824 /* Constants.MAX_SAFE_DELTA */) {\n T.requestNormalizeDelta = true;\n }\n // cover case a) from above\n // there is no need to search this node or its right subtree\n setNodeIsVisited(node, true);\n continue;\n }\n setNodeIsVisited(node, true);\n if (node.right !== SENTINEL && !getNodeIsVisited(node.right)) {\n // go right\n delta += node.delta;\n node = node.right;\n continue;\n }\n }\n setNodeIsVisited(T.root, false);\n}\n//#endregion\n//#region Searching\nfunction collectNodesFromOwner(T, ownerId) {\n let node = T.root;\n const result = [];\n let resultLen = 0;\n while (node !== SENTINEL) {\n if (getNodeIsVisited(node)) {\n // going up from this node\n setNodeIsVisited(node.left, false);\n setNodeIsVisited(node.right, false);\n node = node.parent;\n continue;\n }\n if (node.left !== SENTINEL && !getNodeIsVisited(node.left)) {\n // go left\n node = node.left;\n continue;\n }\n // handle current node\n if (node.ownerId === ownerId) {\n result[resultLen++] = node;\n }\n setNodeIsVisited(node, true);\n if (node.right !== SENTINEL && !getNodeIsVisited(node.right)) {\n // go right\n node = node.right;\n continue;\n }\n }\n setNodeIsVisited(T.root, false);\n return result;\n}\nfunction collectNodesPostOrder(T) {\n let node = T.root;\n const result = [];\n let resultLen = 0;\n while (node !== SENTINEL) {\n if (getNodeIsVisited(node)) {\n // going up from this node\n setNodeIsVisited(node.left, false);\n setNodeIsVisited(node.right, false);\n node = node.parent;\n continue;\n }\n if (node.left !== SENTINEL && !getNodeIsVisited(node.left)) {\n // go left\n node = node.left;\n continue;\n }\n if (node.right !== SENTINEL && !getNodeIsVisited(node.right)) {\n // go right\n node = node.right;\n continue;\n }\n // handle current node\n result[resultLen++] = node;\n setNodeIsVisited(node, true);\n }\n setNodeIsVisited(T.root, false);\n return result;\n}\nfunction search(T, filterOwnerId, filterOutValidation, cachedVersionId, onlyMarginDecorations) {\n let node = T.root;\n let delta = 0;\n let nodeStart = 0;\n let nodeEnd = 0;\n const result = [];\n let resultLen = 0;\n while (node !== SENTINEL) {\n if (getNodeIsVisited(node)) {\n // going up from this node\n setNodeIsVisited(node.left, false);\n setNodeIsVisited(node.right, false);\n if (node === node.parent.right) {\n delta -= node.parent.delta;\n }\n node = node.parent;\n continue;\n }\n if (node.left !== SENTINEL && !getNodeIsVisited(node.left)) {\n // go left\n node = node.left;\n continue;\n }\n // handle current node\n nodeStart = delta + node.start;\n nodeEnd = delta + node.end;\n node.setCachedOffsets(nodeStart, nodeEnd, cachedVersionId);\n let include = true;\n if (filterOwnerId && node.ownerId && node.ownerId !== filterOwnerId) {\n include = false;\n }\n if (filterOutValidation && getNodeIsForValidation(node)) {\n include = false;\n }\n if (onlyMarginDecorations && !getNodeIsInGlyphMargin(node)) {\n include = false;\n }\n if (include) {\n result[resultLen++] = node;\n }\n setNodeIsVisited(node, true);\n if (node.right !== SENTINEL && !getNodeIsVisited(node.right)) {\n // go right\n delta += node.delta;\n node = node.right;\n continue;\n }\n }\n setNodeIsVisited(T.root, false);\n return result;\n}\nfunction intervalSearch(T, intervalStart, intervalEnd, filterOwnerId, filterOutValidation, cachedVersionId, onlyMarginDecorations) {\n // https://en.wikipedia.org/wiki/Interval_tree#Augmented_tree\n // Now, it is known that two intervals A and B overlap only when both\n // A.low <= B.high and A.high >= B.low. When searching the trees for\n // nodes overlapping with a given interval, you can immediately skip:\n // a) all nodes to the right of nodes whose low value is past the end of the given interval.\n // b) all nodes that have their maximum 'high' value below the start of the given interval.\n let node = T.root;\n let delta = 0;\n let nodeMaxEnd = 0;\n let nodeStart = 0;\n let nodeEnd = 0;\n const result = [];\n let resultLen = 0;\n while (node !== SENTINEL) {\n if (getNodeIsVisited(node)) {\n // going up from this node\n setNodeIsVisited(node.left, false);\n setNodeIsVisited(node.right, false);\n if (node === node.parent.right) {\n delta -= node.parent.delta;\n }\n node = node.parent;\n continue;\n }\n if (!getNodeIsVisited(node.left)) {\n // first time seeing this node\n nodeMaxEnd = delta + node.maxEnd;\n if (nodeMaxEnd < intervalStart) {\n // cover case b) from above\n // there is no need to search this node or its children\n setNodeIsVisited(node, true);\n continue;\n }\n if (node.left !== SENTINEL) {\n // go left\n node = node.left;\n continue;\n }\n }\n // handle current node\n nodeStart = delta + node.start;\n if (nodeStart > intervalEnd) {\n // cover case a) from above\n // there is no need to search this node or its right subtree\n setNodeIsVisited(node, true);\n continue;\n }\n nodeEnd = delta + node.end;\n if (nodeEnd >= intervalStart) {\n // There is overlap\n node.setCachedOffsets(nodeStart, nodeEnd, cachedVersionId);\n let include = true;\n if (filterOwnerId && node.ownerId && node.ownerId !== filterOwnerId) {\n include = false;\n }\n if (filterOutValidation && getNodeIsForValidation(node)) {\n include = false;\n }\n if (onlyMarginDecorations && !getNodeIsInGlyphMargin(node)) {\n include = false;\n }\n if (include) {\n result[resultLen++] = node;\n }\n }\n setNodeIsVisited(node, true);\n if (node.right !== SENTINEL && !getNodeIsVisited(node.right)) {\n // go right\n delta += node.delta;\n node = node.right;\n continue;\n }\n }\n setNodeIsVisited(T.root, false);\n return result;\n}\n//#endregion\n//#region Insertion\nfunction rbTreeInsert(T, newNode) {\n if (T.root === SENTINEL) {\n newNode.parent = SENTINEL;\n newNode.left = SENTINEL;\n newNode.right = SENTINEL;\n setNodeColor(newNode, 0 /* NodeColor.Black */);\n T.root = newNode;\n return T.root;\n }\n treeInsert(T, newNode);\n recomputeMaxEndWalkToRoot(newNode.parent);\n // repair tree\n let x = newNode;\n while (x !== T.root && getNodeColor(x.parent) === 1 /* NodeColor.Red */) {\n if (x.parent === x.parent.parent.left) {\n const y = x.parent.parent.right;\n if (getNodeColor(y) === 1 /* NodeColor.Red */) {\n setNodeColor(x.parent, 0 /* NodeColor.Black */);\n setNodeColor(y, 0 /* NodeColor.Black */);\n setNodeColor(x.parent.parent, 1 /* NodeColor.Red */);\n x = x.parent.parent;\n }\n else {\n if (x === x.parent.right) {\n x = x.parent;\n leftRotate(T, x);\n }\n setNodeColor(x.parent, 0 /* NodeColor.Black */);\n setNodeColor(x.parent.parent, 1 /* NodeColor.Red */);\n rightRotate(T, x.parent.parent);\n }\n }\n else {\n const y = x.parent.parent.left;\n if (getNodeColor(y) === 1 /* NodeColor.Red */) {\n setNodeColor(x.parent, 0 /* NodeColor.Black */);\n setNodeColor(y, 0 /* NodeColor.Black */);\n setNodeColor(x.parent.parent, 1 /* NodeColor.Red */);\n x = x.parent.parent;\n }\n else {\n if (x === x.parent.left) {\n x = x.parent;\n rightRotate(T, x);\n }\n setNodeColor(x.parent, 0 /* NodeColor.Black */);\n setNodeColor(x.parent.parent, 1 /* NodeColor.Red */);\n leftRotate(T, x.parent.parent);\n }\n }\n }\n setNodeColor(T.root, 0 /* NodeColor.Black */);\n return newNode;\n}\nfunction treeInsert(T, z) {\n let delta = 0;\n let x = T.root;\n const zAbsoluteStart = z.start;\n const zAbsoluteEnd = z.end;\n while (true) {\n const cmp = intervalCompare(zAbsoluteStart, zAbsoluteEnd, x.start + delta, x.end + delta);\n if (cmp < 0) {\n // this node should be inserted to the left\n // => it is not affected by the node's delta\n if (x.left === SENTINEL) {\n z.start -= delta;\n z.end -= delta;\n z.maxEnd -= delta;\n x.left = z;\n break;\n }\n else {\n x = x.left;\n }\n }\n else {\n // this node should be inserted to the right\n // => it is not affected by the node's delta\n if (x.right === SENTINEL) {\n z.start -= (delta + x.delta);\n z.end -= (delta + x.delta);\n z.maxEnd -= (delta + x.delta);\n x.right = z;\n break;\n }\n else {\n delta += x.delta;\n x = x.right;\n }\n }\n }\n z.parent = x;\n z.left = SENTINEL;\n z.right = SENTINEL;\n setNodeColor(z, 1 /* NodeColor.Red */);\n}\n//#endregion\n//#region Deletion\nfunction rbTreeDelete(T, z) {\n let x;\n let y;\n // RB-DELETE except we don't swap z and y in case c)\n // i.e. we always delete what's pointed at by z.\n if (z.left === SENTINEL) {\n x = z.right;\n y = z;\n // x's delta is no longer influenced by z's delta\n x.delta += z.delta;\n if (x.delta < -1073741824 /* Constants.MIN_SAFE_DELTA */ || x.delta > 1073741824 /* Constants.MAX_SAFE_DELTA */) {\n T.requestNormalizeDelta = true;\n }\n x.start += z.delta;\n x.end += z.delta;\n }\n else if (z.right === SENTINEL) {\n x = z.left;\n y = z;\n }\n else {\n y = leftest(z.right);\n x = y.right;\n // y's delta is no longer influenced by z's delta,\n // but we don't want to walk the entire right-hand-side subtree of x.\n // we therefore maintain z's delta in y, and adjust only x\n x.start += y.delta;\n x.end += y.delta;\n x.delta += y.delta;\n if (x.delta < -1073741824 /* Constants.MIN_SAFE_DELTA */ || x.delta > 1073741824 /* Constants.MAX_SAFE_DELTA */) {\n T.requestNormalizeDelta = true;\n }\n y.start += z.delta;\n y.end += z.delta;\n y.delta = z.delta;\n if (y.delta < -1073741824 /* Constants.MIN_SAFE_DELTA */ || y.delta > 1073741824 /* Constants.MAX_SAFE_DELTA */) {\n T.requestNormalizeDelta = true;\n }\n }\n if (y === T.root) {\n T.root = x;\n setNodeColor(x, 0 /* NodeColor.Black */);\n z.detach();\n resetSentinel();\n recomputeMaxEnd(x);\n T.root.parent = SENTINEL;\n return;\n }\n const yWasRed = (getNodeColor(y) === 1 /* NodeColor.Red */);\n if (y === y.parent.left) {\n y.parent.left = x;\n }\n else {\n y.parent.right = x;\n }\n if (y === z) {\n x.parent = y.parent;\n }\n else {\n if (y.parent === z) {\n x.parent = y;\n }\n else {\n x.parent = y.parent;\n }\n y.left = z.left;\n y.right = z.right;\n y.parent = z.parent;\n setNodeColor(y, getNodeColor(z));\n if (z === T.root) {\n T.root = y;\n }\n else {\n if (z === z.parent.left) {\n z.parent.left = y;\n }\n else {\n z.parent.right = y;\n }\n }\n if (y.left !== SENTINEL) {\n y.left.parent = y;\n }\n if (y.right !== SENTINEL) {\n y.right.parent = y;\n }\n }\n z.detach();\n if (yWasRed) {\n recomputeMaxEndWalkToRoot(x.parent);\n if (y !== z) {\n recomputeMaxEndWalkToRoot(y);\n recomputeMaxEndWalkToRoot(y.parent);\n }\n resetSentinel();\n return;\n }\n recomputeMaxEndWalkToRoot(x);\n recomputeMaxEndWalkToRoot(x.parent);\n if (y !== z) {\n recomputeMaxEndWalkToRoot(y);\n recomputeMaxEndWalkToRoot(y.parent);\n }\n // RB-DELETE-FIXUP\n let w;\n while (x !== T.root && getNodeColor(x) === 0 /* NodeColor.Black */) {\n if (x === x.parent.left) {\n w = x.parent.right;\n if (getNodeColor(w) === 1 /* NodeColor.Red */) {\n setNodeColor(w, 0 /* NodeColor.Black */);\n setNodeColor(x.parent, 1 /* NodeColor.Red */);\n leftRotate(T, x.parent);\n w = x.parent.right;\n }\n if (getNodeColor(w.left) === 0 /* NodeColor.Black */ && getNodeColor(w.right) === 0 /* NodeColor.Black */) {\n setNodeColor(w, 1 /* NodeColor.Red */);\n x = x.parent;\n }\n else {\n if (getNodeColor(w.right) === 0 /* NodeColor.Black */) {\n setNodeColor(w.left, 0 /* NodeColor.Black */);\n setNodeColor(w, 1 /* NodeColor.Red */);\n rightRotate(T, w);\n w = x.parent.right;\n }\n setNodeColor(w, getNodeColor(x.parent));\n setNodeColor(x.parent, 0 /* NodeColor.Black */);\n setNodeColor(w.right, 0 /* NodeColor.Black */);\n leftRotate(T, x.parent);\n x = T.root;\n }\n }\n else {\n w = x.parent.left;\n if (getNodeColor(w) === 1 /* NodeColor.Red */) {\n setNodeColor(w, 0 /* NodeColor.Black */);\n setNodeColor(x.parent, 1 /* NodeColor.Red */);\n rightRotate(T, x.parent);\n w = x.parent.left;\n }\n if (getNodeColor(w.left) === 0 /* NodeColor.Black */ && getNodeColor(w.right) === 0 /* NodeColor.Black */) {\n setNodeColor(w, 1 /* NodeColor.Red */);\n x = x.parent;\n }\n else {\n if (getNodeColor(w.left) === 0 /* NodeColor.Black */) {\n setNodeColor(w.right, 0 /* NodeColor.Black */);\n setNodeColor(w, 1 /* NodeColor.Red */);\n leftRotate(T, w);\n w = x.parent.left;\n }\n setNodeColor(w, getNodeColor(x.parent));\n setNodeColor(x.parent, 0 /* NodeColor.Black */);\n setNodeColor(w.left, 0 /* NodeColor.Black */);\n rightRotate(T, x.parent);\n x = T.root;\n }\n }\n }\n setNodeColor(x, 0 /* NodeColor.Black */);\n resetSentinel();\n}\nfunction leftest(node) {\n while (node.left !== SENTINEL) {\n node = node.left;\n }\n return node;\n}\nfunction resetSentinel() {\n SENTINEL.parent = SENTINEL;\n SENTINEL.delta = 0; // optional\n SENTINEL.start = 0; // optional\n SENTINEL.end = 0; // optional\n}\n//#endregion\n//#region Rotations\nfunction leftRotate(T, x) {\n const y = x.right; // set y.\n y.delta += x.delta; // y's delta is no longer influenced by x's delta\n if (y.delta < -1073741824 /* Constants.MIN_SAFE_DELTA */ || y.delta > 1073741824 /* Constants.MAX_SAFE_DELTA */) {\n T.requestNormalizeDelta = true;\n }\n y.start += x.delta;\n y.end += x.delta;\n x.right = y.left; // turn y's left subtree into x's right subtree.\n if (y.left !== SENTINEL) {\n y.left.parent = x;\n }\n y.parent = x.parent; // link x's parent to y.\n if (x.parent === SENTINEL) {\n T.root = y;\n }\n else if (x === x.parent.left) {\n x.parent.left = y;\n }\n else {\n x.parent.right = y;\n }\n y.left = x; // put x on y's left.\n x.parent = y;\n recomputeMaxEnd(x);\n recomputeMaxEnd(y);\n}\nfunction rightRotate(T, y) {\n const x = y.left;\n y.delta -= x.delta;\n if (y.delta < -1073741824 /* Constants.MIN_SAFE_DELTA */ || y.delta > 1073741824 /* Constants.MAX_SAFE_DELTA */) {\n T.requestNormalizeDelta = true;\n }\n y.start -= x.delta;\n y.end -= x.delta;\n y.left = x.right;\n if (x.right !== SENTINEL) {\n x.right.parent = y;\n }\n x.parent = y.parent;\n if (y.parent === SENTINEL) {\n T.root = x;\n }\n else if (y === y.parent.right) {\n y.parent.right = x;\n }\n else {\n y.parent.left = x;\n }\n x.right = y;\n y.parent = x;\n recomputeMaxEnd(y);\n recomputeMaxEnd(x);\n}\n//#endregion\n//#region max end computation\nfunction computeMaxEnd(node) {\n let maxEnd = node.end;\n if (node.left !== SENTINEL) {\n const leftMaxEnd = node.left.maxEnd;\n if (leftMaxEnd > maxEnd) {\n maxEnd = leftMaxEnd;\n }\n }\n if (node.right !== SENTINEL) {\n const rightMaxEnd = node.right.maxEnd + node.delta;\n if (rightMaxEnd > maxEnd) {\n maxEnd = rightMaxEnd;\n }\n }\n return maxEnd;\n}\nexport function recomputeMaxEnd(node) {\n node.maxEnd = computeMaxEnd(node);\n}\nfunction recomputeMaxEndWalkToRoot(node) {\n while (node !== SENTINEL) {\n const maxEnd = computeMaxEnd(node);\n if (node.maxEnd === maxEnd) {\n // no need to go further\n return;\n }\n node.maxEnd = maxEnd;\n node = node.parent;\n }\n}\n//#endregion\n//#region utils\nexport function intervalCompare(aStart, aEnd, bStart, bEnd) {\n if (aStart === bStart) {\n return aEnd - bEnd;\n }\n return aStart - bStart;\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 *--------------------------------------------------------------------------------------------*/\nexport class TreeNode {\n constructor(piece, color) {\n this.piece = piece;\n this.color = color;\n this.size_left = 0;\n this.lf_left = 0;\n this.parent = this;\n this.left = this;\n this.right = this;\n }\n next() {\n if (this.right !== SENTINEL) {\n return leftest(this.right);\n }\n let node = this;\n while (node.parent !== SENTINEL) {\n if (node.parent.left === node) {\n break;\n }\n node = node.parent;\n }\n if (node.parent === SENTINEL) {\n return SENTINEL;\n }\n else {\n return node.parent;\n }\n }\n prev() {\n if (this.left !== SENTINEL) {\n return righttest(this.left);\n }\n let node = this;\n while (node.parent !== SENTINEL) {\n if (node.parent.right === node) {\n break;\n }\n node = node.parent;\n }\n if (node.parent === SENTINEL) {\n return SENTINEL;\n }\n else {\n return node.parent;\n }\n }\n detach() {\n this.parent = null;\n this.left = null;\n this.right = null;\n }\n}\nexport const SENTINEL = new TreeNode(null, 0 /* NodeColor.Black */);\nSENTINEL.parent = SENTINEL;\nSENTINEL.left = SENTINEL;\nSENTINEL.right = SENTINEL;\nSENTINEL.color = 0 /* NodeColor.Black */;\nexport function leftest(node) {\n while (node.left !== SENTINEL) {\n node = node.left;\n }\n return node;\n}\nexport function righttest(node) {\n while (node.right !== SENTINEL) {\n node = node.right;\n }\n return node;\n}\nfunction calculateSize(node) {\n if (node === SENTINEL) {\n return 0;\n }\n return node.size_left + node.piece.length + calculateSize(node.right);\n}\nfunction calculateLF(node) {\n if (node === SENTINEL) {\n return 0;\n }\n return node.lf_left + node.piece.lineFeedCnt + calculateLF(node.right);\n}\nfunction resetSentinel() {\n SENTINEL.parent = SENTINEL;\n}\nexport function leftRotate(tree, x) {\n const y = x.right;\n // fix size_left\n y.size_left += x.size_left + (x.piece ? x.piece.length : 0);\n y.lf_left += x.lf_left + (x.piece ? x.piece.lineFeedCnt : 0);\n x.right = y.left;\n if (y.left !== SENTINEL) {\n y.left.parent = x;\n }\n y.parent = x.parent;\n if (x.parent === SENTINEL) {\n tree.root = y;\n }\n else if (x.parent.left === x) {\n x.parent.left = y;\n }\n else {\n x.parent.right = y;\n }\n y.left = x;\n x.parent = y;\n}\nexport function rightRotate(tree, y) {\n const x = y.left;\n y.left = x.right;\n if (x.right !== SENTINEL) {\n x.right.parent = y;\n }\n x.parent = y.parent;\n // fix size_left\n y.size_left -= x.size_left + (x.piece ? x.piece.length : 0);\n y.lf_left -= x.lf_left + (x.piece ? x.piece.lineFeedCnt : 0);\n if (y.parent === SENTINEL) {\n tree.root = x;\n }\n else if (y === y.parent.right) {\n y.parent.right = x;\n }\n else {\n y.parent.left = x;\n }\n x.right = y;\n y.parent = x;\n}\nexport function rbDelete(tree, z) {\n let x;\n let y;\n if (z.left === SENTINEL) {\n y = z;\n x = y.right;\n }\n else if (z.right === SENTINEL) {\n y = z;\n x = y.left;\n }\n else {\n y = leftest(z.right);\n x = y.right;\n }\n if (y === tree.root) {\n tree.root = x;\n // if x is null, we are removing the only node\n x.color = 0 /* NodeColor.Black */;\n z.detach();\n resetSentinel();\n tree.root.parent = SENTINEL;\n return;\n }\n const yWasRed = (y.color === 1 /* NodeColor.Red */);\n if (y === y.parent.left) {\n y.parent.left = x;\n }\n else {\n y.parent.right = x;\n }\n if (y === z) {\n x.parent = y.parent;\n recomputeTreeMetadata(tree, x);\n }\n else {\n if (y.parent === z) {\n x.parent = y;\n }\n else {\n x.parent = y.parent;\n }\n // as we make changes to x's hierarchy, update size_left of subtree first\n recomputeTreeMetadata(tree, x);\n y.left = z.left;\n y.right = z.right;\n y.parent = z.parent;\n y.color = z.color;\n if (z === tree.root) {\n tree.root = y;\n }\n else {\n if (z === z.parent.left) {\n z.parent.left = y;\n }\n else {\n z.parent.right = y;\n }\n }\n if (y.left !== SENTINEL) {\n y.left.parent = y;\n }\n if (y.right !== SENTINEL) {\n y.right.parent = y;\n }\n // update metadata\n // we replace z with y, so in this sub tree, the length change is z.item.length\n y.size_left = z.size_left;\n y.lf_left = z.lf_left;\n recomputeTreeMetadata(tree, y);\n }\n z.detach();\n if (x.parent.left === x) {\n const newSizeLeft = calculateSize(x);\n const newLFLeft = calculateLF(x);\n if (newSizeLeft !== x.parent.size_left || newLFLeft !== x.parent.lf_left) {\n const delta = newSizeLeft - x.parent.size_left;\n const lf_delta = newLFLeft - x.parent.lf_left;\n x.parent.size_left = newSizeLeft;\n x.parent.lf_left = newLFLeft;\n updateTreeMetadata(tree, x.parent, delta, lf_delta);\n }\n }\n recomputeTreeMetadata(tree, x.parent);\n if (yWasRed) {\n resetSentinel();\n return;\n }\n // RB-DELETE-FIXUP\n let w;\n while (x !== tree.root && x.color === 0 /* NodeColor.Black */) {\n if (x === x.parent.left) {\n w = x.parent.right;\n if (w.color === 1 /* NodeColor.Red */) {\n w.color = 0 /* NodeColor.Black */;\n x.parent.color = 1 /* NodeColor.Red */;\n leftRotate(tree, x.parent);\n w = x.parent.right;\n }\n if (w.left.color === 0 /* NodeColor.Black */ && w.right.color === 0 /* NodeColor.Black */) {\n w.color = 1 /* NodeColor.Red */;\n x = x.parent;\n }\n else {\n if (w.right.color === 0 /* NodeColor.Black */) {\n w.left.color = 0 /* NodeColor.Black */;\n w.color = 1 /* NodeColor.Red */;\n rightRotate(tree, w);\n w = x.parent.right;\n }\n w.color = x.parent.color;\n x.parent.color = 0 /* NodeColor.Black */;\n w.right.color = 0 /* NodeColor.Black */;\n leftRotate(tree, x.parent);\n x = tree.root;\n }\n }\n else {\n w = x.parent.left;\n if (w.color === 1 /* NodeColor.Red */) {\n w.color = 0 /* NodeColor.Black */;\n x.parent.color = 1 /* NodeColor.Red */;\n rightRotate(tree, x.parent);\n w = x.parent.left;\n }\n if (w.left.color === 0 /* NodeColor.Black */ && w.right.color === 0 /* NodeColor.Black */) {\n w.color = 1 /* NodeColor.Red */;\n x = x.parent;\n }\n else {\n if (w.left.color === 0 /* NodeColor.Black */) {\n w.right.color = 0 /* NodeColor.Black */;\n w.color = 1 /* NodeColor.Red */;\n leftRotate(tree, w);\n w = x.parent.left;\n }\n w.color = x.parent.color;\n x.parent.color = 0 /* NodeColor.Black */;\n w.left.color = 0 /* NodeColor.Black */;\n rightRotate(tree, x.parent);\n x = tree.root;\n }\n }\n }\n x.color = 0 /* NodeColor.Black */;\n resetSentinel();\n}\nexport function fixInsert(tree, x) {\n recomputeTreeMetadata(tree, x);\n while (x !== tree.root && x.parent.color === 1 /* NodeColor.Red */) {\n if (x.parent === x.parent.parent.left) {\n const y = x.parent.parent.right;\n if (y.color === 1 /* NodeColor.Red */) {\n x.parent.color = 0 /* NodeColor.Black */;\n y.color = 0 /* NodeColor.Black */;\n x.parent.parent.color = 1 /* NodeColor.Red */;\n x = x.parent.parent;\n }\n else {\n if (x === x.parent.right) {\n x = x.parent;\n leftRotate(tree, x);\n }\n x.parent.color = 0 /* NodeColor.Black */;\n x.parent.parent.color = 1 /* NodeColor.Red */;\n rightRotate(tree, x.parent.parent);\n }\n }\n else {\n const y = x.parent.parent.left;\n if (y.color === 1 /* NodeColor.Red */) {\n x.parent.color = 0 /* NodeColor.Black */;\n y.color = 0 /* NodeColor.Black */;\n x.parent.parent.color = 1 /* NodeColor.Red */;\n x = x.parent.parent;\n }\n else {\n if (x === x.parent.left) {\n x = x.parent;\n rightRotate(tree, x);\n }\n x.parent.color = 0 /* NodeColor.Black */;\n x.parent.parent.color = 1 /* NodeColor.Red */;\n leftRotate(tree, x.parent.parent);\n }\n }\n }\n tree.root.color = 0 /* NodeColor.Black */;\n}\nexport function updateTreeMetadata(tree, x, delta, lineFeedCntDelta) {\n // node length change or line feed count change\n while (x !== tree.root && x !== SENTINEL) {\n if (x.parent.left === x) {\n x.parent.size_left += delta;\n x.parent.lf_left += lineFeedCntDelta;\n }\n x = x.parent;\n }\n}\nexport function recomputeTreeMetadata(tree, x) {\n let delta = 0;\n let lf_delta = 0;\n if (x === tree.root) {\n return;\n }\n // go upwards till the node whose left subtree is changed.\n while (x !== tree.root && x === x.parent.right) {\n x = x.parent;\n }\n if (x === tree.root) {\n // well, it means we add a node to the end (inorder)\n return;\n }\n // x is the node whose right subtree is changed.\n x = x.parent;\n delta = calculateSize(x.left) - x.size_left;\n lf_delta = calculateLF(x.left) - x.lf_left;\n x.size_left += delta;\n x.lf_left += lf_delta;\n // go upwards till root. O(logN)\n while (x !== tree.root && (delta !== 0 || lf_delta !== 0)) {\n if (x.parent.left === x) {\n x.parent.size_left += delta;\n x.parent.lf_left += lf_delta;\n }\n x = x.parent;\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 *--------------------------------------------------------------------------------------------*/\nimport { Position } from '../../core/position.js';\nimport { Range } from '../../core/range.js';\nimport { FindMatch } from '../../model.js';\nimport { SENTINEL, TreeNode, fixInsert, leftest, rbDelete, righttest, updateTreeMetadata } from './rbTreeBase.js';\nimport { Searcher, createFindMatch, isValidMatch } from '../textModelSearch.js';\n// const lfRegex = new RegExp(/\\r\\n|\\r|\\n/g);\nconst AverageBufferSize = 65535;\nfunction createUintArray(arr) {\n let r;\n if (arr[arr.length - 1] < 65536) {\n r = new Uint16Array(arr.length);\n }\n else {\n r = new Uint32Array(arr.length);\n }\n r.set(arr, 0);\n return r;\n}\nclass LineStarts {\n constructor(lineStarts, cr, lf, crlf, isBasicASCII) {\n this.lineStarts = lineStarts;\n this.cr = cr;\n this.lf = lf;\n this.crlf = crlf;\n this.isBasicASCII = isBasicASCII;\n }\n}\nexport function createLineStartsFast(str, readonly = true) {\n const r = [0];\n let rLength = 1;\n for (let i = 0, len = str.length; i < len; i++) {\n const chr = str.charCodeAt(i);\n if (chr === 13 /* CharCode.CarriageReturn */) {\n if (i + 1 < len && str.charCodeAt(i + 1) === 10 /* CharCode.LineFeed */) {\n // \\r\\n... case\n r[rLength++] = i + 2;\n i++; // skip \\n\n }\n else {\n // \\r... case\n r[rLength++] = i + 1;\n }\n }\n else if (chr === 10 /* CharCode.LineFeed */) {\n r[rLength++] = i + 1;\n }\n }\n if (readonly) {\n return createUintArray(r);\n }\n else {\n return r;\n }\n}\nexport function createLineStarts(r, str) {\n r.length = 0;\n r[0] = 0;\n let rLength = 1;\n let cr = 0, lf = 0, crlf = 0;\n let isBasicASCII = true;\n for (let i = 0, len = str.length; i < len; i++) {\n const chr = str.charCodeAt(i);\n if (chr === 13 /* CharCode.CarriageReturn */) {\n if (i + 1 < len && str.charCodeAt(i + 1) === 10 /* CharCode.LineFeed */) {\n // \\r\\n... case\n crlf++;\n r[rLength++] = i + 2;\n i++; // skip \\n\n }\n else {\n cr++;\n // \\r... case\n r[rLength++] = i + 1;\n }\n }\n else if (chr === 10 /* CharCode.LineFeed */) {\n lf++;\n r[rLength++] = i + 1;\n }\n else {\n if (isBasicASCII) {\n if (chr !== 9 /* CharCode.Tab */ && (chr < 32 || chr > 126)) {\n isBasicASCII = false;\n }\n }\n }\n }\n const result = new LineStarts(createUintArray(r), cr, lf, crlf, isBasicASCII);\n r.length = 0;\n return result;\n}\nexport class Piece {\n constructor(bufferIndex, start, end, lineFeedCnt, length) {\n this.bufferIndex = bufferIndex;\n this.start = start;\n this.end = end;\n this.lineFeedCnt = lineFeedCnt;\n this.length = length;\n }\n}\nexport class StringBuffer {\n constructor(buffer, lineStarts) {\n this.buffer = buffer;\n this.lineStarts = lineStarts;\n }\n}\n/**\n * Readonly snapshot for piece tree.\n * In a real multiple thread environment, to make snapshot reading always work correctly, we need to\n * 1. Make TreeNode.piece immutable, then reading and writing can run in parallel.\n * 2. TreeNode/Buffers normalization should not happen during snapshot reading.\n */\nclass PieceTreeSnapshot {\n constructor(tree, BOM) {\n this._pieces = [];\n this._tree = tree;\n this._BOM = BOM;\n this._index = 0;\n if (tree.root !== SENTINEL) {\n tree.iterate(tree.root, node => {\n if (node !== SENTINEL) {\n this._pieces.push(node.piece);\n }\n return true;\n });\n }\n }\n read() {\n if (this._pieces.length === 0) {\n if (this._index === 0) {\n this._index++;\n return this._BOM;\n }\n else {\n return null;\n }\n }\n if (this._index > this._pieces.length - 1) {\n return null;\n }\n if (this._index === 0) {\n return this._BOM + this._tree.getPieceContent(this._pieces[this._index++]);\n }\n return this._tree.getPieceContent(this._pieces[this._index++]);\n }\n}\nclass PieceTreeSearchCache {\n constructor(limit) {\n this._limit = limit;\n this._cache = [];\n }\n get(offset) {\n for (let i = this._cache.length - 1; i >= 0; i--) {\n const nodePos = this._cache[i];\n if (nodePos.nodeStartOffset <= offset && nodePos.nodeStartOffset + nodePos.node.piece.length >= offset) {\n return nodePos;\n }\n }\n return null;\n }\n get2(lineNumber) {\n for (let i = this._cache.length - 1; i >= 0; i--) {\n const nodePos = this._cache[i];\n if (nodePos.nodeStartLineNumber && nodePos.nodeStartLineNumber < lineNumber && nodePos.nodeStartLineNumber + nodePos.node.piece.lineFeedCnt >= lineNumber) {\n return nodePos;\n }\n }\n return null;\n }\n set(nodePosition) {\n if (this._cache.length >= this._limit) {\n this._cache.shift();\n }\n this._cache.push(nodePosition);\n }\n validate(offset) {\n let hasInvalidVal = false;\n const tmp = this._cache;\n for (let i = 0; i < tmp.length; i++) {\n const nodePos = tmp[i];\n if (nodePos.node.parent === null || nodePos.nodeStartOffset >= offset) {\n tmp[i] = null;\n hasInvalidVal = true;\n continue;\n }\n }\n if (hasInvalidVal) {\n const newArr = [];\n for (const entry of tmp) {\n if (entry !== null) {\n newArr.push(entry);\n }\n }\n this._cache = newArr;\n }\n }\n}\nexport class PieceTreeBase {\n constructor(chunks, eol, eolNormalized) {\n this.create(chunks, eol, eolNormalized);\n }\n create(chunks, eol, eolNormalized) {\n this._buffers = [\n new StringBuffer('', [0])\n ];\n this._lastChangeBufferPos = { line: 0, column: 0 };\n this.root = SENTINEL;\n this._lineCnt = 1;\n this._length = 0;\n this._EOL = eol;\n this._EOLLength = eol.length;\n this._EOLNormalized = eolNormalized;\n let lastNode = null;\n for (let i = 0, len = chunks.length; i < len; i++) {\n if (chunks[i].buffer.length > 0) {\n if (!chunks[i].lineStarts) {\n chunks[i].lineStarts = createLineStartsFast(chunks[i].buffer);\n }\n const piece = new Piece(i + 1, { line: 0, column: 0 }, { line: chunks[i].lineStarts.length - 1, column: chunks[i].buffer.length - chunks[i].lineStarts[chunks[i].lineStarts.length - 1] }, chunks[i].lineStarts.length - 1, chunks[i].buffer.length);\n this._buffers.push(chunks[i]);\n lastNode = this.rbInsertRight(lastNode, piece);\n }\n }\n this._searchCache = new PieceTreeSearchCache(1);\n this._lastVisitedLine = { lineNumber: 0, value: '' };\n this.computeBufferMetadata();\n }\n normalizeEOL(eol) {\n const averageBufferSize = AverageBufferSize;\n const min = averageBufferSize - Math.floor(averageBufferSize / 3);\n const max = min * 2;\n let tempChunk = '';\n let tempChunkLen = 0;\n const chunks = [];\n this.iterate(this.root, node => {\n const str = this.getNodeContent(node);\n const len = str.length;\n if (tempChunkLen <= min || tempChunkLen + len < max) {\n tempChunk += str;\n tempChunkLen += len;\n return true;\n }\n // flush anyways\n const text = tempChunk.replace(/\\r\\n|\\r|\\n/g, eol);\n chunks.push(new StringBuffer(text, createLineStartsFast(text)));\n tempChunk = str;\n tempChunkLen = len;\n return true;\n });\n if (tempChunkLen > 0) {\n const text = tempChunk.replace(/\\r\\n|\\r|\\n/g, eol);\n chunks.push(new StringBuffer(text, createLineStartsFast(text)));\n }\n this.create(chunks, eol, true);\n }\n // #region Buffer API\n getEOL() {\n return this._EOL;\n }\n setEOL(newEOL) {\n this._EOL = newEOL;\n this._EOLLength = this._EOL.length;\n this.normalizeEOL(newEOL);\n }\n createSnapshot(BOM) {\n return new PieceTreeSnapshot(this, BOM);\n }\n getOffsetAt(lineNumber, column) {\n let leftLen = 0; // inorder\n let x = this.root;\n while (x !== SENTINEL) {\n if (x.left !== SENTINEL && x.lf_left + 1 >= lineNumber) {\n x = x.left;\n }\n else if (x.lf_left + x.piece.lineFeedCnt + 1 >= lineNumber) {\n leftLen += x.size_left;\n // lineNumber >= 2\n const accumualtedValInCurrentIndex = this.getAccumulatedValue(x, lineNumber - x.lf_left - 2);\n return leftLen += accumualtedValInCurrentIndex + column - 1;\n }\n else {\n lineNumber -= x.lf_left + x.piece.lineFeedCnt;\n leftLen += x.size_left + x.piece.length;\n x = x.right;\n }\n }\n return leftLen;\n }\n getPositionAt(offset) {\n offset = Math.floor(offset);\n offset = Math.max(0, offset);\n let x = this.root;\n let lfCnt = 0;\n const originalOffset = offset;\n while (x !== SENTINEL) {\n if (x.size_left !== 0 && x.size_left >= offset) {\n x = x.left;\n }\n else if (x.size_left + x.piece.length >= offset) {\n const out = this.getIndexOf(x, offset - x.size_left);\n lfCnt += x.lf_left + out.index;\n if (out.index === 0) {\n const lineStartOffset = this.getOffsetAt(lfCnt + 1, 1);\n const column = originalOffset - lineStartOffset;\n return new Position(lfCnt + 1, column + 1);\n }\n return new Position(lfCnt + 1, out.remainder + 1);\n }\n else {\n offset -= x.size_left + x.piece.length;\n lfCnt += x.lf_left + x.piece.lineFeedCnt;\n if (x.right === SENTINEL) {\n // last node\n const lineStartOffset = this.getOffsetAt(lfCnt + 1, 1);\n const column = originalOffset - offset - lineStartOffset;\n return new Position(lfCnt + 1, column + 1);\n }\n else {\n x = x.right;\n }\n }\n }\n return new Position(1, 1);\n }\n getValueInRange(range, eol) {\n if (range.startLineNumber === range.endLineNumber && range.startColumn === range.endColumn) {\n return '';\n }\n const startPosition = this.nodeAt2(range.startLineNumber, range.startColumn);\n const endPosition = this.nodeAt2(range.endLineNumber, range.endColumn);\n const value = this.getValueInRange2(startPosition, endPosition);\n if (eol) {\n if (eol !== this._EOL || !this._EOLNormalized) {\n return value.replace(/\\r\\n|\\r|\\n/g, eol);\n }\n if (eol === this.getEOL() && this._EOLNormalized) {\n if (eol === '\\r\\n') {\n }\n return value;\n }\n return value.replace(/\\r\\n|\\r|\\n/g, eol);\n }\n return value;\n }\n getValueInRange2(startPosition, endPosition) {\n if (startPosition.node === endPosition.node) {\n const node = startPosition.node;\n const buffer = this._buffers[node.piece.bufferIndex].buffer;\n const startOffset = this.offsetInBuffer(node.piece.bufferIndex, node.piece.start);\n return buffer.substring(startOffset + startPosition.remainder, startOffset + endPosition.remainder);\n }\n let x = startPosition.node;\n const buffer = this._buffers[x.piece.bufferIndex].buffer;\n const startOffset = this.offsetInBuffer(x.piece.bufferIndex, x.piece.start);\n let ret = buffer.substring(startOffset + startPosition.remainder, startOffset + x.piece.length);\n x = x.next();\n while (x !== SENTINEL) {\n const buffer = this._buffers[x.piece.bufferIndex].buffer;\n const startOffset = this.offsetInBuffer(x.piece.bufferIndex, x.piece.start);\n if (x === endPosition.node) {\n ret += buffer.substring(startOffset, startOffset + endPosition.remainder);\n break;\n }\n else {\n ret += buffer.substr(startOffset, x.piece.length);\n }\n x = x.next();\n }\n return ret;\n }\n getLinesContent() {\n const lines = [];\n let linesLength = 0;\n let currentLine = '';\n let danglingCR = false;\n this.iterate(this.root, node => {\n if (node === SENTINEL) {\n return true;\n }\n const piece = node.piece;\n let pieceLength = piece.length;\n if (pieceLength === 0) {\n return true;\n }\n const buffer = this._buffers[piece.bufferIndex].buffer;\n const lineStarts = this._buffers[piece.bufferIndex].lineStarts;\n const pieceStartLine = piece.start.line;\n const pieceEndLine = piece.end.line;\n let pieceStartOffset = lineStarts[pieceStartLine] + piece.start.column;\n if (danglingCR) {\n if (buffer.charCodeAt(pieceStartOffset) === 10 /* CharCode.LineFeed */) {\n // pretend the \\n was in the previous piece..\n pieceStartOffset++;\n pieceLength--;\n }\n lines[linesLength++] = currentLine;\n currentLine = '';\n danglingCR = false;\n if (pieceLength === 0) {\n return true;\n }\n }\n if (pieceStartLine === pieceEndLine) {\n // this piece has no new lines\n if (!this._EOLNormalized && buffer.charCodeAt(pieceStartOffset + pieceLength - 1) === 13 /* CharCode.CarriageReturn */) {\n danglingCR = true;\n currentLine += buffer.substr(pieceStartOffset, pieceLength - 1);\n }\n else {\n currentLine += buffer.substr(pieceStartOffset, pieceLength);\n }\n return true;\n }\n // add the text before the first line start in this piece\n currentLine += (this._EOLNormalized\n ? buffer.substring(pieceStartOffset, Math.max(pieceStartOffset, lineStarts[pieceStartLine + 1] - this._EOLLength))\n : buffer.substring(pieceStartOffset, lineStarts[pieceStartLine + 1]).replace(/(\\r\\n|\\r|\\n)$/, ''));\n lines[linesLength++] = currentLine;\n for (let line = pieceStartLine + 1; line < pieceEndLine; line++) {\n currentLine = (this._EOLNormalized\n ? buffer.substring(lineStarts[line], lineStarts[line + 1] - this._EOLLength)\n : buffer.substring(lineStarts[line], lineStarts[line + 1]).replace(/(\\r\\n|\\r|\\n)$/, ''));\n lines[linesLength++] = currentLine;\n }\n if (!this._EOLNormalized && buffer.charCodeAt(lineStarts[pieceEndLine] + piece.end.column - 1) === 13 /* CharCode.CarriageReturn */) {\n danglingCR = true;\n if (piece.end.column === 0) {\n // The last line ended with a \\r, let's undo the push, it will be pushed by next iteration\n linesLength--;\n }\n else {\n currentLine = buffer.substr(lineStarts[pieceEndLine], piece.end.column - 1);\n }\n }\n else {\n currentLine = buffer.substr(lineStarts[pieceEndLine], piece.end.column);\n }\n return true;\n });\n if (danglingCR) {\n lines[linesLength++] = currentLine;\n currentLine = '';\n }\n lines[linesLength++] = currentLine;\n return lines;\n }\n getLength() {\n return this._length;\n }\n getLineCount() {\n return this._lineCnt;\n }\n getLineContent(lineNumber) {\n if (this._lastVisitedLine.lineNumber === lineNumber) {\n return this._lastVisitedLine.value;\n }\n this._lastVisitedLine.lineNumber = lineNumber;\n if (lineNumber === this._lineCnt) {\n this._lastVisitedLine.value = this.getLineRawContent(lineNumber);\n }\n else if (this._EOLNormalized) {\n this._lastVisitedLine.value = this.getLineRawContent(lineNumber, this._EOLLength);\n }\n else {\n this._lastVisitedLine.value = this.getLineRawContent(lineNumber).replace(/(\\r\\n|\\r|\\n)$/, '');\n }\n return this._lastVisitedLine.value;\n }\n _getCharCode(nodePos) {\n if (nodePos.remainder === nodePos.node.piece.length) {\n // the char we want to fetch is at the head of next node.\n const matchingNode = nodePos.node.next();\n if (!matchingNode) {\n return 0;\n }\n const buffer = this._buffers[matchingNode.piece.bufferIndex];\n const startOffset = this.offsetInBuffer(matchingNode.piece.bufferIndex, matchingNode.piece.start);\n return buffer.buffer.charCodeAt(startOffset);\n }\n else {\n const buffer = this._buffers[nodePos.node.piece.bufferIndex];\n const startOffset = this.offsetInBuffer(nodePos.node.piece.bufferIndex, nodePos.node.piece.start);\n const targetOffset = startOffset + nodePos.remainder;\n return buffer.buffer.charCodeAt(targetOffset);\n }\n }\n getLineCharCode(lineNumber, index) {\n const nodePos = this.nodeAt2(lineNumber, index + 1);\n return this._getCharCode(nodePos);\n }\n getLineLength(lineNumber) {\n if (lineNumber === this.getLineCount()) {\n const startOffset = this.getOffsetAt(lineNumber, 1);\n return this.getLength() - startOffset;\n }\n return this.getOffsetAt(lineNumber + 1, 1) - this.getOffsetAt(lineNumber, 1) - this._EOLLength;\n }\n findMatchesInNode(node, searcher, startLineNumber, startColumn, startCursor, endCursor, searchData, captureMatches, limitResultCount, resultLen, result) {\n const buffer = this._buffers[node.piece.bufferIndex];\n const startOffsetInBuffer = this.offsetInBuffer(node.piece.bufferIndex, node.piece.start);\n const start = this.offsetInBuffer(node.piece.bufferIndex, startCursor);\n const end = this.offsetInBuffer(node.piece.bufferIndex, endCursor);\n let m;\n // Reset regex to search from the beginning\n const ret = { line: 0, column: 0 };\n let searchText;\n let offsetInBuffer;\n if (searcher._wordSeparators) {\n searchText = buffer.buffer.substring(start, end);\n offsetInBuffer = (offset) => offset + start;\n searcher.reset(0);\n }\n else {\n searchText = buffer.buffer;\n offsetInBuffer = (offset) => offset;\n searcher.reset(start);\n }\n do {\n m = searcher.next(searchText);\n if (m) {\n if (offsetInBuffer(m.index) >= end) {\n return resultLen;\n }\n this.positionInBuffer(node, offsetInBuffer(m.index) - startOffsetInBuffer, ret);\n const lineFeedCnt = this.getLineFeedCnt(node.piece.bufferIndex, startCursor, ret);\n const retStartColumn = ret.line === startCursor.line ? ret.column - startCursor.column + startColumn : ret.column + 1;\n const retEndColumn = retStartColumn + m[0].length;\n result[resultLen++] = createFindMatch(new Range(startLineNumber + lineFeedCnt, retStartColumn, startLineNumber + lineFeedCnt, retEndColumn), m, captureMatches);\n if (offsetInBuffer(m.index) + m[0].length >= end) {\n return resultLen;\n }\n if (resultLen >= limitResultCount) {\n return resultLen;\n }\n }\n } while (m);\n return resultLen;\n }\n findMatchesLineByLine(searchRange, searchData, captureMatches, limitResultCount) {\n const result = [];\n let resultLen = 0;\n const searcher = new Searcher(searchData.wordSeparators, searchData.regex);\n let startPosition = this.nodeAt2(searchRange.startLineNumber, searchRange.startColumn);\n if (startPosition === null) {\n return [];\n }\n const endPosition = this.nodeAt2(searchRange.endLineNumber, searchRange.endColumn);\n if (endPosition === null) {\n return [];\n }\n let start = this.positionInBuffer(startPosition.node, startPosition.remainder);\n const end = this.positionInBuffer(endPosition.node, endPosition.remainder);\n if (startPosition.node === endPosition.node) {\n this.findMatchesInNode(startPosition.node, searcher, searchRange.startLineNumber, searchRange.startColumn, start, end, searchData, captureMatches, limitResultCount, resultLen, result);\n return result;\n }\n let startLineNumber = searchRange.startLineNumber;\n let currentNode = startPosition.node;\n while (currentNode !== endPosition.node) {\n const lineBreakCnt = this.getLineFeedCnt(currentNode.piece.bufferIndex, start, currentNode.piece.end);\n if (lineBreakCnt >= 1) {\n // last line break position\n const lineStarts = this._buffers[currentNode.piece.bufferIndex].lineStarts;\n const startOffsetInBuffer = this.offsetInBuffer(currentNode.piece.bufferIndex, currentNode.piece.start);\n const nextLineStartOffset = lineStarts[start.line + lineBreakCnt];\n const startColumn = startLineNumber === searchRange.startLineNumber ? searchRange.startColumn : 1;\n resultLen = this.findMatchesInNode(currentNode, searcher, startLineNumber, startColumn, start, this.positionInBuffer(currentNode, nextLineStartOffset - startOffsetInBuffer), searchData, captureMatches, limitResultCount, resultLen, result);\n if (resultLen >= limitResultCount) {\n return result;\n }\n startLineNumber += lineBreakCnt;\n }\n const startColumn = startLineNumber === searchRange.startLineNumber ? searchRange.startColumn - 1 : 0;\n // search for the remaining content\n if (startLineNumber === searchRange.endLineNumber) {\n const text = this.getLineContent(startLineNumber).substring(startColumn, searchRange.endColumn - 1);\n resultLen = this._findMatchesInLine(searchData, searcher, text, searchRange.endLineNumber, startColumn, resultLen, result, captureMatches, limitResultCount);\n return result;\n }\n resultLen = this._findMatchesInLine(searchData, searcher, this.getLineContent(startLineNumber).substr(startColumn), startLineNumber, startColumn, resultLen, result, captureMatches, limitResultCount);\n if (resultLen >= limitResultCount) {\n return result;\n }\n startLineNumber++;\n startPosition = this.nodeAt2(startLineNumber, 1);\n currentNode = startPosition.node;\n start = this.positionInBuffer(startPosition.node, startPosition.remainder);\n }\n if (startLineNumber === searchRange.endLineNumber) {\n const startColumn = startLineNumber === searchRange.startLineNumber ? searchRange.startColumn - 1 : 0;\n const text = this.getLineContent(startLineNumber).substring(startColumn, searchRange.endColumn - 1);\n resultLen = this._findMatchesInLine(searchData, searcher, text, searchRange.endLineNumber, startColumn, resultLen, result, captureMatches, limitResultCount);\n return result;\n }\n const startColumn = startLineNumber === searchRange.startLineNumber ? searchRange.startColumn : 1;\n resultLen = this.findMatchesInNode(endPosition.node, searcher, startLineNumber, startColumn, start, end, searchData, captureMatches, limitResultCount, resultLen, result);\n return result;\n }\n _findMatchesInLine(searchData, searcher, text, lineNumber, deltaOffset, resultLen, result, captureMatches, limitResultCount) {\n const wordSeparators = searchData.wordSeparators;\n if (!captureMatches && searchData.simpleSearch) {\n const searchString = searchData.simpleSearch;\n const searchStringLen = searchString.length;\n const textLength = text.length;\n let lastMatchIndex = -searchStringLen;\n while ((lastMatchIndex = text.indexOf(searchString, lastMatchIndex + searchStringLen)) !== -1) {\n if (!wordSeparators || isValidMatch(wordSeparators, text, textLength, lastMatchIndex, searchStringLen)) {\n result[resultLen++] = new FindMatch(new Range(lineNumber, lastMatchIndex + 1 + deltaOffset, lineNumber, lastMatchIndex + 1 + searchStringLen + deltaOffset), null);\n if (resultLen >= limitResultCount) {\n return resultLen;\n }\n }\n }\n return resultLen;\n }\n let m;\n // Reset regex to search from the beginning\n searcher.reset(0);\n do {\n m = searcher.next(text);\n if (m) {\n result[resultLen++] = createFindMatch(new Range(lineNumber, m.index + 1 + deltaOffset, lineNumber, m.index + 1 + m[0].length + deltaOffset), m, captureMatches);\n if (resultLen >= limitResultCount) {\n return resultLen;\n }\n }\n } while (m);\n return resultLen;\n }\n // #endregion\n // #region Piece Table\n insert(offset, value, eolNormalized = false) {\n this._EOLNormalized = this._EOLNormalized && eolNormalized;\n this._lastVisitedLine.lineNumber = 0;\n this._lastVisitedLine.value = '';\n if (this.root !== SENTINEL) {\n const { node, remainder, nodeStartOffset } = this.nodeAt(offset);\n const piece = node.piece;\n const bufferIndex = piece.bufferIndex;\n const insertPosInBuffer = this.positionInBuffer(node, remainder);\n if (node.piece.bufferIndex === 0 &&\n piece.end.line === this._lastChangeBufferPos.line &&\n piece.end.column === this._lastChangeBufferPos.column &&\n (nodeStartOffset + piece.length === offset) &&\n value.length < AverageBufferSize) {\n // changed buffer\n this.appendToNode(node, value);\n this.computeBufferMetadata();\n return;\n }\n if (nodeStartOffset === offset) {\n this.insertContentToNodeLeft(value, node);\n this._searchCache.validate(offset);\n }\n else if (nodeStartOffset + node.piece.length > offset) {\n // we are inserting into the middle of a node.\n const nodesToDel = [];\n let newRightPiece = new Piece(piece.bufferIndex, insertPosInBuffer, piece.end, this.getLineFeedCnt(piece.bufferIndex, insertPosInBuffer, piece.end), this.offsetInBuffer(bufferIndex, piece.end) - this.offsetInBuffer(bufferIndex, insertPosInBuffer));\n if (this.shouldCheckCRLF() && this.endWithCR(value)) {\n const headOfRight = this.nodeCharCodeAt(node, remainder);\n if (headOfRight === 10 /** \\n */) {\n const newStart = { line: newRightPiece.start.line + 1, column: 0 };\n newRightPiece = new Piece(newRightPiece.bufferIndex, newStart, newRightPiece.end, this.getLineFeedCnt(newRightPiece.bufferIndex, newStart, newRightPiece.end), newRightPiece.length - 1);\n value += '\\n';\n }\n }\n // reuse node for content before insertion point.\n if (this.shouldCheckCRLF() && this.startWithLF(value)) {\n const tailOfLeft = this.nodeCharCodeAt(node, remainder - 1);\n if (tailOfLeft === 13 /** \\r */) {\n const previousPos = this.positionInBuffer(node, remainder - 1);\n this.deleteNodeTail(node, previousPos);\n value = '\\r' + value;\n if (node.piece.length === 0) {\n nodesToDel.push(node);\n }\n }\n else {\n this.deleteNodeTail(node, insertPosInBuffer);\n }\n }\n else {\n this.deleteNodeTail(node, insertPosInBuffer);\n }\n const newPieces = this.createNewPieces(value);\n if (newRightPiece.length > 0) {\n this.rbInsertRight(node, newRightPiece);\n }\n let tmpNode = node;\n for (let k = 0; k < newPieces.length; k++) {\n tmpNode = this.rbInsertRight(tmpNode, newPieces[k]);\n }\n this.deleteNodes(nodesToDel);\n }\n else {\n this.insertContentToNodeRight(value, node);\n }\n }\n else {\n // insert new node\n const pieces = this.createNewPieces(value);\n let node = this.rbInsertLeft(null, pieces[0]);\n for (let k = 1; k < pieces.length; k++) {\n node = this.rbInsertRight(node, pieces[k]);\n }\n }\n // todo, this is too brutal. Total line feed count should be updated the same way as lf_left.\n this.computeBufferMetadata();\n }\n delete(offset, cnt) {\n this._lastVisitedLine.lineNumber = 0;\n this._lastVisitedLine.value = '';\n if (cnt <= 0 || this.root === SENTINEL) {\n return;\n }\n const startPosition = this.nodeAt(offset);\n const endPosition = this.nodeAt(offset + cnt);\n const startNode = startPosition.node;\n const endNode = endPosition.node;\n if (startNode === endNode) {\n const startSplitPosInBuffer = this.positionInBuffer(startNode, startPosition.remainder);\n const endSplitPosInBuffer = this.positionInBuffer(startNode, endPosition.remainder);\n if (startPosition.nodeStartOffset === offset) {\n if (cnt === startNode.piece.length) { // delete node\n const next = startNode.next();\n rbDelete(this, startNode);\n this.validateCRLFWithPrevNode(next);\n this.computeBufferMetadata();\n return;\n }\n this.deleteNodeHead(startNode, endSplitPosInBuffer);\n this._searchCache.validate(offset);\n this.validateCRLFWithPrevNode(startNode);\n this.computeBufferMetadata();\n return;\n }\n if (startPosition.nodeStartOffset + startNode.piece.length === offset + cnt) {\n this.deleteNodeTail(startNode, startSplitPosInBuffer);\n this.validateCRLFWithNextNode(startNode);\n this.computeBufferMetadata();\n return;\n }\n // delete content in the middle, this node will be splitted to nodes\n this.shrinkNode(startNode, startSplitPosInBuffer, endSplitPosInBuffer);\n this.computeBufferMetadata();\n return;\n }\n const nodesToDel = [];\n const startSplitPosInBuffer = this.positionInBuffer(startNode, startPosition.remainder);\n this.deleteNodeTail(startNode, startSplitPosInBuffer);\n this._searchCache.validate(offset);\n if (startNode.piece.length === 0) {\n nodesToDel.push(startNode);\n }\n // update last touched node\n const endSplitPosInBuffer = this.positionInBuffer(endNode, endPosition.remainder);\n this.deleteNodeHead(endNode, endSplitPosInBuffer);\n if (endNode.piece.length === 0) {\n nodesToDel.push(endNode);\n }\n // delete nodes in between\n const secondNode = startNode.next();\n for (let node = secondNode; node !== SENTINEL && node !== endNode; node = node.next()) {\n nodesToDel.push(node);\n }\n const prev = startNode.piece.length === 0 ? startNode.prev() : startNode;\n this.deleteNodes(nodesToDel);\n this.validateCRLFWithNextNode(prev);\n this.computeBufferMetadata();\n }\n insertContentToNodeLeft(value, node) {\n // we are inserting content to the beginning of node\n const nodesToDel = [];\n if (this.shouldCheckCRLF() && this.endWithCR(value) && this.startWithLF(node)) {\n // move `\\n` to new node.\n const piece = node.piece;\n const newStart = { line: piece.start.line + 1, column: 0 };\n const nPiece = new Piece(piece.bufferIndex, newStart, piece.end, this.getLineFeedCnt(piece.bufferIndex, newStart, piece.end), piece.length - 1);\n node.piece = nPiece;\n value += '\\n';\n updateTreeMetadata(this, node, -1, -1);\n if (node.piece.length === 0) {\n nodesToDel.push(node);\n }\n }\n const newPieces = this.createNewPieces(value);\n let newNode = this.rbInsertLeft(node, newPieces[newPieces.length - 1]);\n for (let k = newPieces.length - 2; k >= 0; k--) {\n newNode = this.rbInsertLeft(newNode, newPieces[k]);\n }\n this.validateCRLFWithPrevNode(newNode);\n this.deleteNodes(nodesToDel);\n }\n insertContentToNodeRight(value, node) {\n // we are inserting to the right of this node.\n if (this.adjustCarriageReturnFromNext(value, node)) {\n // move \\n to the new node.\n value += '\\n';\n }\n const newPieces = this.createNewPieces(value);\n const newNode = this.rbInsertRight(node, newPieces[0]);\n let tmpNode = newNode;\n for (let k = 1; k < newPieces.length; k++) {\n tmpNode = this.rbInsertRight(tmpNode, newPieces[k]);\n }\n this.validateCRLFWithPrevNode(newNode);\n }\n positionInBuffer(node, remainder, ret) {\n const piece = node.piece;\n const bufferIndex = node.piece.bufferIndex;\n const lineStarts = this._buffers[bufferIndex].lineStarts;\n const startOffset = lineStarts[piece.start.line] + piece.start.column;\n const offset = startOffset + remainder;\n // binary search offset between startOffset and endOffset\n let low = piece.start.line;\n let high = piece.end.line;\n let mid = 0;\n let midStop = 0;\n let midStart = 0;\n while (low <= high) {\n mid = low + ((high - low) / 2) | 0;\n midStart = lineStarts[mid];\n if (mid === high) {\n break;\n }\n midStop = lineStarts[mid + 1];\n if (offset < midStart) {\n high = mid - 1;\n }\n else if (offset >= midStop) {\n low = mid + 1;\n }\n else {\n break;\n }\n }\n if (ret) {\n ret.line = mid;\n ret.column = offset - midStart;\n return null;\n }\n return {\n line: mid,\n column: offset - midStart\n };\n }\n getLineFeedCnt(bufferIndex, start, end) {\n // we don't need to worry about start: abc\\r|\\n, or abc|\\r, or abc|\\n, or abc|\\r\\n doesn't change the fact that, there is one line break after start.\n // now let's take care of end: abc\\r|\\n, if end is in between \\r and \\n, we need to add line feed count by 1\n if (end.column === 0) {\n return end.line - start.line;\n }\n const lineStarts = this._buffers[bufferIndex].lineStarts;\n if (end.line === lineStarts.length - 1) { // it means, there is no \\n after end, otherwise, there will be one more lineStart.\n return end.line - start.line;\n }\n const nextLineStartOffset = lineStarts[end.line + 1];\n const endOffset = lineStarts[end.line] + end.column;\n if (nextLineStartOffset > endOffset + 1) { // there are more than 1 character after end, which means it can't be \\n\n return end.line - start.line;\n }\n // endOffset + 1 === nextLineStartOffset\n // character at endOffset is \\n, so we check the character before first\n // if character at endOffset is \\r, end.column is 0 and we can't get here.\n const previousCharOffset = endOffset - 1; // end.column > 0 so it's okay.\n const buffer = this._buffers[bufferIndex].buffer;\n if (buffer.charCodeAt(previousCharOffset) === 13) {\n return end.line - start.line + 1;\n }\n else {\n return end.line - start.line;\n }\n }\n offsetInBuffer(bufferIndex, cursor) {\n const lineStarts = this._buffers[bufferIndex].lineStarts;\n return lineStarts[cursor.line] + cursor.column;\n }\n deleteNodes(nodes) {\n for (let i = 0; i < nodes.length; i++) {\n rbDelete(this, nodes[i]);\n }\n }\n createNewPieces(text) {\n if (text.length > AverageBufferSize) {\n // the content is large, operations like substring, charCode becomes slow\n // so here we split it into smaller chunks, just like what we did for CR/LF normalization\n const newPieces = [];\n while (text.length > AverageBufferSize) {\n const lastChar = text.charCodeAt(AverageBufferSize - 1);\n let splitText;\n if (lastChar === 13 /* CharCode.CarriageReturn */ || (lastChar >= 0xD800 && lastChar <= 0xDBFF)) {\n // last character is \\r or a high surrogate => keep it back\n splitText = text.substring(0, AverageBufferSize - 1);\n text = text.substring(AverageBufferSize - 1);\n }\n else {\n splitText = text.substring(0, AverageBufferSize);\n text = text.substring(AverageBufferSize);\n }\n const lineStarts = createLineStartsFast(splitText);\n newPieces.push(new Piece(this._buffers.length, /* buffer index */ { line: 0, column: 0 }, { line: lineStarts.length - 1, column: splitText.length - lineStarts[lineStarts.length - 1] }, lineStarts.length - 1, splitText.length));\n this._buffers.push(new StringBuffer(splitText, lineStarts));\n }\n const lineStarts = createLineStartsFast(text);\n newPieces.push(new Piece(this._buffers.length, /* buffer index */ { line: 0, column: 0 }, { line: lineStarts.length - 1, column: text.length - lineStarts[lineStarts.length - 1] }, lineStarts.length - 1, text.length));\n this._buffers.push(new StringBuffer(text, lineStarts));\n return newPieces;\n }\n let startOffset = this._buffers[0].buffer.length;\n const lineStarts = createLineStartsFast(text, false);\n let start = this._lastChangeBufferPos;\n if (this._buffers[0].lineStarts[this._buffers[0].lineStarts.length - 1] === startOffset\n && startOffset !== 0\n && this.startWithLF(text)\n && this.endWithCR(this._buffers[0].buffer) // todo, we can check this._lastChangeBufferPos's column as it's the last one\n ) {\n this._lastChangeBufferPos = { line: this._lastChangeBufferPos.line, column: this._lastChangeBufferPos.column + 1 };\n start = this._lastChangeBufferPos;\n for (let i = 0; i < lineStarts.length; i++) {\n lineStarts[i] += startOffset + 1;\n }\n this._buffers[0].lineStarts = this._buffers[0].lineStarts.concat(lineStarts.slice(1));\n this._buffers[0].buffer += '_' + text;\n startOffset += 1;\n }\n else {\n if (startOffset !== 0) {\n for (let i = 0; i < lineStarts.length; i++) {\n lineStarts[i] += startOffset;\n }\n }\n this._buffers[0].lineStarts = this._buffers[0].lineStarts.concat(lineStarts.slice(1));\n this._buffers[0].buffer += text;\n }\n const endOffset = this._buffers[0].buffer.length;\n const endIndex = this._buffers[0].lineStarts.length - 1;\n const endColumn = endOffset - this._buffers[0].lineStarts[endIndex];\n const endPos = { line: endIndex, column: endColumn };\n const newPiece = new Piece(0, /** todo@peng */ start, endPos, this.getLineFeedCnt(0, start, endPos), endOffset - startOffset);\n this._lastChangeBufferPos = endPos;\n return [newPiece];\n }\n getLineRawContent(lineNumber, endOffset = 0) {\n let x = this.root;\n let ret = '';\n const cache = this._searchCache.get2(lineNumber);\n if (cache) {\n x = cache.node;\n const prevAccumulatedValue = this.getAccumulatedValue(x, lineNumber - cache.nodeStartLineNumber - 1);\n const buffer = this._buffers[x.piece.bufferIndex].buffer;\n const startOffset = this.offsetInBuffer(x.piece.bufferIndex, x.piece.start);\n if (cache.nodeStartLineNumber + x.piece.lineFeedCnt === lineNumber) {\n ret = buffer.substring(startOffset + prevAccumulatedValue, startOffset + x.piece.length);\n }\n else {\n const accumulatedValue = this.getAccumulatedValue(x, lineNumber - cache.nodeStartLineNumber);\n return buffer.substring(startOffset + prevAccumulatedValue, startOffset + accumulatedValue - endOffset);\n }\n }\n else {\n let nodeStartOffset = 0;\n const originalLineNumber = lineNumber;\n while (x !== SENTINEL) {\n if (x.left !== SENTINEL && x.lf_left >= lineNumber - 1) {\n x = x.left;\n }\n else if (x.lf_left + x.piece.lineFeedCnt > lineNumber - 1) {\n const prevAccumulatedValue = this.getAccumulatedValue(x, lineNumber - x.lf_left - 2);\n const accumulatedValue = this.getAccumulatedValue(x, lineNumber - x.lf_left - 1);\n const buffer = this._buffers[x.piece.bufferIndex].buffer;\n const startOffset = this.offsetInBuffer(x.piece.bufferIndex, x.piece.start);\n nodeStartOffset += x.size_left;\n this._searchCache.set({\n node: x,\n nodeStartOffset,\n nodeStartLineNumber: originalLineNumber - (lineNumber - 1 - x.lf_left)\n });\n return buffer.substring(startOffset + prevAccumulatedValue, startOffset + accumulatedValue - endOffset);\n }\n else if (x.lf_left + x.piece.lineFeedCnt === lineNumber - 1) {\n const prevAccumulatedValue = this.getAccumulatedValue(x, lineNumber - x.lf_left - 2);\n const buffer = this._buffers[x.piece.bufferIndex].buffer;\n const startOffset = this.offsetInBuffer(x.piece.bufferIndex, x.piece.start);\n ret = buffer.substring(startOffset + prevAccumulatedValue, startOffset + x.piece.length);\n break;\n }\n else {\n lineNumber -= x.lf_left + x.piece.lineFeedCnt;\n nodeStartOffset += x.size_left + x.piece.length;\n x = x.right;\n }\n }\n }\n // search in order, to find the node contains end column\n x = x.next();\n while (x !== SENTINEL) {\n const buffer = this._buffers[x.piece.bufferIndex].buffer;\n if (x.piece.lineFeedCnt > 0) {\n const accumulatedValue = this.getAccumulatedValue(x, 0);\n const startOffset = this.offsetInBuffer(x.piece.bufferIndex, x.piece.start);\n ret += buffer.substring(startOffset, startOffset + accumulatedValue - endOffset);\n return ret;\n }\n else {\n const startOffset = this.offsetInBuffer(x.piece.bufferIndex, x.piece.start);\n ret += buffer.substr(startOffset, x.piece.length);\n }\n x = x.next();\n }\n return ret;\n }\n computeBufferMetadata() {\n let x = this.root;\n let lfCnt = 1;\n let len = 0;\n while (x !== SENTINEL) {\n lfCnt += x.lf_left + x.piece.lineFeedCnt;\n len += x.size_left + x.piece.length;\n x = x.right;\n }\n this._lineCnt = lfCnt;\n this._length = len;\n this._searchCache.validate(this._length);\n }\n // #region node operations\n getIndexOf(node, accumulatedValue) {\n const piece = node.piece;\n const pos = this.positionInBuffer(node, accumulatedValue);\n const lineCnt = pos.line - piece.start.line;\n if (this.offsetInBuffer(piece.bufferIndex, piece.end) - this.offsetInBuffer(piece.bufferIndex, piece.start) === accumulatedValue) {\n // we are checking the end of this node, so a CRLF check is necessary.\n const realLineCnt = this.getLineFeedCnt(node.piece.bufferIndex, piece.start, pos);\n if (realLineCnt !== lineCnt) {\n // aha yes, CRLF\n return { index: realLineCnt, remainder: 0 };\n }\n }\n return { index: lineCnt, remainder: pos.column };\n }\n getAccumulatedValue(node, index) {\n if (index < 0) {\n return 0;\n }\n const piece = node.piece;\n const lineStarts = this._buffers[piece.bufferIndex].lineStarts;\n const expectedLineStartIndex = piece.start.line + index + 1;\n if (expectedLineStartIndex > piece.end.line) {\n return lineStarts[piece.end.line] + piece.end.column - lineStarts[piece.start.line] - piece.start.column;\n }\n else {\n return lineStarts[expectedLineStartIndex] - lineStarts[piece.start.line] - piece.start.column;\n }\n }\n deleteNodeTail(node, pos) {\n const piece = node.piece;\n const originalLFCnt = piece.lineFeedCnt;\n const originalEndOffset = this.offsetInBuffer(piece.bufferIndex, piece.end);\n const newEnd = pos;\n const newEndOffset = this.offsetInBuffer(piece.bufferIndex, newEnd);\n const newLineFeedCnt = this.getLineFeedCnt(piece.bufferIndex, piece.start, newEnd);\n const lf_delta = newLineFeedCnt - originalLFCnt;\n const size_delta = newEndOffset - originalEndOffset;\n const newLength = piece.length + size_delta;\n node.piece = new Piece(piece.bufferIndex, piece.start, newEnd, newLineFeedCnt, newLength);\n updateTreeMetadata(this, node, size_delta, lf_delta);\n }\n deleteNodeHead(node, pos) {\n const piece = node.piece;\n const originalLFCnt = piece.lineFeedCnt;\n const originalStartOffset = this.offsetInBuffer(piece.bufferIndex, piece.start);\n const newStart = pos;\n const newLineFeedCnt = this.getLineFeedCnt(piece.bufferIndex, newStart, piece.end);\n const newStartOffset = this.offsetInBuffer(piece.bufferIndex, newStart);\n const lf_delta = newLineFeedCnt - originalLFCnt;\n const size_delta = originalStartOffset - newStartOffset;\n const newLength = piece.length + size_delta;\n node.piece = new Piece(piece.bufferIndex, newStart, piece.end, newLineFeedCnt, newLength);\n updateTreeMetadata(this, node, size_delta, lf_delta);\n }\n shrinkNode(node, start, end) {\n const piece = node.piece;\n const originalStartPos = piece.start;\n const originalEndPos = piece.end;\n // old piece, originalStartPos, start\n const oldLength = piece.length;\n const oldLFCnt = piece.lineFeedCnt;\n const newEnd = start;\n const newLineFeedCnt = this.getLineFeedCnt(piece.bufferIndex, piece.start, newEnd);\n const newLength = this.offsetInBuffer(piece.bufferIndex, start) - this.offsetInBuffer(piece.bufferIndex, originalStartPos);\n node.piece = new Piece(piece.bufferIndex, piece.start, newEnd, newLineFeedCnt, newLength);\n updateTreeMetadata(this, node, newLength - oldLength, newLineFeedCnt - oldLFCnt);\n // new right piece, end, originalEndPos\n const newPiece = new Piece(piece.bufferIndex, end, originalEndPos, this.getLineFeedCnt(piece.bufferIndex, end, originalEndPos), this.offsetInBuffer(piece.bufferIndex, originalEndPos) - this.offsetInBuffer(piece.bufferIndex, end));\n const newNode = this.rbInsertRight(node, newPiece);\n this.validateCRLFWithPrevNode(newNode);\n }\n appendToNode(node, value) {\n if (this.adjustCarriageReturnFromNext(value, node)) {\n value += '\\n';\n }\n const hitCRLF = this.shouldCheckCRLF() && this.startWithLF(value) && this.endWithCR(node);\n const startOffset = this._buffers[0].buffer.length;\n this._buffers[0].buffer += value;\n const lineStarts = createLineStartsFast(value, false);\n for (let i = 0; i < lineStarts.length; i++) {\n lineStarts[i] += startOffset;\n }\n if (hitCRLF) {\n const prevStartOffset = this._buffers[0].lineStarts[this._buffers[0].lineStarts.length - 2];\n this._buffers[0].lineStarts.pop();\n // _lastChangeBufferPos is already wrong\n this._lastChangeBufferPos = { line: this._lastChangeBufferPos.line - 1, column: startOffset - prevStartOffset };\n }\n this._buffers[0].lineStarts = this._buffers[0].lineStarts.concat(lineStarts.slice(1));\n const endIndex = this._buffers[0].lineStarts.length - 1;\n const endColumn = this._buffers[0].buffer.length - this._buffers[0].lineStarts[endIndex];\n const newEnd = { line: endIndex, column: endColumn };\n const newLength = node.piece.length + value.length;\n const oldLineFeedCnt = node.piece.lineFeedCnt;\n const newLineFeedCnt = this.getLineFeedCnt(0, node.piece.start, newEnd);\n const lf_delta = newLineFeedCnt - oldLineFeedCnt;\n node.piece = new Piece(node.piece.bufferIndex, node.piece.start, newEnd, newLineFeedCnt, newLength);\n this._lastChangeBufferPos = newEnd;\n updateTreeMetadata(this, node, value.length, lf_delta);\n }\n nodeAt(offset) {\n let x = this.root;\n const cache = this._searchCache.get(offset);\n if (cache) {\n return {\n node: cache.node,\n nodeStartOffset: cache.nodeStartOffset,\n remainder: offset - cache.nodeStartOffset\n };\n }\n let nodeStartOffset = 0;\n while (x !== SENTINEL) {\n if (x.size_left > offset) {\n x = x.left;\n }\n else if (x.size_left + x.piece.length >= offset) {\n nodeStartOffset += x.size_left;\n const ret = {\n node: x,\n remainder: offset - x.size_left,\n nodeStartOffset\n };\n this._searchCache.set(ret);\n return ret;\n }\n else {\n offset -= x.size_left + x.piece.length;\n nodeStartOffset += x.size_left + x.piece.length;\n x = x.right;\n }\n }\n return null;\n }\n nodeAt2(lineNumber, column) {\n let x = this.root;\n let nodeStartOffset = 0;\n while (x !== SENTINEL) {\n if (x.left !== SENTINEL && x.lf_left >= lineNumber - 1) {\n x = x.left;\n }\n else if (x.lf_left + x.piece.lineFeedCnt > lineNumber - 1) {\n const prevAccumualtedValue = this.getAccumulatedValue(x, lineNumber - x.lf_left - 2);\n const accumulatedValue = this.getAccumulatedValue(x, lineNumber - x.lf_left - 1);\n nodeStartOffset += x.size_left;\n return {\n node: x,\n remainder: Math.min(prevAccumualtedValue + column - 1, accumulatedValue),\n nodeStartOffset\n };\n }\n else if (x.lf_left + x.piece.lineFeedCnt === lineNumber - 1) {\n const prevAccumualtedValue = this.getAccumulatedValue(x, lineNumber - x.lf_left - 2);\n if (prevAccumualtedValue + column - 1 <= x.piece.length) {\n return {\n node: x,\n remainder: prevAccumualtedValue + column - 1,\n nodeStartOffset\n };\n }\n else {\n column -= x.piece.length - prevAccumualtedValue;\n break;\n }\n }\n else {\n lineNumber -= x.lf_left + x.piece.lineFeedCnt;\n nodeStartOffset += x.size_left + x.piece.length;\n x = x.right;\n }\n }\n // search in order, to find the node contains position.column\n x = x.next();\n while (x !== SENTINEL) {\n if (x.piece.lineFeedCnt > 0) {\n const accumulatedValue = this.getAccumulatedValue(x, 0);\n const nodeStartOffset = this.offsetOfNode(x);\n return {\n node: x,\n remainder: Math.min(column - 1, accumulatedValue),\n nodeStartOffset\n };\n }\n else {\n if (x.piece.length >= column - 1) {\n const nodeStartOffset = this.offsetOfNode(x);\n return {\n node: x,\n remainder: column - 1,\n nodeStartOffset\n };\n }\n else {\n column -= x.piece.length;\n }\n }\n x = x.next();\n }\n return null;\n }\n nodeCharCodeAt(node, offset) {\n if (node.piece.lineFeedCnt < 1) {\n return -1;\n }\n const buffer = this._buffers[node.piece.bufferIndex];\n const newOffset = this.offsetInBuffer(node.piece.bufferIndex, node.piece.start) + offset;\n return buffer.buffer.charCodeAt(newOffset);\n }\n offsetOfNode(node) {\n if (!node) {\n return 0;\n }\n let pos = node.size_left;\n while (node !== this.root) {\n if (node.parent.right === node) {\n pos += node.parent.size_left + node.parent.piece.length;\n }\n node = node.parent;\n }\n return pos;\n }\n // #endregion\n // #region CRLF\n shouldCheckCRLF() {\n return !(this._EOLNormalized && this._EOL === '\\n');\n }\n startWithLF(val) {\n if (typeof val === 'string') {\n return val.charCodeAt(0) === 10;\n }\n if (val === SENTINEL || val.piece.lineFeedCnt === 0) {\n return false;\n }\n const piece = val.piece;\n const lineStarts = this._buffers[piece.bufferIndex].lineStarts;\n const line = piece.start.line;\n const startOffset = lineStarts[line] + piece.start.column;\n if (line === lineStarts.length - 1) {\n // last line, so there is no line feed at the end of this line\n return false;\n }\n const nextLineOffset = lineStarts[line + 1];\n if (nextLineOffset > startOffset + 1) {\n return false;\n }\n return this._buffers[piece.bufferIndex].buffer.charCodeAt(startOffset) === 10;\n }\n endWithCR(val) {\n if (typeof val === 'string') {\n return val.charCodeAt(val.length - 1) === 13;\n }\n if (val === SENTINEL || val.piece.lineFeedCnt === 0) {\n return false;\n }\n return this.nodeCharCodeAt(val, val.piece.length - 1) === 13;\n }\n validateCRLFWithPrevNode(nextNode) {\n if (this.shouldCheckCRLF() && this.startWithLF(nextNode)) {\n const node = nextNode.prev();\n if (this.endWithCR(node)) {\n this.fixCRLF(node, nextNode);\n }\n }\n }\n validateCRLFWithNextNode(node) {\n if (this.shouldCheckCRLF() && this.endWithCR(node)) {\n const nextNode = node.next();\n if (this.startWithLF(nextNode)) {\n this.fixCRLF(node, nextNode);\n }\n }\n }\n fixCRLF(prev, next) {\n const nodesToDel = [];\n // update node\n const lineStarts = this._buffers[prev.piece.bufferIndex].lineStarts;\n let newEnd;\n if (prev.piece.end.column === 0) {\n // it means, last line ends with \\r, not \\r\\n\n newEnd = { line: prev.piece.end.line - 1, column: lineStarts[prev.piece.end.line] - lineStarts[prev.piece.end.line - 1] - 1 };\n }\n else {\n // \\r\\n\n newEnd = { line: prev.piece.end.line, column: prev.piece.end.column - 1 };\n }\n const prevNewLength = prev.piece.length - 1;\n const prevNewLFCnt = prev.piece.lineFeedCnt - 1;\n prev.piece = new Piece(prev.piece.bufferIndex, prev.piece.start, newEnd, prevNewLFCnt, prevNewLength);\n updateTreeMetadata(this, prev, -1, -1);\n if (prev.piece.length === 0) {\n nodesToDel.push(prev);\n }\n // update nextNode\n const newStart = { line: next.piece.start.line + 1, column: 0 };\n const newLength = next.piece.length - 1;\n const newLineFeedCnt = this.getLineFeedCnt(next.piece.bufferIndex, newStart, next.piece.end);\n next.piece = new Piece(next.piece.bufferIndex, newStart, next.piece.end, newLineFeedCnt, newLength);\n updateTreeMetadata(this, next, -1, -1);\n if (next.piece.length === 0) {\n nodesToDel.push(next);\n }\n // create new piece which contains \\r\\n\n const pieces = this.createNewPieces('\\r\\n');\n this.rbInsertRight(prev, pieces[0]);\n // delete empty nodes\n for (let i = 0; i < nodesToDel.length; i++) {\n rbDelete(this, nodesToDel[i]);\n }\n }\n adjustCarriageReturnFromNext(value, node) {\n if (this.shouldCheckCRLF() && this.endWithCR(value)) {\n const nextNode = node.next();\n if (this.startWithLF(nextNode)) {\n // move `\\n` forward\n value += '\\n';\n if (nextNode.piece.length === 1) {\n rbDelete(this, nextNode);\n }\n else {\n const piece = nextNode.piece;\n const newStart = { line: piece.start.line + 1, column: 0 };\n const newLength = piece.length - 1;\n const newLineFeedCnt = this.getLineFeedCnt(piece.bufferIndex, newStart, piece.end);\n nextNode.piece = new Piece(piece.bufferIndex, newStart, piece.end, newLineFeedCnt, newLength);\n updateTreeMetadata(this, nextNode, -1, -1);\n }\n return true;\n }\n }\n return false;\n }\n // #endregion\n // #endregion\n // #region Tree operations\n iterate(node, callback) {\n if (node === SENTINEL) {\n return callback(SENTINEL);\n }\n const leftRet = this.iterate(node.left, callback);\n if (!leftRet) {\n return leftRet;\n }\n return callback(node) && this.iterate(node.right, callback);\n }\n getNodeContent(node) {\n if (node === SENTINEL) {\n return '';\n }\n const buffer = this._buffers[node.piece.bufferIndex];\n const piece = node.piece;\n const startOffset = this.offsetInBuffer(piece.bufferIndex, piece.start);\n const endOffset = this.offsetInBuffer(piece.bufferIndex, piece.end);\n const currentContent = buffer.buffer.substring(startOffset, endOffset);\n return currentContent;\n }\n getPieceContent(piece) {\n const buffer = this._buffers[piece.bufferIndex];\n const startOffset = this.offsetInBuffer(piece.bufferIndex, piece.start);\n const endOffset = this.offsetInBuffer(piece.bufferIndex, piece.end);\n const currentContent = buffer.buffer.substring(startOffset, endOffset);\n return currentContent;\n }\n /**\n * node node\n * / \\ / \\\n * a b <---- a b\n * /\n * z\n */\n rbInsertRight(node, p) {\n const z = new TreeNode(p, 1 /* NodeColor.Red */);\n z.left = SENTINEL;\n z.right = SENTINEL;\n z.parent = SENTINEL;\n z.size_left = 0;\n z.lf_left = 0;\n const x = this.root;\n if (x === SENTINEL) {\n this.root = z;\n z.color = 0 /* NodeColor.Black */;\n }\n else if (node.right === SENTINEL) {\n node.right = z;\n z.parent = node;\n }\n else {\n const nextNode = leftest(node.right);\n nextNode.left = z;\n z.parent = nextNode;\n }\n fixInsert(this, z);\n return z;\n }\n /**\n * node node\n * / \\ / \\\n * a b ----> a b\n * \\\n * z\n */\n rbInsertLeft(node, p) {\n const z = new TreeNode(p, 1 /* NodeColor.Red */);\n z.left = SENTINEL;\n z.right = SENTINEL;\n z.parent = SENTINEL;\n z.size_left = 0;\n z.lf_left = 0;\n if (this.root === SENTINEL) {\n this.root = z;\n z.color = 0 /* NodeColor.Black */;\n }\n else if (node.left === SENTINEL) {\n node.left = z;\n z.parent = node;\n }\n else {\n const prevNode = righttest(node.left); // a\n prevNode.right = z;\n z.parent = prevNode;\n }\n fixInsert(this, z);\n return z;\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 *--------------------------------------------------------------------------------------------*/\nimport { Emitter } from '../../../../base/common/event.js';\nimport * as strings from '../../../../base/common/strings.js';\nimport { Range } from '../../core/range.js';\nimport { ApplyEditsResult } from '../../model.js';\nimport { PieceTreeBase } from './pieceTreeBase.js';\nimport { countEOL } from '../../core/eolCounter.js';\nimport { TextChange } from '../../core/textChange.js';\nimport { Disposable } from '../../../../base/common/lifecycle.js';\nexport class PieceTreeTextBuffer extends Disposable {\n constructor(chunks, BOM, eol, containsRTL, containsUnusualLineTerminators, isBasicASCII, eolNormalized) {\n super();\n this._onDidChangeContent = this._register(new Emitter());\n this._BOM = BOM;\n this._mightContainNonBasicASCII = !isBasicASCII;\n this._mightContainRTL = containsRTL;\n this._mightContainUnusualLineTerminators = containsUnusualLineTerminators;\n this._pieceTree = new PieceTreeBase(chunks, eol, eolNormalized);\n }\n mightContainRTL() {\n return this._mightContainRTL;\n }\n mightContainUnusualLineTerminators() {\n return this._mightContainUnusualLineTerminators;\n }\n resetMightContainUnusualLineTerminators() {\n this._mightContainUnusualLineTerminators = false;\n }\n mightContainNonBasicASCII() {\n return this._mightContainNonBasicASCII;\n }\n getBOM() {\n return this._BOM;\n }\n getEOL() {\n return this._pieceTree.getEOL();\n }\n createSnapshot(preserveBOM) {\n return this._pieceTree.createSnapshot(preserveBOM ? this._BOM : '');\n }\n getOffsetAt(lineNumber, column) {\n return this._pieceTree.getOffsetAt(lineNumber, column);\n }\n getPositionAt(offset) {\n return this._pieceTree.getPositionAt(offset);\n }\n getRangeAt(start, length) {\n const end = start + length;\n const startPosition = this.getPositionAt(start);\n const endPosition = this.getPositionAt(end);\n return new Range(startPosition.lineNumber, startPosition.column, endPosition.lineNumber, endPosition.column);\n }\n getValueInRange(range, eol = 0 /* EndOfLinePreference.TextDefined */) {\n if (range.isEmpty()) {\n return '';\n }\n const lineEnding = this._getEndOfLine(eol);\n return this._pieceTree.getValueInRange(range, lineEnding);\n }\n getValueLengthInRange(range, eol = 0 /* EndOfLinePreference.TextDefined */) {\n if (range.isEmpty()) {\n return 0;\n }\n if (range.startLineNumber === range.endLineNumber) {\n return (range.endColumn - range.startColumn);\n }\n const startOffset = this.getOffsetAt(range.startLineNumber, range.startColumn);\n const endOffset = this.getOffsetAt(range.endLineNumber, range.endColumn);\n // offsets use the text EOL, so we need to compensate for length differences\n // if the requested EOL doesn't match the text EOL\n let eolOffsetCompensation = 0;\n const desiredEOL = this._getEndOfLine(eol);\n const actualEOL = this.getEOL();\n if (desiredEOL.length !== actualEOL.length) {\n const delta = desiredEOL.length - actualEOL.length;\n const eolCount = range.endLineNumber - range.startLineNumber;\n eolOffsetCompensation = delta * eolCount;\n }\n return endOffset - startOffset + eolOffsetCompensation;\n }\n getCharacterCountInRange(range, eol = 0 /* EndOfLinePreference.TextDefined */) {\n if (this._mightContainNonBasicASCII) {\n // we must count by iterating\n let result = 0;\n const fromLineNumber = range.startLineNumber;\n const toLineNumber = range.endLineNumber;\n for (let lineNumber = fromLineNumber; lineNumber <= toLineNumber; lineNumber++) {\n const lineContent = this.getLineContent(lineNumber);\n const fromOffset = (lineNumber === fromLineNumber ? range.startColumn - 1 : 0);\n const toOffset = (lineNumber === toLineNumber ? range.endColumn - 1 : lineContent.length);\n for (let offset = fromOffset; offset < toOffset; offset++) {\n if (strings.isHighSurrogate(lineContent.charCodeAt(offset))) {\n result = result + 1;\n offset = offset + 1;\n }\n else {\n result = result + 1;\n }\n }\n }\n result += this._getEndOfLine(eol).length * (toLineNumber - fromLineNumber);\n return result;\n }\n return this.getValueLengthInRange(range, eol);\n }\n getLength() {\n return this._pieceTree.getLength();\n }\n getLineCount() {\n return this._pieceTree.getLineCount();\n }\n getLinesContent() {\n return this._pieceTree.getLinesContent();\n }\n getLineContent(lineNumber) {\n return this._pieceTree.getLineContent(lineNumber);\n }\n getLineCharCode(lineNumber, index) {\n return this._pieceTree.getLineCharCode(lineNumber, index);\n }\n getLineLength(lineNumber) {\n return this._pieceTree.getLineLength(lineNumber);\n }\n getLineFirstNonWhitespaceColumn(lineNumber) {\n const result = strings.firstNonWhitespaceIndex(this.getLineContent(lineNumber));\n if (result === -1) {\n return 0;\n }\n return result + 1;\n }\n getLineLastNonWhitespaceColumn(lineNumber) {\n const result = strings.lastNonWhitespaceIndex(this.getLineContent(lineNumber));\n if (result === -1) {\n return 0;\n }\n return result + 2;\n }\n _getEndOfLine(eol) {\n switch (eol) {\n case 1 /* EndOfLinePreference.LF */:\n return '\\n';\n case 2 /* EndOfLinePreference.CRLF */:\n return '\\r\\n';\n case 0 /* EndOfLinePreference.TextDefined */:\n return this.getEOL();\n default:\n throw new Error('Unknown EOL preference');\n }\n }\n setEOL(newEOL) {\n this._pieceTree.setEOL(newEOL);\n }\n applyEdits(rawOperations, recordTrimAutoWhitespace, computeUndoEdits) {\n let mightContainRTL = this._mightContainRTL;\n let mightContainUnusualLineTerminators = this._mightContainUnusualLineTerminators;\n let mightContainNonBasicASCII = this._mightContainNonBasicASCII;\n let canReduceOperations = true;\n let operations = [];\n for (let i = 0; i < rawOperations.length; i++) {\n const op = rawOperations[i];\n if (canReduceOperations && op._isTracked) {\n canReduceOperations = false;\n }\n const validatedRange = op.range;\n if (op.text) {\n let textMightContainNonBasicASCII = true;\n if (!mightContainNonBasicASCII) {\n textMightContainNonBasicASCII = !strings.isBasicASCII(op.text);\n mightContainNonBasicASCII = textMightContainNonBasicASCII;\n }\n if (!mightContainRTL && textMightContainNonBasicASCII) {\n // check if the new inserted text contains RTL\n mightContainRTL = strings.containsRTL(op.text);\n }\n if (!mightContainUnusualLineTerminators && textMightContainNonBasicASCII) {\n // check if the new inserted text contains unusual line terminators\n mightContainUnusualLineTerminators = strings.containsUnusualLineTerminators(op.text);\n }\n }\n let validText = '';\n let eolCount = 0;\n let firstLineLength = 0;\n let lastLineLength = 0;\n if (op.text) {\n let strEOL;\n [eolCount, firstLineLength, lastLineLength, strEOL] = countEOL(op.text);\n const bufferEOL = this.getEOL();\n const expectedStrEOL = (bufferEOL === '\\r\\n' ? 2 /* StringEOL.CRLF */ : 1 /* StringEOL.LF */);\n if (strEOL === 0 /* StringEOL.Unknown */ || strEOL === expectedStrEOL) {\n validText = op.text;\n }\n else {\n validText = op.text.replace(/\\r\\n|\\r|\\n/g, bufferEOL);\n }\n }\n operations[i] = {\n sortIndex: i,\n identifier: op.identifier || null,\n range: validatedRange,\n rangeOffset: this.getOffsetAt(validatedRange.startLineNumber, validatedRange.startColumn),\n rangeLength: this.getValueLengthInRange(validatedRange),\n text: validText,\n eolCount: eolCount,\n firstLineLength: firstLineLength,\n lastLineLength: lastLineLength,\n forceMoveMarkers: Boolean(op.forceMoveMarkers),\n isAutoWhitespaceEdit: op.isAutoWhitespaceEdit || false\n };\n }\n // Sort operations ascending\n operations.sort(PieceTreeTextBuffer._sortOpsAscending);\n let hasTouchingRanges = false;\n for (let i = 0, count = operations.length - 1; i < count; i++) {\n const rangeEnd = operations[i].range.getEndPosition();\n const nextRangeStart = operations[i + 1].range.getStartPosition();\n if (nextRangeStart.isBeforeOrEqual(rangeEnd)) {\n if (nextRangeStart.isBefore(rangeEnd)) {\n // overlapping ranges\n throw new Error('Overlapping ranges are not allowed!');\n }\n hasTouchingRanges = true;\n }\n }\n if (canReduceOperations) {\n operations = this._reduceOperations(operations);\n }\n // Delta encode operations\n const reverseRanges = (computeUndoEdits || recordTrimAutoWhitespace ? PieceTreeTextBuffer._getInverseEditRanges(operations) : []);\n const newTrimAutoWhitespaceCandidates = [];\n if (recordTrimAutoWhitespace) {\n for (let i = 0; i < operations.length; i++) {\n const op = operations[i];\n const reverseRange = reverseRanges[i];\n if (op.isAutoWhitespaceEdit && op.range.isEmpty()) {\n // Record already the future line numbers that might be auto whitespace removal candidates on next edit\n for (let lineNumber = reverseRange.startLineNumber; lineNumber <= reverseRange.endLineNumber; lineNumber++) {\n let currentLineContent = '';\n if (lineNumber === reverseRange.startLineNumber) {\n currentLineContent = this.getLineContent(op.range.startLineNumber);\n if (strings.firstNonWhitespaceIndex(currentLineContent) !== -1) {\n continue;\n }\n }\n newTrimAutoWhitespaceCandidates.push({ lineNumber: lineNumber, oldContent: currentLineContent });\n }\n }\n }\n }\n let reverseOperations = null;\n if (computeUndoEdits) {\n let reverseRangeDeltaOffset = 0;\n reverseOperations = [];\n for (let i = 0; i < operations.length; i++) {\n const op = operations[i];\n const reverseRange = reverseRanges[i];\n const bufferText = this.getValueInRange(op.range);\n const reverseRangeOffset = op.rangeOffset + reverseRangeDeltaOffset;\n reverseRangeDeltaOffset += (op.text.length - bufferText.length);\n reverseOperations[i] = {\n sortIndex: op.sortIndex,\n identifier: op.identifier,\n range: reverseRange,\n text: bufferText,\n textChange: new TextChange(op.rangeOffset, bufferText, reverseRangeOffset, op.text)\n };\n }\n // Can only sort reverse operations when the order is not significant\n if (!hasTouchingRanges) {\n reverseOperations.sort((a, b) => a.sortIndex - b.sortIndex);\n }\n }\n this._mightContainRTL = mightContainRTL;\n this._mightContainUnusualLineTerminators = mightContainUnusualLineTerminators;\n this._mightContainNonBasicASCII = mightContainNonBasicASCII;\n const contentChanges = this._doApplyEdits(operations);\n let trimAutoWhitespaceLineNumbers = null;\n if (recordTrimAutoWhitespace && newTrimAutoWhitespaceCandidates.length > 0) {\n // sort line numbers auto whitespace removal candidates for next edit descending\n newTrimAutoWhitespaceCandidates.sort((a, b) => b.lineNumber - a.lineNumber);\n trimAutoWhitespaceLineNumbers = [];\n for (let i = 0, len = newTrimAutoWhitespaceCandidates.length; i < len; i++) {\n const lineNumber = newTrimAutoWhitespaceCandidates[i].lineNumber;\n if (i > 0 && newTrimAutoWhitespaceCandidates[i - 1].lineNumber === lineNumber) {\n // Do not have the same line number twice\n continue;\n }\n const prevContent = newTrimAutoWhitespaceCandidates[i].oldContent;\n const lineContent = this.getLineContent(lineNumber);\n if (lineContent.length === 0 || lineContent === prevContent || strings.firstNonWhitespaceIndex(lineContent) !== -1) {\n continue;\n }\n trimAutoWhitespaceLineNumbers.push(lineNumber);\n }\n }\n this._onDidChangeContent.fire();\n return new ApplyEditsResult(reverseOperations, contentChanges, trimAutoWhitespaceLineNumbers);\n }\n /**\n * Transform operations such that they represent the same logic edit,\n * but that they also do not cause OOM crashes.\n */\n _reduceOperations(operations) {\n if (operations.length < 1000) {\n // We know from empirical testing that a thousand edits work fine regardless of their shape.\n return operations;\n }\n // At one point, due to how events are emitted and how each operation is handled,\n // some operations can trigger a high amount of temporary string allocations,\n // that will immediately get edited again.\n // e.g. a formatter inserting ridiculous ammounts of \\n on a model with a single line\n // Therefore, the strategy is to collapse all the operations into a huge single edit operation\n return [this._toSingleEditOperation(operations)];\n }\n _toSingleEditOperation(operations) {\n let forceMoveMarkers = false;\n const firstEditRange = operations[0].range;\n const lastEditRange = operations[operations.length - 1].range;\n const entireEditRange = new Range(firstEditRange.startLineNumber, firstEditRange.startColumn, lastEditRange.endLineNumber, lastEditRange.endColumn);\n let lastEndLineNumber = firstEditRange.startLineNumber;\n let lastEndColumn = firstEditRange.startColumn;\n const result = [];\n for (let i = 0, len = operations.length; i < len; i++) {\n const operation = operations[i];\n const range = operation.range;\n forceMoveMarkers = forceMoveMarkers || operation.forceMoveMarkers;\n // (1) -- Push old text\n result.push(this.getValueInRange(new Range(lastEndLineNumber, lastEndColumn, range.startLineNumber, range.startColumn)));\n // (2) -- Push new text\n if (operation.text.length > 0) {\n result.push(operation.text);\n }\n lastEndLineNumber = range.endLineNumber;\n lastEndColumn = range.endColumn;\n }\n const text = result.join('');\n const [eolCount, firstLineLength, lastLineLength] = countEOL(text);\n return {\n sortIndex: 0,\n identifier: operations[0].identifier,\n range: entireEditRange,\n rangeOffset: this.getOffsetAt(entireEditRange.startLineNumber, entireEditRange.startColumn),\n rangeLength: this.getValueLengthInRange(entireEditRange, 0 /* EndOfLinePreference.TextDefined */),\n text: text,\n eolCount: eolCount,\n firstLineLength: firstLineLength,\n lastLineLength: lastLineLength,\n forceMoveMarkers: forceMoveMarkers,\n isAutoWhitespaceEdit: false\n };\n }\n _doApplyEdits(operations) {\n operations.sort(PieceTreeTextBuffer._sortOpsDescending);\n const contentChanges = [];\n // operations are from bottom to top\n for (let i = 0; i < operations.length; i++) {\n const op = operations[i];\n const startLineNumber = op.range.startLineNumber;\n const startColumn = op.range.startColumn;\n const endLineNumber = op.range.endLineNumber;\n const endColumn = op.range.endColumn;\n if (startLineNumber === endLineNumber && startColumn === endColumn && op.text.length === 0) {\n // no-op\n continue;\n }\n if (op.text) {\n // replacement\n this._pieceTree.delete(op.rangeOffset, op.rangeLength);\n this._pieceTree.insert(op.rangeOffset, op.text, true);\n }\n else {\n // deletion\n this._pieceTree.delete(op.rangeOffset, op.rangeLength);\n }\n const contentChangeRange = new Range(startLineNumber, startColumn, endLineNumber, endColumn);\n contentChanges.push({\n range: contentChangeRange,\n rangeLength: op.rangeLength,\n text: op.text,\n rangeOffset: op.rangeOffset,\n forceMoveMarkers: op.forceMoveMarkers\n });\n }\n return contentChanges;\n }\n findMatchesLineByLine(searchRange, searchData, captureMatches, limitResultCount) {\n return this._pieceTree.findMatchesLineByLine(searchRange, searchData, captureMatches, limitResultCount);\n }\n /**\n * Assumes `operations` are validated and sorted ascending\n */\n static _getInverseEditRanges(operations) {\n const result = [];\n let prevOpEndLineNumber = 0;\n let prevOpEndColumn = 0;\n let prevOp = null;\n for (let i = 0, len = operations.length; i < len; i++) {\n const op = operations[i];\n let startLineNumber;\n let startColumn;\n if (prevOp) {\n if (prevOp.range.endLineNumber === op.range.startLineNumber) {\n startLineNumber = prevOpEndLineNumber;\n startColumn = prevOpEndColumn + (op.range.startColumn - prevOp.range.endColumn);\n }\n else {\n startLineNumber = prevOpEndLineNumber + (op.range.startLineNumber - prevOp.range.endLineNumber);\n startColumn = op.range.startColumn;\n }\n }\n else {\n startLineNumber = op.range.startLineNumber;\n startColumn = op.range.startColumn;\n }\n let resultRange;\n if (op.text.length > 0) {\n // the operation inserts something\n const lineCount = op.eolCount + 1;\n if (lineCount === 1) {\n // single line insert\n resultRange = new Range(startLineNumber, startColumn, startLineNumber, startColumn + op.firstLineLength);\n }\n else {\n // multi line insert\n resultRange = new Range(startLineNumber, startColumn, startLineNumber + lineCount - 1, op.lastLineLength + 1);\n }\n }\n else {\n // There is nothing to insert\n resultRange = new Range(startLineNumber, startColumn, startLineNumber, startColumn);\n }\n prevOpEndLineNumber = resultRange.endLineNumber;\n prevOpEndColumn = resultRange.endColumn;\n result.push(resultRange);\n prevOp = op;\n }\n return result;\n }\n static _sortOpsAscending(a, b) {\n const r = Range.compareRangesUsingEnds(a.range, b.range);\n if (r === 0) {\n return a.sortIndex - b.sortIndex;\n }\n return r;\n }\n static _sortOpsDescending(a, b) {\n const r = Range.compareRangesUsingEnds(a.range, b.range);\n if (r === 0) {\n return b.sortIndex - a.sortIndex;\n }\n return -r;\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 *--------------------------------------------------------------------------------------------*/\nimport * as strings from '../../../../base/common/strings.js';\nimport { StringBuffer, createLineStarts, createLineStartsFast } from './pieceTreeBase.js';\nimport { PieceTreeTextBuffer } from './pieceTreeTextBuffer.js';\nclass PieceTreeTextBufferFactory {\n constructor(_chunks, _bom, _cr, _lf, _crlf, _containsRTL, _containsUnusualLineTerminators, _isBasicASCII, _normalizeEOL) {\n this._chunks = _chunks;\n this._bom = _bom;\n this._cr = _cr;\n this._lf = _lf;\n this._crlf = _crlf;\n this._containsRTL = _containsRTL;\n this._containsUnusualLineTerminators = _containsUnusualLineTerminators;\n this._isBasicASCII = _isBasicASCII;\n this._normalizeEOL = _normalizeEOL;\n }\n _getEOL(defaultEOL) {\n const totalEOLCount = this._cr + this._lf + this._crlf;\n const totalCRCount = this._cr + this._crlf;\n if (totalEOLCount === 0) {\n // This is an empty file or a file with precisely one line\n return (defaultEOL === 1 /* DefaultEndOfLine.LF */ ? '\\n' : '\\r\\n');\n }\n if (totalCRCount > totalEOLCount / 2) {\n // More than half of the file contains \\r\\n ending lines\n return '\\r\\n';\n }\n // At least one line more ends in \\n\n return '\\n';\n }\n create(defaultEOL) {\n const eol = this._getEOL(defaultEOL);\n const chunks = this._chunks;\n if (this._normalizeEOL &&\n ((eol === '\\r\\n' && (this._cr > 0 || this._lf > 0))\n || (eol === '\\n' && (this._cr > 0 || this._crlf > 0)))) {\n // Normalize pieces\n for (let i = 0, len = chunks.length; i < len; i++) {\n const str = chunks[i].buffer.replace(/\\r\\n|\\r|\\n/g, eol);\n const newLineStart = createLineStartsFast(str);\n chunks[i] = new StringBuffer(str, newLineStart);\n }\n }\n const textBuffer = new PieceTreeTextBuffer(chunks, this._bom, eol, this._containsRTL, this._containsUnusualLineTerminators, this._isBasicASCII, this._normalizeEOL);\n return { textBuffer: textBuffer, disposable: textBuffer };\n }\n}\nexport class PieceTreeTextBufferBuilder {\n constructor() {\n this.chunks = [];\n this.BOM = '';\n this._hasPreviousChar = false;\n this._previousChar = 0;\n this._tmpLineStarts = [];\n this.cr = 0;\n this.lf = 0;\n this.crlf = 0;\n this.containsRTL = false;\n this.containsUnusualLineTerminators = false;\n this.isBasicASCII = true;\n }\n acceptChunk(chunk) {\n if (chunk.length === 0) {\n return;\n }\n if (this.chunks.length === 0) {\n if (strings.startsWithUTF8BOM(chunk)) {\n this.BOM = strings.UTF8_BOM_CHARACTER;\n chunk = chunk.substr(1);\n }\n }\n const lastChar = chunk.charCodeAt(chunk.length - 1);\n if (lastChar === 13 /* CharCode.CarriageReturn */ || (lastChar >= 0xD800 && lastChar <= 0xDBFF)) {\n // last character is \\r or a high surrogate => keep it back\n this._acceptChunk1(chunk.substr(0, chunk.length - 1), false);\n this._hasPreviousChar = true;\n this._previousChar = lastChar;\n }\n else {\n this._acceptChunk1(chunk, false);\n this._hasPreviousChar = false;\n this._previousChar = lastChar;\n }\n }\n _acceptChunk1(chunk, allowEmptyStrings) {\n if (!allowEmptyStrings && chunk.length === 0) {\n // Nothing to do\n return;\n }\n if (this._hasPreviousChar) {\n this._acceptChunk2(String.fromCharCode(this._previousChar) + chunk);\n }\n else {\n this._acceptChunk2(chunk);\n }\n }\n _acceptChunk2(chunk) {\n const lineStarts = createLineStarts(this._tmpLineStarts, chunk);\n this.chunks.push(new StringBuffer(chunk, lineStarts.lineStarts));\n this.cr += lineStarts.cr;\n this.lf += lineStarts.lf;\n this.crlf += lineStarts.crlf;\n if (!lineStarts.isBasicASCII) {\n // this chunk contains non basic ASCII characters\n this.isBasicASCII = false;\n if (!this.containsRTL) {\n this.containsRTL = strings.containsRTL(chunk);\n }\n if (!this.containsUnusualLineTerminators) {\n this.containsUnusualLineTerminators = strings.containsUnusualLineTerminators(chunk);\n }\n }\n }\n finish(normalizeEOL = true) {\n this._finish();\n return new PieceTreeTextBufferFactory(this.chunks, this.BOM, this.cr, this.lf, this.crlf, this.containsRTL, this.containsUnusualLineTerminators, this.isBasicASCII, normalizeEOL);\n }\n _finish() {\n if (this.chunks.length === 0) {\n this._acceptChunk1('', true);\n }\n if (this._hasPreviousChar) {\n this._hasPreviousChar = false;\n // recreate last chunk\n const lastChunk = this.chunks[this.chunks.length - 1];\n lastChunk.buffer += String.fromCharCode(this._previousChar);\n const newLineStarts = createLineStartsFast(lastChunk.buffer);\n lastChunk.lineStarts = newLineStarts;\n if (this._previousChar === 13 /* CharCode.CarriageReturn */) {\n this.cr++;\n }\n }\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 *--------------------------------------------------------------------------------------------*/\nimport { arrayInsert } from '../../../base/common/arrays.js';\n/**\n * An array that avoids being sparse by always\n * filling up unused indices with a default value.\n */\nexport class FixedArray {\n constructor(_default) {\n this._default = _default;\n this._store = [];\n }\n get(index) {\n if (index < this._store.length) {\n return this._store[index];\n }\n return this._default;\n }\n set(index, value) {\n while (index >= this._store.length) {\n this._store[this._store.length] = this._default;\n }\n this._store[index] = value;\n }\n replace(index, oldLength, newLength) {\n if (index >= this._store.length) {\n return;\n }\n if (oldLength === 0) {\n this.insert(index, newLength);\n return;\n }\n else if (newLength === 0) {\n this.delete(index, oldLength);\n return;\n }\n const before = this._store.slice(0, index);\n const after = this._store.slice(index + oldLength);\n const insertArr = arrayFill(newLength, this._default);\n this._store = before.concat(insertArr, after);\n }\n delete(deleteIndex, deleteCount) {\n if (deleteCount === 0 || deleteIndex >= this._store.length) {\n return;\n }\n this._store.splice(deleteIndex, deleteCount);\n }\n insert(insertIndex, insertCount) {\n if (insertCount === 0 || insertIndex >= this._store.length) {\n return;\n }\n const arr = [];\n for (let i = 0; i < insertCount; i++) {\n arr[i] = this._default;\n }\n this._store = arrayInsert(this._store, insertIndex, arr);\n }\n}\nfunction arrayFill(length, value) {\n const arr = [];\n for (let i = 0; i < length; i++) {\n arr[i] = value;\n }\n return arr;\n}\n", "/**\n * Represents contiguous tokens over a contiguous range of lines.\n */\nexport class ContiguousMultilineTokens {\n /**\n * (Inclusive) start line number for these tokens.\n */\n get startLineNumber() {\n return this._startLineNumber;\n }\n /**\n * (Inclusive) end line number for these tokens.\n */\n get endLineNumber() {\n return this._startLineNumber + this._tokens.length - 1;\n }\n constructor(startLineNumber, tokens) {\n this._startLineNumber = startLineNumber;\n this._tokens = tokens;\n }\n /**\n * @see {@link _tokens}\n */\n getLineTokens(lineNumber) {\n return this._tokens[lineNumber - this._startLineNumber];\n }\n appendLineTokens(lineTokens) {\n this._tokens.push(lineTokens);\n }\n}\n", "import { ContiguousMultilineTokens } from './contiguousMultilineTokens.js';\nexport class ContiguousMultilineTokensBuilder {\n constructor() {\n this._tokens = [];\n }\n add(lineNumber, lineTokens) {\n if (this._tokens.length > 0) {\n const last = this._tokens[this._tokens.length - 1];\n if (last.endLineNumber + 1 === lineNumber) {\n // append\n last.appendLineTokens(lineTokens);\n return;\n }\n }\n this._tokens.push(new ContiguousMultilineTokens(lineNumber, [lineTokens]));\n }\n finalize() {\n return this._tokens;\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 *--------------------------------------------------------------------------------------------*/\nimport { runWhenGlobalIdle } from '../../../base/common/async.js';\nimport { BugIndicatingError, onUnexpectedError } from '../../../base/common/errors.js';\nimport { setTimeout0 } from '../../../base/common/platform.js';\nimport { StopWatch } from '../../../base/common/stopwatch.js';\nimport { countEOL } from '../core/eolCounter.js';\nimport { LineRange } from '../core/lineRange.js';\nimport { OffsetRange } from '../core/offsetRange.js';\nimport { nullTokenizeEncoded } from '../languages/nullTokenize.js';\nimport { FixedArray } from './fixedArray.js';\nimport { ContiguousMultilineTokensBuilder } from '../tokens/contiguousMultilineTokensBuilder.js';\nimport { LineTokens } from '../tokens/lineTokens.js';\nexport class TokenizerWithStateStore {\n constructor(lineCount, tokenizationSupport) {\n this.tokenizationSupport = tokenizationSupport;\n this.initialState = this.tokenizationSupport.getInitialState();\n this.store = new TrackingTokenizationStateStore(lineCount);\n }\n getStartState(lineNumber) {\n return this.store.getStartState(lineNumber, this.initialState);\n }\n getFirstInvalidLine() {\n return this.store.getFirstInvalidLine(this.initialState);\n }\n}\nexport class TokenizerWithStateStoreAndTextModel extends TokenizerWithStateStore {\n constructor(lineCount, tokenizationSupport, _textModel, _languageIdCodec) {\n super(lineCount, tokenizationSupport);\n this._textModel = _textModel;\n this._languageIdCodec = _languageIdCodec;\n }\n updateTokensUntilLine(builder, lineNumber) {\n const languageId = this._textModel.getLanguageId();\n while (true) {\n const lineToTokenize = this.getFirstInvalidLine();\n if (!lineToTokenize || lineToTokenize.lineNumber > lineNumber) {\n break;\n }\n const text = this._textModel.getLineContent(lineToTokenize.lineNumber);\n const r = safeTokenize(this._languageIdCodec, languageId, this.tokenizationSupport, text, true, lineToTokenize.startState);\n builder.add(lineToTokenize.lineNumber, r.tokens);\n this.store.setEndState(lineToTokenize.lineNumber, r.endState);\n }\n }\n /** assumes state is up to date */\n getTokenTypeIfInsertingCharacter(position, character) {\n // TODO@hediet: use tokenizeLineWithEdit\n const lineStartState = this.getStartState(position.lineNumber);\n if (!lineStartState) {\n return 0 /* StandardTokenType.Other */;\n }\n const languageId = this._textModel.getLanguageId();\n const lineContent = this._textModel.getLineContent(position.lineNumber);\n // Create the text as if `character` was inserted\n const text = (lineContent.substring(0, position.column - 1)\n + character\n + lineContent.substring(position.column - 1));\n const r = safeTokenize(this._languageIdCodec, languageId, this.tokenizationSupport, text, true, lineStartState);\n const lineTokens = new LineTokens(r.tokens, text, this._languageIdCodec);\n if (lineTokens.getCount() === 0) {\n return 0 /* StandardTokenType.Other */;\n }\n const tokenIndex = lineTokens.findTokenIndexAtOffset(position.column - 1);\n return lineTokens.getStandardTokenType(tokenIndex);\n }\n /** assumes state is up to date */\n tokenizeLineWithEdit(position, length, newText) {\n const lineNumber = position.lineNumber;\n const column = position.column;\n const lineStartState = this.getStartState(lineNumber);\n if (!lineStartState) {\n return null;\n }\n const curLineContent = this._textModel.getLineContent(lineNumber);\n const newLineContent = curLineContent.substring(0, column - 1)\n + newText + curLineContent.substring(column - 1 + length);\n const languageId = this._textModel.getLanguageIdAtPosition(lineNumber, 0);\n const result = safeTokenize(this._languageIdCodec, languageId, this.tokenizationSupport, newLineContent, true, lineStartState);\n const lineTokens = new LineTokens(result.tokens, newLineContent, this._languageIdCodec);\n return lineTokens;\n }\n hasAccurateTokensForLine(lineNumber) {\n const firstInvalidLineNumber = this.store.getFirstInvalidEndStateLineNumberOrMax();\n return (lineNumber < firstInvalidLineNumber);\n }\n isCheapToTokenize(lineNumber) {\n const firstInvalidLineNumber = this.store.getFirstInvalidEndStateLineNumberOrMax();\n if (lineNumber < firstInvalidLineNumber) {\n return true;\n }\n if (lineNumber === firstInvalidLineNumber\n && this._textModel.getLineLength(lineNumber) < 2048 /* Constants.CHEAP_TOKENIZATION_LENGTH_LIMIT */) {\n return true;\n }\n return false;\n }\n /**\n * The result is not cached.\n */\n tokenizeHeuristically(builder, startLineNumber, endLineNumber) {\n if (endLineNumber <= this.store.getFirstInvalidEndStateLineNumberOrMax()) {\n // nothing to do\n return { heuristicTokens: false };\n }\n if (startLineNumber <= this.store.getFirstInvalidEndStateLineNumberOrMax()) {\n // tokenization has reached the viewport start...\n this.updateTokensUntilLine(builder, endLineNumber);\n return { heuristicTokens: false };\n }\n let state = this.guessStartState(startLineNumber);\n const languageId = this._textModel.getLanguageId();\n for (let lineNumber = startLineNumber; lineNumber <= endLineNumber; lineNumber++) {\n const text = this._textModel.getLineContent(lineNumber);\n const r = safeTokenize(this._languageIdCodec, languageId, this.tokenizationSupport, text, true, state);\n builder.add(lineNumber, r.tokens);\n state = r.endState;\n }\n return { heuristicTokens: true };\n }\n guessStartState(lineNumber) {\n let nonWhitespaceColumn = this._textModel.getLineFirstNonWhitespaceColumn(lineNumber);\n const likelyRelevantLines = [];\n let initialState = null;\n for (let i = lineNumber - 1; nonWhitespaceColumn > 1 && i >= 1; i--) {\n const newNonWhitespaceIndex = this._textModel.getLineFirstNonWhitespaceColumn(i);\n // Ignore lines full of whitespace\n if (newNonWhitespaceIndex === 0) {\n continue;\n }\n if (newNonWhitespaceIndex < nonWhitespaceColumn) {\n likelyRelevantLines.push(this._textModel.getLineContent(i));\n nonWhitespaceColumn = newNonWhitespaceIndex;\n initialState = this.getStartState(i);\n if (initialState) {\n break;\n }\n }\n }\n if (!initialState) {\n initialState = this.tokenizationSupport.getInitialState();\n }\n likelyRelevantLines.reverse();\n const languageId = this._textModel.getLanguageId();\n let state = initialState;\n for (const line of likelyRelevantLines) {\n const r = safeTokenize(this._languageIdCodec, languageId, this.tokenizationSupport, line, false, state);\n state = r.endState;\n }\n return state;\n }\n}\n/**\n * **Invariant:**\n * If the text model is retokenized from line 1 to {@link getFirstInvalidEndStateLineNumber}() - 1,\n * then the recomputed end state for line l will be equal to {@link getEndState}(l).\n */\nexport class TrackingTokenizationStateStore {\n constructor(lineCount) {\n this.lineCount = lineCount;\n this._tokenizationStateStore = new TokenizationStateStore();\n this._invalidEndStatesLineNumbers = new RangePriorityQueueImpl();\n this._invalidEndStatesLineNumbers.addRange(new OffsetRange(1, lineCount + 1));\n }\n getEndState(lineNumber) {\n return this._tokenizationStateStore.getEndState(lineNumber);\n }\n /**\n * @returns if the end state has changed.\n */\n setEndState(lineNumber, state) {\n if (!state) {\n throw new BugIndicatingError('Cannot set null/undefined state');\n }\n this._invalidEndStatesLineNumbers.delete(lineNumber);\n const r = this._tokenizationStateStore.setEndState(lineNumber, state);\n if (r && lineNumber < this.lineCount) {\n // because the state changed, we cannot trust the next state anymore and have to invalidate it.\n this._invalidEndStatesLineNumbers.addRange(new OffsetRange(lineNumber + 1, lineNumber + 2));\n }\n return r;\n }\n acceptChange(range, newLineCount) {\n this.lineCount += newLineCount - range.length;\n this._tokenizationStateStore.acceptChange(range, newLineCount);\n this._invalidEndStatesLineNumbers.addRangeAndResize(new OffsetRange(range.startLineNumber, range.endLineNumberExclusive), newLineCount);\n }\n acceptChanges(changes) {\n for (const c of changes) {\n const [eolCount] = countEOL(c.text);\n this.acceptChange(new LineRange(c.range.startLineNumber, c.range.endLineNumber + 1), eolCount + 1);\n }\n }\n invalidateEndStateRange(range) {\n this._invalidEndStatesLineNumbers.addRange(new OffsetRange(range.startLineNumber, range.endLineNumberExclusive));\n }\n getFirstInvalidEndStateLineNumber() { return this._invalidEndStatesLineNumbers.min; }\n getFirstInvalidEndStateLineNumberOrMax() {\n return this.getFirstInvalidEndStateLineNumber() || Number.MAX_SAFE_INTEGER;\n }\n allStatesValid() { return this._invalidEndStatesLineNumbers.min === null; }\n getStartState(lineNumber, initialState) {\n if (lineNumber === 1) {\n return initialState;\n }\n return this.getEndState(lineNumber - 1);\n }\n getFirstInvalidLine(initialState) {\n const lineNumber = this.getFirstInvalidEndStateLineNumber();\n if (lineNumber === null) {\n return null;\n }\n const startState = this.getStartState(lineNumber, initialState);\n if (!startState) {\n throw new BugIndicatingError('Start state must be defined');\n }\n return { lineNumber, startState };\n }\n}\nexport class TokenizationStateStore {\n constructor() {\n this._lineEndStates = new FixedArray(null);\n }\n getEndState(lineNumber) {\n return this._lineEndStates.get(lineNumber);\n }\n setEndState(lineNumber, state) {\n const oldState = this._lineEndStates.get(lineNumber);\n if (oldState && oldState.equals(state)) {\n return false;\n }\n this._lineEndStates.set(lineNumber, state);\n return true;\n }\n acceptChange(range, newLineCount) {\n let length = range.length;\n if (newLineCount > 0 && length > 0) {\n // Keep the last state, even though it is unrelated.\n // But if the new state happens to agree with this last state, then we know we can stop tokenizing.\n length--;\n newLineCount--;\n }\n this._lineEndStates.replace(range.startLineNumber, length, newLineCount);\n }\n}\nexport class RangePriorityQueueImpl {\n constructor() {\n this._ranges = [];\n }\n get min() {\n if (this._ranges.length === 0) {\n return null;\n }\n return this._ranges[0].start;\n }\n delete(value) {\n const idx = this._ranges.findIndex(r => r.contains(value));\n if (idx !== -1) {\n const range = this._ranges[idx];\n if (range.start === value) {\n if (range.endExclusive === value + 1) {\n this._ranges.splice(idx, 1);\n }\n else {\n this._ranges[idx] = new OffsetRange(value + 1, range.endExclusive);\n }\n }\n else {\n if (range.endExclusive === value + 1) {\n this._ranges[idx] = new OffsetRange(range.start, value);\n }\n else {\n this._ranges.splice(idx, 1, new OffsetRange(range.start, value), new OffsetRange(value + 1, range.endExclusive));\n }\n }\n }\n }\n addRange(range) {\n OffsetRange.addRange(range, this._ranges);\n }\n addRangeAndResize(range, newLength) {\n let idxFirstMightBeIntersecting = 0;\n while (!(idxFirstMightBeIntersecting >= this._ranges.length || range.start <= this._ranges[idxFirstMightBeIntersecting].endExclusive)) {\n idxFirstMightBeIntersecting++;\n }\n let idxFirstIsAfter = idxFirstMightBeIntersecting;\n while (!(idxFirstIsAfter >= this._ranges.length || range.endExclusive < this._ranges[idxFirstIsAfter].start)) {\n idxFirstIsAfter++;\n }\n const delta = newLength - range.length;\n for (let i = idxFirstIsAfter; i < this._ranges.length; i++) {\n this._ranges[i] = this._ranges[i].delta(delta);\n }\n if (idxFirstMightBeIntersecting === idxFirstIsAfter) {\n const newRange = new OffsetRange(range.start, range.start + newLength);\n if (!newRange.isEmpty) {\n this._ranges.splice(idxFirstMightBeIntersecting, 0, newRange);\n }\n }\n else {\n const start = Math.min(range.start, this._ranges[idxFirstMightBeIntersecting].start);\n const endEx = Math.max(range.endExclusive, this._ranges[idxFirstIsAfter - 1].endExclusive);\n const newRange = new OffsetRange(start, endEx + delta);\n if (!newRange.isEmpty) {\n this._ranges.splice(idxFirstMightBeIntersecting, idxFirstIsAfter - idxFirstMightBeIntersecting, newRange);\n }\n else {\n this._ranges.splice(idxFirstMightBeIntersecting, idxFirstIsAfter - idxFirstMightBeIntersecting);\n }\n }\n }\n toString() {\n return this._ranges.map(r => r.toString()).join(' + ');\n }\n}\nfunction safeTokenize(languageIdCodec, languageId, tokenizationSupport, text, hasEOL, state) {\n let r = null;\n if (tokenizationSupport) {\n try {\n r = tokenizationSupport.tokenizeEncoded(text, hasEOL, state.clone());\n }\n catch (e) {\n onUnexpectedError(e);\n }\n }\n if (!r) {\n r = nullTokenizeEncoded(languageIdCodec.encodeLanguageId(languageId), state);\n }\n LineTokens.convertToEndOffset(r.tokens, text.length);\n return r;\n}\nexport class DefaultBackgroundTokenizer {\n constructor(_tokenizerWithStateStore, _backgroundTokenStore) {\n this._tokenizerWithStateStore = _tokenizerWithStateStore;\n this._backgroundTokenStore = _backgroundTokenStore;\n this._isDisposed = false;\n this._isScheduled = false;\n }\n dispose() {\n this._isDisposed = true;\n }\n handleChanges() {\n this._beginBackgroundTokenization();\n }\n _beginBackgroundTokenization() {\n if (this._isScheduled || !this._tokenizerWithStateStore._textModel.isAttachedToEditor() || !this._hasLinesToTokenize()) {\n return;\n }\n this._isScheduled = true;\n runWhenGlobalIdle((deadline) => {\n this._isScheduled = false;\n this._backgroundTokenizeWithDeadline(deadline);\n });\n }\n /**\n * Tokenize until the deadline occurs, but try to yield every 1-2ms.\n */\n _backgroundTokenizeWithDeadline(deadline) {\n // Read the time remaining from the `deadline` immediately because it is unclear\n // if the `deadline` object will be valid after execution leaves this function.\n const endTime = Date.now() + deadline.timeRemaining();\n const execute = () => {\n if (this._isDisposed || !this._tokenizerWithStateStore._textModel.isAttachedToEditor() || !this._hasLinesToTokenize()) {\n // disposed in the meantime or detached or finished\n return;\n }\n this._backgroundTokenizeForAtLeast1ms();\n if (Date.now() < endTime) {\n // There is still time before reaching the deadline, so yield to the browser and then\n // continue execution\n setTimeout0(execute);\n }\n else {\n // The deadline has been reached, so schedule a new idle callback if necessary\n this._beginBackgroundTokenization();\n }\n };\n execute();\n }\n /**\n * Tokenize for at least 1ms.\n */\n _backgroundTokenizeForAtLeast1ms() {\n const lineCount = this._tokenizerWithStateStore._textModel.getLineCount();\n const builder = new ContiguousMultilineTokensBuilder();\n const sw = StopWatch.create(false);\n do {\n if (sw.elapsed() > 1) {\n // the comparison is intentionally > 1 and not >= 1 to ensure that\n // a full millisecond has elapsed, given how microseconds are rounded\n // to milliseconds\n break;\n }\n const tokenizedLineNumber = this._tokenizeOneInvalidLine(builder);\n if (tokenizedLineNumber >= lineCount) {\n break;\n }\n } while (this._hasLinesToTokenize());\n this._backgroundTokenStore.setTokens(builder.finalize());\n this.checkFinished();\n }\n _hasLinesToTokenize() {\n if (!this._tokenizerWithStateStore) {\n return false;\n }\n return !this._tokenizerWithStateStore.store.allStatesValid();\n }\n _tokenizeOneInvalidLine(builder) {\n var _a;\n const firstInvalidLine = (_a = this._tokenizerWithStateStore) === null || _a === void 0 ? void 0 : _a.getFirstInvalidLine();\n if (!firstInvalidLine) {\n return this._tokenizerWithStateStore._textModel.getLineCount() + 1;\n }\n this._tokenizerWithStateStore.updateTokensUntilLine(builder, firstInvalidLine.lineNumber);\n return firstInvalidLine.lineNumber;\n }\n checkFinished() {\n if (this._isDisposed) {\n return;\n }\n if (this._tokenizerWithStateStore.store.allStatesValid()) {\n this._backgroundTokenStore.backgroundTokenizationFinished();\n }\n }\n requestTokens(startLineNumber, endLineNumberExclusive) {\n this._tokenizerWithStateStore.store.invalidateEndStateRange(new LineRange(startLineNumber, endLineNumberExclusive));\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 *--------------------------------------------------------------------------------------------*/\nimport { LineTokens } from './lineTokens.js';\nexport const EMPTY_LINE_TOKENS = (new Uint32Array(0)).buffer;\nexport class ContiguousTokensEditing {\n static deleteBeginning(lineTokens, toChIndex) {\n if (lineTokens === null || lineTokens === EMPTY_LINE_TOKENS) {\n return lineTokens;\n }\n return ContiguousTokensEditing.delete(lineTokens, 0, toChIndex);\n }\n static deleteEnding(lineTokens, fromChIndex) {\n if (lineTokens === null || lineTokens === EMPTY_LINE_TOKENS) {\n return lineTokens;\n }\n const tokens = toUint32Array(lineTokens);\n const lineTextLength = tokens[tokens.length - 2];\n return ContiguousTokensEditing.delete(lineTokens, fromChIndex, lineTextLength);\n }\n static delete(lineTokens, fromChIndex, toChIndex) {\n if (lineTokens === null || lineTokens === EMPTY_LINE_TOKENS || fromChIndex === toChIndex) {\n return lineTokens;\n }\n const tokens = toUint32Array(lineTokens);\n const tokensCount = (tokens.length >>> 1);\n // special case: deleting everything\n if (fromChIndex === 0 && tokens[tokens.length - 2] === toChIndex) {\n return EMPTY_LINE_TOKENS;\n }\n const fromTokenIndex = LineTokens.findIndexInTokensArray(tokens, fromChIndex);\n const fromTokenStartOffset = (fromTokenIndex > 0 ? tokens[(fromTokenIndex - 1) << 1] : 0);\n const fromTokenEndOffset = tokens[fromTokenIndex << 1];\n if (toChIndex < fromTokenEndOffset) {\n // the delete range is inside a single token\n const delta = (toChIndex - fromChIndex);\n for (let i = fromTokenIndex; i < tokensCount; i++) {\n tokens[i << 1] -= delta;\n }\n return lineTokens;\n }\n let dest;\n let lastEnd;\n if (fromTokenStartOffset !== fromChIndex) {\n tokens[fromTokenIndex << 1] = fromChIndex;\n dest = ((fromTokenIndex + 1) << 1);\n lastEnd = fromChIndex;\n }\n else {\n dest = (fromTokenIndex << 1);\n lastEnd = fromTokenStartOffset;\n }\n const delta = (toChIndex - fromChIndex);\n for (let tokenIndex = fromTokenIndex + 1; tokenIndex < tokensCount; tokenIndex++) {\n const tokenEndOffset = tokens[tokenIndex << 1] - delta;\n if (tokenEndOffset > lastEnd) {\n tokens[dest++] = tokenEndOffset;\n tokens[dest++] = tokens[(tokenIndex << 1) + 1];\n lastEnd = tokenEndOffset;\n }\n }\n if (dest === tokens.length) {\n // nothing to trim\n return lineTokens;\n }\n const tmp = new Uint32Array(dest);\n tmp.set(tokens.subarray(0, dest), 0);\n return tmp.buffer;\n }\n static append(lineTokens, _otherTokens) {\n if (_otherTokens === EMPTY_LINE_TOKENS) {\n return lineTokens;\n }\n if (lineTokens === EMPTY_LINE_TOKENS) {\n return _otherTokens;\n }\n if (lineTokens === null) {\n return lineTokens;\n }\n if (_otherTokens === null) {\n // cannot determine combined line length...\n return null;\n }\n const myTokens = toUint32Array(lineTokens);\n const otherTokens = toUint32Array(_otherTokens);\n const otherTokensCount = (otherTokens.length >>> 1);\n const result = new Uint32Array(myTokens.length + otherTokens.length);\n result.set(myTokens, 0);\n let dest = myTokens.length;\n const delta = myTokens[myTokens.length - 2];\n for (let i = 0; i < otherTokensCount; i++) {\n result[dest++] = otherTokens[(i << 1)] + delta;\n result[dest++] = otherTokens[(i << 1) + 1];\n }\n return result.buffer;\n }\n static insert(lineTokens, chIndex, textLength) {\n if (lineTokens === null || lineTokens === EMPTY_LINE_TOKENS) {\n // nothing to do\n return lineTokens;\n }\n const tokens = toUint32Array(lineTokens);\n const tokensCount = (tokens.length >>> 1);\n let fromTokenIndex = LineTokens.findIndexInTokensArray(tokens, chIndex);\n if (fromTokenIndex > 0) {\n const fromTokenStartOffset = tokens[(fromTokenIndex - 1) << 1];\n if (fromTokenStartOffset === chIndex) {\n fromTokenIndex--;\n }\n }\n for (let tokenIndex = fromTokenIndex; tokenIndex < tokensCount; tokenIndex++) {\n tokens[tokenIndex << 1] += textLength;\n }\n return lineTokens;\n }\n}\nexport function toUint32Array(arr) {\n if (arr instanceof Uint32Array) {\n return arr;\n }\n else {\n return new Uint32Array(arr);\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 *--------------------------------------------------------------------------------------------*/\nimport * as arrays from '../../../base/common/arrays.js';\nimport { Position } from '../core/position.js';\nimport { ContiguousTokensEditing, EMPTY_LINE_TOKENS, toUint32Array } from './contiguousTokensEditing.js';\nimport { LineTokens } from './lineTokens.js';\nimport { TokenMetadata } from '../encodedTokenAttributes.js';\n/**\n * Represents contiguous tokens in a text model.\n */\nexport class ContiguousTokensStore {\n constructor(languageIdCodec) {\n this._lineTokens = [];\n this._len = 0;\n this._languageIdCodec = languageIdCodec;\n }\n flush() {\n this._lineTokens = [];\n this._len = 0;\n }\n get hasTokens() {\n return this._lineTokens.length > 0;\n }\n getTokens(topLevelLanguageId, lineIndex, lineText) {\n let rawLineTokens = null;\n if (lineIndex < this._len) {\n rawLineTokens = this._lineTokens[lineIndex];\n }\n if (rawLineTokens !== null && rawLineTokens !== EMPTY_LINE_TOKENS) {\n return new LineTokens(toUint32Array(rawLineTokens), lineText, this._languageIdCodec);\n }\n const lineTokens = new Uint32Array(2);\n lineTokens[0] = lineText.length;\n lineTokens[1] = getDefaultMetadata(this._languageIdCodec.encodeLanguageId(topLevelLanguageId));\n return new LineTokens(lineTokens, lineText, this._languageIdCodec);\n }\n static _massageTokens(topLevelLanguageId, lineTextLength, _tokens) {\n const tokens = _tokens ? toUint32Array(_tokens) : null;\n if (lineTextLength === 0) {\n let hasDifferentLanguageId = false;\n if (tokens && tokens.length > 1) {\n hasDifferentLanguageId = (TokenMetadata.getLanguageId(tokens[1]) !== topLevelLanguageId);\n }\n if (!hasDifferentLanguageId) {\n return EMPTY_LINE_TOKENS;\n }\n }\n if (!tokens || tokens.length === 0) {\n const tokens = new Uint32Array(2);\n tokens[0] = lineTextLength;\n tokens[1] = getDefaultMetadata(topLevelLanguageId);\n return tokens.buffer;\n }\n // Ensure the last token covers the end of the text\n tokens[tokens.length - 2] = lineTextLength;\n if (tokens.byteOffset === 0 && tokens.byteLength === tokens.buffer.byteLength) {\n // Store directly the ArrayBuffer pointer to save an object\n return tokens.buffer;\n }\n return tokens;\n }\n _ensureLine(lineIndex) {\n while (lineIndex >= this._len) {\n this._lineTokens[this._len] = null;\n this._len++;\n }\n }\n _deleteLines(start, deleteCount) {\n if (deleteCount === 0) {\n return;\n }\n if (start + deleteCount > this._len) {\n deleteCount = this._len - start;\n }\n this._lineTokens.splice(start, deleteCount);\n this._len -= deleteCount;\n }\n _insertLines(insertIndex, insertCount) {\n if (insertCount === 0) {\n return;\n }\n const lineTokens = [];\n for (let i = 0; i < insertCount; i++) {\n lineTokens[i] = null;\n }\n this._lineTokens = arrays.arrayInsert(this._lineTokens, insertIndex, lineTokens);\n this._len += insertCount;\n }\n setTokens(topLevelLanguageId, lineIndex, lineTextLength, _tokens, checkEquality) {\n const tokens = ContiguousTokensStore._massageTokens(this._languageIdCodec.encodeLanguageId(topLevelLanguageId), lineTextLength, _tokens);\n this._ensureLine(lineIndex);\n const oldTokens = this._lineTokens[lineIndex];\n this._lineTokens[lineIndex] = tokens;\n if (checkEquality) {\n return !ContiguousTokensStore._equals(oldTokens, tokens);\n }\n return false;\n }\n static _equals(_a, _b) {\n if (!_a || !_b) {\n return !_a && !_b;\n }\n const a = toUint32Array(_a);\n const b = toUint32Array(_b);\n if (a.length !== b.length) {\n return false;\n }\n for (let i = 0, len = a.length; i < len; i++) {\n if (a[i] !== b[i]) {\n return false;\n }\n }\n return true;\n }\n //#region Editing\n acceptEdit(range, eolCount, firstLineLength) {\n this._acceptDeleteRange(range);\n this._acceptInsertText(new Position(range.startLineNumber, range.startColumn), eolCount, firstLineLength);\n }\n _acceptDeleteRange(range) {\n const firstLineIndex = range.startLineNumber - 1;\n if (firstLineIndex >= this._len) {\n return;\n }\n if (range.startLineNumber === range.endLineNumber) {\n if (range.startColumn === range.endColumn) {\n // Nothing to delete\n return;\n }\n this._lineTokens[firstLineIndex] = ContiguousTokensEditing.delete(this._lineTokens[firstLineIndex], range.startColumn - 1, range.endColumn - 1);\n return;\n }\n this._lineTokens[firstLineIndex] = ContiguousTokensEditing.deleteEnding(this._lineTokens[firstLineIndex], range.startColumn - 1);\n const lastLineIndex = range.endLineNumber - 1;\n let lastLineTokens = null;\n if (lastLineIndex < this._len) {\n lastLineTokens = ContiguousTokensEditing.deleteBeginning(this._lineTokens[lastLineIndex], range.endColumn - 1);\n }\n // Take remaining text on last line and append it to remaining text on first line\n this._lineTokens[firstLineIndex] = ContiguousTokensEditing.append(this._lineTokens[firstLineIndex], lastLineTokens);\n // Delete middle lines\n this._deleteLines(range.startLineNumber, range.endLineNumber - range.startLineNumber);\n }\n _acceptInsertText(position, eolCount, firstLineLength) {\n if (eolCount === 0 && firstLineLength === 0) {\n // Nothing to insert\n return;\n }\n const lineIndex = position.lineNumber - 1;\n if (lineIndex >= this._len) {\n return;\n }\n if (eolCount === 0) {\n // Inserting text on one line\n this._lineTokens[lineIndex] = ContiguousTokensEditing.insert(this._lineTokens[lineIndex], position.column - 1, firstLineLength);\n return;\n }\n this._lineTokens[lineIndex] = ContiguousTokensEditing.deleteEnding(this._lineTokens[lineIndex], position.column - 1);\n this._lineTokens[lineIndex] = ContiguousTokensEditing.insert(this._lineTokens[lineIndex], position.column - 1, firstLineLength);\n this._insertLines(position.lineNumber, eolCount);\n }\n //#endregion\n setMultilineTokens(tokens, textModel) {\n if (tokens.length === 0) {\n return { changes: [] };\n }\n const ranges = [];\n for (let i = 0, len = tokens.length; i < len; i++) {\n const element = tokens[i];\n let minChangedLineNumber = 0;\n let maxChangedLineNumber = 0;\n let hasChange = false;\n for (let lineNumber = element.startLineNumber; lineNumber <= element.endLineNumber; lineNumber++) {\n if (hasChange) {\n this.setTokens(textModel.getLanguageId(), lineNumber - 1, textModel.getLineLength(lineNumber), element.getLineTokens(lineNumber), false);\n maxChangedLineNumber = lineNumber;\n }\n else {\n const lineHasChange = this.setTokens(textModel.getLanguageId(), lineNumber - 1, textModel.getLineLength(lineNumber), element.getLineTokens(lineNumber), true);\n if (lineHasChange) {\n hasChange = true;\n minChangedLineNumber = lineNumber;\n maxChangedLineNumber = lineNumber;\n }\n }\n }\n if (hasChange) {\n ranges.push({ fromLineNumber: minChangedLineNumber, toLineNumber: maxChangedLineNumber, });\n }\n }\n return { changes: ranges };\n }\n}\nfunction getDefaultMetadata(topLevelLanguageId) {\n return ((topLevelLanguageId << 0 /* MetadataConsts.LANGUAGEID_OFFSET */)\n | (0 /* StandardTokenType.Other */ << 8 /* MetadataConsts.TOKEN_TYPE_OFFSET */)\n | (0 /* FontStyle.None */ << 11 /* MetadataConsts.FONT_STYLE_OFFSET */)\n | (1 /* ColorId.DefaultForeground */ << 15 /* MetadataConsts.FOREGROUND_OFFSET */)\n | (2 /* ColorId.DefaultBackground */ << 24 /* MetadataConsts.BACKGROUND_OFFSET */)\n // If there is no grammar, we just take a guess and try to match brackets.\n | (1024 /* MetadataConsts.BALANCED_BRACKETS_MASK */)) >>> 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 *--------------------------------------------------------------------------------------------*/\nimport * as arrays from '../../../base/common/arrays.js';\nimport { LineTokens } from './lineTokens.js';\n/**\n * Represents sparse tokens in a text model.\n */\nexport class SparseTokensStore {\n constructor(languageIdCodec) {\n this._pieces = [];\n this._isComplete = false;\n this._languageIdCodec = languageIdCodec;\n }\n flush() {\n this._pieces = [];\n this._isComplete = false;\n }\n isEmpty() {\n return (this._pieces.length === 0);\n }\n set(pieces, isComplete) {\n this._pieces = pieces || [];\n this._isComplete = isComplete;\n }\n setPartial(_range, pieces) {\n // console.log(`setPartial ${_range} ${pieces.map(p => p.toString()).join(', ')}`);\n let range = _range;\n if (pieces.length > 0) {\n const _firstRange = pieces[0].getRange();\n const _lastRange = pieces[pieces.length - 1].getRange();\n if (!_firstRange || !_lastRange) {\n return _range;\n }\n range = _range.plusRange(_firstRange).plusRange(_lastRange);\n }\n let insertPosition = null;\n for (let i = 0, len = this._pieces.length; i < len; i++) {\n const piece = this._pieces[i];\n if (piece.endLineNumber < range.startLineNumber) {\n // this piece is before the range\n continue;\n }\n if (piece.startLineNumber > range.endLineNumber) {\n // this piece is after the range, so mark the spot before this piece\n // as a good insertion position and stop looping\n insertPosition = insertPosition || { index: i };\n break;\n }\n // this piece might intersect with the range\n piece.removeTokens(range);\n if (piece.isEmpty()) {\n // remove the piece if it became empty\n this._pieces.splice(i, 1);\n i--;\n len--;\n continue;\n }\n if (piece.endLineNumber < range.startLineNumber) {\n // after removal, this piece is before the range\n continue;\n }\n if (piece.startLineNumber > range.endLineNumber) {\n // after removal, this piece is after the range\n insertPosition = insertPosition || { index: i };\n continue;\n }\n // after removal, this piece contains the range\n const [a, b] = piece.split(range);\n if (a.isEmpty()) {\n // this piece is actually after the range\n insertPosition = insertPosition || { index: i };\n continue;\n }\n if (b.isEmpty()) {\n // this piece is actually before the range\n continue;\n }\n this._pieces.splice(i, 1, a, b);\n i++;\n len++;\n insertPosition = insertPosition || { index: i };\n }\n insertPosition = insertPosition || { index: this._pieces.length };\n if (pieces.length > 0) {\n this._pieces = arrays.arrayInsert(this._pieces, insertPosition.index, pieces);\n }\n // console.log(`I HAVE ${this._pieces.length} pieces`);\n // console.log(`${this._pieces.map(p => p.toString()).join('\\n')}`);\n return range;\n }\n isComplete() {\n return this._isComplete;\n }\n addSparseTokens(lineNumber, aTokens) {\n if (aTokens.getLineContent().length === 0) {\n // Don't do anything for empty lines\n return aTokens;\n }\n const pieces = this._pieces;\n if (pieces.length === 0) {\n return aTokens;\n }\n const pieceIndex = SparseTokensStore._findFirstPieceWithLine(pieces, lineNumber);\n const bTokens = pieces[pieceIndex].getLineTokens(lineNumber);\n if (!bTokens) {\n return aTokens;\n }\n const aLen = aTokens.getCount();\n const bLen = bTokens.getCount();\n let aIndex = 0;\n const result = [];\n let resultLen = 0;\n let lastEndOffset = 0;\n const emitToken = (endOffset, metadata) => {\n if (endOffset === lastEndOffset) {\n return;\n }\n lastEndOffset = endOffset;\n result[resultLen++] = endOffset;\n result[resultLen++] = metadata;\n };\n for (let bIndex = 0; bIndex < bLen; bIndex++) {\n const bStartCharacter = bTokens.getStartCharacter(bIndex);\n const bEndCharacter = bTokens.getEndCharacter(bIndex);\n const bMetadata = bTokens.getMetadata(bIndex);\n const bMask = (((bMetadata & 1 /* MetadataConsts.SEMANTIC_USE_ITALIC */) ? 2048 /* MetadataConsts.ITALIC_MASK */ : 0)\n | ((bMetadata & 2 /* MetadataConsts.SEMANTIC_USE_BOLD */) ? 4096 /* MetadataConsts.BOLD_MASK */ : 0)\n | ((bMetadata & 4 /* MetadataConsts.SEMANTIC_USE_UNDERLINE */) ? 8192 /* MetadataConsts.UNDERLINE_MASK */ : 0)\n | ((bMetadata & 8 /* MetadataConsts.SEMANTIC_USE_STRIKETHROUGH */) ? 16384 /* MetadataConsts.STRIKETHROUGH_MASK */ : 0)\n | ((bMetadata & 16 /* MetadataConsts.SEMANTIC_USE_FOREGROUND */) ? 16744448 /* MetadataConsts.FOREGROUND_MASK */ : 0)\n | ((bMetadata & 32 /* MetadataConsts.SEMANTIC_USE_BACKGROUND */) ? 4278190080 /* MetadataConsts.BACKGROUND_MASK */ : 0)) >>> 0;\n const aMask = (~bMask) >>> 0;\n // push any token from `a` that is before `b`\n while (aIndex < aLen && aTokens.getEndOffset(aIndex) <= bStartCharacter) {\n emitToken(aTokens.getEndOffset(aIndex), aTokens.getMetadata(aIndex));\n aIndex++;\n }\n // push the token from `a` if it intersects the token from `b`\n if (aIndex < aLen && aTokens.getStartOffset(aIndex) < bStartCharacter) {\n emitToken(bStartCharacter, aTokens.getMetadata(aIndex));\n }\n // skip any tokens from `a` that are contained inside `b`\n while (aIndex < aLen && aTokens.getEndOffset(aIndex) < bEndCharacter) {\n emitToken(aTokens.getEndOffset(aIndex), (aTokens.getMetadata(aIndex) & aMask) | (bMetadata & bMask));\n aIndex++;\n }\n if (aIndex < aLen) {\n emitToken(bEndCharacter, (aTokens.getMetadata(aIndex) & aMask) | (bMetadata & bMask));\n if (aTokens.getEndOffset(aIndex) === bEndCharacter) {\n // `a` ends exactly at the same spot as `b`!\n aIndex++;\n }\n }\n else {\n const aMergeIndex = Math.min(Math.max(0, aIndex - 1), aLen - 1);\n // push the token from `b`\n emitToken(bEndCharacter, (aTokens.getMetadata(aMergeIndex) & aMask) | (bMetadata & bMask));\n }\n }\n // push the remaining tokens from `a`\n while (aIndex < aLen) {\n emitToken(aTokens.getEndOffset(aIndex), aTokens.getMetadata(aIndex));\n aIndex++;\n }\n return new LineTokens(new Uint32Array(result), aTokens.getLineContent(), this._languageIdCodec);\n }\n static _findFirstPieceWithLine(pieces, lineNumber) {\n let low = 0;\n let high = pieces.length - 1;\n while (low < high) {\n let mid = low + Math.floor((high - low) / 2);\n if (pieces[mid].endLineNumber < lineNumber) {\n low = mid + 1;\n }\n else if (pieces[mid].startLineNumber > lineNumber) {\n high = mid - 1;\n }\n else {\n while (mid > low && pieces[mid - 1].startLineNumber <= lineNumber && lineNumber <= pieces[mid - 1].endLineNumber) {\n mid--;\n }\n return mid;\n }\n }\n return low;\n }\n acceptEdit(range, eolCount, firstLineLength, lastLineLength, firstCharCode) {\n for (const piece of this._pieces) {\n piece.acceptEdit(range, eolCount, firstLineLength, lastLineLength, firstCharCode);\n }\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 *--------------------------------------------------------------------------------------------*/\nimport { equals } from '../../../base/common/arrays.js';\nimport { RunOnceScheduler } from '../../../base/common/async.js';\nimport { BugIndicatingError, onUnexpectedError } from '../../../base/common/errors.js';\nimport { Emitter } from '../../../base/common/event.js';\nimport { Disposable, DisposableMap, MutableDisposable } from '../../../base/common/lifecycle.js';\nimport { countEOL } from '../core/eolCounter.js';\nimport { LineRange } from '../core/lineRange.js';\nimport { Position } from '../core/position.js';\nimport { getWordAtText } from '../core/wordHelper.js';\nimport { TokenizationRegistry } from '../languages.js';\nimport { TextModelPart } from './textModelPart.js';\nimport { DefaultBackgroundTokenizer, TokenizerWithStateStoreAndTextModel, TrackingTokenizationStateStore } from './textModelTokens.js';\nimport { ContiguousMultilineTokensBuilder } from '../tokens/contiguousMultilineTokensBuilder.js';\nimport { ContiguousTokensStore } from '../tokens/contiguousTokensStore.js';\nimport { SparseTokensStore } from '../tokens/sparseTokensStore.js';\nexport class TokenizationTextModelPart extends TextModelPart {\n constructor(_languageService, _languageConfigurationService, _textModel, _bracketPairsTextModelPart, _languageId, _attachedViews) {\n super();\n this._languageService = _languageService;\n this._languageConfigurationService = _languageConfigurationService;\n this._textModel = _textModel;\n this._bracketPairsTextModelPart = _bracketPairsTextModelPart;\n this._languageId = _languageId;\n this._attachedViews = _attachedViews;\n this._semanticTokens = new SparseTokensStore(this._languageService.languageIdCodec);\n this._onDidChangeLanguage = this._register(new Emitter());\n this.onDidChangeLanguage = this._onDidChangeLanguage.event;\n this._onDidChangeLanguageConfiguration = this._register(new Emitter());\n this.onDidChangeLanguageConfiguration = this._onDidChangeLanguageConfiguration.event;\n this._onDidChangeTokens = this._register(new Emitter());\n this.onDidChangeTokens = this._onDidChangeTokens.event;\n this.grammarTokens = this._register(new GrammarTokens(this._languageService.languageIdCodec, this._textModel, () => this._languageId, this._attachedViews));\n this._register(this._languageConfigurationService.onDidChange(e => {\n if (e.affects(this._languageId)) {\n this._onDidChangeLanguageConfiguration.fire({});\n }\n }));\n this._register(this.grammarTokens.onDidChangeTokens(e => {\n this._emitModelTokensChangedEvent(e);\n }));\n this._register(this.grammarTokens.onDidChangeBackgroundTokenizationState(e => {\n this._bracketPairsTextModelPart.handleDidChangeBackgroundTokenizationState();\n }));\n }\n handleDidChangeContent(e) {\n if (e.isFlush) {\n this._semanticTokens.flush();\n }\n else if (!e.isEolChange) { // We don't have to do anything on an EOL change\n for (const c of e.changes) {\n const [eolCount, firstLineLength, lastLineLength] = countEOL(c.text);\n this._semanticTokens.acceptEdit(c.range, eolCount, firstLineLength, lastLineLength, c.text.length > 0 ? c.text.charCodeAt(0) : 0 /* CharCode.Null */);\n }\n }\n this.grammarTokens.handleDidChangeContent(e);\n }\n handleDidChangeAttached() {\n this.grammarTokens.handleDidChangeAttached();\n }\n /**\n * Includes grammar and semantic tokens.\n */\n getLineTokens(lineNumber) {\n this.validateLineNumber(lineNumber);\n const syntacticTokens = this.grammarTokens.getLineTokens(lineNumber);\n return this._semanticTokens.addSparseTokens(lineNumber, syntacticTokens);\n }\n _emitModelTokensChangedEvent(e) {\n if (!this._textModel._isDisposing()) {\n this._bracketPairsTextModelPart.handleDidChangeTokens(e);\n this._onDidChangeTokens.fire(e);\n }\n }\n // #region Grammar Tokens\n validateLineNumber(lineNumber) {\n if (lineNumber < 1 || lineNumber > this._textModel.getLineCount()) {\n throw new BugIndicatingError('Illegal value for lineNumber');\n }\n }\n get hasTokens() {\n return this.grammarTokens.hasTokens;\n }\n resetTokenization() {\n this.grammarTokens.resetTokenization();\n }\n get backgroundTokenizationState() {\n return this.grammarTokens.backgroundTokenizationState;\n }\n forceTokenization(lineNumber) {\n this.validateLineNumber(lineNumber);\n this.grammarTokens.forceTokenization(lineNumber);\n }\n hasAccurateTokensForLine(lineNumber) {\n this.validateLineNumber(lineNumber);\n return this.grammarTokens.hasAccurateTokensForLine(lineNumber);\n }\n isCheapToTokenize(lineNumber) {\n this.validateLineNumber(lineNumber);\n return this.grammarTokens.isCheapToTokenize(lineNumber);\n }\n tokenizeIfCheap(lineNumber) {\n this.validateLineNumber(lineNumber);\n this.grammarTokens.tokenizeIfCheap(lineNumber);\n }\n getTokenTypeIfInsertingCharacter(lineNumber, column, character) {\n return this.grammarTokens.getTokenTypeIfInsertingCharacter(lineNumber, column, character);\n }\n tokenizeLineWithEdit(position, length, newText) {\n return this.grammarTokens.tokenizeLineWithEdit(position, length, newText);\n }\n // #endregion\n // #region Semantic Tokens\n setSemanticTokens(tokens, isComplete) {\n this._semanticTokens.set(tokens, isComplete);\n this._emitModelTokensChangedEvent({\n semanticTokensApplied: tokens !== null,\n ranges: [{ fromLineNumber: 1, toLineNumber: this._textModel.getLineCount() }],\n });\n }\n hasCompleteSemanticTokens() {\n return this._semanticTokens.isComplete();\n }\n hasSomeSemanticTokens() {\n return !this._semanticTokens.isEmpty();\n }\n setPartialSemanticTokens(range, tokens) {\n if (this.hasCompleteSemanticTokens()) {\n return;\n }\n const changedRange = this._textModel.validateRange(this._semanticTokens.setPartial(range, tokens));\n this._emitModelTokensChangedEvent({\n semanticTokensApplied: true,\n ranges: [\n {\n fromLineNumber: changedRange.startLineNumber,\n toLineNumber: changedRange.endLineNumber,\n },\n ],\n });\n }\n // #endregion\n // #region Utility Methods\n getWordAtPosition(_position) {\n this.assertNotDisposed();\n const position = this._textModel.validatePosition(_position);\n const lineContent = this._textModel.getLineContent(position.lineNumber);\n const lineTokens = this.getLineTokens(position.lineNumber);\n const tokenIndex = lineTokens.findTokenIndexAtOffset(position.column - 1);\n // (1). First try checking right biased word\n const [rbStartOffset, rbEndOffset] = TokenizationTextModelPart._findLanguageBoundaries(lineTokens, tokenIndex);\n const rightBiasedWord = getWordAtText(position.column, this.getLanguageConfiguration(lineTokens.getLanguageId(tokenIndex)).getWordDefinition(), lineContent.substring(rbStartOffset, rbEndOffset), rbStartOffset);\n // Make sure the result touches the original passed in position\n if (rightBiasedWord &&\n rightBiasedWord.startColumn <= _position.column &&\n _position.column <= rightBiasedWord.endColumn) {\n return rightBiasedWord;\n }\n // (2). Else, if we were at a language boundary, check the left biased word\n if (tokenIndex > 0 && rbStartOffset === position.column - 1) {\n // edge case, where `position` sits between two tokens belonging to two different languages\n const [lbStartOffset, lbEndOffset] = TokenizationTextModelPart._findLanguageBoundaries(lineTokens, tokenIndex - 1);\n const leftBiasedWord = getWordAtText(position.column, this.getLanguageConfiguration(lineTokens.getLanguageId(tokenIndex - 1)).getWordDefinition(), lineContent.substring(lbStartOffset, lbEndOffset), lbStartOffset);\n // Make sure the result touches the original passed in position\n if (leftBiasedWord &&\n leftBiasedWord.startColumn <= _position.column &&\n _position.column <= leftBiasedWord.endColumn) {\n return leftBiasedWord;\n }\n }\n return null;\n }\n getLanguageConfiguration(languageId) {\n return this._languageConfigurationService.getLanguageConfiguration(languageId);\n }\n static _findLanguageBoundaries(lineTokens, tokenIndex) {\n const languageId = lineTokens.getLanguageId(tokenIndex);\n // go left until a different language is hit\n let startOffset = 0;\n for (let i = tokenIndex; i >= 0 && lineTokens.getLanguageId(i) === languageId; i--) {\n startOffset = lineTokens.getStartOffset(i);\n }\n // go right until a different language is hit\n let endOffset = lineTokens.getLineContent().length;\n for (let i = tokenIndex, tokenCount = lineTokens.getCount(); i < tokenCount && lineTokens.getLanguageId(i) === languageId; i++) {\n endOffset = lineTokens.getEndOffset(i);\n }\n return [startOffset, endOffset];\n }\n getWordUntilPosition(position) {\n const wordAtPosition = this.getWordAtPosition(position);\n if (!wordAtPosition) {\n return { word: '', startColumn: position.column, endColumn: position.column, };\n }\n return {\n word: wordAtPosition.word.substr(0, position.column - wordAtPosition.startColumn),\n startColumn: wordAtPosition.startColumn,\n endColumn: position.column,\n };\n }\n // #endregion\n // #region Language Id handling\n getLanguageId() {\n return this._languageId;\n }\n getLanguageIdAtPosition(lineNumber, column) {\n const position = this._textModel.validatePosition(new Position(lineNumber, column));\n const lineTokens = this.getLineTokens(position.lineNumber);\n return lineTokens.getLanguageId(lineTokens.findTokenIndexAtOffset(position.column - 1));\n }\n setLanguageId(languageId, source = 'api') {\n if (this._languageId === languageId) {\n // There's nothing to do\n return;\n }\n const e = {\n oldLanguage: this._languageId,\n newLanguage: languageId,\n source\n };\n this._languageId = languageId;\n this._bracketPairsTextModelPart.handleDidChangeLanguage(e);\n this.grammarTokens.resetTokenization();\n this._onDidChangeLanguage.fire(e);\n this._onDidChangeLanguageConfiguration.fire({});\n }\n}\nclass GrammarTokens extends Disposable {\n get backgroundTokenizationState() {\n return this._backgroundTokenizationState;\n }\n constructor(_languageIdCodec, _textModel, getLanguageId, attachedViews) {\n super();\n this._languageIdCodec = _languageIdCodec;\n this._textModel = _textModel;\n this.getLanguageId = getLanguageId;\n this._tokenizer = null;\n this._defaultBackgroundTokenizer = null;\n this._backgroundTokenizer = this._register(new MutableDisposable());\n this._tokens = new ContiguousTokensStore(this._languageIdCodec);\n this._debugBackgroundTokenizer = this._register(new MutableDisposable());\n this._backgroundTokenizationState = 1 /* BackgroundTokenizationState.InProgress */;\n this._onDidChangeBackgroundTokenizationState = this._register(new Emitter());\n /** @internal, should not be exposed by the text model! */\n this.onDidChangeBackgroundTokenizationState = this._onDidChangeBackgroundTokenizationState.event;\n this._onDidChangeTokens = this._register(new Emitter());\n /** @internal, should not be exposed by the text model! */\n this.onDidChangeTokens = this._onDidChangeTokens.event;\n this._attachedViewStates = this._register(new DisposableMap());\n this._register(TokenizationRegistry.onDidChange((e) => {\n const languageId = this.getLanguageId();\n if (e.changedLanguages.indexOf(languageId) === -1) {\n return;\n }\n this.resetTokenization();\n }));\n this.resetTokenization();\n this._register(attachedViews.onDidChangeVisibleRanges(({ view, state }) => {\n if (state) {\n let existing = this._attachedViewStates.get(view);\n if (!existing) {\n existing = new AttachedViewHandler(() => this.refreshRanges(existing.lineRanges));\n this._attachedViewStates.set(view, existing);\n }\n existing.handleStateChange(state);\n }\n else {\n this._attachedViewStates.deleteAndDispose(view);\n }\n }));\n }\n resetTokenization(fireTokenChangeEvent = true) {\n var _a;\n this._tokens.flush();\n (_a = this._debugBackgroundTokens) === null || _a === void 0 ? void 0 : _a.flush();\n if (this._debugBackgroundStates) {\n this._debugBackgroundStates = new TrackingTokenizationStateStore(this._textModel.getLineCount());\n }\n if (fireTokenChangeEvent) {\n this._onDidChangeTokens.fire({\n semanticTokensApplied: false,\n ranges: [\n {\n fromLineNumber: 1,\n toLineNumber: this._textModel.getLineCount(),\n },\n ],\n });\n }\n const initializeTokenization = () => {\n if (this._textModel.isTooLargeForTokenization()) {\n return [null, null];\n }\n const tokenizationSupport = TokenizationRegistry.get(this.getLanguageId());\n if (!tokenizationSupport) {\n return [null, null];\n }\n let initialState;\n try {\n initialState = tokenizationSupport.getInitialState();\n }\n catch (e) {\n onUnexpectedError(e);\n return [null, null];\n }\n return [tokenizationSupport, initialState];\n };\n const [tokenizationSupport, initialState] = initializeTokenization();\n if (tokenizationSupport && initialState) {\n this._tokenizer = new TokenizerWithStateStoreAndTextModel(this._textModel.getLineCount(), tokenizationSupport, this._textModel, this._languageIdCodec);\n }\n else {\n this._tokenizer = null;\n }\n this._backgroundTokenizer.clear();\n this._defaultBackgroundTokenizer = null;\n if (this._tokenizer) {\n const b = {\n setTokens: (tokens) => {\n this.setTokens(tokens);\n },\n backgroundTokenizationFinished: () => {\n if (this._backgroundTokenizationState === 2 /* BackgroundTokenizationState.Completed */) {\n // We already did a full tokenization and don't go back to progressing.\n return;\n }\n const newState = 2 /* BackgroundTokenizationState.Completed */;\n this._backgroundTokenizationState = newState;\n this._onDidChangeBackgroundTokenizationState.fire();\n },\n setEndState: (lineNumber, state) => {\n var _a;\n if (!this._tokenizer) {\n return;\n }\n const firstInvalidEndStateLineNumber = this._tokenizer.store.getFirstInvalidEndStateLineNumber();\n // Don't accept states for definitely valid states, the renderer is ahead of the worker!\n if (firstInvalidEndStateLineNumber !== null && lineNumber >= firstInvalidEndStateLineNumber) {\n (_a = this._tokenizer) === null || _a === void 0 ? void 0 : _a.store.setEndState(lineNumber, state);\n }\n },\n };\n if (tokenizationSupport && tokenizationSupport.createBackgroundTokenizer && !tokenizationSupport.backgroundTokenizerShouldOnlyVerifyTokens) {\n this._backgroundTokenizer.value = tokenizationSupport.createBackgroundTokenizer(this._textModel, b);\n }\n if (!this._backgroundTokenizer.value && !this._textModel.isTooLargeForTokenization()) {\n this._backgroundTokenizer.value = this._defaultBackgroundTokenizer =\n new DefaultBackgroundTokenizer(this._tokenizer, b);\n this._defaultBackgroundTokenizer.handleChanges();\n }\n if ((tokenizationSupport === null || tokenizationSupport === void 0 ? void 0 : tokenizationSupport.backgroundTokenizerShouldOnlyVerifyTokens) && tokenizationSupport.createBackgroundTokenizer) {\n this._debugBackgroundTokens = new ContiguousTokensStore(this._languageIdCodec);\n this._debugBackgroundStates = new TrackingTokenizationStateStore(this._textModel.getLineCount());\n this._debugBackgroundTokenizer.clear();\n this._debugBackgroundTokenizer.value = tokenizationSupport.createBackgroundTokenizer(this._textModel, {\n setTokens: (tokens) => {\n var _a;\n (_a = this._debugBackgroundTokens) === null || _a === void 0 ? void 0 : _a.setMultilineTokens(tokens, this._textModel);\n },\n backgroundTokenizationFinished() {\n // NO OP\n },\n setEndState: (lineNumber, state) => {\n var _a;\n (_a = this._debugBackgroundStates) === null || _a === void 0 ? void 0 : _a.setEndState(lineNumber, state);\n },\n });\n }\n else {\n this._debugBackgroundTokens = undefined;\n this._debugBackgroundStates = undefined;\n this._debugBackgroundTokenizer.value = undefined;\n }\n }\n this.refreshAllVisibleLineTokens();\n }\n handleDidChangeAttached() {\n var _a;\n (_a = this._defaultBackgroundTokenizer) === null || _a === void 0 ? void 0 : _a.handleChanges();\n }\n handleDidChangeContent(e) {\n var _a, _b, _c;\n if (e.isFlush) {\n // Don't fire the event, as the view might not have got the text change event yet\n this.resetTokenization(false);\n }\n else if (!e.isEolChange) { // We don't have to do anything on an EOL change\n for (const c of e.changes) {\n const [eolCount, firstLineLength] = countEOL(c.text);\n this._tokens.acceptEdit(c.range, eolCount, firstLineLength);\n (_a = this._debugBackgroundTokens) === null || _a === void 0 ? void 0 : _a.acceptEdit(c.range, eolCount, firstLineLength);\n }\n (_b = this._debugBackgroundStates) === null || _b === void 0 ? void 0 : _b.acceptChanges(e.changes);\n if (this._tokenizer) {\n this._tokenizer.store.acceptChanges(e.changes);\n }\n (_c = this._defaultBackgroundTokenizer) === null || _c === void 0 ? void 0 : _c.handleChanges();\n }\n }\n setTokens(tokens) {\n const { changes } = this._tokens.setMultilineTokens(tokens, this._textModel);\n if (changes.length > 0) {\n this._onDidChangeTokens.fire({ semanticTokensApplied: false, ranges: changes, });\n }\n return { changes: changes };\n }\n refreshAllVisibleLineTokens() {\n const ranges = LineRange.joinMany([...this._attachedViewStates].map(([_, s]) => s.lineRanges));\n this.refreshRanges(ranges);\n }\n refreshRanges(ranges) {\n for (const range of ranges) {\n this.refreshRange(range.startLineNumber, range.endLineNumberExclusive - 1);\n }\n }\n refreshRange(startLineNumber, endLineNumber) {\n var _a, _b;\n if (!this._tokenizer) {\n return;\n }\n startLineNumber = Math.max(1, Math.min(this._textModel.getLineCount(), startLineNumber));\n endLineNumber = Math.min(this._textModel.getLineCount(), endLineNumber);\n const builder = new ContiguousMultilineTokensBuilder();\n const { heuristicTokens } = this._tokenizer.tokenizeHeuristically(builder, startLineNumber, endLineNumber);\n const changedTokens = this.setTokens(builder.finalize());\n if (heuristicTokens) {\n // We overrode tokens with heuristically computed ones.\n // Because old states might get reused (thus stopping invalidation),\n // we have to explicitly request the tokens for the changed ranges again.\n for (const c of changedTokens.changes) {\n (_a = this._backgroundTokenizer.value) === null || _a === void 0 ? void 0 : _a.requestTokens(c.fromLineNumber, c.toLineNumber + 1);\n }\n }\n (_b = this._defaultBackgroundTokenizer) === null || _b === void 0 ? void 0 : _b.checkFinished();\n }\n forceTokenization(lineNumber) {\n var _a, _b;\n const builder = new ContiguousMultilineTokensBuilder();\n (_a = this._tokenizer) === null || _a === void 0 ? void 0 : _a.updateTokensUntilLine(builder, lineNumber);\n this.setTokens(builder.finalize());\n (_b = this._defaultBackgroundTokenizer) === null || _b === void 0 ? void 0 : _b.checkFinished();\n }\n hasAccurateTokensForLine(lineNumber) {\n if (!this._tokenizer) {\n return true;\n }\n return this._tokenizer.hasAccurateTokensForLine(lineNumber);\n }\n isCheapToTokenize(lineNumber) {\n if (!this._tokenizer) {\n return true;\n }\n return this._tokenizer.isCheapToTokenize(lineNumber);\n }\n tokenizeIfCheap(lineNumber) {\n if (this.isCheapToTokenize(lineNumber)) {\n this.forceTokenization(lineNumber);\n }\n }\n getLineTokens(lineNumber) {\n var _a;\n const lineText = this._textModel.getLineContent(lineNumber);\n const result = this._tokens.getTokens(this._textModel.getLanguageId(), lineNumber - 1, lineText);\n if (this._debugBackgroundTokens && this._debugBackgroundStates && this._tokenizer) {\n if (this._debugBackgroundStates.getFirstInvalidEndStateLineNumberOrMax() > lineNumber && this._tokenizer.store.getFirstInvalidEndStateLineNumberOrMax() > lineNumber) {\n const backgroundResult = this._debugBackgroundTokens.getTokens(this._textModel.getLanguageId(), lineNumber - 1, lineText);\n if (!result.equals(backgroundResult) && ((_a = this._debugBackgroundTokenizer.value) === null || _a === void 0 ? void 0 : _a.reportMismatchingTokens)) {\n this._debugBackgroundTokenizer.value.reportMismatchingTokens(lineNumber);\n }\n }\n }\n return result;\n }\n getTokenTypeIfInsertingCharacter(lineNumber, column, character) {\n if (!this._tokenizer) {\n return 0 /* StandardTokenType.Other */;\n }\n const position = this._textModel.validatePosition(new Position(lineNumber, column));\n this.forceTokenization(position.lineNumber);\n return this._tokenizer.getTokenTypeIfInsertingCharacter(position, character);\n }\n tokenizeLineWithEdit(position, length, newText) {\n if (!this._tokenizer) {\n return null;\n }\n const validatedPosition = this._textModel.validatePosition(position);\n this.forceTokenization(validatedPosition.lineNumber);\n return this._tokenizer.tokenizeLineWithEdit(validatedPosition, length, newText);\n }\n get hasTokens() {\n return this._tokens.hasTokens;\n }\n}\nclass AttachedViewHandler extends Disposable {\n get lineRanges() { return this._lineRanges; }\n constructor(_refreshTokens) {\n super();\n this._refreshTokens = _refreshTokens;\n this.runner = this._register(new RunOnceScheduler(() => this.update(), 50));\n this._computedLineRanges = [];\n this._lineRanges = [];\n }\n update() {\n if (equals(this._computedLineRanges, this._lineRanges, (a, b) => a.equals(b))) {\n return;\n }\n this._computedLineRanges = this._lineRanges;\n this._refreshTokens();\n }\n handleStateChange(state) {\n this._lineRanges = state.visibleLineRanges;\n if (state.stabilized) {\n this.runner.cancel();\n this.update();\n }\n else {\n this.runner.schedule();\n }\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 *--------------------------------------------------------------------------------------------*/\nimport { createDecorator } from '../../instantiation/common/instantiation.js';\nexport const IUndoRedoService = createDecorator('undoRedoService');\nexport class ResourceEditStackSnapshot {\n constructor(resource, elements) {\n this.resource = resource;\n this.elements = elements;\n }\n}\nexport class UndoRedoGroup {\n constructor() {\n this.id = UndoRedoGroup._ID++;\n this.order = 1;\n }\n nextOrder() {\n if (this.id === 0) {\n return 0;\n }\n return this.order++;\n }\n}\nUndoRedoGroup._ID = 0;\nUndoRedoGroup.None = new UndoRedoGroup();\nexport class UndoRedoSource {\n constructor() {\n this.id = UndoRedoSource._ID++;\n this.order = 1;\n }\n nextOrder() {\n if (this.id === 0) {\n return 0;\n }\n return this.order++;\n }\n}\nUndoRedoSource._ID = 0;\nUndoRedoSource.None = new UndoRedoSource();\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};\nvar TextModel_1;\nimport { ArrayQueue, pushMany } from '../../../base/common/arrays.js';\nimport { Color } from '../../../base/common/color.js';\nimport { BugIndicatingError, illegalArgument, onUnexpectedError } from '../../../base/common/errors.js';\nimport { Emitter } from '../../../base/common/event.js';\nimport { Disposable, MutableDisposable, combinedDisposable } from '../../../base/common/lifecycle.js';\nimport * as strings from '../../../base/common/strings.js';\nimport { URI } from '../../../base/common/uri.js';\nimport { countEOL } from '../core/eolCounter.js';\nimport { normalizeIndentation } from '../core/indentation.js';\nimport { LineRange } from '../core/lineRange.js';\nimport { Position } from '../core/position.js';\nimport { Range } from '../core/range.js';\nimport { Selection } from '../core/selection.js';\nimport { EDITOR_MODEL_DEFAULTS } from '../core/textModelDefaults.js';\nimport { ILanguageService } from '../languages/language.js';\nimport { ILanguageConfigurationService } from '../languages/languageConfigurationRegistry.js';\nimport * as model from '../model.js';\nimport { BracketPairsTextModelPart } from './bracketPairsTextModelPart/bracketPairsImpl.js';\nimport { ColorizedBracketPairsDecorationProvider } from './bracketPairsTextModelPart/colorizedBracketPairsDecorationProvider.js';\nimport { EditStack } from './editStack.js';\nimport { GuidesTextModelPart } from './guidesTextModelPart.js';\nimport { guessIndentation } from './indentationGuesser.js';\nimport { IntervalNode, IntervalTree, recomputeMaxEnd } from './intervalTree.js';\nimport { PieceTreeTextBuffer } from './pieceTreeTextBuffer/pieceTreeTextBuffer.js';\nimport { PieceTreeTextBufferBuilder } from './pieceTreeTextBuffer/pieceTreeTextBufferBuilder.js';\nimport { SearchParams, TextModelSearch } from './textModelSearch.js';\nimport { TokenizationTextModelPart } from './tokenizationTextModelPart.js';\nimport { InternalModelContentChangeEvent, LineInjectedText, ModelInjectedTextChangedEvent, ModelRawContentChangedEvent, ModelRawEOLChanged, ModelRawFlush, ModelRawLineChanged, ModelRawLinesDeleted, ModelRawLinesInserted } from '../textModelEvents.js';\nimport { IUndoRedoService } from '../../../platform/undoRedo/common/undoRedo.js';\nexport function createTextBufferFactory(text) {\n const builder = new PieceTreeTextBufferBuilder();\n builder.acceptChunk(text);\n return builder.finish();\n}\nexport function createTextBufferFactoryFromSnapshot(snapshot) {\n const builder = new PieceTreeTextBufferBuilder();\n let chunk;\n while (typeof (chunk = snapshot.read()) === 'string') {\n builder.acceptChunk(chunk);\n }\n return builder.finish();\n}\nexport function createTextBuffer(value, defaultEOL) {\n let factory;\n if (typeof value === 'string') {\n factory = createTextBufferFactory(value);\n }\n else if (model.isITextSnapshot(value)) {\n factory = createTextBufferFactoryFromSnapshot(value);\n }\n else {\n factory = value;\n }\n return factory.create(defaultEOL);\n}\nlet MODEL_ID = 0;\nconst LIMIT_FIND_COUNT = 999;\nconst LONG_LINE_BOUNDARY = 10000;\nclass TextModelSnapshot {\n constructor(source) {\n this._source = source;\n this._eos = false;\n }\n read() {\n if (this._eos) {\n return null;\n }\n const result = [];\n let resultCnt = 0;\n let resultLength = 0;\n do {\n const tmp = this._source.read();\n if (tmp === null) {\n // end-of-stream\n this._eos = true;\n if (resultCnt === 0) {\n return null;\n }\n else {\n return result.join('');\n }\n }\n if (tmp.length > 0) {\n result[resultCnt++] = tmp;\n resultLength += tmp.length;\n }\n if (resultLength >= 64 * 1024) {\n return result.join('');\n }\n } while (true);\n }\n}\nconst invalidFunc = () => { throw new Error(`Invalid change accessor`); };\nlet TextModel = TextModel_1 = class TextModel extends Disposable {\n static resolveOptions(textBuffer, options) {\n if (options.detectIndentation) {\n const guessedIndentation = guessIndentation(textBuffer, options.tabSize, options.insertSpaces);\n return new model.TextModelResolvedOptions({\n tabSize: guessedIndentation.tabSize,\n indentSize: 'tabSize', // TODO@Alex: guess indentSize independent of tabSize\n insertSpaces: guessedIndentation.insertSpaces,\n trimAutoWhitespace: options.trimAutoWhitespace,\n defaultEOL: options.defaultEOL,\n bracketPairColorizationOptions: options.bracketPairColorizationOptions,\n });\n }\n return new model.TextModelResolvedOptions(options);\n }\n get onDidChangeLanguage() { return this._tokenizationTextModelPart.onDidChangeLanguage; }\n get onDidChangeLanguageConfiguration() { return this._tokenizationTextModelPart.onDidChangeLanguageConfiguration; }\n get onDidChangeTokens() { return this._tokenizationTextModelPart.onDidChangeTokens; }\n onDidChangeContent(listener) {\n return this._eventEmitter.slowEvent((e) => listener(e.contentChangedEvent));\n }\n onDidChangeContentOrInjectedText(listener) {\n return combinedDisposable(this._eventEmitter.fastEvent(e => listener(e)), this._onDidChangeInjectedText.event(e => listener(e)));\n }\n _isDisposing() { return this.__isDisposing; }\n get tokenization() { return this._tokenizationTextModelPart; }\n get bracketPairs() { return this._bracketPairs; }\n get guides() { return this._guidesTextModelPart; }\n constructor(source, languageIdOrSelection, creationOptions, associatedResource = null, _undoRedoService, _languageService, _languageConfigurationService) {\n super();\n this._undoRedoService = _undoRedoService;\n this._languageService = _languageService;\n this._languageConfigurationService = _languageConfigurationService;\n //#region Events\n this._onWillDispose = this._register(new Emitter());\n this.onWillDispose = this._onWillDispose.event;\n this._onDidChangeDecorations = this._register(new DidChangeDecorationsEmitter(affectedInjectedTextLines => this.handleBeforeFireDecorationsChangedEvent(affectedInjectedTextLines)));\n this.onDidChangeDecorations = this._onDidChangeDecorations.event;\n this._onDidChangeOptions = this._register(new Emitter());\n this.onDidChangeOptions = this._onDidChangeOptions.event;\n this._onDidChangeAttached = this._register(new Emitter());\n this.onDidChangeAttached = this._onDidChangeAttached.event;\n this._onDidChangeInjectedText = this._register(new Emitter());\n this._eventEmitter = this._register(new DidChangeContentEmitter());\n this._languageSelectionListener = this._register(new MutableDisposable());\n this._deltaDecorationCallCnt = 0;\n this._attachedViews = new AttachedViews();\n // Generate a new unique model id\n MODEL_ID++;\n this.id = '$model' + MODEL_ID;\n this.isForSimpleWidget = creationOptions.isForSimpleWidget;\n if (typeof associatedResource === 'undefined' || associatedResource === null) {\n this._associatedResource = URI.parse('inmemory://model/' + MODEL_ID);\n }\n else {\n this._associatedResource = associatedResource;\n }\n this._attachedEditorCount = 0;\n const { textBuffer, disposable } = createTextBuffer(source, creationOptions.defaultEOL);\n this._buffer = textBuffer;\n this._bufferDisposable = disposable;\n this._options = TextModel_1.resolveOptions(this._buffer, creationOptions);\n const languageId = (typeof languageIdOrSelection === 'string' ? languageIdOrSelection : languageIdOrSelection.languageId);\n if (typeof languageIdOrSelection !== 'string') {\n this._languageSelectionListener.value = languageIdOrSelection.onDidChange(() => this._setLanguage(languageIdOrSelection.languageId));\n }\n this._bracketPairs = this._register(new BracketPairsTextModelPart(this, this._languageConfigurationService));\n this._guidesTextModelPart = this._register(new GuidesTextModelPart(this, this._languageConfigurationService));\n this._decorationProvider = this._register(new ColorizedBracketPairsDecorationProvider(this));\n this._tokenizationTextModelPart = new TokenizationTextModelPart(this._languageService, this._languageConfigurationService, this, this._bracketPairs, languageId, this._attachedViews);\n const bufferLineCount = this._buffer.getLineCount();\n const bufferTextLength = this._buffer.getValueLengthInRange(new Range(1, 1, bufferLineCount, this._buffer.getLineLength(bufferLineCount) + 1), 0 /* model.EndOfLinePreference.TextDefined */);\n // !!! Make a decision in the ctor and permanently respect this decision !!!\n // If a model is too large at construction time, it will never get tokenized,\n // under no circumstances.\n if (creationOptions.largeFileOptimizations) {\n this._isTooLargeForTokenization = ((bufferTextLength > TextModel_1.LARGE_FILE_SIZE_THRESHOLD)\n || (bufferLineCount > TextModel_1.LARGE_FILE_LINE_COUNT_THRESHOLD));\n this._isTooLargeForHeapOperation = bufferTextLength > TextModel_1.LARGE_FILE_HEAP_OPERATION_THRESHOLD;\n }\n else {\n this._isTooLargeForTokenization = false;\n this._isTooLargeForHeapOperation = false;\n }\n this._isTooLargeForSyncing = (bufferTextLength > TextModel_1._MODEL_SYNC_LIMIT);\n this._versionId = 1;\n this._alternativeVersionId = 1;\n this._initialUndoRedoSnapshot = null;\n this._isDisposed = false;\n this.__isDisposing = false;\n this._instanceId = strings.singleLetterHash(MODEL_ID);\n this._lastDecorationId = 0;\n this._decorations = Object.create(null);\n this._decorationsTree = new DecorationsTrees();\n this._commandManager = new EditStack(this, this._undoRedoService);\n this._isUndoing = false;\n this._isRedoing = false;\n this._trimAutoWhitespaceLines = null;\n this._register(this._decorationProvider.onDidChange(() => {\n this._onDidChangeDecorations.beginDeferredEmit();\n this._onDidChangeDecorations.fire();\n this._onDidChangeDecorations.endDeferredEmit();\n }));\n this._languageService.requestRichLanguageFeatures(languageId);\n }\n dispose() {\n this.__isDisposing = true;\n this._onWillDispose.fire();\n this._tokenizationTextModelPart.dispose();\n this._isDisposed = true;\n super.dispose();\n this._bufferDisposable.dispose();\n this.__isDisposing = false;\n // Manually release reference to previous text buffer to avoid large leaks\n // in case someone leaks a TextModel reference\n const emptyDisposedTextBuffer = new PieceTreeTextBuffer([], '', '\\n', false, false, true, true);\n emptyDisposedTextBuffer.dispose();\n this._buffer = emptyDisposedTextBuffer;\n this._bufferDisposable = Disposable.None;\n }\n _assertNotDisposed() {\n if (this._isDisposed) {\n throw new Error('Model is disposed!');\n }\n }\n _emitContentChangedEvent(rawChange, change) {\n if (this.__isDisposing) {\n // Do not confuse listeners by emitting any event after disposing\n return;\n }\n this._tokenizationTextModelPart.handleDidChangeContent(change);\n this._bracketPairs.handleDidChangeContent(change);\n this._eventEmitter.fire(new InternalModelContentChangeEvent(rawChange, change));\n }\n setValue(value) {\n this._assertNotDisposed();\n if (value === null || value === undefined) {\n throw illegalArgument();\n }\n const { textBuffer, disposable } = createTextBuffer(value, this._options.defaultEOL);\n this._setValueFromTextBuffer(textBuffer, disposable);\n }\n _createContentChanged2(range, rangeOffset, rangeLength, text, isUndoing, isRedoing, isFlush, isEolChange) {\n return {\n changes: [{\n range: range,\n rangeOffset: rangeOffset,\n rangeLength: rangeLength,\n text: text,\n }],\n eol: this._buffer.getEOL(),\n isEolChange: isEolChange,\n versionId: this.getVersionId(),\n isUndoing: isUndoing,\n isRedoing: isRedoing,\n isFlush: isFlush\n };\n }\n _setValueFromTextBuffer(textBuffer, textBufferDisposable) {\n this._assertNotDisposed();\n const oldFullModelRange = this.getFullModelRange();\n const oldModelValueLength = this.getValueLengthInRange(oldFullModelRange);\n const endLineNumber = this.getLineCount();\n const endColumn = this.getLineMaxColumn(endLineNumber);\n this._buffer = textBuffer;\n this._bufferDisposable.dispose();\n this._bufferDisposable = textBufferDisposable;\n this._increaseVersionId();\n // Destroy all my decorations\n this._decorations = Object.create(null);\n this._decorationsTree = new DecorationsTrees();\n // Destroy my edit history and settings\n this._commandManager.clear();\n this._trimAutoWhitespaceLines = null;\n this._emitContentChangedEvent(new ModelRawContentChangedEvent([\n new ModelRawFlush()\n ], this._versionId, false, false), this._createContentChanged2(new Range(1, 1, endLineNumber, endColumn), 0, oldModelValueLength, this.getValue(), false, false, true, false));\n }\n setEOL(eol) {\n this._assertNotDisposed();\n const newEOL = (eol === 1 /* model.EndOfLineSequence.CRLF */ ? '\\r\\n' : '\\n');\n if (this._buffer.getEOL() === newEOL) {\n // Nothing to do\n return;\n }\n const oldFullModelRange = this.getFullModelRange();\n const oldModelValueLength = this.getValueLengthInRange(oldFullModelRange);\n const endLineNumber = this.getLineCount();\n const endColumn = this.getLineMaxColumn(endLineNumber);\n this._onBeforeEOLChange();\n this._buffer.setEOL(newEOL);\n this._increaseVersionId();\n this._onAfterEOLChange();\n this._emitContentChangedEvent(new ModelRawContentChangedEvent([\n new ModelRawEOLChanged()\n ], this._versionId, false, false), this._createContentChanged2(new Range(1, 1, endLineNumber, endColumn), 0, oldModelValueLength, this.getValue(), false, false, false, true));\n }\n _onBeforeEOLChange() {\n // Ensure all decorations get their `range` set.\n this._decorationsTree.ensureAllNodesHaveRanges(this);\n }\n _onAfterEOLChange() {\n // Transform back `range` to offsets\n const versionId = this.getVersionId();\n const allDecorations = this._decorationsTree.collectNodesPostOrder();\n for (let i = 0, len = allDecorations.length; i < len; i++) {\n const node = allDecorations[i];\n const range = node.range; // the range is defined due to `_onBeforeEOLChange`\n const delta = node.cachedAbsoluteStart - node.start;\n const startOffset = this._buffer.getOffsetAt(range.startLineNumber, range.startColumn);\n const endOffset = this._buffer.getOffsetAt(range.endLineNumber, range.endColumn);\n node.cachedAbsoluteStart = startOffset;\n node.cachedAbsoluteEnd = endOffset;\n node.cachedVersionId = versionId;\n node.start = startOffset - delta;\n node.end = endOffset - delta;\n recomputeMaxEnd(node);\n }\n }\n onBeforeAttached() {\n this._attachedEditorCount++;\n if (this._attachedEditorCount === 1) {\n this._tokenizationTextModelPart.handleDidChangeAttached();\n this._onDidChangeAttached.fire(undefined);\n }\n return this._attachedViews.attachView();\n }\n onBeforeDetached(view) {\n this._attachedEditorCount--;\n if (this._attachedEditorCount === 0) {\n this._tokenizationTextModelPart.handleDidChangeAttached();\n this._onDidChangeAttached.fire(undefined);\n }\n this._attachedViews.detachView(view);\n }\n isAttachedToEditor() {\n return this._attachedEditorCount > 0;\n }\n getAttachedEditorCount() {\n return this._attachedEditorCount;\n }\n isTooLargeForSyncing() {\n return this._isTooLargeForSyncing;\n }\n isTooLargeForTokenization() {\n return this._isTooLargeForTokenization;\n }\n isTooLargeForHeapOperation() {\n return this._isTooLargeForHeapOperation;\n }\n isDisposed() {\n return this._isDisposed;\n }\n isDominatedByLongLines() {\n this._assertNotDisposed();\n if (this.isTooLargeForTokenization()) {\n // Cannot word wrap huge files anyways, so it doesn't really matter\n return false;\n }\n let smallLineCharCount = 0;\n let longLineCharCount = 0;\n const lineCount = this._buffer.getLineCount();\n for (let lineNumber = 1; lineNumber <= lineCount; lineNumber++) {\n const lineLength = this._buffer.getLineLength(lineNumber);\n if (lineLength >= LONG_LINE_BOUNDARY) {\n longLineCharCount += lineLength;\n }\n else {\n smallLineCharCount += lineLength;\n }\n }\n return (longLineCharCount > smallLineCharCount);\n }\n get uri() {\n return this._associatedResource;\n }\n //#region Options\n getOptions() {\n this._assertNotDisposed();\n return this._options;\n }\n getFormattingOptions() {\n return {\n tabSize: this._options.indentSize,\n insertSpaces: this._options.insertSpaces\n };\n }\n updateOptions(_newOpts) {\n this._assertNotDisposed();\n const tabSize = (typeof _newOpts.tabSize !== 'undefined') ? _newOpts.tabSize : this._options.tabSize;\n const indentSize = (typeof _newOpts.indentSize !== 'undefined') ? _newOpts.indentSize : this._options.originalIndentSize;\n const insertSpaces = (typeof _newOpts.insertSpaces !== 'undefined') ? _newOpts.insertSpaces : this._options.insertSpaces;\n const trimAutoWhitespace = (typeof _newOpts.trimAutoWhitespace !== 'undefined') ? _newOpts.trimAutoWhitespace : this._options.trimAutoWhitespace;\n const bracketPairColorizationOptions = (typeof _newOpts.bracketColorizationOptions !== 'undefined') ? _newOpts.bracketColorizationOptions : this._options.bracketPairColorizationOptions;\n const newOpts = new model.TextModelResolvedOptions({\n tabSize: tabSize,\n indentSize: indentSize,\n insertSpaces: insertSpaces,\n defaultEOL: this._options.defaultEOL,\n trimAutoWhitespace: trimAutoWhitespace,\n bracketPairColorizationOptions,\n });\n if (this._options.equals(newOpts)) {\n return;\n }\n const e = this._options.createChangeEvent(newOpts);\n this._options = newOpts;\n this._bracketPairs.handleDidChangeOptions(e);\n this._decorationProvider.handleDidChangeOptions(e);\n this._onDidChangeOptions.fire(e);\n }\n detectIndentation(defaultInsertSpaces, defaultTabSize) {\n this._assertNotDisposed();\n const guessedIndentation = guessIndentation(this._buffer, defaultTabSize, defaultInsertSpaces);\n this.updateOptions({\n insertSpaces: guessedIndentation.insertSpaces,\n tabSize: guessedIndentation.tabSize,\n indentSize: guessedIndentation.tabSize, // TODO@Alex: guess indentSize independent of tabSize\n });\n }\n normalizeIndentation(str) {\n this._assertNotDisposed();\n return normalizeIndentation(str, this._options.indentSize, this._options.insertSpaces);\n }\n //#endregion\n //#region Reading\n getVersionId() {\n this._assertNotDisposed();\n return this._versionId;\n }\n mightContainRTL() {\n return this._buffer.mightContainRTL();\n }\n mightContainUnusualLineTerminators() {\n return this._buffer.mightContainUnusualLineTerminators();\n }\n removeUnusualLineTerminators(selections = null) {\n const matches = this.findMatches(strings.UNUSUAL_LINE_TERMINATORS.source, false, true, false, null, false, 1073741824 /* Constants.MAX_SAFE_SMALL_INTEGER */);\n this._buffer.resetMightContainUnusualLineTerminators();\n this.pushEditOperations(selections, matches.map(m => ({ range: m.range, text: null })), () => null);\n }\n mightContainNonBasicASCII() {\n return this._buffer.mightContainNonBasicASCII();\n }\n getAlternativeVersionId() {\n this._assertNotDisposed();\n return this._alternativeVersionId;\n }\n getInitialUndoRedoSnapshot() {\n this._assertNotDisposed();\n return this._initialUndoRedoSnapshot;\n }\n getOffsetAt(rawPosition) {\n this._assertNotDisposed();\n const position = this._validatePosition(rawPosition.lineNumber, rawPosition.column, 0 /* StringOffsetValidationType.Relaxed */);\n return this._buffer.getOffsetAt(position.lineNumber, position.column);\n }\n getPositionAt(rawOffset) {\n this._assertNotDisposed();\n const offset = (Math.min(this._buffer.getLength(), Math.max(0, rawOffset)));\n return this._buffer.getPositionAt(offset);\n }\n _increaseVersionId() {\n this._versionId = this._versionId + 1;\n this._alternativeVersionId = this._versionId;\n }\n _overwriteVersionId(versionId) {\n this._versionId = versionId;\n }\n _overwriteAlternativeVersionId(newAlternativeVersionId) {\n this._alternativeVersionId = newAlternativeVersionId;\n }\n _overwriteInitialUndoRedoSnapshot(newInitialUndoRedoSnapshot) {\n this._initialUndoRedoSnapshot = newInitialUndoRedoSnapshot;\n }\n getValue(eol, preserveBOM = false) {\n this._assertNotDisposed();\n if (this.isTooLargeForHeapOperation()) {\n throw new BugIndicatingError('Operation would exceed heap memory limits');\n }\n const fullModelRange = this.getFullModelRange();\n const fullModelValue = this.getValueInRange(fullModelRange, eol);\n if (preserveBOM) {\n return this._buffer.getBOM() + fullModelValue;\n }\n return fullModelValue;\n }\n createSnapshot(preserveBOM = false) {\n return new TextModelSnapshot(this._buffer.createSnapshot(preserveBOM));\n }\n getValueLength(eol, preserveBOM = false) {\n this._assertNotDisposed();\n const fullModelRange = this.getFullModelRange();\n const fullModelValue = this.getValueLengthInRange(fullModelRange, eol);\n if (preserveBOM) {\n return this._buffer.getBOM().length + fullModelValue;\n }\n return fullModelValue;\n }\n getValueInRange(rawRange, eol = 0 /* model.EndOfLinePreference.TextDefined */) {\n this._assertNotDisposed();\n return this._buffer.getValueInRange(this.validateRange(rawRange), eol);\n }\n getValueLengthInRange(rawRange, eol = 0 /* model.EndOfLinePreference.TextDefined */) {\n this._assertNotDisposed();\n return this._buffer.getValueLengthInRange(this.validateRange(rawRange), eol);\n }\n getCharacterCountInRange(rawRange, eol = 0 /* model.EndOfLinePreference.TextDefined */) {\n this._assertNotDisposed();\n return this._buffer.getCharacterCountInRange(this.validateRange(rawRange), eol);\n }\n getLineCount() {\n this._assertNotDisposed();\n return this._buffer.getLineCount();\n }\n getLineContent(lineNumber) {\n this._assertNotDisposed();\n if (lineNumber < 1 || lineNumber > this.getLineCount()) {\n throw new BugIndicatingError('Illegal value for lineNumber');\n }\n return this._buffer.getLineContent(lineNumber);\n }\n getLineLength(lineNumber) {\n this._assertNotDisposed();\n if (lineNumber < 1 || lineNumber > this.getLineCount()) {\n throw new BugIndicatingError('Illegal value for lineNumber');\n }\n return this._buffer.getLineLength(lineNumber);\n }\n getLinesContent() {\n this._assertNotDisposed();\n if (this.isTooLargeForHeapOperation()) {\n throw new BugIndicatingError('Operation would exceed heap memory limits');\n }\n return this._buffer.getLinesContent();\n }\n getEOL() {\n this._assertNotDisposed();\n return this._buffer.getEOL();\n }\n getEndOfLineSequence() {\n this._assertNotDisposed();\n return (this._buffer.getEOL() === '\\n'\n ? 0 /* model.EndOfLineSequence.LF */\n : 1 /* model.EndOfLineSequence.CRLF */);\n }\n getLineMinColumn(lineNumber) {\n this._assertNotDisposed();\n return 1;\n }\n getLineMaxColumn(lineNumber) {\n this._assertNotDisposed();\n if (lineNumber < 1 || lineNumber > this.getLineCount()) {\n throw new BugIndicatingError('Illegal value for lineNumber');\n }\n return this._buffer.getLineLength(lineNumber) + 1;\n }\n getLineFirstNonWhitespaceColumn(lineNumber) {\n this._assertNotDisposed();\n if (lineNumber < 1 || lineNumber > this.getLineCount()) {\n throw new BugIndicatingError('Illegal value for lineNumber');\n }\n return this._buffer.getLineFirstNonWhitespaceColumn(lineNumber);\n }\n getLineLastNonWhitespaceColumn(lineNumber) {\n this._assertNotDisposed();\n if (lineNumber < 1 || lineNumber > this.getLineCount()) {\n throw new BugIndicatingError('Illegal value for lineNumber');\n }\n return this._buffer.getLineLastNonWhitespaceColumn(lineNumber);\n }\n /**\n * Validates `range` is within buffer bounds, but allows it to sit in between surrogate pairs, etc.\n * Will try to not allocate if possible.\n */\n _validateRangeRelaxedNoAllocations(range) {\n const linesCount = this._buffer.getLineCount();\n const initialStartLineNumber = range.startLineNumber;\n const initialStartColumn = range.startColumn;\n let startLineNumber = Math.floor((typeof initialStartLineNumber === 'number' && !isNaN(initialStartLineNumber)) ? initialStartLineNumber : 1);\n let startColumn = Math.floor((typeof initialStartColumn === 'number' && !isNaN(initialStartColumn)) ? initialStartColumn : 1);\n if (startLineNumber < 1) {\n startLineNumber = 1;\n startColumn = 1;\n }\n else if (startLineNumber > linesCount) {\n startLineNumber = linesCount;\n startColumn = this.getLineMaxColumn(startLineNumber);\n }\n else {\n if (startColumn <= 1) {\n startColumn = 1;\n }\n else {\n const maxColumn = this.getLineMaxColumn(startLineNumber);\n if (startColumn >= maxColumn) {\n startColumn = maxColumn;\n }\n }\n }\n const initialEndLineNumber = range.endLineNumber;\n const initialEndColumn = range.endColumn;\n let endLineNumber = Math.floor((typeof initialEndLineNumber === 'number' && !isNaN(initialEndLineNumber)) ? initialEndLineNumber : 1);\n let endColumn = Math.floor((typeof initialEndColumn === 'number' && !isNaN(initialEndColumn)) ? initialEndColumn : 1);\n if (endLineNumber < 1) {\n endLineNumber = 1;\n endColumn = 1;\n }\n else if (endLineNumber > linesCount) {\n endLineNumber = linesCount;\n endColumn = this.getLineMaxColumn(endLineNumber);\n }\n else {\n if (endColumn <= 1) {\n endColumn = 1;\n }\n else {\n const maxColumn = this.getLineMaxColumn(endLineNumber);\n if (endColumn >= maxColumn) {\n endColumn = maxColumn;\n }\n }\n }\n if (initialStartLineNumber === startLineNumber\n && initialStartColumn === startColumn\n && initialEndLineNumber === endLineNumber\n && initialEndColumn === endColumn\n && range instanceof Range\n && !(range instanceof Selection)) {\n return range;\n }\n return new Range(startLineNumber, startColumn, endLineNumber, endColumn);\n }\n _isValidPosition(lineNumber, column, validationType) {\n if (typeof lineNumber !== 'number' || typeof column !== 'number') {\n return false;\n }\n if (isNaN(lineNumber) || isNaN(column)) {\n return false;\n }\n if (lineNumber < 1 || column < 1) {\n return false;\n }\n if ((lineNumber | 0) !== lineNumber || (column | 0) !== column) {\n return false;\n }\n const lineCount = this._buffer.getLineCount();\n if (lineNumber > lineCount) {\n return false;\n }\n if (column === 1) {\n return true;\n }\n const maxColumn = this.getLineMaxColumn(lineNumber);\n if (column > maxColumn) {\n return false;\n }\n if (validationType === 1 /* StringOffsetValidationType.SurrogatePairs */) {\n // !!At this point, column > 1\n const charCodeBefore = this._buffer.getLineCharCode(lineNumber, column - 2);\n if (strings.isHighSurrogate(charCodeBefore)) {\n return false;\n }\n }\n return true;\n }\n _validatePosition(_lineNumber, _column, validationType) {\n const lineNumber = Math.floor((typeof _lineNumber === 'number' && !isNaN(_lineNumber)) ? _lineNumber : 1);\n const column = Math.floor((typeof _column === 'number' && !isNaN(_column)) ? _column : 1);\n const lineCount = this._buffer.getLineCount();\n if (lineNumber < 1) {\n return new Position(1, 1);\n }\n if (lineNumber > lineCount) {\n return new Position(lineCount, this.getLineMaxColumn(lineCount));\n }\n if (column <= 1) {\n return new Position(lineNumber, 1);\n }\n const maxColumn = this.getLineMaxColumn(lineNumber);\n if (column >= maxColumn) {\n return new Position(lineNumber, maxColumn);\n }\n if (validationType === 1 /* StringOffsetValidationType.SurrogatePairs */) {\n // If the position would end up in the middle of a high-low surrogate pair,\n // we move it to before the pair\n // !!At this point, column > 1\n const charCodeBefore = this._buffer.getLineCharCode(lineNumber, column - 2);\n if (strings.isHighSurrogate(charCodeBefore)) {\n return new Position(lineNumber, column - 1);\n }\n }\n return new Position(lineNumber, column);\n }\n validatePosition(position) {\n const validationType = 1 /* StringOffsetValidationType.SurrogatePairs */;\n this._assertNotDisposed();\n // Avoid object allocation and cover most likely case\n if (position instanceof Position) {\n if (this._isValidPosition(position.lineNumber, position.column, validationType)) {\n return position;\n }\n }\n return this._validatePosition(position.lineNumber, position.column, validationType);\n }\n _isValidRange(range, validationType) {\n const startLineNumber = range.startLineNumber;\n const startColumn = range.startColumn;\n const endLineNumber = range.endLineNumber;\n const endColumn = range.endColumn;\n if (!this._isValidPosition(startLineNumber, startColumn, 0 /* StringOffsetValidationType.Relaxed */)) {\n return false;\n }\n if (!this._isValidPosition(endLineNumber, endColumn, 0 /* StringOffsetValidationType.Relaxed */)) {\n return false;\n }\n if (validationType === 1 /* StringOffsetValidationType.SurrogatePairs */) {\n const charCodeBeforeStart = (startColumn > 1 ? this._buffer.getLineCharCode(startLineNumber, startColumn - 2) : 0);\n const charCodeBeforeEnd = (endColumn > 1 && endColumn <= this._buffer.getLineLength(endLineNumber) ? this._buffer.getLineCharCode(endLineNumber, endColumn - 2) : 0);\n const startInsideSurrogatePair = strings.isHighSurrogate(charCodeBeforeStart);\n const endInsideSurrogatePair = strings.isHighSurrogate(charCodeBeforeEnd);\n if (!startInsideSurrogatePair && !endInsideSurrogatePair) {\n return true;\n }\n return false;\n }\n return true;\n }\n validateRange(_range) {\n const validationType = 1 /* StringOffsetValidationType.SurrogatePairs */;\n this._assertNotDisposed();\n // Avoid object allocation and cover most likely case\n if ((_range instanceof Range) && !(_range instanceof Selection)) {\n if (this._isValidRange(_range, validationType)) {\n return _range;\n }\n }\n const start = this._validatePosition(_range.startLineNumber, _range.startColumn, 0 /* StringOffsetValidationType.Relaxed */);\n const end = this._validatePosition(_range.endLineNumber, _range.endColumn, 0 /* StringOffsetValidationType.Relaxed */);\n const startLineNumber = start.lineNumber;\n const startColumn = start.column;\n const endLineNumber = end.lineNumber;\n const endColumn = end.column;\n if (validationType === 1 /* StringOffsetValidationType.SurrogatePairs */) {\n const charCodeBeforeStart = (startColumn > 1 ? this._buffer.getLineCharCode(startLineNumber, startColumn - 2) : 0);\n const charCodeBeforeEnd = (endColumn > 1 && endColumn <= this._buffer.getLineLength(endLineNumber) ? this._buffer.getLineCharCode(endLineNumber, endColumn - 2) : 0);\n const startInsideSurrogatePair = strings.isHighSurrogate(charCodeBeforeStart);\n const endInsideSurrogatePair = strings.isHighSurrogate(charCodeBeforeEnd);\n if (!startInsideSurrogatePair && !endInsideSurrogatePair) {\n return new Range(startLineNumber, startColumn, endLineNumber, endColumn);\n }\n if (startLineNumber === endLineNumber && startColumn === endColumn) {\n // do not expand a collapsed range, simply move it to a valid location\n return new Range(startLineNumber, startColumn - 1, endLineNumber, endColumn - 1);\n }\n if (startInsideSurrogatePair && endInsideSurrogatePair) {\n // expand range at both ends\n return new Range(startLineNumber, startColumn - 1, endLineNumber, endColumn + 1);\n }\n if (startInsideSurrogatePair) {\n // only expand range at the start\n return new Range(startLineNumber, startColumn - 1, endLineNumber, endColumn);\n }\n // only expand range at the end\n return new Range(startLineNumber, startColumn, endLineNumber, endColumn + 1);\n }\n return new Range(startLineNumber, startColumn, endLineNumber, endColumn);\n }\n modifyPosition(rawPosition, offset) {\n this._assertNotDisposed();\n const candidate = this.getOffsetAt(rawPosition) + offset;\n return this.getPositionAt(Math.min(this._buffer.getLength(), Math.max(0, candidate)));\n }\n getFullModelRange() {\n this._assertNotDisposed();\n const lineCount = this.getLineCount();\n return new Range(1, 1, lineCount, this.getLineMaxColumn(lineCount));\n }\n findMatchesLineByLine(searchRange, searchData, captureMatches, limitResultCount) {\n return this._buffer.findMatchesLineByLine(searchRange, searchData, captureMatches, limitResultCount);\n }\n findMatches(searchString, rawSearchScope, isRegex, matchCase, wordSeparators, captureMatches, limitResultCount = LIMIT_FIND_COUNT) {\n this._assertNotDisposed();\n let searchRanges = null;\n if (rawSearchScope !== null) {\n if (!Array.isArray(rawSearchScope)) {\n rawSearchScope = [rawSearchScope];\n }\n if (rawSearchScope.every((searchScope) => Range.isIRange(searchScope))) {\n searchRanges = rawSearchScope.map((searchScope) => this.validateRange(searchScope));\n }\n }\n if (searchRanges === null) {\n searchRanges = [this.getFullModelRange()];\n }\n searchRanges = searchRanges.sort((d1, d2) => d1.startLineNumber - d2.startLineNumber || d1.startColumn - d2.startColumn);\n const uniqueSearchRanges = [];\n uniqueSearchRanges.push(searchRanges.reduce((prev, curr) => {\n if (Range.areIntersecting(prev, curr)) {\n return prev.plusRange(curr);\n }\n uniqueSearchRanges.push(prev);\n return curr;\n }));\n let matchMapper;\n if (!isRegex && searchString.indexOf('\\n') < 0) {\n // not regex, not multi line\n const searchParams = new SearchParams(searchString, isRegex, matchCase, wordSeparators);\n const searchData = searchParams.parseSearchRequest();\n if (!searchData) {\n return [];\n }\n matchMapper = (searchRange) => this.findMatchesLineByLine(searchRange, searchData, captureMatches, limitResultCount);\n }\n else {\n matchMapper = (searchRange) => TextModelSearch.findMatches(this, new SearchParams(searchString, isRegex, matchCase, wordSeparators), searchRange, captureMatches, limitResultCount);\n }\n return uniqueSearchRanges.map(matchMapper).reduce((arr, matches) => arr.concat(matches), []);\n }\n findNextMatch(searchString, rawSearchStart, isRegex, matchCase, wordSeparators, captureMatches) {\n this._assertNotDisposed();\n const searchStart = this.validatePosition(rawSearchStart);\n if (!isRegex && searchString.indexOf('\\n') < 0) {\n const searchParams = new SearchParams(searchString, isRegex, matchCase, wordSeparators);\n const searchData = searchParams.parseSearchRequest();\n if (!searchData) {\n return null;\n }\n const lineCount = this.getLineCount();\n let searchRange = new Range(searchStart.lineNumber, searchStart.column, lineCount, this.getLineMaxColumn(lineCount));\n let ret = this.findMatchesLineByLine(searchRange, searchData, captureMatches, 1);\n TextModelSearch.findNextMatch(this, new SearchParams(searchString, isRegex, matchCase, wordSeparators), searchStart, captureMatches);\n if (ret.length > 0) {\n return ret[0];\n }\n searchRange = new Range(1, 1, searchStart.lineNumber, this.getLineMaxColumn(searchStart.lineNumber));\n ret = this.findMatchesLineByLine(searchRange, searchData, captureMatches, 1);\n if (ret.length > 0) {\n return ret[0];\n }\n return null;\n }\n return TextModelSearch.findNextMatch(this, new SearchParams(searchString, isRegex, matchCase, wordSeparators), searchStart, captureMatches);\n }\n findPreviousMatch(searchString, rawSearchStart, isRegex, matchCase, wordSeparators, captureMatches) {\n this._assertNotDisposed();\n const searchStart = this.validatePosition(rawSearchStart);\n return TextModelSearch.findPreviousMatch(this, new SearchParams(searchString, isRegex, matchCase, wordSeparators), searchStart, captureMatches);\n }\n //#endregion\n //#region Editing\n pushStackElement() {\n this._commandManager.pushStackElement();\n }\n popStackElement() {\n this._commandManager.popStackElement();\n }\n pushEOL(eol) {\n const currentEOL = (this.getEOL() === '\\n' ? 0 /* model.EndOfLineSequence.LF */ : 1 /* model.EndOfLineSequence.CRLF */);\n if (currentEOL === eol) {\n return;\n }\n try {\n this._onDidChangeDecorations.beginDeferredEmit();\n this._eventEmitter.beginDeferredEmit();\n if (this._initialUndoRedoSnapshot === null) {\n this._initialUndoRedoSnapshot = this._undoRedoService.createSnapshot(this.uri);\n }\n this._commandManager.pushEOL(eol);\n }\n finally {\n this._eventEmitter.endDeferredEmit();\n this._onDidChangeDecorations.endDeferredEmit();\n }\n }\n _validateEditOperation(rawOperation) {\n if (rawOperation instanceof model.ValidAnnotatedEditOperation) {\n return rawOperation;\n }\n return new model.ValidAnnotatedEditOperation(rawOperation.identifier || null, this.validateRange(rawOperation.range), rawOperation.text, rawOperation.forceMoveMarkers || false, rawOperation.isAutoWhitespaceEdit || false, rawOperation._isTracked || false);\n }\n _validateEditOperations(rawOperations) {\n const result = [];\n for (let i = 0, len = rawOperations.length; i < len; i++) {\n result[i] = this._validateEditOperation(rawOperations[i]);\n }\n return result;\n }\n pushEditOperations(beforeCursorState, editOperations, cursorStateComputer, group) {\n try {\n this._onDidChangeDecorations.beginDeferredEmit();\n this._eventEmitter.beginDeferredEmit();\n return this._pushEditOperations(beforeCursorState, this._validateEditOperations(editOperations), cursorStateComputer, group);\n }\n finally {\n this._eventEmitter.endDeferredEmit();\n this._onDidChangeDecorations.endDeferredEmit();\n }\n }\n _pushEditOperations(beforeCursorState, editOperations, cursorStateComputer, group) {\n if (this._options.trimAutoWhitespace && this._trimAutoWhitespaceLines) {\n // Go through each saved line number and insert a trim whitespace edit\n // if it is safe to do so (no conflicts with other edits).\n const incomingEdits = editOperations.map((op) => {\n return {\n range: this.validateRange(op.range),\n text: op.text\n };\n });\n // Sometimes, auto-formatters change ranges automatically which can cause undesired auto whitespace trimming near the cursor\n // We'll use the following heuristic: if the edits occur near the cursor, then it's ok to trim auto whitespace\n let editsAreNearCursors = true;\n if (beforeCursorState) {\n for (let i = 0, len = beforeCursorState.length; i < len; i++) {\n const sel = beforeCursorState[i];\n let foundEditNearSel = false;\n for (let j = 0, lenJ = incomingEdits.length; j < lenJ; j++) {\n const editRange = incomingEdits[j].range;\n const selIsAbove = editRange.startLineNumber > sel.endLineNumber;\n const selIsBelow = sel.startLineNumber > editRange.endLineNumber;\n if (!selIsAbove && !selIsBelow) {\n foundEditNearSel = true;\n break;\n }\n }\n if (!foundEditNearSel) {\n editsAreNearCursors = false;\n break;\n }\n }\n }\n if (editsAreNearCursors) {\n for (let i = 0, len = this._trimAutoWhitespaceLines.length; i < len; i++) {\n const trimLineNumber = this._trimAutoWhitespaceLines[i];\n const maxLineColumn = this.getLineMaxColumn(trimLineNumber);\n let allowTrimLine = true;\n for (let j = 0, lenJ = incomingEdits.length; j < lenJ; j++) {\n const editRange = incomingEdits[j].range;\n const editText = incomingEdits[j].text;\n if (trimLineNumber < editRange.startLineNumber || trimLineNumber > editRange.endLineNumber) {\n // `trimLine` is completely outside this edit\n continue;\n }\n // At this point:\n // editRange.startLineNumber <= trimLine <= editRange.endLineNumber\n if (trimLineNumber === editRange.startLineNumber && editRange.startColumn === maxLineColumn\n && editRange.isEmpty() && editText && editText.length > 0 && editText.charAt(0) === '\\n') {\n // This edit inserts a new line (and maybe other text) after `trimLine`\n continue;\n }\n if (trimLineNumber === editRange.startLineNumber && editRange.startColumn === 1\n && editRange.isEmpty() && editText && editText.length > 0 && editText.charAt(editText.length - 1) === '\\n') {\n // This edit inserts a new line (and maybe other text) before `trimLine`\n continue;\n }\n // Looks like we can't trim this line as it would interfere with an incoming edit\n allowTrimLine = false;\n break;\n }\n if (allowTrimLine) {\n const trimRange = new Range(trimLineNumber, 1, trimLineNumber, maxLineColumn);\n editOperations.push(new model.ValidAnnotatedEditOperation(null, trimRange, null, false, false, false));\n }\n }\n }\n this._trimAutoWhitespaceLines = null;\n }\n if (this._initialUndoRedoSnapshot === null) {\n this._initialUndoRedoSnapshot = this._undoRedoService.createSnapshot(this.uri);\n }\n return this._commandManager.pushEditOperation(beforeCursorState, editOperations, cursorStateComputer, group);\n }\n _applyUndo(changes, eol, resultingAlternativeVersionId, resultingSelection) {\n const edits = changes.map((change) => {\n const rangeStart = this.getPositionAt(change.newPosition);\n const rangeEnd = this.getPositionAt(change.newEnd);\n return {\n range: new Range(rangeStart.lineNumber, rangeStart.column, rangeEnd.lineNumber, rangeEnd.column),\n text: change.oldText\n };\n });\n this._applyUndoRedoEdits(edits, eol, true, false, resultingAlternativeVersionId, resultingSelection);\n }\n _applyRedo(changes, eol, resultingAlternativeVersionId, resultingSelection) {\n const edits = changes.map((change) => {\n const rangeStart = this.getPositionAt(change.oldPosition);\n const rangeEnd = this.getPositionAt(change.oldEnd);\n return {\n range: new Range(rangeStart.lineNumber, rangeStart.column, rangeEnd.lineNumber, rangeEnd.column),\n text: change.newText\n };\n });\n this._applyUndoRedoEdits(edits, eol, false, true, resultingAlternativeVersionId, resultingSelection);\n }\n _applyUndoRedoEdits(edits, eol, isUndoing, isRedoing, resultingAlternativeVersionId, resultingSelection) {\n try {\n this._onDidChangeDecorations.beginDeferredEmit();\n this._eventEmitter.beginDeferredEmit();\n this._isUndoing = isUndoing;\n this._isRedoing = isRedoing;\n this.applyEdits(edits, false);\n this.setEOL(eol);\n this._overwriteAlternativeVersionId(resultingAlternativeVersionId);\n }\n finally {\n this._isUndoing = false;\n this._isRedoing = false;\n this._eventEmitter.endDeferredEmit(resultingSelection);\n this._onDidChangeDecorations.endDeferredEmit();\n }\n }\n applyEdits(rawOperations, computeUndoEdits = false) {\n try {\n this._onDidChangeDecorations.beginDeferredEmit();\n this._eventEmitter.beginDeferredEmit();\n const operations = this._validateEditOperations(rawOperations);\n return this._doApplyEdits(operations, computeUndoEdits);\n }\n finally {\n this._eventEmitter.endDeferredEmit();\n this._onDidChangeDecorations.endDeferredEmit();\n }\n }\n _doApplyEdits(rawOperations, computeUndoEdits) {\n const oldLineCount = this._buffer.getLineCount();\n const result = this._buffer.applyEdits(rawOperations, this._options.trimAutoWhitespace, computeUndoEdits);\n const newLineCount = this._buffer.getLineCount();\n const contentChanges = result.changes;\n this._trimAutoWhitespaceLines = result.trimAutoWhitespaceLineNumbers;\n if (contentChanges.length !== 0) {\n // We do a first pass to update decorations\n // because we want to read decorations in the second pass\n // where we will emit content change events\n // and we want to read the final decorations\n for (let i = 0, len = contentChanges.length; i < len; i++) {\n const change = contentChanges[i];\n this._decorationsTree.acceptReplace(change.rangeOffset, change.rangeLength, change.text.length, change.forceMoveMarkers);\n }\n const rawContentChanges = [];\n this._increaseVersionId();\n let lineCount = oldLineCount;\n for (let i = 0, len = contentChanges.length; i < len; i++) {\n const change = contentChanges[i];\n const [eolCount] = countEOL(change.text);\n this._onDidChangeDecorations.fire();\n const startLineNumber = change.range.startLineNumber;\n const endLineNumber = change.range.endLineNumber;\n const deletingLinesCnt = endLineNumber - startLineNumber;\n const insertingLinesCnt = eolCount;\n const editingLinesCnt = Math.min(deletingLinesCnt, insertingLinesCnt);\n const changeLineCountDelta = (insertingLinesCnt - deletingLinesCnt);\n const currentEditStartLineNumber = newLineCount - lineCount - changeLineCountDelta + startLineNumber;\n const firstEditLineNumber = currentEditStartLineNumber;\n const lastInsertedLineNumber = currentEditStartLineNumber + insertingLinesCnt;\n const decorationsWithInjectedTextInEditedRange = this._decorationsTree.getInjectedTextInInterval(this, this.getOffsetAt(new Position(firstEditLineNumber, 1)), this.getOffsetAt(new Position(lastInsertedLineNumber, this.getLineMaxColumn(lastInsertedLineNumber))), 0);\n const injectedTextInEditedRange = LineInjectedText.fromDecorations(decorationsWithInjectedTextInEditedRange);\n const injectedTextInEditedRangeQueue = new ArrayQueue(injectedTextInEditedRange);\n for (let j = editingLinesCnt; j >= 0; j--) {\n const editLineNumber = startLineNumber + j;\n const currentEditLineNumber = currentEditStartLineNumber + j;\n injectedTextInEditedRangeQueue.takeFromEndWhile(r => r.lineNumber > currentEditLineNumber);\n const decorationsInCurrentLine = injectedTextInEditedRangeQueue.takeFromEndWhile(r => r.lineNumber === currentEditLineNumber);\n rawContentChanges.push(new ModelRawLineChanged(editLineNumber, this.getLineContent(currentEditLineNumber), decorationsInCurrentLine));\n }\n if (editingLinesCnt < deletingLinesCnt) {\n // Must delete some lines\n const spliceStartLineNumber = startLineNumber + editingLinesCnt;\n rawContentChanges.push(new ModelRawLinesDeleted(spliceStartLineNumber + 1, endLineNumber));\n }\n if (editingLinesCnt < insertingLinesCnt) {\n const injectedTextInEditedRangeQueue = new ArrayQueue(injectedTextInEditedRange);\n // Must insert some lines\n const spliceLineNumber = startLineNumber + editingLinesCnt;\n const cnt = insertingLinesCnt - editingLinesCnt;\n const fromLineNumber = newLineCount - lineCount - cnt + spliceLineNumber + 1;\n const injectedTexts = [];\n const newLines = [];\n for (let i = 0; i < cnt; i++) {\n const lineNumber = fromLineNumber + i;\n newLines[i] = this.getLineContent(lineNumber);\n injectedTextInEditedRangeQueue.takeWhile(r => r.lineNumber < lineNumber);\n injectedTexts[i] = injectedTextInEditedRangeQueue.takeWhile(r => r.lineNumber === lineNumber);\n }\n rawContentChanges.push(new ModelRawLinesInserted(spliceLineNumber + 1, startLineNumber + insertingLinesCnt, newLines, injectedTexts));\n }\n lineCount += changeLineCountDelta;\n }\n this._emitContentChangedEvent(new ModelRawContentChangedEvent(rawContentChanges, this.getVersionId(), this._isUndoing, this._isRedoing), {\n changes: contentChanges,\n eol: this._buffer.getEOL(),\n isEolChange: false,\n versionId: this.getVersionId(),\n isUndoing: this._isUndoing,\n isRedoing: this._isRedoing,\n isFlush: false\n });\n }\n return (result.reverseEdits === null ? undefined : result.reverseEdits);\n }\n undo() {\n return this._undoRedoService.undo(this.uri);\n }\n canUndo() {\n return this._undoRedoService.canUndo(this.uri);\n }\n redo() {\n return this._undoRedoService.redo(this.uri);\n }\n canRedo() {\n return this._undoRedoService.canRedo(this.uri);\n }\n //#endregion\n //#region Decorations\n handleBeforeFireDecorationsChangedEvent(affectedInjectedTextLines) {\n // This is called before the decoration changed event is fired.\n if (affectedInjectedTextLines === null || affectedInjectedTextLines.size === 0) {\n return;\n }\n const affectedLines = Array.from(affectedInjectedTextLines);\n const lineChangeEvents = affectedLines.map(lineNumber => new ModelRawLineChanged(lineNumber, this.getLineContent(lineNumber), this._getInjectedTextInLine(lineNumber)));\n this._onDidChangeInjectedText.fire(new ModelInjectedTextChangedEvent(lineChangeEvents));\n }\n changeDecorations(callback, ownerId = 0) {\n this._assertNotDisposed();\n try {\n this._onDidChangeDecorations.beginDeferredEmit();\n return this._changeDecorations(ownerId, callback);\n }\n finally {\n this._onDidChangeDecorations.endDeferredEmit();\n }\n }\n _changeDecorations(ownerId, callback) {\n const changeAccessor = {\n addDecoration: (range, options) => {\n return this._deltaDecorationsImpl(ownerId, [], [{ range: range, options: options }])[0];\n },\n changeDecoration: (id, newRange) => {\n this._changeDecorationImpl(id, newRange);\n },\n changeDecorationOptions: (id, options) => {\n this._changeDecorationOptionsImpl(id, _normalizeOptions(options));\n },\n removeDecoration: (id) => {\n this._deltaDecorationsImpl(ownerId, [id], []);\n },\n deltaDecorations: (oldDecorations, newDecorations) => {\n if (oldDecorations.length === 0 && newDecorations.length === 0) {\n // nothing to do\n return [];\n }\n return this._deltaDecorationsImpl(ownerId, oldDecorations, newDecorations);\n }\n };\n let result = null;\n try {\n result = callback(changeAccessor);\n }\n catch (e) {\n onUnexpectedError(e);\n }\n // Invalidate change accessor\n changeAccessor.addDecoration = invalidFunc;\n changeAccessor.changeDecoration = invalidFunc;\n changeAccessor.changeDecorationOptions = invalidFunc;\n changeAccessor.removeDecoration = invalidFunc;\n changeAccessor.deltaDecorations = invalidFunc;\n return result;\n }\n deltaDecorations(oldDecorations, newDecorations, ownerId = 0) {\n this._assertNotDisposed();\n if (!oldDecorations) {\n oldDecorations = [];\n }\n if (oldDecorations.length === 0 && newDecorations.length === 0) {\n // nothing to do\n return [];\n }\n try {\n this._deltaDecorationCallCnt++;\n if (this._deltaDecorationCallCnt > 1) {\n console.warn(`Invoking deltaDecorations recursively could lead to leaking decorations.`);\n onUnexpectedError(new Error(`Invoking deltaDecorations recursively could lead to leaking decorations.`));\n }\n this._onDidChangeDecorations.beginDeferredEmit();\n return this._deltaDecorationsImpl(ownerId, oldDecorations, newDecorations);\n }\n finally {\n this._onDidChangeDecorations.endDeferredEmit();\n this._deltaDecorationCallCnt--;\n }\n }\n _getTrackedRange(id) {\n return this.getDecorationRange(id);\n }\n _setTrackedRange(id, newRange, newStickiness) {\n const node = (id ? this._decorations[id] : null);\n if (!node) {\n if (!newRange) {\n // node doesn't exist, the request is to delete => nothing to do\n return null;\n }\n // node doesn't exist, the request is to set => add the tracked range\n return this._deltaDecorationsImpl(0, [], [{ range: newRange, options: TRACKED_RANGE_OPTIONS[newStickiness] }], true)[0];\n }\n if (!newRange) {\n // node exists, the request is to delete => delete node\n this._decorationsTree.delete(node);\n delete this._decorations[node.id];\n return null;\n }\n // node exists, the request is to set => change the tracked range and its options\n const range = this._validateRangeRelaxedNoAllocations(newRange);\n const startOffset = this._buffer.getOffsetAt(range.startLineNumber, range.startColumn);\n const endOffset = this._buffer.getOffsetAt(range.endLineNumber, range.endColumn);\n this._decorationsTree.delete(node);\n node.reset(this.getVersionId(), startOffset, endOffset, range);\n node.setOptions(TRACKED_RANGE_OPTIONS[newStickiness]);\n this._decorationsTree.insert(node);\n return node.id;\n }\n removeAllDecorationsWithOwnerId(ownerId) {\n if (this._isDisposed) {\n return;\n }\n const nodes = this._decorationsTree.collectNodesFromOwner(ownerId);\n for (let i = 0, len = nodes.length; i < len; i++) {\n const node = nodes[i];\n this._decorationsTree.delete(node);\n delete this._decorations[node.id];\n }\n }\n getDecorationOptions(decorationId) {\n const node = this._decorations[decorationId];\n if (!node) {\n return null;\n }\n return node.options;\n }\n getDecorationRange(decorationId) {\n const node = this._decorations[decorationId];\n if (!node) {\n return null;\n }\n return this._decorationsTree.getNodeRange(this, node);\n }\n getLineDecorations(lineNumber, ownerId = 0, filterOutValidation = false) {\n if (lineNumber < 1 || lineNumber > this.getLineCount()) {\n return [];\n }\n return this.getLinesDecorations(lineNumber, lineNumber, ownerId, filterOutValidation);\n }\n getLinesDecorations(_startLineNumber, _endLineNumber, ownerId = 0, filterOutValidation = false, onlyMarginDecorations = false) {\n const lineCount = this.getLineCount();\n const startLineNumber = Math.min(lineCount, Math.max(1, _startLineNumber));\n const endLineNumber = Math.min(lineCount, Math.max(1, _endLineNumber));\n const endColumn = this.getLineMaxColumn(endLineNumber);\n const range = new Range(startLineNumber, 1, endLineNumber, endColumn);\n const decorations = this._getDecorationsInRange(range, ownerId, filterOutValidation, onlyMarginDecorations);\n pushMany(decorations, this._decorationProvider.getDecorationsInRange(range, ownerId, filterOutValidation));\n return decorations;\n }\n getDecorationsInRange(range, ownerId = 0, filterOutValidation = false, onlyMinimapDecorations = false, onlyMarginDecorations = false) {\n const validatedRange = this.validateRange(range);\n const decorations = this._getDecorationsInRange(validatedRange, ownerId, filterOutValidation, onlyMarginDecorations);\n pushMany(decorations, this._decorationProvider.getDecorationsInRange(validatedRange, ownerId, filterOutValidation, onlyMinimapDecorations));\n return decorations;\n }\n getOverviewRulerDecorations(ownerId = 0, filterOutValidation = false) {\n return this._decorationsTree.getAll(this, ownerId, filterOutValidation, true, false);\n }\n getInjectedTextDecorations(ownerId = 0) {\n return this._decorationsTree.getAllInjectedText(this, ownerId);\n }\n _getInjectedTextInLine(lineNumber) {\n const startOffset = this._buffer.getOffsetAt(lineNumber, 1);\n const endOffset = startOffset + this._buffer.getLineLength(lineNumber);\n const result = this._decorationsTree.getInjectedTextInInterval(this, startOffset, endOffset, 0);\n return LineInjectedText.fromDecorations(result).filter(t => t.lineNumber === lineNumber);\n }\n getAllDecorations(ownerId = 0, filterOutValidation = false) {\n let result = this._decorationsTree.getAll(this, ownerId, filterOutValidation, false, false);\n result = result.concat(this._decorationProvider.getAllDecorations(ownerId, filterOutValidation));\n return result;\n }\n getAllMarginDecorations(ownerId = 0) {\n return this._decorationsTree.getAll(this, ownerId, false, false, true);\n }\n _getDecorationsInRange(filterRange, filterOwnerId, filterOutValidation, onlyMarginDecorations) {\n const startOffset = this._buffer.getOffsetAt(filterRange.startLineNumber, filterRange.startColumn);\n const endOffset = this._buffer.getOffsetAt(filterRange.endLineNumber, filterRange.endColumn);\n return this._decorationsTree.getAllInInterval(this, startOffset, endOffset, filterOwnerId, filterOutValidation, onlyMarginDecorations);\n }\n getRangeAt(start, end) {\n return this._buffer.getRangeAt(start, end - start);\n }\n _changeDecorationImpl(decorationId, _range) {\n const node = this._decorations[decorationId];\n if (!node) {\n return;\n }\n if (node.options.after) {\n const oldRange = this.getDecorationRange(decorationId);\n this._onDidChangeDecorations.recordLineAffectedByInjectedText(oldRange.endLineNumber);\n }\n if (node.options.before) {\n const oldRange = this.getDecorationRange(decorationId);\n this._onDidChangeDecorations.recordLineAffectedByInjectedText(oldRange.startLineNumber);\n }\n const range = this._validateRangeRelaxedNoAllocations(_range);\n const startOffset = this._buffer.getOffsetAt(range.startLineNumber, range.startColumn);\n const endOffset = this._buffer.getOffsetAt(range.endLineNumber, range.endColumn);\n this._decorationsTree.delete(node);\n node.reset(this.getVersionId(), startOffset, endOffset, range);\n this._decorationsTree.insert(node);\n this._onDidChangeDecorations.checkAffectedAndFire(node.options);\n if (node.options.after) {\n this._onDidChangeDecorations.recordLineAffectedByInjectedText(range.endLineNumber);\n }\n if (node.options.before) {\n this._onDidChangeDecorations.recordLineAffectedByInjectedText(range.startLineNumber);\n }\n }\n _changeDecorationOptionsImpl(decorationId, options) {\n const node = this._decorations[decorationId];\n if (!node) {\n return;\n }\n const nodeWasInOverviewRuler = (node.options.overviewRuler && node.options.overviewRuler.color ? true : false);\n const nodeIsInOverviewRuler = (options.overviewRuler && options.overviewRuler.color ? true : false);\n this._onDidChangeDecorations.checkAffectedAndFire(node.options);\n this._onDidChangeDecorations.checkAffectedAndFire(options);\n if (node.options.after || options.after) {\n const nodeRange = this._decorationsTree.getNodeRange(this, node);\n this._onDidChangeDecorations.recordLineAffectedByInjectedText(nodeRange.endLineNumber);\n }\n if (node.options.before || options.before) {\n const nodeRange = this._decorationsTree.getNodeRange(this, node);\n this._onDidChangeDecorations.recordLineAffectedByInjectedText(nodeRange.startLineNumber);\n }\n const movedInOverviewRuler = nodeWasInOverviewRuler !== nodeIsInOverviewRuler;\n const changedWhetherInjectedText = isOptionsInjectedText(options) !== isNodeInjectedText(node);\n if (movedInOverviewRuler || changedWhetherInjectedText) {\n this._decorationsTree.delete(node);\n node.setOptions(options);\n this._decorationsTree.insert(node);\n }\n else {\n node.setOptions(options);\n }\n }\n _deltaDecorationsImpl(ownerId, oldDecorationsIds, newDecorations, suppressEvents = false) {\n const versionId = this.getVersionId();\n const oldDecorationsLen = oldDecorationsIds.length;\n let oldDecorationIndex = 0;\n const newDecorationsLen = newDecorations.length;\n let newDecorationIndex = 0;\n this._onDidChangeDecorations.beginDeferredEmit();\n try {\n const result = new Array(newDecorationsLen);\n while (oldDecorationIndex < oldDecorationsLen || newDecorationIndex < newDecorationsLen) {\n let node = null;\n if (oldDecorationIndex < oldDecorationsLen) {\n // (1) get ourselves an old node\n do {\n node = this._decorations[oldDecorationsIds[oldDecorationIndex++]];\n } while (!node && oldDecorationIndex < oldDecorationsLen);\n // (2) remove the node from the tree (if it exists)\n if (node) {\n if (node.options.after) {\n const nodeRange = this._decorationsTree.getNodeRange(this, node);\n this._onDidChangeDecorations.recordLineAffectedByInjectedText(nodeRange.endLineNumber);\n }\n if (node.options.before) {\n const nodeRange = this._decorationsTree.getNodeRange(this, node);\n this._onDidChangeDecorations.recordLineAffectedByInjectedText(nodeRange.startLineNumber);\n }\n this._decorationsTree.delete(node);\n if (!suppressEvents) {\n this._onDidChangeDecorations.checkAffectedAndFire(node.options);\n }\n }\n }\n if (newDecorationIndex < newDecorationsLen) {\n // (3) create a new node if necessary\n if (!node) {\n const internalDecorationId = (++this._lastDecorationId);\n const decorationId = `${this._instanceId};${internalDecorationId}`;\n node = new IntervalNode(decorationId, 0, 0);\n this._decorations[decorationId] = node;\n }\n // (4) initialize node\n const newDecoration = newDecorations[newDecorationIndex];\n const range = this._validateRangeRelaxedNoAllocations(newDecoration.range);\n const options = _normalizeOptions(newDecoration.options);\n const startOffset = this._buffer.getOffsetAt(range.startLineNumber, range.startColumn);\n const endOffset = this._buffer.getOffsetAt(range.endLineNumber, range.endColumn);\n node.ownerId = ownerId;\n node.reset(versionId, startOffset, endOffset, range);\n node.setOptions(options);\n if (node.options.after) {\n this._onDidChangeDecorations.recordLineAffectedByInjectedText(range.endLineNumber);\n }\n if (node.options.before) {\n this._onDidChangeDecorations.recordLineAffectedByInjectedText(range.startLineNumber);\n }\n if (!suppressEvents) {\n this._onDidChangeDecorations.checkAffectedAndFire(options);\n }\n this._decorationsTree.insert(node);\n result[newDecorationIndex] = node.id;\n newDecorationIndex++;\n }\n else {\n if (node) {\n delete this._decorations[node.id];\n }\n }\n }\n return result;\n }\n finally {\n this._onDidChangeDecorations.endDeferredEmit();\n }\n }\n //#endregion\n //#region Tokenization\n // TODO move them to the tokenization part.\n getLanguageId() {\n return this.tokenization.getLanguageId();\n }\n setLanguage(languageIdOrSelection, source) {\n if (typeof languageIdOrSelection === 'string') {\n this._languageSelectionListener.clear();\n this._setLanguage(languageIdOrSelection, source);\n }\n else {\n this._languageSelectionListener.value = languageIdOrSelection.onDidChange(() => this._setLanguage(languageIdOrSelection.languageId, source));\n this._setLanguage(languageIdOrSelection.languageId, source);\n }\n }\n _setLanguage(languageId, source) {\n this.tokenization.setLanguageId(languageId, source);\n this._languageService.requestRichLanguageFeatures(languageId);\n }\n getLanguageIdAtPosition(lineNumber, column) {\n return this.tokenization.getLanguageIdAtPosition(lineNumber, column);\n }\n getWordAtPosition(position) {\n return this._tokenizationTextModelPart.getWordAtPosition(position);\n }\n getWordUntilPosition(position) {\n return this._tokenizationTextModelPart.getWordUntilPosition(position);\n }\n //#endregion\n normalizePosition(position, affinity) {\n return position;\n }\n /**\n * Gets the column at which indentation stops at a given line.\n * @internal\n */\n getLineIndentColumn(lineNumber) {\n // Columns start with 1.\n return indentOfLine(this.getLineContent(lineNumber)) + 1;\n }\n};\nTextModel._MODEL_SYNC_LIMIT = 50 * 1024 * 1024; // 50 MB, // used in tests\nTextModel.LARGE_FILE_SIZE_THRESHOLD = 20 * 1024 * 1024; // 20 MB;\nTextModel.LARGE_FILE_LINE_COUNT_THRESHOLD = 300 * 1000; // 300K lines\nTextModel.LARGE_FILE_HEAP_OPERATION_THRESHOLD = 256 * 1024 * 1024; // 256M characters, usually ~> 512MB memory usage\nTextModel.DEFAULT_CREATION_OPTIONS = {\n isForSimpleWidget: false,\n tabSize: EDITOR_MODEL_DEFAULTS.tabSize,\n indentSize: EDITOR_MODEL_DEFAULTS.indentSize,\n insertSpaces: EDITOR_MODEL_DEFAULTS.insertSpaces,\n detectIndentation: false,\n defaultEOL: 1 /* model.DefaultEndOfLine.LF */,\n trimAutoWhitespace: EDITOR_MODEL_DEFAULTS.trimAutoWhitespace,\n largeFileOptimizations: EDITOR_MODEL_DEFAULTS.largeFileOptimizations,\n bracketPairColorizationOptions: EDITOR_MODEL_DEFAULTS.bracketPairColorizationOptions,\n};\nTextModel = TextModel_1 = __decorate([\n __param(4, IUndoRedoService),\n __param(5, ILanguageService),\n __param(6, ILanguageConfigurationService)\n], TextModel);\nexport { TextModel };\nfunction indentOfLine(line) {\n let indent = 0;\n for (const c of line) {\n if (c === ' ' || c === '\\t') {\n indent++;\n }\n else {\n break;\n }\n }\n return indent;\n}\n//#region Decorations\nfunction isNodeInOverviewRuler(node) {\n return (node.options.overviewRuler && node.options.overviewRuler.color ? true : false);\n}\nfunction isOptionsInjectedText(options) {\n return !!options.after || !!options.before;\n}\nfunction isNodeInjectedText(node) {\n return !!node.options.after || !!node.options.before;\n}\nclass DecorationsTrees {\n constructor() {\n this._decorationsTree0 = new IntervalTree();\n this._decorationsTree1 = new IntervalTree();\n this._injectedTextDecorationsTree = new IntervalTree();\n }\n ensureAllNodesHaveRanges(host) {\n this.getAll(host, 0, false, false, false);\n }\n _ensureNodesHaveRanges(host, nodes) {\n for (const node of nodes) {\n if (node.range === null) {\n node.range = host.getRangeAt(node.cachedAbsoluteStart, node.cachedAbsoluteEnd);\n }\n }\n return nodes;\n }\n getAllInInterval(host, start, end, filterOwnerId, filterOutValidation, onlyMarginDecorations) {\n const versionId = host.getVersionId();\n const result = this._intervalSearch(start, end, filterOwnerId, filterOutValidation, versionId, onlyMarginDecorations);\n return this._ensureNodesHaveRanges(host, result);\n }\n _intervalSearch(start, end, filterOwnerId, filterOutValidation, cachedVersionId, onlyMarginDecorations) {\n const r0 = this._decorationsTree0.intervalSearch(start, end, filterOwnerId, filterOutValidation, cachedVersionId, onlyMarginDecorations);\n const r1 = this._decorationsTree1.intervalSearch(start, end, filterOwnerId, filterOutValidation, cachedVersionId, onlyMarginDecorations);\n const r2 = this._injectedTextDecorationsTree.intervalSearch(start, end, filterOwnerId, filterOutValidation, cachedVersionId, onlyMarginDecorations);\n return r0.concat(r1).concat(r2);\n }\n getInjectedTextInInterval(host, start, end, filterOwnerId) {\n const versionId = host.getVersionId();\n const result = this._injectedTextDecorationsTree.intervalSearch(start, end, filterOwnerId, false, versionId, false);\n return this._ensureNodesHaveRanges(host, result).filter((i) => i.options.showIfCollapsed || !i.range.isEmpty());\n }\n getAllInjectedText(host, filterOwnerId) {\n const versionId = host.getVersionId();\n const result = this._injectedTextDecorationsTree.search(filterOwnerId, false, versionId, false);\n return this._ensureNodesHaveRanges(host, result).filter((i) => i.options.showIfCollapsed || !i.range.isEmpty());\n }\n getAll(host, filterOwnerId, filterOutValidation, overviewRulerOnly, onlyMarginDecorations) {\n const versionId = host.getVersionId();\n const result = this._search(filterOwnerId, filterOutValidation, overviewRulerOnly, versionId, onlyMarginDecorations);\n return this._ensureNodesHaveRanges(host, result);\n }\n _search(filterOwnerId, filterOutValidation, overviewRulerOnly, cachedVersionId, onlyMarginDecorations) {\n if (overviewRulerOnly) {\n return this._decorationsTree1.search(filterOwnerId, filterOutValidation, cachedVersionId, onlyMarginDecorations);\n }\n else {\n const r0 = this._decorationsTree0.search(filterOwnerId, filterOutValidation, cachedVersionId, onlyMarginDecorations);\n const r1 = this._decorationsTree1.search(filterOwnerId, filterOutValidation, cachedVersionId, onlyMarginDecorations);\n const r2 = this._injectedTextDecorationsTree.search(filterOwnerId, filterOutValidation, cachedVersionId, onlyMarginDecorations);\n return r0.concat(r1).concat(r2);\n }\n }\n collectNodesFromOwner(ownerId) {\n const r0 = this._decorationsTree0.collectNodesFromOwner(ownerId);\n const r1 = this._decorationsTree1.collectNodesFromOwner(ownerId);\n const r2 = this._injectedTextDecorationsTree.collectNodesFromOwner(ownerId);\n return r0.concat(r1).concat(r2);\n }\n collectNodesPostOrder() {\n const r0 = this._decorationsTree0.collectNodesPostOrder();\n const r1 = this._decorationsTree1.collectNodesPostOrder();\n const r2 = this._injectedTextDecorationsTree.collectNodesPostOrder();\n return r0.concat(r1).concat(r2);\n }\n insert(node) {\n if (isNodeInjectedText(node)) {\n this._injectedTextDecorationsTree.insert(node);\n }\n else if (isNodeInOverviewRuler(node)) {\n this._decorationsTree1.insert(node);\n }\n else {\n this._decorationsTree0.insert(node);\n }\n }\n delete(node) {\n if (isNodeInjectedText(node)) {\n this._injectedTextDecorationsTree.delete(node);\n }\n else if (isNodeInOverviewRuler(node)) {\n this._decorationsTree1.delete(node);\n }\n else {\n this._decorationsTree0.delete(node);\n }\n }\n getNodeRange(host, node) {\n const versionId = host.getVersionId();\n if (node.cachedVersionId !== versionId) {\n this._resolveNode(node, versionId);\n }\n if (node.range === null) {\n node.range = host.getRangeAt(node.cachedAbsoluteStart, node.cachedAbsoluteEnd);\n }\n return node.range;\n }\n _resolveNode(node, cachedVersionId) {\n if (isNodeInjectedText(node)) {\n this._injectedTextDecorationsTree.resolveNode(node, cachedVersionId);\n }\n else if (isNodeInOverviewRuler(node)) {\n this._decorationsTree1.resolveNode(node, cachedVersionId);\n }\n else {\n this._decorationsTree0.resolveNode(node, cachedVersionId);\n }\n }\n acceptReplace(offset, length, textLength, forceMoveMarkers) {\n this._decorationsTree0.acceptReplace(offset, length, textLength, forceMoveMarkers);\n this._decorationsTree1.acceptReplace(offset, length, textLength, forceMoveMarkers);\n this._injectedTextDecorationsTree.acceptReplace(offset, length, textLength, forceMoveMarkers);\n }\n}\nfunction cleanClassName(className) {\n return className.replace(/[^a-z0-9\\-_]/gi, ' ');\n}\nclass DecorationOptions {\n constructor(options) {\n this.color = options.color || '';\n this.darkColor = options.darkColor || '';\n }\n}\nexport class ModelDecorationOverviewRulerOptions extends DecorationOptions {\n constructor(options) {\n super(options);\n this._resolvedColor = null;\n this.position = (typeof options.position === 'number' ? options.position : model.OverviewRulerLane.Center);\n }\n getColor(theme) {\n if (!this._resolvedColor) {\n if (theme.type !== 'light' && this.darkColor) {\n this._resolvedColor = this._resolveColor(this.darkColor, theme);\n }\n else {\n this._resolvedColor = this._resolveColor(this.color, theme);\n }\n }\n return this._resolvedColor;\n }\n invalidateCachedColor() {\n this._resolvedColor = null;\n }\n _resolveColor(color, theme) {\n if (typeof color === 'string') {\n return color;\n }\n const c = color ? theme.getColor(color.id) : null;\n if (!c) {\n return '';\n }\n return c.toString();\n }\n}\nexport class ModelDecorationGlyphMarginOptions {\n constructor(options) {\n var _a;\n this.position = (_a = options === null || options === void 0 ? void 0 : options.position) !== null && _a !== void 0 ? _a : model.GlyphMarginLane.Center;\n this.persistLane = options === null || options === void 0 ? void 0 : options.persistLane;\n }\n}\nexport class ModelDecorationMinimapOptions extends DecorationOptions {\n constructor(options) {\n var _a, _b;\n super(options);\n this.position = options.position;\n this.sectionHeaderStyle = (_a = options.sectionHeaderStyle) !== null && _a !== void 0 ? _a : null;\n this.sectionHeaderText = (_b = options.sectionHeaderText) !== null && _b !== void 0 ? _b : null;\n }\n getColor(theme) {\n if (!this._resolvedColor) {\n if (theme.type !== 'light' && this.darkColor) {\n this._resolvedColor = this._resolveColor(this.darkColor, theme);\n }\n else {\n this._resolvedColor = this._resolveColor(this.color, theme);\n }\n }\n return this._resolvedColor;\n }\n invalidateCachedColor() {\n this._resolvedColor = undefined;\n }\n _resolveColor(color, theme) {\n if (typeof color === 'string') {\n return Color.fromHex(color);\n }\n return theme.getColor(color.id);\n }\n}\nexport class ModelDecorationInjectedTextOptions {\n static from(options) {\n if (options instanceof ModelDecorationInjectedTextOptions) {\n return options;\n }\n return new ModelDecorationInjectedTextOptions(options);\n }\n constructor(options) {\n this.content = options.content || '';\n this.inlineClassName = options.inlineClassName || null;\n this.inlineClassNameAffectsLetterSpacing = options.inlineClassNameAffectsLetterSpacing || false;\n this.attachedData = options.attachedData || null;\n this.cursorStops = options.cursorStops || null;\n }\n}\nexport class ModelDecorationOptions {\n static register(options) {\n return new ModelDecorationOptions(options);\n }\n static createDynamic(options) {\n return new ModelDecorationOptions(options);\n }\n constructor(options) {\n var _a, _b, _c, _d, _e, _f;\n this.description = options.description;\n this.blockClassName = options.blockClassName ? cleanClassName(options.blockClassName) : null;\n this.blockDoesNotCollapse = (_a = options.blockDoesNotCollapse) !== null && _a !== void 0 ? _a : null;\n this.blockIsAfterEnd = (_b = options.blockIsAfterEnd) !== null && _b !== void 0 ? _b : null;\n this.blockPadding = (_c = options.blockPadding) !== null && _c !== void 0 ? _c : null;\n this.stickiness = options.stickiness || 0 /* model.TrackedRangeStickiness.AlwaysGrowsWhenTypingAtEdges */;\n this.zIndex = options.zIndex || 0;\n this.className = options.className ? cleanClassName(options.className) : null;\n this.shouldFillLineOnLineBreak = (_d = options.shouldFillLineOnLineBreak) !== null && _d !== void 0 ? _d : null;\n this.hoverMessage = options.hoverMessage || null;\n this.glyphMarginHoverMessage = options.glyphMarginHoverMessage || null;\n this.lineNumberHoverMessage = options.lineNumberHoverMessage || null;\n this.isWholeLine = options.isWholeLine || false;\n this.showIfCollapsed = options.showIfCollapsed || false;\n this.collapseOnReplaceEdit = options.collapseOnReplaceEdit || false;\n this.overviewRuler = options.overviewRuler ? new ModelDecorationOverviewRulerOptions(options.overviewRuler) : null;\n this.minimap = options.minimap ? new ModelDecorationMinimapOptions(options.minimap) : null;\n this.glyphMargin = options.glyphMarginClassName ? new ModelDecorationGlyphMarginOptions(options.glyphMargin) : null;\n this.glyphMarginClassName = options.glyphMarginClassName ? cleanClassName(options.glyphMarginClassName) : null;\n this.linesDecorationsClassName = options.linesDecorationsClassName ? cleanClassName(options.linesDecorationsClassName) : null;\n this.lineNumberClassName = options.lineNumberClassName ? cleanClassName(options.lineNumberClassName) : null;\n this.linesDecorationsTooltip = options.linesDecorationsTooltip ? strings.htmlAttributeEncodeValue(options.linesDecorationsTooltip) : null;\n this.firstLineDecorationClassName = options.firstLineDecorationClassName ? cleanClassName(options.firstLineDecorationClassName) : null;\n this.marginClassName = options.marginClassName ? cleanClassName(options.marginClassName) : null;\n this.inlineClassName = options.inlineClassName ? cleanClassName(options.inlineClassName) : null;\n this.inlineClassNameAffectsLetterSpacing = options.inlineClassNameAffectsLetterSpacing || false;\n this.beforeContentClassName = options.beforeContentClassName ? cleanClassName(options.beforeContentClassName) : null;\n this.afterContentClassName = options.afterContentClassName ? cleanClassName(options.afterContentClassName) : null;\n this.after = options.after ? ModelDecorationInjectedTextOptions.from(options.after) : null;\n this.before = options.before ? ModelDecorationInjectedTextOptions.from(options.before) : null;\n this.hideInCommentTokens = (_e = options.hideInCommentTokens) !== null && _e !== void 0 ? _e : false;\n this.hideInStringTokens = (_f = options.hideInStringTokens) !== null && _f !== void 0 ? _f : false;\n }\n}\nModelDecorationOptions.EMPTY = ModelDecorationOptions.register({ description: 'empty' });\n/**\n * The order carefully matches the values of the enum.\n */\nconst TRACKED_RANGE_OPTIONS = [\n ModelDecorationOptions.register({ description: 'tracked-range-always-grows-when-typing-at-edges', stickiness: 0 /* model.TrackedRangeStickiness.AlwaysGrowsWhenTypingAtEdges */ }),\n ModelDecorationOptions.register({ description: 'tracked-range-never-grows-when-typing-at-edges', stickiness: 1 /* model.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges */ }),\n ModelDecorationOptions.register({ description: 'tracked-range-grows-only-when-typing-before', stickiness: 2 /* model.TrackedRangeStickiness.GrowsOnlyWhenTypingBefore */ }),\n ModelDecorationOptions.register({ description: 'tracked-range-grows-only-when-typing-after', stickiness: 3 /* model.TrackedRangeStickiness.GrowsOnlyWhenTypingAfter */ }),\n];\nfunction _normalizeOptions(options) {\n if (options instanceof ModelDecorationOptions) {\n return options;\n }\n return ModelDecorationOptions.createDynamic(options);\n}\nclass DidChangeDecorationsEmitter extends Disposable {\n constructor(handleBeforeFire) {\n super();\n this.handleBeforeFire = handleBeforeFire;\n this._actual = this._register(new Emitter());\n this.event = this._actual.event;\n this._affectedInjectedTextLines = null;\n this._deferredCnt = 0;\n this._shouldFireDeferred = false;\n this._affectsMinimap = false;\n this._affectsOverviewRuler = false;\n this._affectsGlyphMargin = false;\n this._affectsLineNumber = false;\n }\n beginDeferredEmit() {\n this._deferredCnt++;\n }\n endDeferredEmit() {\n var _a;\n this._deferredCnt--;\n if (this._deferredCnt === 0) {\n if (this._shouldFireDeferred) {\n this.doFire();\n }\n (_a = this._affectedInjectedTextLines) === null || _a === void 0 ? void 0 : _a.clear();\n this._affectedInjectedTextLines = null;\n }\n }\n recordLineAffectedByInjectedText(lineNumber) {\n if (!this._affectedInjectedTextLines) {\n this._affectedInjectedTextLines = new Set();\n }\n this._affectedInjectedTextLines.add(lineNumber);\n }\n checkAffectedAndFire(options) {\n var _a, _b;\n this._affectsMinimap || (this._affectsMinimap = !!((_a = options.minimap) === null || _a === void 0 ? void 0 : _a.position));\n this._affectsOverviewRuler || (this._affectsOverviewRuler = !!((_b = options.overviewRuler) === null || _b === void 0 ? void 0 : _b.color));\n this._affectsGlyphMargin || (this._affectsGlyphMargin = !!options.glyphMarginClassName);\n this._affectsLineNumber || (this._affectsLineNumber = !!options.lineNumberClassName);\n this.tryFire();\n }\n fire() {\n this._affectsMinimap = true;\n this._affectsOverviewRuler = true;\n this._affectsGlyphMargin = true;\n this.tryFire();\n }\n tryFire() {\n if (this._deferredCnt === 0) {\n this.doFire();\n }\n else {\n this._shouldFireDeferred = true;\n }\n }\n doFire() {\n this.handleBeforeFire(this._affectedInjectedTextLines);\n const event = {\n affectsMinimap: this._affectsMinimap,\n affectsOverviewRuler: this._affectsOverviewRuler,\n affectsGlyphMargin: this._affectsGlyphMargin,\n affectsLineNumber: this._affectsLineNumber,\n };\n this._shouldFireDeferred = false;\n this._affectsMinimap = false;\n this._affectsOverviewRuler = false;\n this._affectsGlyphMargin = false;\n this._actual.fire(event);\n }\n}\n//#endregion\nclass DidChangeContentEmitter extends Disposable {\n constructor() {\n super();\n /**\n * Both `fastEvent` and `slowEvent` work the same way and contain the same events, but first we invoke `fastEvent` and then `slowEvent`.\n */\n this._fastEmitter = this._register(new Emitter());\n this.fastEvent = this._fastEmitter.event;\n this._slowEmitter = this._register(new Emitter());\n this.slowEvent = this._slowEmitter.event;\n this._deferredCnt = 0;\n this._deferredEvent = null;\n }\n beginDeferredEmit() {\n this._deferredCnt++;\n }\n endDeferredEmit(resultingSelection = null) {\n this._deferredCnt--;\n if (this._deferredCnt === 0) {\n if (this._deferredEvent !== null) {\n this._deferredEvent.rawContentChangedEvent.resultingSelection = resultingSelection;\n const e = this._deferredEvent;\n this._deferredEvent = null;\n this._fastEmitter.fire(e);\n this._slowEmitter.fire(e);\n }\n }\n }\n fire(e) {\n if (this._deferredCnt > 0) {\n if (this._deferredEvent) {\n this._deferredEvent = this._deferredEvent.merge(e);\n }\n else {\n this._deferredEvent = e;\n }\n return;\n }\n this._fastEmitter.fire(e);\n this._slowEmitter.fire(e);\n }\n}\n/**\n * @internal\n */\nexport class AttachedViews {\n constructor() {\n this._onDidChangeVisibleRanges = new Emitter();\n this.onDidChangeVisibleRanges = this._onDidChangeVisibleRanges.event;\n this._views = new Set();\n }\n attachView() {\n const view = new AttachedViewImpl((state) => {\n this._onDidChangeVisibleRanges.fire({ view, state });\n });\n this._views.add(view);\n return view;\n }\n detachView(view) {\n this._views.delete(view);\n this._onDidChangeVisibleRanges.fire({ view, state: undefined });\n }\n}\nclass AttachedViewImpl {\n constructor(handleStateChange) {\n this.handleStateChange = handleStateChange;\n }\n setVisibleLines(visibleLines, stabilized) {\n const visibleLineRanges = visibleLines.map((line) => new LineRange(line.startLineNumber, line.endLineNumber + 1));\n this.handleStateChange({ visibleLineRanges, stabilized });\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 *--------------------------------------------------------------------------------------------*/\nexport function clamp(value, min, max) {\n return Math.min(Math.max(value, min), max);\n}\nexport class MovingAverage {\n constructor() {\n this._n = 1;\n this._val = 0;\n }\n update(value) {\n this._val = this._val + (value - this._val) / this._n;\n this._n += 1;\n return this._val;\n }\n get value() {\n return this._val;\n }\n}\nexport class SlidingWindowAverage {\n constructor(size) {\n this._n = 0;\n this._val = 0;\n this._values = [];\n this._index = 0;\n this._sum = 0;\n this._values = new Array(size);\n this._values.fill(0, 0, size);\n }\n update(value) {\n const oldValue = this._values[this._index];\n this._values[this._index] = value;\n this._index = (this._index + 1) % this._values.length;\n this._sum -= oldValue;\n this._sum += value;\n if (this._n < this._values.length) {\n this._n += 1;\n }\n this._val = this._sum / this._n;\n return this._val;\n }\n get value() {\n return this._val;\n }\n}\n", "import { createDecorator } from '../../instantiation/common/instantiation.js';\nexport const IEnvironmentService = createDecorator('environmentService');\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};\nimport { doHash } from '../../../base/common/hash.js';\nimport { LRUCache } from '../../../base/common/map.js';\nimport { clamp, MovingAverage, SlidingWindowAverage } from '../../../base/common/numbers.js';\nimport { IEnvironmentService } from '../../../platform/environment/common/environment.js';\nimport { registerSingleton } from '../../../platform/instantiation/common/extensions.js';\nimport { createDecorator } from '../../../platform/instantiation/common/instantiation.js';\nimport { ILogService } from '../../../platform/log/common/log.js';\nimport { matchesScheme } from '../../../base/common/network.js';\nexport const ILanguageFeatureDebounceService = createDecorator('ILanguageFeatureDebounceService');\nvar IdentityHash;\n(function (IdentityHash) {\n const _hashes = new WeakMap();\n let pool = 0;\n function of(obj) {\n let value = _hashes.get(obj);\n if (value === undefined) {\n value = ++pool;\n _hashes.set(obj, value);\n }\n return value;\n }\n IdentityHash.of = of;\n})(IdentityHash || (IdentityHash = {}));\nclass NullDebounceInformation {\n constructor(_default) {\n this._default = _default;\n }\n get(_model) {\n return this._default;\n }\n update(_model, _value) {\n return this._default;\n }\n default() {\n return this._default;\n }\n}\nclass FeatureDebounceInformation {\n constructor(_logService, _name, _registry, _default, _min, _max) {\n this._logService = _logService;\n this._name = _name;\n this._registry = _registry;\n this._default = _default;\n this._min = _min;\n this._max = _max;\n this._cache = new LRUCache(50, 0.7);\n }\n _key(model) {\n return model.id + this._registry.all(model).reduce((hashVal, obj) => doHash(IdentityHash.of(obj), hashVal), 0);\n }\n get(model) {\n const key = this._key(model);\n const avg = this._cache.get(key);\n return avg\n ? clamp(avg.value, this._min, this._max)\n : this.default();\n }\n update(model, value) {\n const key = this._key(model);\n let avg = this._cache.get(key);\n if (!avg) {\n avg = new SlidingWindowAverage(6);\n this._cache.set(key, avg);\n }\n const newValue = clamp(avg.update(value), this._min, this._max);\n if (!matchesScheme(model.uri, 'output')) {\n this._logService.trace(`[DEBOUNCE: ${this._name}] for ${model.uri.toString()} is ${newValue}ms`);\n }\n return newValue;\n }\n _overall() {\n const result = new MovingAverage();\n for (const [, avg] of this._cache) {\n result.update(avg.value);\n }\n return result.value;\n }\n default() {\n const value = (this._overall() | 0) || this._default;\n return clamp(value, this._min, this._max);\n }\n}\nlet LanguageFeatureDebounceService = class LanguageFeatureDebounceService {\n constructor(_logService, envService) {\n this._logService = _logService;\n this._data = new Map();\n this._isDev = envService.isExtensionDevelopment || !envService.isBuilt;\n }\n for(feature, name, config) {\n var _a, _b, _c;\n const min = (_a = config === null || config === void 0 ? void 0 : config.min) !== null && _a !== void 0 ? _a : 50;\n const max = (_b = config === null || config === void 0 ? void 0 : config.max) !== null && _b !== void 0 ? _b : min ** 2;\n const extra = (_c = config === null || config === void 0 ? void 0 : config.key) !== null && _c !== void 0 ? _c : undefined;\n const key = `${IdentityHash.of(feature)},${min}${extra ? ',' + extra : ''}`;\n let info = this._data.get(key);\n if (!info) {\n if (this._isDev) {\n this._logService.debug(`[DEBOUNCE: ${name}] is disabled in developed mode`);\n info = new NullDebounceInformation(min * 1.5);\n }\n else {\n info = new FeatureDebounceInformation(this._logService, name, feature, (this._overallAverage() | 0) || (min * 1.5), // default is overall default or derived from min-value\n min, max);\n }\n this._data.set(key, info);\n }\n return info;\n }\n _overallAverage() {\n // Average of all language features. Not a great value but an approximation\n const result = new MovingAverage();\n for (const info of this._data.values()) {\n result.update(info.default());\n }\n return result.value;\n }\n};\nLanguageFeatureDebounceService = __decorate([\n __param(0, ILogService),\n __param(1, IEnvironmentService)\n], LanguageFeatureDebounceService);\nexport { LanguageFeatureDebounceService };\nregisterSingleton(ILanguageFeatureDebounceService, LanguageFeatureDebounceService, 1 /* 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 *--------------------------------------------------------------------------------------------*/\nimport * as dom from '../../dom.js';\nimport { ThemeIcon } from '../../../common/themables.js';\nconst labelWithIconsRegex = new RegExp(`(\\\\\\\\)?\\\\$\\\\((${ThemeIcon.iconNameExpression}(?:${ThemeIcon.iconModifierExpression})?)\\\\)`, 'g');\nexport function renderLabelWithIcons(text) {\n const elements = new Array();\n let match;\n let textStart = 0, textStop = 0;\n while ((match = labelWithIconsRegex.exec(text)) !== null) {\n textStop = match.index || 0;\n if (textStart < textStop) {\n elements.push(text.substring(textStart, textStop));\n }\n textStart = (match.index || 0) + match[0].length;\n const [, escaped, codicon] = match;\n elements.push(escaped ? `$(${codicon})` : renderIcon({ id: codicon }));\n }\n if (textStart < text.length) {\n elements.push(text.substring(textStart));\n }\n return elements;\n}\nexport function renderIcon(icon) {\n const node = dom.$(`span`);\n node.classList.add(...ThemeIcon.asClassNameArray(icon));\n return 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// allow-any-unicode-comment-file\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) {\n const result = disassembleKorean(code);\n if (result && result.length > 0) {\n return new Uint32Array(result);\n }\n return undefined;\n}\nlet codeBufferLength = 0;\nconst codeBuffer = new Uint32Array(10);\nfunction disassembleKorean(code) {\n codeBufferLength = 0;\n // Initial consonants (\uCD08\uC131)\n getCodesFromArray(code, modernConsonants, 4352 /* HangulRangeStartCode.InitialConsonant */);\n if (codeBufferLength > 0) {\n return codeBuffer.subarray(0, codeBufferLength);\n }\n // Vowels (\uC911\uC131)\n getCodesFromArray(code, modernVowels, 4449 /* HangulRangeStartCode.Vowel */);\n if (codeBufferLength > 0) {\n return codeBuffer.subarray(0, codeBufferLength);\n }\n // Final consonants (\uC885\uC131)\n getCodesFromArray(code, modernFinalConsonants, 4520 /* HangulRangeStartCode.FinalConsonant */);\n if (codeBufferLength > 0) {\n return codeBuffer.subarray(0, codeBufferLength);\n }\n // Hangul Compatibility Jamo\n getCodesFromArray(code, compatibilityJamo, 12593 /* HangulRangeStartCode.CompatibilityJamo */);\n if (codeBufferLength) {\n return codeBuffer.subarray(0, codeBufferLength);\n }\n // Hangul Syllables\n if (code >= 0xAC00 && code <= 0xD7A3) {\n const hangulIndex = code - 0xAC00;\n const vowelAndFinalConsonantProduct = hangulIndex % 588;\n // 0-based starting at 0x1100\n const initialConsonantIndex = Math.floor(hangulIndex / 588);\n // 0-based starting at 0x1161\n const vowelIndex = Math.floor(vowelAndFinalConsonantProduct / 28);\n // 0-based starting at 0x11A8\n // Subtract 1 as the standard algorithm uses the 0 index to represent no\n // final consonant\n const finalConsonantIndex = vowelAndFinalConsonantProduct % 28 - 1;\n if (initialConsonantIndex < modernConsonants.length) {\n getCodesFromArray(initialConsonantIndex, modernConsonants, 0);\n }\n else if (4352 /* HangulRangeStartCode.InitialConsonant */ + initialConsonantIndex - 12593 /* HangulRangeStartCode.CompatibilityJamo */ < compatibilityJamo.length) {\n getCodesFromArray(4352 /* HangulRangeStartCode.InitialConsonant */ + initialConsonantIndex, compatibilityJamo, 12593 /* HangulRangeStartCode.CompatibilityJamo */);\n }\n if (vowelIndex < modernVowels.length) {\n getCodesFromArray(vowelIndex, modernVowels, 0);\n }\n else if (4449 /* HangulRangeStartCode.Vowel */ + vowelIndex - 12593 /* HangulRangeStartCode.CompatibilityJamo */ < compatibilityJamo.length) {\n getCodesFromArray(4449 /* HangulRangeStartCode.Vowel */ + vowelIndex - 12593 /* HangulRangeStartCode.CompatibilityJamo */, compatibilityJamo, 12593 /* HangulRangeStartCode.CompatibilityJamo */);\n }\n if (finalConsonantIndex >= 0) {\n if (finalConsonantIndex < modernFinalConsonants.length) {\n getCodesFromArray(finalConsonantIndex, modernFinalConsonants, 0);\n }\n else if (4520 /* HangulRangeStartCode.FinalConsonant */ + finalConsonantIndex - 12593 /* HangulRangeStartCode.CompatibilityJamo */ < compatibilityJamo.length) {\n getCodesFromArray(4520 /* HangulRangeStartCode.FinalConsonant */ + finalConsonantIndex - 12593 /* HangulRangeStartCode.CompatibilityJamo */, compatibilityJamo, 12593 /* HangulRangeStartCode.CompatibilityJamo */);\n }\n }\n if (codeBufferLength > 0) {\n return codeBuffer.subarray(0, codeBufferLength);\n }\n }\n return undefined;\n}\nfunction getCodesFromArray(code, array, arrayStartIndex) {\n // Verify the code is within the array's range\n if (code >= arrayStartIndex && code < arrayStartIndex + array.length) {\n addCodesToBuffer(array[code - arrayStartIndex]);\n }\n}\nfunction addCodesToBuffer(codes) {\n // NUL is ignored, this is used for archaic characters to avoid using a Map\n // for the data\n if (codes === 0 /* AsciiCode.NUL */) {\n return;\n }\n // Number stored in format: OptionalThirdCode << 16 | OptionalSecondCode << 8 | Code\n codeBuffer[codeBufferLength++] = codes & 0xFF;\n if (codes >> 8) {\n codeBuffer[codeBufferLength++] = (codes >> 8) & 0xFF;\n }\n if (codes >> 16) {\n codeBuffer[codeBufferLength++] = (codes >> 16) & 0xFF;\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 | \u1100 | \u1101 | \u1102 | \u1103 | \u1104 | \u1105 | \u1106 | \u1107 | \u1108 | \u1109 | \u110A | \u110B | \u110C | \u110D | \u110E | \u110F |\n * | U+111x | \u1110 | \u1111 | \u1112 |\n */\nconst modernConsonants = new Uint8Array([\n 114 /* AsciiCode.r */, // \u3131\n 82 /* AsciiCode.R */, // \u3132\n 115 /* AsciiCode.s */, // \u3134\n 101 /* AsciiCode.e */, // \u3137\n 69 /* AsciiCode.E */, // \u3138\n 102 /* AsciiCode.f */, // \u3139\n 97 /* AsciiCode.a */, // \u3141\n 113 /* AsciiCode.q */, // \u3142\n 81 /* AsciiCode.Q */, // \u3143\n 116 /* AsciiCode.t */, // \u3145\n 84 /* AsciiCode.T */, // \u3146\n 100 /* AsciiCode.d */, // \u3147\n 119 /* AsciiCode.w */, // \u3148\n 87 /* AsciiCode.W */, // \u3149\n 99 /* AsciiCode.c */, // \u314A\n 122 /* AsciiCode.z */, // \u314B\n 120 /* AsciiCode.x */, // \u314C\n 118 /* AsciiCode.v */, // \u314D\n 103 /* AsciiCode.g */, // \u314E\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 | | \u1161 | \u1162 | \u1163 | \u1164 | \u1165 | \u1166 | \u1167 | \u1168 | \u1169 | \u116A | \u116B | \u116C | \u116D | \u116E | \u116F |\n * | U+117x | \u1170 | \u1171 | \u1172 | \u1173 | \u1174 | \u1175 |\n */\nconst modernVowels = new Uint16Array([\n 107 /* AsciiCode.k */, // -> \u314F\n 111 /* AsciiCode.o */, // -> \u3150\n 105 /* AsciiCode.i */, // -> \u3151\n 79 /* AsciiCode.O */, // -> \u3152\n 106 /* AsciiCode.j */, // -> \u3153\n 112 /* AsciiCode.p */, // -> \u3154\n 117 /* AsciiCode.u */, // -> \u3155\n 80 /* AsciiCode.P */, // -> \u3156\n 104 /* AsciiCode.h */, // -> \u3157\n 27496 /* AsciiCodeCombo.hk */, // -> \u3158\n 28520 /* AsciiCodeCombo.ho */, // -> \u3159\n 27752 /* AsciiCodeCombo.hl */, // -> \u315A\n 121 /* AsciiCode.y */, // -> \u315B\n 110 /* AsciiCode.n */, // -> \u315C\n 27246 /* AsciiCodeCombo.nj */, // -> \u315D\n 28782 /* AsciiCodeCombo.np */, // -> \u315E\n 27758 /* AsciiCodeCombo.nl */, // -> \u315F\n 98 /* AsciiCode.b */, // -> \u3160\n 109 /* AsciiCode.m */, // -> \u3161\n 27757 /* AsciiCodeCombo.ml */, // -> \u3162\n 108 /* AsciiCode.l */, // -> \u3163\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 | | | | | | | | | \u11A8 | \u11A9 | \u11AA | \u11AB | \u11AC | \u11AD | \u11AE | \u11AF |\n * | U+11Bx | \u11B0 | \u11B1 | \u11B2 | \u11B3 | \u11B4 | \u11B5 | \u11B6 | \u11B7 | \u11B8 | \u11B9 | \u11BA | \u11BB | \u11BC | \u11BD | \u11BE | \u11BF |\n * | U+11Cx | \u11C0 | \u11C1 | \u11C2 |\n */\nconst modernFinalConsonants = new Uint16Array([\n 114 /* AsciiCode.r */, // \u3131\n 82 /* AsciiCode.R */, // \u3132\n 29810 /* AsciiCodeCombo.rt */, // \u3133\n 115 /* AsciiCode.s */, // \u3134\n 30579 /* AsciiCodeCombo.sw */, // \u3135\n 26483 /* AsciiCodeCombo.sg */, // \u3136\n 101 /* AsciiCode.e */, // \u3137\n 102 /* AsciiCode.f */, // \u3139\n 29286 /* AsciiCodeCombo.fr */, // \u313A\n 24934 /* AsciiCodeCombo.fa */, // \u313B\n 29030 /* AsciiCodeCombo.fq */, // \u313C\n 29798 /* AsciiCodeCombo.ft */, // \u313D\n 30822 /* AsciiCodeCombo.fx */, // \u313E\n 30310 /* AsciiCodeCombo.fv */, // \u313F\n 26470 /* AsciiCodeCombo.fg */, // \u3140\n 97 /* AsciiCode.a */, // \u3141\n 113 /* AsciiCode.q */, // \u3142\n 29809 /* AsciiCodeCombo.qt */, // \u3144\n 116 /* AsciiCode.t */, // \u3145\n 84 /* AsciiCode.T */, // \u3146\n 100 /* AsciiCode.d */, // \u3147\n 119 /* AsciiCode.w */, // \u3148\n 99 /* AsciiCode.c */, // \u314A\n 122 /* AsciiCode.z */, // \u314B\n 120 /* AsciiCode.x */, // \u314C\n 118 /* AsciiCode.v */, // \u314D\n 103 /* AsciiCode.g */, // \u314E\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 | | \u3131 | \u3132 | \u3133 | \u3134 | \u3135 | \u3136 | \u3137 | \u3138 | \u3139 | \u313A | \u313B | \u313C | \u313D | \u313E | \u313F |\n * | U+314x | \u3140 | \u3141 | \u3142 | \u3143 | \u3144 | \u3145 | \u3146 | \u3147 | \u3148 | \u3149 | \u314A | \u314B | \u314C | \u314D | \u314E | \u314F |\n * | U+315x | \u3150 | \u3151 | \u3152 | \u3153 | \u3154 | \u3155 | \u3156 | \u3157 | \u3158 | \u3159 | \u315A | \u315B | \u315C | \u315D | \u315E | \u315F |\n * | U+316x | \u3160 | \u3161 | \u3162 | \u3163 | HF | \u3165 | \u3166 | \u3167 | \u3168 | \u3169 | \u316A | \u316B | \u316C | \u316D | \u316E | \u316F |\n * | U+317x | \u3170 | \u3171 | \u3172 | \u3173 | \u3174 | \u3175 | \u3176 | \u3177 | \u3178 | \u3179 | \u317A | \u317B | \u317C | \u317D | \u317E | \u317F |\n * | U+318x | \u3180 | \u3181 | \u3182 | \u3183 | \u3184 | \u3185 | \u3186 | \u3187 | \u3188 | \u3189 | \u318A | \u318B | \u318C | \u318D | \u318E |\n */\nconst compatibilityJamo = new Uint16Array([\n 114 /* AsciiCode.r */, // \u3131\n 82 /* AsciiCode.R */, // \u3132\n 29810 /* AsciiCodeCombo.rt */, // \u3133\n 115 /* AsciiCode.s */, // \u3134\n 30579 /* AsciiCodeCombo.sw */, // \u3135\n 26483 /* AsciiCodeCombo.sg */, // \u3136\n 101 /* AsciiCode.e */, // \u3137\n 69 /* AsciiCode.E */, // \u3138\n 102 /* AsciiCode.f */, // \u3139\n 29286 /* AsciiCodeCombo.fr */, // \u313A\n 24934 /* AsciiCodeCombo.fa */, // \u313B\n 29030 /* AsciiCodeCombo.fq */, // \u313C\n 29798 /* AsciiCodeCombo.ft */, // \u313D\n 30822 /* AsciiCodeCombo.fx */, // \u313E\n 30310 /* AsciiCodeCombo.fv */, // \u313F\n 26470 /* AsciiCodeCombo.fg */, // \u3140\n 97 /* AsciiCode.a */, // \u3141\n 113 /* AsciiCode.q */, // \u3142\n 81 /* AsciiCode.Q */, // \u3143\n 29809 /* AsciiCodeCombo.qt */, // \u3144\n 116 /* AsciiCode.t */, // \u3145\n 84 /* AsciiCode.T */, // \u3146\n 100 /* AsciiCode.d */, // \u3147\n 119 /* AsciiCode.w */, // \u3148\n 87 /* AsciiCode.W */, // \u3149\n 99 /* AsciiCode.c */, // \u314A\n 122 /* AsciiCode.z */, // \u314B\n 120 /* AsciiCode.x */, // \u314C\n 118 /* AsciiCode.v */, // \u314D\n 103 /* AsciiCode.g */, // \u314E\n 107 /* AsciiCode.k */, // \u314F\n 111 /* AsciiCode.o */, // \u3150\n 105 /* AsciiCode.i */, // \u3151\n 79 /* AsciiCode.O */, // \u3152\n 106 /* AsciiCode.j */, // \u3153\n 112 /* AsciiCode.p */, // \u3154\n 117 /* AsciiCode.u */, // \u3155\n 80 /* AsciiCode.P */, // \u3156\n 104 /* AsciiCode.h */, // \u3157\n 27496 /* AsciiCodeCombo.hk */, // \u3158\n 28520 /* AsciiCodeCombo.ho */, // \u3159\n 27752 /* AsciiCodeCombo.hl */, // \u315A\n 121 /* AsciiCode.y */, // \u315B\n 110 /* AsciiCode.n */, // \u315C\n 27246 /* AsciiCodeCombo.nj */, // \u315D\n 28782 /* AsciiCodeCombo.np */, // \u315E\n 27758 /* AsciiCodeCombo.nl */, // \u315F\n 98 /* AsciiCode.b */, // \u3160\n 109 /* AsciiCode.m */, // \u3161\n 27757 /* AsciiCodeCombo.ml */, // \u3162\n 108 /* AsciiCode.l */, // \u3163\n // HF: Hangul Filler (everything after this is archaic)\n // \u3165\n // \u3166\n // \u3167\n // \u3168\n // \u3169\n // \u316A\n // \u316B\n // \u316C\n // \u316E\n // \u316F\n // \u3170\n // \u3171\n // \u3172\n // \u3173\n // \u3174\n // \u3175\n // \u3176\n // \u3177\n // \u3178\n // \u3179\n // \u317A\n // \u317B\n // \u317C\n // \u317D\n // \u317E\n // \u317F\n // \u3180\n // \u3181\n // \u3182\n // \u3183\n // \u3184\n // \u3185\n // \u3186\n // \u3187\n // \u3188\n // \u3189\n // \u318A\n // \u318B\n // \u318C\n // \u318D\n // \u318E\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 { LRUCache } from './map.js';\nimport { getKoreanAltChars } from './naturalLanguage/korean.js';\nimport * as strings from './strings.js';\n// Combined filters\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) {\n return function (word, wordToMatchAgainst) {\n for (let i = 0, len = filter.length; i < len; i++) {\n const match = filter[i](word, wordToMatchAgainst);\n if (match) {\n return match;\n }\n }\n return null;\n };\n}\n// Prefix\nexport const matchesStrictPrefix = _matchesPrefix.bind(undefined, false);\nexport const matchesPrefix = _matchesPrefix.bind(undefined, true);\nfunction _matchesPrefix(ignoreCase, word, wordToMatchAgainst) {\n if (!wordToMatchAgainst || wordToMatchAgainst.length < word.length) {\n return null;\n }\n let matches;\n if (ignoreCase) {\n matches = strings.startsWithIgnoreCase(wordToMatchAgainst, word);\n }\n else {\n matches = wordToMatchAgainst.indexOf(word) === 0;\n }\n if (!matches) {\n return null;\n }\n return word.length > 0 ? [{ start: 0, end: word.length }] : [];\n}\n// Contiguous Substring\nexport function matchesContiguousSubString(word, wordToMatchAgainst) {\n const index = wordToMatchAgainst.toLowerCase().indexOf(word.toLowerCase());\n if (index === -1) {\n return null;\n }\n return [{ start: index, end: index + word.length }];\n}\n// Substring\nexport function matchesSubString(word, wordToMatchAgainst) {\n return _matchesSubString(word.toLowerCase(), wordToMatchAgainst.toLowerCase(), 0, 0);\n}\nfunction _matchesSubString(word, wordToMatchAgainst, i, j) {\n if (i === word.length) {\n return [];\n }\n else if (j === wordToMatchAgainst.length) {\n return null;\n }\n else {\n if (word[i] === wordToMatchAgainst[j]) {\n let result = null;\n if (result = _matchesSubString(word, wordToMatchAgainst, i + 1, j + 1)) {\n return join({ start: j, end: j + 1 }, result);\n }\n return null;\n }\n return _matchesSubString(word, wordToMatchAgainst, i, j + 1);\n }\n}\n// CamelCase\nfunction isLower(code) {\n return 97 /* CharCode.a */ <= code && code <= 122 /* CharCode.z */;\n}\nexport function isUpper(code) {\n return 65 /* CharCode.A */ <= code && code <= 90 /* CharCode.Z */;\n}\nfunction isNumber(code) {\n return 48 /* CharCode.Digit0 */ <= code && code <= 57 /* CharCode.Digit9 */;\n}\nfunction isWhitespace(code) {\n return (code === 32 /* CharCode.Space */\n || code === 9 /* CharCode.Tab */\n || code === 10 /* CharCode.LineFeed */\n || code === 13 /* CharCode.CarriageReturn */);\n}\nconst wordSeparators = new Set();\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 .split('')\n .forEach(s => wordSeparators.add(s.charCodeAt(0)));\nfunction isWordSeparator(code) {\n return isWhitespace(code) || wordSeparators.has(code);\n}\nfunction charactersMatch(codeA, codeB) {\n return (codeA === codeB) || (isWordSeparator(codeA) && isWordSeparator(codeB));\n}\nconst alternateCharsCache = 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) {\n if (alternateCharsCache.has(code)) {\n return alternateCharsCache.get(code);\n }\n // NOTE: This function is written in such a way that it can be extended in\n // the future, but right now the return type takes into account it's only\n // supported by a single \"alt codes provider\".\n // `ArrayLike>` is a more appropriate type if changed.\n let result;\n const codes = getKoreanAltChars(code);\n if (codes) {\n result = codes;\n }\n alternateCharsCache.set(code, result);\n return result;\n}\nfunction isAlphanumeric(code) {\n return isLower(code) || isUpper(code) || isNumber(code);\n}\nfunction join(head, tail) {\n if (tail.length === 0) {\n tail = [head];\n }\n else if (head.end === tail[0].start) {\n tail[0].start = head.start;\n }\n else {\n tail.unshift(head);\n }\n return tail;\n}\nfunction nextAnchor(camelCaseWord, start) {\n for (let i = start; i < camelCaseWord.length; i++) {\n const c = camelCaseWord.charCodeAt(i);\n if (isUpper(c) || isNumber(c) || (i > 0 && !isAlphanumeric(camelCaseWord.charCodeAt(i - 1)))) {\n return i;\n }\n }\n return camelCaseWord.length;\n}\nfunction _matchesCamelCase(word, camelCaseWord, i, j) {\n if (i === word.length) {\n return [];\n }\n else if (j === camelCaseWord.length) {\n return null;\n }\n else if (word[i] !== camelCaseWord[j].toLowerCase()) {\n return null;\n }\n else {\n let result = null;\n let nextUpperIndex = j + 1;\n result = _matchesCamelCase(word, camelCaseWord, i + 1, j + 1);\n while (!result && (nextUpperIndex = nextAnchor(camelCaseWord, nextUpperIndex)) < camelCaseWord.length) {\n result = _matchesCamelCase(word, camelCaseWord, i + 1, nextUpperIndex);\n nextUpperIndex++;\n }\n return result === null ? null : join({ start: j, end: j + 1 }, result);\n }\n}\n// Heuristic to avoid computing camel case matcher for words that don't\n// look like camelCaseWords.\nfunction analyzeCamelCaseWord(word) {\n let upper = 0, lower = 0, alpha = 0, numeric = 0, code = 0;\n for (let i = 0; i < word.length; i++) {\n code = word.charCodeAt(i);\n if (isUpper(code)) {\n upper++;\n }\n if (isLower(code)) {\n lower++;\n }\n if (isAlphanumeric(code)) {\n alpha++;\n }\n if (isNumber(code)) {\n numeric++;\n }\n }\n const upperPercent = upper / word.length;\n const lowerPercent = lower / word.length;\n const alphaPercent = alpha / word.length;\n const numericPercent = numeric / word.length;\n return { upperPercent, lowerPercent, alphaPercent, numericPercent };\n}\nfunction isUpperCaseWord(analysis) {\n const { upperPercent, lowerPercent } = analysis;\n return lowerPercent === 0 && upperPercent > 0.6;\n}\nfunction isCamelCaseWord(analysis) {\n const { upperPercent, lowerPercent, alphaPercent, numericPercent } = analysis;\n return lowerPercent > 0.2 && upperPercent < 0.8 && alphaPercent > 0.6 && numericPercent < 0.2;\n}\n// Heuristic to avoid computing camel case matcher for words that don't\n// look like camel case patterns.\nfunction isCamelCasePattern(word) {\n let upper = 0, lower = 0, code = 0, whitespace = 0;\n for (let i = 0; i < word.length; i++) {\n code = word.charCodeAt(i);\n if (isUpper(code)) {\n upper++;\n }\n if (isLower(code)) {\n lower++;\n }\n if (isWhitespace(code)) {\n whitespace++;\n }\n }\n if ((upper === 0 || lower === 0) && whitespace === 0) {\n return word.length <= 30;\n }\n else {\n return upper <= 5;\n }\n}\nexport function matchesCamelCase(word, camelCaseWord) {\n if (!camelCaseWord) {\n return null;\n }\n camelCaseWord = camelCaseWord.trim();\n if (camelCaseWord.length === 0) {\n return null;\n }\n if (!isCamelCasePattern(word)) {\n return null;\n }\n // TODO: Consider removing this check\n if (camelCaseWord.length > 60) {\n camelCaseWord = camelCaseWord.substring(0, 60);\n }\n const analysis = analyzeCamelCaseWord(camelCaseWord);\n if (!isCamelCaseWord(analysis)) {\n if (!isUpperCaseWord(analysis)) {\n return null;\n }\n camelCaseWord = camelCaseWord.toLowerCase();\n }\n let result = null;\n let i = 0;\n word = word.toLowerCase();\n while (i < camelCaseWord.length && (result = _matchesCamelCase(word, camelCaseWord, 0, i)) === null) {\n i = nextAnchor(camelCaseWord, i + 1);\n }\n return result;\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)\nexport function matchesWords(word, target, contiguous = false) {\n if (!target || target.length === 0) {\n return null;\n }\n let result = null;\n let targetIndex = 0;\n word = word.toLowerCase();\n target = target.toLowerCase();\n while (targetIndex < target.length) {\n result = _matchesWords(word, target, 0, targetIndex, contiguous);\n if (result !== null) {\n break;\n }\n targetIndex = nextWord(target, targetIndex + 1);\n }\n return result;\n}\nfunction _matchesWords(word, target, wordIndex, targetIndex, contiguous) {\n let targetIndexOffset = 0;\n if (wordIndex === word.length) {\n return [];\n }\n else if (targetIndex === target.length) {\n return null;\n }\n else if (!charactersMatch(word.charCodeAt(wordIndex), target.charCodeAt(targetIndex))) {\n // Verify alternate characters before exiting\n const altChars = getAlternateCodes(word.charCodeAt(wordIndex));\n if (!altChars) {\n return null;\n }\n for (let k = 0; k < altChars.length; k++) {\n if (!charactersMatch(altChars[k], target.charCodeAt(targetIndex + k))) {\n return null;\n }\n }\n targetIndexOffset += altChars.length - 1;\n }\n let result = null;\n let nextWordIndex = targetIndex + targetIndexOffset + 1;\n result = _matchesWords(word, target, wordIndex + 1, nextWordIndex, contiguous);\n if (!contiguous) {\n while (!result && (nextWordIndex = nextWord(target, nextWordIndex)) < target.length) {\n result = _matchesWords(word, target, wordIndex + 1, nextWordIndex, contiguous);\n nextWordIndex++;\n }\n }\n if (!result) {\n return null;\n }\n // If the characters don't exactly match, then they must be word separators (see charactersMatch(...)).\n // 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 if (word.charCodeAt(wordIndex) !== target.charCodeAt(targetIndex)) {\n // Verify alternate characters before exiting\n const altChars = getAlternateCodes(word.charCodeAt(wordIndex));\n if (!altChars) {\n return result;\n }\n for (let k = 0; k < altChars.length; k++) {\n if (altChars[k] !== target.charCodeAt(targetIndex + k)) {\n return result;\n }\n }\n }\n return join({ start: targetIndex, end: targetIndex + targetIndexOffset + 1 }, result);\n}\nfunction nextWord(word, start) {\n for (let i = start; i < word.length; i++) {\n if (isWordSeparator(word.charCodeAt(i)) ||\n (i > 0 && isWordSeparator(word.charCodeAt(i - 1)))) {\n return i;\n }\n }\n return word.length;\n}\n// Fuzzy\nconst fuzzyContiguousFilter = or(matchesPrefix, matchesCamelCase, matchesContiguousSubString);\nconst fuzzySeparateFilter = or(matchesPrefix, matchesCamelCase, matchesSubString);\nconst fuzzyRegExpCache = new LRUCache(10000); // bounded to 10000 elements\nexport function matchesFuzzy(word, wordToMatchAgainst, enableSeparateSubstringMatching = false) {\n if (typeof word !== 'string' || typeof wordToMatchAgainst !== 'string') {\n return null; // return early for invalid input\n }\n // Form RegExp for wildcard matches\n let regexp = fuzzyRegExpCache.get(word);\n if (!regexp) {\n regexp = new RegExp(strings.convertSimple2RegExpPattern(word), 'i');\n fuzzyRegExpCache.set(word, regexp);\n }\n // RegExp Filter\n const match = regexp.exec(wordToMatchAgainst);\n if (match) {\n return [{ start: match.index, end: match.index + match[0].length }];\n }\n // Default Filter\n return enableSeparateSubstringMatching ? fuzzySeparateFilter(word, wordToMatchAgainst) : fuzzyContiguousFilter(word, wordToMatchAgainst);\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, word) {\n const score = fuzzyScore(pattern, pattern.toLowerCase(), 0, word, word.toLowerCase(), 0, { firstMatchCanBeWeak: true, boostFullMatch: true });\n return score ? createMatches(score) : null;\n}\nexport function anyScore(pattern, lowPattern, patternPos, word, lowWord, wordPos) {\n const max = Math.min(13, pattern.length);\n for (; patternPos < max; patternPos++) {\n const result = fuzzyScore(pattern, lowPattern, patternPos, word, lowWord, wordPos, { firstMatchCanBeWeak: true, boostFullMatch: true });\n if (result) {\n return result;\n }\n }\n return [0, wordPos];\n}\n//#region --- fuzzyScore ---\nexport function createMatches(score) {\n if (typeof score === 'undefined') {\n return [];\n }\n const res = [];\n const wordPos = score[1];\n for (let i = score.length - 1; i > 1; i--) {\n const pos = score[i] + wordPos;\n const last = res[res.length - 1];\n if (last && last.end === pos) {\n last.end = pos + 1;\n }\n else {\n res.push({ start: pos, end: pos + 1 });\n }\n }\n return res;\n}\nconst _maxLen = 128;\nfunction initTable() {\n const table = [];\n const row = [];\n for (let i = 0; i <= _maxLen; i++) {\n row[i] = 0;\n }\n for (let i = 0; i <= _maxLen; i++) {\n table.push(row.slice(0));\n }\n return table;\n}\nfunction initArr(maxLen) {\n const row = [];\n for (let i = 0; i <= maxLen; i++) {\n row[i] = 0;\n }\n return row;\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 = initTable();\nconst _debug = false;\nfunction printTable(table, pattern, patternLen, word, wordLen) {\n function pad(s, n, pad = ' ') {\n while (s.length < n) {\n s = pad + s;\n }\n return s;\n }\n let ret = ` | |${word.split('').map(c => pad(c, 3)).join('|')}\\n`;\n for (let i = 0; i <= patternLen; i++) {\n if (i === 0) {\n ret += ' |';\n }\n else {\n ret += `${pattern[i - 1]}|`;\n }\n ret += table[i].slice(0, wordLen + 1).map(n => pad(n.toString(), 3)).join('|') + '\\n';\n }\n return ret;\n}\nfunction printTables(pattern, patternStart, word, wordStart) {\n pattern = pattern.substr(patternStart);\n word = word.substr(wordStart);\n console.log(printTable(_table, pattern, pattern.length, word, word.length));\n console.log(printTable(_arrows, pattern, pattern.length, word, word.length));\n console.log(printTable(_diag, pattern, pattern.length, word, word.length));\n}\nfunction isSeparatorAtPos(value, index) {\n if (index < 0 || index >= value.length) {\n return false;\n }\n const code = value.codePointAt(index);\n switch (code) {\n case 95 /* CharCode.Underline */:\n case 45 /* CharCode.Dash */:\n case 46 /* CharCode.Period */:\n case 32 /* CharCode.Space */:\n case 47 /* CharCode.Slash */:\n case 92 /* CharCode.Backslash */:\n case 39 /* CharCode.SingleQuote */:\n case 34 /* CharCode.DoubleQuote */:\n case 58 /* CharCode.Colon */:\n case 36 /* CharCode.DollarSign */:\n case 60 /* CharCode.LessThan */:\n case 62 /* CharCode.GreaterThan */:\n case 40 /* CharCode.OpenParen */:\n case 41 /* CharCode.CloseParen */:\n case 91 /* CharCode.OpenSquareBracket */:\n case 93 /* CharCode.CloseSquareBracket */:\n case 123 /* CharCode.OpenCurlyBrace */:\n case 125 /* CharCode.CloseCurlyBrace */:\n return true;\n case undefined:\n return false;\n default:\n if (strings.isEmojiImprecise(code)) {\n return true;\n }\n return false;\n }\n}\nfunction isWhitespaceAtPos(value, index) {\n if (index < 0 || index >= value.length) {\n return false;\n }\n const code = value.charCodeAt(index);\n switch (code) {\n case 32 /* CharCode.Space */:\n case 9 /* CharCode.Tab */:\n return true;\n default:\n return false;\n }\n}\nfunction isUpperCaseAtPos(pos, word, wordLow) {\n return word[pos] !== wordLow[pos];\n}\nexport function isPatternInWord(patternLow, patternPos, patternLen, wordLow, wordPos, wordLen, fillMinWordPosArr = false) {\n while (patternPos < patternLen && wordPos < wordLen) {\n if (patternLow[patternPos] === wordLow[wordPos]) {\n if (fillMinWordPosArr) {\n // Remember the min word position for each pattern position\n _minWordMatchPos[patternPos] = wordPos;\n }\n patternPos += 1;\n }\n wordPos += 1;\n }\n return patternPos === patternLen; // pattern must be exhausted\n}\nexport var FuzzyScore;\n(function (FuzzyScore) {\n /**\n * No matches and value `-100`\n */\n FuzzyScore.Default = ([-100, 0]);\n function isDefault(score) {\n return !score || (score.length === 2 && score[0] === -100 && score[1] === 0);\n }\n FuzzyScore.isDefault = isDefault;\n})(FuzzyScore || (FuzzyScore = {}));\nexport class FuzzyScoreOptions {\n constructor(firstMatchCanBeWeak, boostFullMatch) {\n this.firstMatchCanBeWeak = firstMatchCanBeWeak;\n this.boostFullMatch = boostFullMatch;\n }\n}\nFuzzyScoreOptions.default = { boostFullMatch: true, firstMatchCanBeWeak: false };\nexport function fuzzyScore(pattern, patternLow, patternStart, word, wordLow, wordStart, options = FuzzyScoreOptions.default) {\n const patternLen = pattern.length > _maxLen ? _maxLen : pattern.length;\n const wordLen = word.length > _maxLen ? _maxLen : word.length;\n if (patternStart >= patternLen || wordStart >= wordLen || (patternLen - patternStart) > (wordLen - wordStart)) {\n return undefined;\n }\n // Run a simple check if the characters of pattern occur\n // (in order) at all in word. If that isn't the case we\n // stop because no match will be possible\n if (!isPatternInWord(patternLow, patternStart, patternLen, wordLow, wordStart, wordLen, true)) {\n return undefined;\n }\n // Find the max matching word position for each pattern position\n // NOTE: the min matching word position was filled in above, in the `isPatternInWord` call\n _fillInMaxWordMatchPos(patternLen, wordLen, patternStart, wordStart, patternLow, wordLow);\n let row = 1;\n let column = 1;\n let patternPos = patternStart;\n let wordPos = wordStart;\n const hasStrongFirstMatch = [false];\n // There will be a match, fill in tables\n for (row = 1, patternPos = patternStart; patternPos < patternLen; row++, patternPos++) {\n // Reduce search space to possible matching word positions and to possible access from next row\n const minWordMatchPos = _minWordMatchPos[patternPos];\n const maxWordMatchPos = _maxWordMatchPos[patternPos];\n const nextMaxWordMatchPos = (patternPos + 1 < patternLen ? _maxWordMatchPos[patternPos + 1] : wordLen);\n for (column = minWordMatchPos - wordStart + 1, wordPos = minWordMatchPos; wordPos < nextMaxWordMatchPos; column++, wordPos++) {\n let score = Number.MIN_SAFE_INTEGER;\n let canComeDiag = false;\n if (wordPos <= maxWordMatchPos) {\n score = _doScore(pattern, patternLow, patternPos, patternStart, word, wordLow, wordPos, wordLen, wordStart, _diag[row - 1][column - 1] === 0, hasStrongFirstMatch);\n }\n let diagScore = 0;\n if (score !== Number.MAX_SAFE_INTEGER) {\n canComeDiag = true;\n diagScore = score + _table[row - 1][column - 1];\n }\n const canComeLeft = wordPos > minWordMatchPos;\n const leftScore = canComeLeft ? _table[row][column - 1] + (_diag[row][column - 1] > 0 ? -5 : 0) : 0; // penalty for a gap start\n const canComeLeftLeft = wordPos > minWordMatchPos + 1 && _diag[row][column - 1] > 0;\n const leftLeftScore = canComeLeftLeft ? _table[row][column - 2] + (_diag[row][column - 2] > 0 ? -5 : 0) : 0; // penalty for a gap start\n if (canComeLeftLeft && (!canComeLeft || leftLeftScore >= leftScore) && (!canComeDiag || leftLeftScore >= diagScore)) {\n // always prefer choosing left left to jump over a diagonal because that means a match is earlier in the word\n _table[row][column] = leftLeftScore;\n _arrows[row][column] = 3 /* Arrow.LeftLeft */;\n _diag[row][column] = 0;\n }\n else if (canComeLeft && (!canComeDiag || leftScore >= diagScore)) {\n // always prefer choosing left since that means a match is earlier in the word\n _table[row][column] = leftScore;\n _arrows[row][column] = 2 /* Arrow.Left */;\n _diag[row][column] = 0;\n }\n else if (canComeDiag) {\n _table[row][column] = diagScore;\n _arrows[row][column] = 1 /* Arrow.Diag */;\n _diag[row][column] = _diag[row - 1][column - 1] + 1;\n }\n else {\n throw new Error(`not possible`);\n }\n }\n }\n if (_debug) {\n printTables(pattern, patternStart, word, wordStart);\n }\n if (!hasStrongFirstMatch[0] && !options.firstMatchCanBeWeak) {\n return undefined;\n }\n row--;\n column--;\n const result = [_table[row][column], wordStart];\n let backwardsDiagLength = 0;\n let maxMatchColumn = 0;\n while (row >= 1) {\n // Find the column where we go diagonally up\n let diagColumn = column;\n do {\n const arrow = _arrows[row][diagColumn];\n if (arrow === 3 /* Arrow.LeftLeft */) {\n diagColumn = diagColumn - 2;\n }\n else if (arrow === 2 /* Arrow.Left */) {\n diagColumn = diagColumn - 1;\n }\n else {\n // found the diagonal\n break;\n }\n } while (diagColumn >= 1);\n // Overturn the \"forwards\" decision if keeping the \"backwards\" diagonal would give a better match\n if (backwardsDiagLength > 1 // only if we would have a contiguous match of 3 characters\n && patternLow[patternStart + row - 1] === wordLow[wordStart + column - 1] // only if we can do a contiguous match diagonally\n && !isUpperCaseAtPos(diagColumn + wordStart - 1, word, wordLow) // only if the forwards chose diagonal is not an uppercase\n && backwardsDiagLength + 1 > _diag[row][diagColumn] // only if our contiguous match would be longer than the \"forwards\" contiguous match\n ) {\n diagColumn = column;\n }\n if (diagColumn === column) {\n // this is a contiguous match\n backwardsDiagLength++;\n }\n else {\n backwardsDiagLength = 1;\n }\n if (!maxMatchColumn) {\n // remember the last matched column\n maxMatchColumn = diagColumn;\n }\n row--;\n column = diagColumn - 1;\n result.push(column);\n }\n if (wordLen === patternLen && options.boostFullMatch) {\n // the word matches the pattern with all characters!\n // giving the score a total match boost (to come up ahead other words)\n result[0] += 2;\n }\n // Add 1 penalty for each skipped character in the word\n const skippedCharsCount = maxMatchColumn - patternLen;\n result[0] -= skippedCharsCount;\n return result;\n}\nfunction _fillInMaxWordMatchPos(patternLen, wordLen, patternStart, wordStart, patternLow, wordLow) {\n let patternPos = patternLen - 1;\n let wordPos = wordLen - 1;\n while (patternPos >= patternStart && wordPos >= wordStart) {\n if (patternLow[patternPos] === wordLow[wordPos]) {\n _maxWordMatchPos[patternPos] = wordPos;\n patternPos--;\n }\n wordPos--;\n }\n}\nfunction _doScore(pattern, patternLow, patternPos, patternStart, word, wordLow, wordPos, wordLen, wordStart, newMatchStart, outFirstMatchStrong) {\n if (patternLow[patternPos] !== wordLow[wordPos]) {\n return Number.MIN_SAFE_INTEGER;\n }\n let score = 1;\n let isGapLocation = false;\n if (wordPos === (patternPos - patternStart)) {\n // common prefix: `foobar <-> foobaz`\n // ^^^^^\n score = pattern[patternPos] === word[wordPos] ? 7 : 5;\n }\n else if (isUpperCaseAtPos(wordPos, word, wordLow) && (wordPos === 0 || !isUpperCaseAtPos(wordPos - 1, word, wordLow))) {\n // hitting upper-case: `foo <-> forOthers`\n // ^^ ^\n score = pattern[patternPos] === word[wordPos] ? 7 : 5;\n isGapLocation = true;\n }\n else if (isSeparatorAtPos(wordLow, wordPos) && (wordPos === 0 || !isSeparatorAtPos(wordLow, wordPos - 1))) {\n // hitting a separator: `. <-> foo.bar`\n // ^\n score = 5;\n }\n else if (isSeparatorAtPos(wordLow, wordPos - 1) || isWhitespaceAtPos(wordLow, wordPos - 1)) {\n // post separator: `foo <-> bar_foo`\n // ^^^\n score = 5;\n isGapLocation = true;\n }\n if (score > 1 && patternPos === patternStart) {\n outFirstMatchStrong[0] = true;\n }\n if (!isGapLocation) {\n isGapLocation = isUpperCaseAtPos(wordPos, word, wordLow) || isSeparatorAtPos(wordLow, wordPos - 1) || isWhitespaceAtPos(wordLow, wordPos - 1);\n }\n //\n if (patternPos === patternStart) { // first character in pattern\n if (wordPos > wordStart) {\n // the first pattern character would match a word character that is not at the word start\n // so introduce a penalty to account for the gap preceding this match\n score -= isGapLocation ? 3 : 5;\n }\n }\n else {\n if (newMatchStart) {\n // this would be the beginning of a new match (i.e. there would be a gap before this location)\n score += isGapLocation ? 2 : 0;\n }\n else {\n // 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 score += isGapLocation ? 0 : 1;\n }\n }\n if (wordPos + 1 === wordLen) {\n // we always penalize gaps, but this gives unfair advantages to a match that would match the last character in the word\n // so pretend there is a gap after the last character in the word to normalize things\n score -= isGapLocation ? 3 : 5;\n }\n return score;\n}\n//#endregion\n//#region --- graceful ---\nexport function fuzzyScoreGracefulAggressive(pattern, lowPattern, patternPos, word, lowWord, wordPos, options) {\n return fuzzyScoreWithPermutations(pattern, lowPattern, patternPos, word, lowWord, wordPos, true, options);\n}\nfunction fuzzyScoreWithPermutations(pattern, lowPattern, patternPos, word, lowWord, wordPos, aggressive, options) {\n let top = fuzzyScore(pattern, lowPattern, patternPos, word, lowWord, wordPos, options);\n if (top && !aggressive) {\n // when using the original pattern yield a result we`\n // return it unless we are aggressive and try to find\n // a better alignment, e.g. `cno` -> `^co^ns^ole` or `^c^o^nsole`.\n return top;\n }\n if (pattern.length >= 3) {\n // When the pattern is long enough then try a few (max 7)\n // permutations of the pattern to find a better match. The\n // permutations only swap neighbouring characters, e.g\n // `cnoso` becomes `conso`, `cnsoo`, `cnoos`.\n const tries = Math.min(7, pattern.length - 1);\n for (let movingPatternPos = patternPos + 1; movingPatternPos < tries; movingPatternPos++) {\n const newPattern = nextTypoPermutation(pattern, movingPatternPos);\n if (newPattern) {\n const candidate = fuzzyScore(newPattern, newPattern.toLowerCase(), patternPos, word, lowWord, wordPos, options);\n if (candidate) {\n candidate[0] -= 3; // permutation penalty\n if (!top || candidate[0] > top[0]) {\n top = candidate;\n }\n }\n }\n }\n }\n return top;\n}\nfunction nextTypoPermutation(pattern, patternPos) {\n if (patternPos + 1 >= pattern.length) {\n return undefined;\n }\n const swap1 = pattern[patternPos];\n const swap2 = pattern[patternPos + 1];\n if (swap1 === swap2) {\n return undefined;\n }\n return pattern.slice(0, patternPos)\n + swap2\n + swap1\n + pattern.slice(patternPos + 2);\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 { matchesFuzzy } from './filters.js';\nimport { ltrim } from './strings.js';\nimport { ThemeIcon } from './themables.js';\nconst iconStartMarker = '$(';\nconst iconsRegex = new RegExp(`\\\\$\\\\(${ThemeIcon.iconNameExpression}(?:${ThemeIcon.iconModifierExpression})?\\\\)`, 'g'); // no capturing groups\nconst escapeIconsRegex = new RegExp(`(\\\\\\\\)?${iconsRegex.source}`, 'g');\nexport function escapeIcons(text) {\n return text.replace(escapeIconsRegex, (match, escaped) => escaped ? match : `\\\\${match}`);\n}\nconst markdownEscapedIconsRegex = new RegExp(`\\\\\\\\${iconsRegex.source}`, 'g');\nexport function markdownEscapeEscapedIcons(text) {\n // Need to add an extra \\ for escaping in markdown\n return text.replace(markdownEscapedIconsRegex, match => `\\\\${match}`);\n}\nconst stripIconsRegex = new RegExp(`(\\\\s)?(\\\\\\\\)?${iconsRegex.source}(\\\\s)?`, 'g');\n/**\n * Takes a label with icons (`$(iconId)xyz`) and strips the icons out (`xyz`)\n */\nexport function stripIcons(text) {\n if (text.indexOf(iconStartMarker) === -1) {\n return text;\n }\n return text.replace(stripIconsRegex, (match, preWhitespace, escaped, postWhitespace) => escaped ? match : preWhitespace || postWhitespace || '');\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) {\n if (!text) {\n return '';\n }\n return text.replace(/\\$\\((.*?)\\)/g, (_match, codiconName) => ` ${codiconName} `).trim();\n}\nconst _parseIconsRegex = new RegExp(`\\\\$\\\\(${ThemeIcon.iconNameCharacter}+\\\\)`, 'g');\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) {\n _parseIconsRegex.lastIndex = 0;\n let text = '';\n const iconOffsets = [];\n let iconsOffset = 0;\n while (true) {\n const pos = _parseIconsRegex.lastIndex;\n const match = _parseIconsRegex.exec(input);\n const chars = input.substring(pos, match === null || match === void 0 ? void 0 : match.index);\n if (chars.length > 0) {\n text += chars;\n for (let i = 0; i < chars.length; i++) {\n iconOffsets.push(iconsOffset);\n }\n }\n if (!match) {\n break;\n }\n iconsOffset += match[0].length;\n }\n return { text, iconOffsets };\n}\nexport function matchesFuzzyIconAware(query, target, enableSeparateSubstringMatching = false) {\n const { text, iconOffsets } = target;\n // Return early if there are no icon markers in the word to match against\n if (!iconOffsets || iconOffsets.length === 0) {\n return matchesFuzzy(query, text, enableSeparateSubstringMatching);\n }\n // Trim the word to match against because it could have leading\n // whitespace now if the word started with an icon\n const wordToMatchAgainstWithoutIconsTrimmed = ltrim(text, ' ');\n const leadingWhitespaceOffset = text.length - wordToMatchAgainstWithoutIconsTrimmed.length;\n // match on value without icon\n const matches = matchesFuzzy(query, wordToMatchAgainstWithoutIconsTrimmed, enableSeparateSubstringMatching);\n // Map matches back to offsets with icon and trimming\n if (matches) {\n for (const match of matches) {\n const iconOffset = iconOffsets[match.start + leadingWhitespaceOffset] /* icon offsets at index */ + leadingWhitespaceOffset /* overall leading whitespace offset */;\n match.start += iconOffset;\n match.end += iconOffset;\n }\n }\n return 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 *--------------------------------------------------------------------------------------------*/\nimport { illegalArgument } from './errors.js';\nimport { escapeIcons } from './iconLabels.js';\nimport { isEqual } from './resources.js';\nimport { escapeRegExpCharacters } from './strings.js';\nimport { URI } from './uri.js';\nexport class MarkdownString {\n constructor(value = '', isTrustedOrOptions = false) {\n var _a, _b, _c;\n this.value = value;\n if (typeof this.value !== 'string') {\n throw illegalArgument('value');\n }\n if (typeof isTrustedOrOptions === 'boolean') {\n this.isTrusted = isTrustedOrOptions;\n this.supportThemeIcons = false;\n this.supportHtml = false;\n }\n else {\n this.isTrusted = (_a = isTrustedOrOptions.isTrusted) !== null && _a !== void 0 ? _a : undefined;\n this.supportThemeIcons = (_b = isTrustedOrOptions.supportThemeIcons) !== null && _b !== void 0 ? _b : false;\n this.supportHtml = (_c = isTrustedOrOptions.supportHtml) !== null && _c !== void 0 ? _c : false;\n }\n }\n appendText(value, newlineStyle = 0 /* MarkdownStringTextNewlineStyle.Paragraph */) {\n this.value += escapeMarkdownSyntaxTokens(this.supportThemeIcons ? escapeIcons(value) : value) // CodeQL [SM02383] The Markdown is fully sanitized after being rendered.\n .replace(/([ \\t]+)/g, (_match, g1) => ' '.repeat(g1.length)) // CodeQL [SM02383] The Markdown is fully sanitized after being rendered.\n .replace(/\\>/gm, '\\\\>') // CodeQL [SM02383] The Markdown is fully sanitized after being rendered.\n .replace(/\\n/g, newlineStyle === 1 /* MarkdownStringTextNewlineStyle.Break */ ? '\\\\\\n' : '\\n\\n'); // CodeQL [SM02383] The Markdown is fully sanitized after being rendered.\n return this;\n }\n appendMarkdown(value) {\n this.value += value;\n return this;\n }\n appendCodeblock(langId, code) {\n this.value += `\\n${appendEscapedMarkdownCodeBlockFence(code, langId)}\\n`;\n return this;\n }\n appendLink(target, label, title) {\n this.value += '[';\n this.value += this._escape(label, ']');\n this.value += '](';\n this.value += this._escape(String(target), ')');\n if (title) {\n this.value += ` \"${this._escape(this._escape(title, '\"'), ')')}\"`;\n }\n this.value += ')';\n return this;\n }\n _escape(value, ch) {\n const r = new RegExp(escapeRegExpCharacters(ch), 'g');\n return value.replace(r, (match, offset) => {\n if (value.charAt(offset - 1) !== '\\\\') {\n return `\\\\${match}`;\n }\n else {\n return match;\n }\n });\n }\n}\nexport function isEmptyMarkdownString(oneOrMany) {\n if (isMarkdownString(oneOrMany)) {\n return !oneOrMany.value;\n }\n else if (Array.isArray(oneOrMany)) {\n return oneOrMany.every(isEmptyMarkdownString);\n }\n else {\n return true;\n }\n}\nexport function isMarkdownString(thing) {\n if (thing instanceof MarkdownString) {\n return true;\n }\n else if (thing && typeof thing === 'object') {\n return typeof thing.value === 'string'\n && (typeof thing.isTrusted === 'boolean' || typeof thing.isTrusted === 'object' || thing.isTrusted === undefined)\n && (typeof thing.supportThemeIcons === 'boolean' || thing.supportThemeIcons === undefined);\n }\n return false;\n}\nexport function markdownStringEqual(a, b) {\n if (a === b) {\n return true;\n }\n else if (!a || !b) {\n return false;\n }\n else {\n return a.value === b.value\n && a.isTrusted === b.isTrusted\n && a.supportThemeIcons === b.supportThemeIcons\n && a.supportHtml === b.supportHtml\n && (a.baseUri === b.baseUri || !!a.baseUri && !!b.baseUri && isEqual(URI.from(a.baseUri), URI.from(b.baseUri)));\n }\n}\nexport function escapeMarkdownSyntaxTokens(text) {\n // escape markdown syntax tokens: http://daringfireball.net/projects/markdown/syntax#backslash\n return text.replace(/[\\\\`*_{}[\\]()#+\\-!~]/g, '\\\\$&'); // CodeQL [SM02383] Backslash is escaped in the character class\n}\n/**\n * @see https://github.com/microsoft/vscode/issues/193746\n */\nexport function appendEscapedMarkdownCodeBlockFence(code, langId) {\n var _a, _b;\n const longestFenceLength = (_b = (_a = code.match(/^`+/gm)) === null || _a === void 0 ? void 0 : _a.reduce((a, b) => (a.length > b.length ? a : b)).length) !== null && _b !== void 0 ? _b : 0;\n const desiredFenceLength = longestFenceLength >= 3 ? longestFenceLength + 1 : 3;\n // the markdown result\n return [\n `${'`'.repeat(desiredFenceLength)}${langId}`,\n code,\n `${'`'.repeat(desiredFenceLength)}`,\n ].join('\\n');\n}\nexport function escapeDoubleQuotes(input) {\n return input.replace(/\"/g, '"');\n}\nexport function removeMarkdownEscapes(text) {\n if (!text) {\n return text;\n }\n return text.replace(/\\\\([\\\\`*_{}[\\]()#+\\-.!~])/g, '$1');\n}\nexport function parseHrefAndDimensions(href) {\n const dimensions = [];\n const splitted = href.split('|').map(s => s.trim());\n href = splitted[0];\n const parameters = splitted[1];\n if (parameters) {\n const heightFromParams = /height=(\\d+)/.exec(parameters);\n const widthFromParams = /width=(\\d+)/.exec(parameters);\n const height = heightFromParams ? heightFromParams[1] : '';\n const width = widthFromParams ? widthFromParams[1] : '';\n const widthIsFinite = isFinite(parseInt(width));\n const heightIsFinite = isFinite(parseInt(height));\n if (widthIsFinite) {\n dimensions.push(`width=\"${width}\"`);\n }\n if (heightIsFinite) {\n dimensions.push(`height=\"${height}\"`);\n }\n }\n return { href, dimensions };\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 * as nls from '../../nls.js';\nexport var InspectTokensNLS;\n(function (InspectTokensNLS) {\n InspectTokensNLS.inspectTokensAction = nls.localize('inspectTokens', \"Developer: Inspect Tokens\");\n})(InspectTokensNLS || (InspectTokensNLS = {}));\nexport var GoToLineNLS;\n(function (GoToLineNLS) {\n GoToLineNLS.gotoLineActionLabel = nls.localize('gotoLineActionLabel', \"Go to Line/Column...\");\n})(GoToLineNLS || (GoToLineNLS = {}));\nexport var QuickHelpNLS;\n(function (QuickHelpNLS) {\n QuickHelpNLS.helpQuickAccessActionLabel = nls.localize('helpQuickAccess', \"Show all Quick Access Providers\");\n})(QuickHelpNLS || (QuickHelpNLS = {}));\nexport var QuickCommandNLS;\n(function (QuickCommandNLS) {\n QuickCommandNLS.quickCommandActionLabel = nls.localize('quickCommandActionLabel', \"Command Palette\");\n QuickCommandNLS.quickCommandHelp = nls.localize('quickCommandActionHelp', \"Show And Run Commands\");\n})(QuickCommandNLS || (QuickCommandNLS = {}));\nexport var QuickOutlineNLS;\n(function (QuickOutlineNLS) {\n QuickOutlineNLS.quickOutlineActionLabel = nls.localize('quickOutlineActionLabel', \"Go to Symbol...\");\n QuickOutlineNLS.quickOutlineByCategoryActionLabel = nls.localize('quickOutlineByCategoryActionLabel', \"Go to Symbol by Category...\");\n})(QuickOutlineNLS || (QuickOutlineNLS = {}));\nexport var StandaloneCodeEditorNLS;\n(function (StandaloneCodeEditorNLS) {\n StandaloneCodeEditorNLS.editorViewAccessibleLabel = nls.localize('editorViewAccessibleLabel', \"Editor content\");\n StandaloneCodeEditorNLS.accessibilityHelpMessage = nls.localize('accessibilityHelpMessage', \"Press Alt+F1 for Accessibility Options.\");\n})(StandaloneCodeEditorNLS || (StandaloneCodeEditorNLS = {}));\nexport var ToggleHighContrastNLS;\n(function (ToggleHighContrastNLS) {\n ToggleHighContrastNLS.toggleHighContrast = nls.localize('toggleHighContrast', \"Toggle High Contrast Theme\");\n})(ToggleHighContrastNLS || (ToggleHighContrastNLS = {}));\nexport var StandaloneServicesNLS;\n(function (StandaloneServicesNLS) {\n StandaloneServicesNLS.bulkEditServiceSummary = nls.localize('bulkEditServiceSummary', \"Made {0} edits in {1} files\");\n})(StandaloneServicesNLS || (StandaloneServicesNLS = {}));\n", "/*---------------------------------------------------------------------------------------------\n * 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 * as arrays from './arrays.js';\nexport const strictEquals = (a, b) => a === b;\n/**\n * Checks if the items of two arrays are equal.\n * By default, strict equality is used to compare elements, but a custom equality comparer can be provided.\n */\nexport function itemsEquals(itemEquals = strictEquals) {\n return (a, b) => arrays.equals(a, b, itemEquals);\n}\n/**\n * Uses `item.equals(other)` to determine equality.\n */\nexport function itemEquals() {\n return (a, b) => a.equals(b);\n}\nexport function equalsIfDefined(v1, v2, equals) {\n if (!v1 || !v2) {\n return v1 === v2;\n }\n return equals(v1, v2);\n}\nconst objIds = new WeakMap();\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nexport class DebugNameData {\n constructor(owner, debugNameSource, referenceFn) {\n this.owner = owner;\n this.debugNameSource = debugNameSource;\n this.referenceFn = referenceFn;\n }\n getDebugName(target) {\n return getDebugName(target, this);\n }\n}\nconst countPerName = new Map();\nconst cachedDebugName = new WeakMap();\nexport function getDebugName(target, data) {\n var _a;\n const cached = cachedDebugName.get(target);\n if (cached) {\n return cached;\n }\n const dbgName = computeDebugName(target, data);\n if (dbgName) {\n let count = (_a = countPerName.get(dbgName)) !== null && _a !== void 0 ? _a : 0;\n count++;\n countPerName.set(dbgName, count);\n const result = count === 1 ? dbgName : `${dbgName}#${count}`;\n cachedDebugName.set(target, result);\n return result;\n }\n return undefined;\n}\nfunction computeDebugName(self, data) {\n const cached = cachedDebugName.get(self);\n if (cached) {\n return cached;\n }\n const ownerStr = data.owner ? formatOwner(data.owner) + `.` : '';\n let result;\n const debugNameSource = data.debugNameSource;\n if (debugNameSource !== undefined) {\n if (typeof debugNameSource === 'function') {\n result = debugNameSource();\n if (result !== undefined) {\n return ownerStr + result;\n }\n }\n else {\n return ownerStr + debugNameSource;\n }\n }\n const referenceFn = data.referenceFn;\n if (referenceFn !== undefined) {\n result = getFunctionName(referenceFn);\n if (result !== undefined) {\n return ownerStr + result;\n }\n }\n if (data.owner !== undefined) {\n const key = findKey(data.owner, self);\n if (key !== undefined) {\n return ownerStr + key;\n }\n }\n return undefined;\n}\nfunction findKey(obj, value) {\n for (const key in obj) {\n if (obj[key] === value) {\n return key;\n }\n }\n return undefined;\n}\nconst countPerClassName = new Map();\nconst ownerId = new WeakMap();\nfunction formatOwner(owner) {\n var _a;\n const id = ownerId.get(owner);\n if (id) {\n return id;\n }\n const className = getClassName(owner);\n let count = (_a = countPerClassName.get(className)) !== null && _a !== void 0 ? _a : 0;\n count++;\n countPerClassName.set(className, count);\n const result = count === 1 ? className : `${className}#${count}`;\n ownerId.set(owner, result);\n return result;\n}\nfunction getClassName(obj) {\n const ctor = obj.constructor;\n if (ctor) {\n return ctor.name;\n }\n return 'Object';\n}\nexport function getFunctionName(fn) {\n const fnSrc = fn.toString();\n // Pattern: /** @description ... */\n const regexp = /\\/\\*\\*\\s*@description\\s*([^*]*)\\*\\//;\n const match = regexp.exec(fnSrc);\n const result = match ? match[1] : undefined;\n return result === null || result === void 0 ? void 0 : result.trim();\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 *--------------------------------------------------------------------------------------------*/\nlet globalObservableLogger;\nexport function setLogger(logger) {\n globalObservableLogger = logger;\n}\nexport function getLogger() {\n return globalObservableLogger;\n}\nexport class ConsoleObservableLogger {\n constructor() {\n this.indentation = 0;\n this.changedObservablesSets = new WeakMap();\n }\n textToConsoleArgs(text) {\n return consoleTextToArgs([\n normalText(repeat('| ', this.indentation)),\n text,\n ]);\n }\n formatInfo(info) {\n if (!info.hadValue) {\n return [\n normalText(` `),\n styled(formatValue(info.newValue, 60), {\n color: 'green',\n }),\n normalText(` (initial)`),\n ];\n }\n return info.didChange\n ? [\n normalText(` `),\n styled(formatValue(info.oldValue, 70), {\n color: 'red',\n strikeThrough: true,\n }),\n normalText(` `),\n styled(formatValue(info.newValue, 60), {\n color: 'green',\n }),\n ]\n : [normalText(` (unchanged)`)];\n }\n handleObservableChanged(observable, info) {\n console.log(...this.textToConsoleArgs([\n formatKind('observable value changed'),\n styled(observable.debugName, { color: 'BlueViolet' }),\n ...this.formatInfo(info),\n ]));\n }\n formatChanges(changes) {\n if (changes.size === 0) {\n return undefined;\n }\n return styled(' (changed deps: ' +\n [...changes].map((o) => o.debugName).join(', ') +\n ')', { color: 'gray' });\n }\n handleDerivedCreated(derived) {\n const existingHandleChange = derived.handleChange;\n this.changedObservablesSets.set(derived, new Set());\n derived.handleChange = (observable, change) => {\n this.changedObservablesSets.get(derived).add(observable);\n return existingHandleChange.apply(derived, [observable, change]);\n };\n }\n handleDerivedRecomputed(derived, info) {\n const changedObservables = this.changedObservablesSets.get(derived);\n console.log(...this.textToConsoleArgs([\n formatKind('derived recomputed'),\n styled(derived.debugName, { color: 'BlueViolet' }),\n ...this.formatInfo(info),\n this.formatChanges(changedObservables),\n { data: [{ fn: derived._computeFn }] }\n ]));\n changedObservables.clear();\n }\n handleFromEventObservableTriggered(observable, info) {\n console.log(...this.textToConsoleArgs([\n formatKind('observable from event triggered'),\n styled(observable.debugName, { color: 'BlueViolet' }),\n ...this.formatInfo(info),\n { data: [{ fn: observable._getValue }] }\n ]));\n }\n handleAutorunCreated(autorun) {\n const existingHandleChange = autorun.handleChange;\n this.changedObservablesSets.set(autorun, new Set());\n autorun.handleChange = (observable, change) => {\n this.changedObservablesSets.get(autorun).add(observable);\n return existingHandleChange.apply(autorun, [observable, change]);\n };\n }\n handleAutorunTriggered(autorun) {\n const changedObservables = this.changedObservablesSets.get(autorun);\n console.log(...this.textToConsoleArgs([\n formatKind('autorun'),\n styled(autorun.debugName, { color: 'BlueViolet' }),\n this.formatChanges(changedObservables),\n { data: [{ fn: autorun._runFn }] }\n ]));\n changedObservables.clear();\n this.indentation++;\n }\n handleAutorunFinished(autorun) {\n this.indentation--;\n }\n handleBeginTransaction(transaction) {\n let transactionName = transaction.getDebugName();\n if (transactionName === undefined) {\n transactionName = '';\n }\n console.log(...this.textToConsoleArgs([\n formatKind('transaction'),\n styled(transactionName, { color: 'BlueViolet' }),\n { data: [{ fn: transaction._fn }] }\n ]));\n this.indentation++;\n }\n handleEndTransaction() {\n this.indentation--;\n }\n}\nfunction consoleTextToArgs(text) {\n const styles = new Array();\n const data = [];\n let firstArg = '';\n function process(t) {\n if ('length' in t) {\n for (const item of t) {\n if (item) {\n process(item);\n }\n }\n }\n else if ('text' in t) {\n firstArg += `%c${t.text}`;\n styles.push(t.style);\n if (t.data) {\n data.push(...t.data);\n }\n }\n else if ('data' in t) {\n data.push(...t.data);\n }\n }\n process(text);\n const result = [firstArg, ...styles];\n result.push(...data);\n return result;\n}\nfunction normalText(text) {\n return styled(text, { color: 'black' });\n}\nfunction formatKind(kind) {\n return styled(padStr(`${kind}: `, 10), { color: 'black', bold: true });\n}\nfunction styled(text, options = {\n color: 'black',\n}) {\n function objToCss(styleObj) {\n return Object.entries(styleObj).reduce((styleString, [propName, propValue]) => {\n return `${styleString}${propName}:${propValue};`;\n }, '');\n }\n const style = {\n color: options.color,\n };\n if (options.strikeThrough) {\n style['text-decoration'] = 'line-through';\n }\n if (options.bold) {\n style['font-weight'] = 'bold';\n }\n return {\n text,\n style: objToCss(style),\n };\n}\nfunction formatValue(value, availableLen) {\n switch (typeof value) {\n case 'number':\n return '' + value;\n case 'string':\n if (value.length + 2 <= availableLen) {\n return `\"${value}\"`;\n }\n return `\"${value.substr(0, availableLen - 7)}\"+...`;\n case 'boolean':\n return value ? 'true' : 'false';\n case 'undefined':\n return 'undefined';\n case 'object':\n if (value === null) {\n return 'null';\n }\n if (Array.isArray(value)) {\n return formatArray(value, availableLen);\n }\n return formatObject(value, availableLen);\n case 'symbol':\n return value.toString();\n case 'function':\n return `[[Function${value.name ? ' ' + value.name : ''}]]`;\n default:\n return '' + value;\n }\n}\nfunction formatArray(value, availableLen) {\n let result = '[ ';\n let first = true;\n for (const val of value) {\n if (!first) {\n result += ', ';\n }\n if (result.length - 5 > availableLen) {\n result += '...';\n break;\n }\n first = false;\n result += `${formatValue(val, availableLen - result.length)}`;\n }\n result += ' ]';\n return result;\n}\nfunction formatObject(value, availableLen) {\n let result = '{ ';\n let first = true;\n for (const [key, val] of Object.entries(value)) {\n if (!first) {\n result += ', ';\n }\n if (result.length - 5 > availableLen) {\n result += '...';\n break;\n }\n first = false;\n result += `${key}: ${formatValue(val, availableLen - result.length)}`;\n }\n result += ' }';\n return result;\n}\nfunction repeat(str, count) {\n let result = '';\n for (let i = 1; i <= count; i++) {\n result += str;\n }\n return result;\n}\nfunction padStr(str, length) {\n while (str.length < length) {\n str += ' ';\n }\n return str;\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 { strictEquals } from '../equals.js';\nimport { DebugNameData, getFunctionName } from './debugName.js';\nimport { getLogger } from './logging.js';\nlet _recomputeInitiallyAndOnChange;\nexport function _setRecomputeInitiallyAndOnChange(recomputeInitiallyAndOnChange) {\n _recomputeInitiallyAndOnChange = recomputeInitiallyAndOnChange;\n}\nlet _keepObserved;\nexport function _setKeepObserved(keepObserved) {\n _keepObserved = keepObserved;\n}\nlet _derived;\n/**\n * @internal\n * This is to allow splitting files.\n*/\nexport function _setDerivedOpts(derived) {\n _derived = derived;\n}\nexport class ConvenientObservable {\n get TChange() { return null; }\n reportChanges() {\n this.get();\n }\n /** @sealed */\n read(reader) {\n if (reader) {\n return reader.readObservable(this);\n }\n else {\n return this.get();\n }\n }\n map(fnOrOwner, fnOrUndefined) {\n const owner = fnOrUndefined === undefined ? undefined : fnOrOwner;\n const fn = fnOrUndefined === undefined ? fnOrOwner : fnOrUndefined;\n return _derived({\n owner,\n debugName: () => {\n const name = getFunctionName(fn);\n if (name !== undefined) {\n return name;\n }\n // regexp to match `x => x.y` or `x => x?.y` where x and y can be arbitrary identifiers (uses backref):\n const regexp = /^\\s*\\(?\\s*([a-zA-Z_$][a-zA-Z_$0-9]*)\\s*\\)?\\s*=>\\s*\\1(?:\\??)\\.([a-zA-Z_$][a-zA-Z_$0-9]*)\\s*$/;\n const match = regexp.exec(fn.toString());\n if (match) {\n return `${this.debugName}.${match[2]}`;\n }\n if (!owner) {\n return `${this.debugName} (mapped)`;\n }\n return undefined;\n },\n debugReferenceFn: fn,\n }, (reader) => fn(this.read(reader), reader));\n }\n recomputeInitiallyAndOnChange(store, handleValue) {\n store.add(_recomputeInitiallyAndOnChange(this, handleValue));\n return this;\n }\n}\nexport class BaseObservable extends ConvenientObservable {\n constructor() {\n super(...arguments);\n this.observers = new Set();\n }\n addObserver(observer) {\n const len = this.observers.size;\n this.observers.add(observer);\n if (len === 0) {\n this.onFirstObserverAdded();\n }\n }\n removeObserver(observer) {\n const deleted = this.observers.delete(observer);\n if (deleted && this.observers.size === 0) {\n this.onLastObserverRemoved();\n }\n }\n onFirstObserverAdded() { }\n onLastObserverRemoved() { }\n}\n/**\n * Starts a transaction in which many observables can be changed at once.\n * {@link fn} should start with a JS Doc using `@description` to give the transaction a debug name.\n * Reaction run on demand or when the transaction ends.\n */\nexport function transaction(fn, getDebugName) {\n const tx = new TransactionImpl(fn, getDebugName);\n try {\n fn(tx);\n }\n finally {\n tx.finish();\n }\n}\nlet _globalTransaction = undefined;\nexport function globalTransaction(fn) {\n if (_globalTransaction) {\n fn(_globalTransaction);\n }\n else {\n const tx = new TransactionImpl(fn, undefined);\n _globalTransaction = tx;\n try {\n fn(tx);\n }\n finally {\n tx.finish(); // During finish, more actions might be added to the transaction.\n // Which is why we only clear the global transaction after finish.\n _globalTransaction = undefined;\n }\n }\n}\nexport async function asyncTransaction(fn, getDebugName) {\n const tx = new TransactionImpl(fn, getDebugName);\n try {\n await fn(tx);\n }\n finally {\n tx.finish();\n }\n}\n/**\n * Allows to chain transactions.\n */\nexport function subtransaction(tx, fn, getDebugName) {\n if (!tx) {\n transaction(fn, getDebugName);\n }\n else {\n fn(tx);\n }\n}\nexport class TransactionImpl {\n constructor(_fn, _getDebugName) {\n var _a;\n this._fn = _fn;\n this._getDebugName = _getDebugName;\n this.updatingObservers = [];\n (_a = getLogger()) === null || _a === void 0 ? void 0 : _a.handleBeginTransaction(this);\n }\n getDebugName() {\n if (this._getDebugName) {\n return this._getDebugName();\n }\n return getFunctionName(this._fn);\n }\n updateObserver(observer, observable) {\n // When this gets called while finish is active, they will still get considered\n this.updatingObservers.push({ observer, observable });\n observer.beginUpdate(observable);\n }\n finish() {\n var _a;\n const updatingObservers = this.updatingObservers;\n for (let i = 0; i < updatingObservers.length; i++) {\n const { observer, observable } = updatingObservers[i];\n observer.endUpdate(observable);\n }\n // Prevent anyone from updating observers from now on.\n this.updatingObservers = null;\n (_a = getLogger()) === null || _a === void 0 ? void 0 : _a.handleEndTransaction();\n }\n}\nexport function observableValue(nameOrOwner, initialValue) {\n let debugNameData;\n if (typeof nameOrOwner === 'string') {\n debugNameData = new DebugNameData(undefined, nameOrOwner, undefined);\n }\n else {\n debugNameData = new DebugNameData(nameOrOwner, undefined, undefined);\n }\n return new ObservableValue(debugNameData, initialValue, strictEquals);\n}\nexport function observableValueOpts(options, initialValue) {\n var _a;\n return new ObservableValue(new DebugNameData(options.owner, options.debugName, undefined), initialValue, (_a = options.equalsFn) !== null && _a !== void 0 ? _a : strictEquals);\n}\nexport class ObservableValue extends BaseObservable {\n get debugName() {\n var _a;\n return (_a = this._debugNameData.getDebugName(this)) !== null && _a !== void 0 ? _a : 'ObservableValue';\n }\n constructor(_debugNameData, initialValue, _equalityComparator) {\n super();\n this._debugNameData = _debugNameData;\n this._equalityComparator = _equalityComparator;\n this._value = initialValue;\n }\n get() {\n return this._value;\n }\n set(value, tx, change) {\n var _a;\n if (this._equalityComparator(this._value, value)) {\n return;\n }\n let _tx;\n if (!tx) {\n tx = _tx = new TransactionImpl(() => { }, () => `Setting ${this.debugName}`);\n }\n try {\n const oldValue = this._value;\n this._setValue(value);\n (_a = getLogger()) === null || _a === void 0 ? void 0 : _a.handleObservableChanged(this, { oldValue, newValue: value, change, didChange: true, hadValue: true });\n for (const observer of this.observers) {\n tx.updateObserver(observer, this);\n observer.handleChange(this, change);\n }\n }\n finally {\n if (_tx) {\n _tx.finish();\n }\n }\n }\n toString() {\n return `${this.debugName}: ${this._value}`;\n }\n _setValue(newValue) {\n this._value = newValue;\n }\n}\n/**\n * A disposable observable. When disposed, its value is also disposed.\n * When a new value is set, the previous value is disposed.\n */\nexport function disposableObservableValue(nameOrOwner, initialValue) {\n let debugNameData;\n if (typeof nameOrOwner === 'string') {\n debugNameData = new DebugNameData(undefined, nameOrOwner, undefined);\n }\n else {\n debugNameData = new DebugNameData(nameOrOwner, undefined, undefined);\n }\n return new DisposableObservableValue(debugNameData, initialValue, strictEquals);\n}\nexport class DisposableObservableValue extends ObservableValue {\n _setValue(newValue) {\n if (this._value === newValue) {\n return;\n }\n if (this._value) {\n this._value.dispose();\n }\n this._value = newValue;\n }\n dispose() {\n var _a;\n (_a = this._value) === null || _a === void 0 ? void 0 : _a.dispose();\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 *--------------------------------------------------------------------------------------------*/\nimport { assertFn } from '../assert.js';\nimport { strictEquals } from '../equals.js';\nimport { DisposableStore } from '../lifecycle.js';\nimport { BaseObservable, _setDerivedOpts } from './base.js';\nimport { DebugNameData } from './debugName.js';\nimport { getLogger } from './logging.js';\nexport function derived(computeFnOrOwner, computeFn) {\n if (computeFn !== undefined) {\n return new Derived(new DebugNameData(computeFnOrOwner, undefined, computeFn), computeFn, undefined, undefined, undefined, strictEquals);\n }\n return new Derived(new DebugNameData(undefined, undefined, computeFnOrOwner), computeFnOrOwner, undefined, undefined, undefined, strictEquals);\n}\nexport function derivedOpts(options, computeFn) {\n var _a;\n return new Derived(new DebugNameData(options.owner, options.debugName, options.debugReferenceFn), computeFn, undefined, undefined, options.onLastObserverRemoved, (_a = options.equalsFn) !== null && _a !== void 0 ? _a : strictEquals);\n}\n_setDerivedOpts(derivedOpts);\n/**\n * Represents an observable that is derived from other observables.\n * The value is only recomputed when absolutely needed.\n *\n * {@link computeFn} should start with a JS Doc using `@description` to name the derived.\n *\n * Use `createEmptyChangeSummary` to create a \"change summary\" that can collect the changes.\n * Use `handleChange` to add a reported change to the change summary.\n * The compute function is given the last change summary.\n * The change summary is discarded after the compute function was called.\n *\n * @see derived\n */\nexport function derivedHandleChanges(options, computeFn) {\n var _a;\n return new Derived(new DebugNameData(options.owner, options.debugName, undefined), computeFn, options.createEmptyChangeSummary, options.handleChange, undefined, (_a = options.equalityComparer) !== null && _a !== void 0 ? _a : strictEquals);\n}\nexport function derivedWithStore(computeFnOrOwner, computeFnOrUndefined) {\n let computeFn;\n let owner;\n if (computeFnOrUndefined === undefined) {\n computeFn = computeFnOrOwner;\n owner = undefined;\n }\n else {\n owner = computeFnOrOwner;\n computeFn = computeFnOrUndefined;\n }\n const store = new DisposableStore();\n return new Derived(new DebugNameData(owner, undefined, computeFn), r => {\n store.clear();\n return computeFn(r, store);\n }, undefined, undefined, () => store.dispose(), strictEquals);\n}\nexport function derivedDisposable(computeFnOrOwner, computeFnOrUndefined) {\n let computeFn;\n let owner;\n if (computeFnOrUndefined === undefined) {\n computeFn = computeFnOrOwner;\n owner = undefined;\n }\n else {\n owner = computeFnOrOwner;\n computeFn = computeFnOrUndefined;\n }\n const store = new DisposableStore();\n return new Derived(new DebugNameData(owner, undefined, computeFn), r => {\n store.clear();\n const result = computeFn(r);\n if (result) {\n store.add(result);\n }\n return result;\n }, undefined, undefined, () => store.dispose(), strictEquals);\n}\nexport class Derived extends BaseObservable {\n get debugName() {\n var _a;\n return (_a = this._debugNameData.getDebugName(this)) !== null && _a !== void 0 ? _a : '(anonymous)';\n }\n constructor(_debugNameData, _computeFn, createChangeSummary, _handleChange, _handleLastObserverRemoved = undefined, _equalityComparator) {\n var _a, _b;\n super();\n this._debugNameData = _debugNameData;\n this._computeFn = _computeFn;\n this.createChangeSummary = createChangeSummary;\n this._handleChange = _handleChange;\n this._handleLastObserverRemoved = _handleLastObserverRemoved;\n this._equalityComparator = _equalityComparator;\n this.state = 0 /* DerivedState.initial */;\n this.value = undefined;\n this.updateCount = 0;\n this.dependencies = new Set();\n this.dependenciesToBeRemoved = new Set();\n this.changeSummary = undefined;\n this.changeSummary = (_a = this.createChangeSummary) === null || _a === void 0 ? void 0 : _a.call(this);\n (_b = getLogger()) === null || _b === void 0 ? void 0 : _b.handleDerivedCreated(this);\n }\n onLastObserverRemoved() {\n var _a;\n /**\n * We are not tracking changes anymore, thus we have to assume\n * that our cache is invalid.\n */\n this.state = 0 /* DerivedState.initial */;\n this.value = undefined;\n for (const d of this.dependencies) {\n d.removeObserver(this);\n }\n this.dependencies.clear();\n (_a = this._handleLastObserverRemoved) === null || _a === void 0 ? void 0 : _a.call(this);\n }\n get() {\n var _a;\n if (this.observers.size === 0) {\n // Without observers, we don't know when to clean up stuff.\n // Thus, we don't cache anything to prevent memory leaks.\n const result = this._computeFn(this, (_a = this.createChangeSummary) === null || _a === void 0 ? void 0 : _a.call(this));\n // Clear new dependencies\n this.onLastObserverRemoved();\n return result;\n }\n else {\n do {\n // We might not get a notification for a dependency that changed while it is updating,\n // thus we also have to ask all our depedencies if they changed in this case.\n if (this.state === 1 /* DerivedState.dependenciesMightHaveChanged */) {\n for (const d of this.dependencies) {\n /** might call {@link handleChange} indirectly, which could make us stale */\n d.reportChanges();\n if (this.state === 2 /* DerivedState.stale */) {\n // The other dependencies will refresh on demand, so early break\n break;\n }\n }\n }\n // We called report changes of all dependencies.\n // If we are still not stale, we can assume to be up to date again.\n if (this.state === 1 /* DerivedState.dependenciesMightHaveChanged */) {\n this.state = 3 /* DerivedState.upToDate */;\n }\n this._recomputeIfNeeded();\n // In case recomputation changed one of our dependencies, we need to recompute again.\n } while (this.state !== 3 /* DerivedState.upToDate */);\n return this.value;\n }\n }\n _recomputeIfNeeded() {\n var _a, _b;\n if (this.state === 3 /* DerivedState.upToDate */) {\n return;\n }\n const emptySet = this.dependenciesToBeRemoved;\n this.dependenciesToBeRemoved = this.dependencies;\n this.dependencies = emptySet;\n const hadValue = this.state !== 0 /* DerivedState.initial */;\n const oldValue = this.value;\n this.state = 3 /* DerivedState.upToDate */;\n const changeSummary = this.changeSummary;\n this.changeSummary = (_a = this.createChangeSummary) === null || _a === void 0 ? void 0 : _a.call(this);\n try {\n /** might call {@link handleChange} indirectly, which could invalidate us */\n this.value = this._computeFn(this, changeSummary);\n }\n finally {\n // We don't want our observed observables to think that they are (not even temporarily) not being observed.\n // Thus, we only unsubscribe from observables that are definitely not read anymore.\n for (const o of this.dependenciesToBeRemoved) {\n o.removeObserver(this);\n }\n this.dependenciesToBeRemoved.clear();\n }\n const didChange = hadValue && !(this._equalityComparator(oldValue, this.value));\n (_b = getLogger()) === null || _b === void 0 ? void 0 : _b.handleDerivedRecomputed(this, {\n oldValue,\n newValue: this.value,\n change: undefined,\n didChange,\n hadValue,\n });\n if (didChange) {\n for (const r of this.observers) {\n r.handleChange(this, undefined);\n }\n }\n }\n toString() {\n return `LazyDerived<${this.debugName}>`;\n }\n // IObserver Implementation\n beginUpdate(_observable) {\n this.updateCount++;\n const propagateBeginUpdate = this.updateCount === 1;\n if (this.state === 3 /* DerivedState.upToDate */) {\n this.state = 1 /* DerivedState.dependenciesMightHaveChanged */;\n // If we propagate begin update, that will already signal a possible change.\n if (!propagateBeginUpdate) {\n for (const r of this.observers) {\n r.handlePossibleChange(this);\n }\n }\n }\n if (propagateBeginUpdate) {\n for (const r of this.observers) {\n r.beginUpdate(this); // This signals a possible change\n }\n }\n }\n endUpdate(_observable) {\n this.updateCount--;\n if (this.updateCount === 0) {\n // End update could change the observer list.\n const observers = [...this.observers];\n for (const r of observers) {\n r.endUpdate(this);\n }\n }\n assertFn(() => this.updateCount >= 0);\n }\n handlePossibleChange(observable) {\n // In all other states, observers already know that we might have changed.\n if (this.state === 3 /* DerivedState.upToDate */ && this.dependencies.has(observable) && !this.dependenciesToBeRemoved.has(observable)) {\n this.state = 1 /* DerivedState.dependenciesMightHaveChanged */;\n for (const r of this.observers) {\n r.handlePossibleChange(this);\n }\n }\n }\n handleChange(observable, change) {\n if (this.dependencies.has(observable) && !this.dependenciesToBeRemoved.has(observable)) {\n const shouldReact = this._handleChange ? this._handleChange({\n changedObservable: observable,\n change,\n didChange: o => o === observable,\n }, this.changeSummary) : true;\n const wasUpToDate = this.state === 3 /* DerivedState.upToDate */;\n if (shouldReact && (this.state === 1 /* DerivedState.dependenciesMightHaveChanged */ || wasUpToDate)) {\n this.state = 2 /* DerivedState.stale */;\n if (wasUpToDate) {\n for (const r of this.observers) {\n r.handlePossibleChange(this);\n }\n }\n }\n }\n }\n // IReader Implementation\n readObservable(observable) {\n // Subscribe before getting the value to enable caching\n observable.addObserver(this);\n /** This might call {@link handleChange} indirectly, which could invalidate us */\n const value = observable.get();\n // Which is why we only add the observable to the dependencies now.\n this.dependencies.add(observable);\n this.dependenciesToBeRemoved.delete(observable);\n return value;\n }\n addObserver(observer) {\n const shouldCallBeginUpdate = !this.observers.has(observer) && this.updateCount > 0;\n super.addObserver(observer);\n if (shouldCallBeginUpdate) {\n observer.beginUpdate(this);\n }\n }\n removeObserver(observer) {\n const shouldCallEndUpdate = this.observers.has(observer) && this.updateCount > 0;\n super.removeObserver(observer);\n if (shouldCallEndUpdate) {\n // Calling end update after removing the observer makes sure endUpdate cannot be called twice here.\n observer.endUpdate(this);\n }\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 *--------------------------------------------------------------------------------------------*/\nimport { assertFn } from '../assert.js';\nimport { DisposableStore, markAsDisposed, toDisposable, trackDisposable } from '../lifecycle.js';\nimport { DebugNameData } from './debugName.js';\nimport { getLogger } from './logging.js';\n/**\n * Runs immediately and whenever a transaction ends and an observed observable changed.\n * {@link fn} should start with a JS Doc using `@description` to name the autorun.\n */\nexport function autorun(fn) {\n return new AutorunObserver(new DebugNameData(undefined, undefined, fn), fn, undefined, undefined);\n}\n/**\n * Runs immediately and whenever a transaction ends and an observed observable changed.\n * {@link fn} should start with a JS Doc using `@description` to name the autorun.\n */\nexport function autorunOpts(options, fn) {\n var _a;\n return new AutorunObserver(new DebugNameData(options.owner, options.debugName, (_a = options.debugReferenceFn) !== null && _a !== void 0 ? _a : fn), fn, undefined, undefined);\n}\n/**\n * Runs immediately and whenever a transaction ends and an observed observable changed.\n * {@link fn} should start with a JS Doc using `@description` to name the autorun.\n *\n * Use `createEmptyChangeSummary` to create a \"change summary\" that can collect the changes.\n * Use `handleChange` to add a reported change to the change summary.\n * The run function is given the last change summary.\n * The change summary is discarded after the run function was called.\n *\n * @see autorun\n */\nexport function autorunHandleChanges(options, fn) {\n var _a;\n return new AutorunObserver(new DebugNameData(options.owner, options.debugName, (_a = options.debugReferenceFn) !== null && _a !== void 0 ? _a : fn), fn, options.createEmptyChangeSummary, options.handleChange);\n}\n/**\n * @see autorun (but with a disposable store that is cleared before the next run or on dispose)\n */\nexport function autorunWithStore(fn) {\n const store = new DisposableStore();\n const disposable = autorunOpts({\n owner: undefined,\n debugName: undefined,\n debugReferenceFn: fn,\n }, reader => {\n store.clear();\n fn(reader, store);\n });\n return toDisposable(() => {\n disposable.dispose();\n store.dispose();\n });\n}\nexport class AutorunObserver {\n get debugName() {\n var _a;\n return (_a = this._debugNameData.getDebugName(this)) !== null && _a !== void 0 ? _a : '(anonymous)';\n }\n constructor(_debugNameData, _runFn, createChangeSummary, _handleChange) {\n var _a, _b;\n this._debugNameData = _debugNameData;\n this._runFn = _runFn;\n this.createChangeSummary = createChangeSummary;\n this._handleChange = _handleChange;\n this.state = 2 /* AutorunState.stale */;\n this.updateCount = 0;\n this.disposed = false;\n this.dependencies = new Set();\n this.dependenciesToBeRemoved = new Set();\n this.changeSummary = (_a = this.createChangeSummary) === null || _a === void 0 ? void 0 : _a.call(this);\n (_b = getLogger()) === null || _b === void 0 ? void 0 : _b.handleAutorunCreated(this);\n this._runIfNeeded();\n trackDisposable(this);\n }\n dispose() {\n this.disposed = true;\n for (const o of this.dependencies) {\n o.removeObserver(this);\n }\n this.dependencies.clear();\n markAsDisposed(this);\n }\n _runIfNeeded() {\n var _a, _b, _c;\n if (this.state === 3 /* AutorunState.upToDate */) {\n return;\n }\n const emptySet = this.dependenciesToBeRemoved;\n this.dependenciesToBeRemoved = this.dependencies;\n this.dependencies = emptySet;\n this.state = 3 /* AutorunState.upToDate */;\n const isDisposed = this.disposed;\n try {\n if (!isDisposed) {\n (_a = getLogger()) === null || _a === void 0 ? void 0 : _a.handleAutorunTriggered(this);\n const changeSummary = this.changeSummary;\n this.changeSummary = (_b = this.createChangeSummary) === null || _b === void 0 ? void 0 : _b.call(this);\n this._runFn(this, changeSummary);\n }\n }\n finally {\n if (!isDisposed) {\n (_c = getLogger()) === null || _c === void 0 ? void 0 : _c.handleAutorunFinished(this);\n }\n // We don't want our observed observables to think that they are (not even temporarily) not being observed.\n // Thus, we only unsubscribe from observables that are definitely not read anymore.\n for (const o of this.dependenciesToBeRemoved) {\n o.removeObserver(this);\n }\n this.dependenciesToBeRemoved.clear();\n }\n }\n toString() {\n return `Autorun<${this.debugName}>`;\n }\n // IObserver implementation\n beginUpdate() {\n if (this.state === 3 /* AutorunState.upToDate */) {\n this.state = 1 /* AutorunState.dependenciesMightHaveChanged */;\n }\n this.updateCount++;\n }\n endUpdate() {\n if (this.updateCount === 1) {\n do {\n if (this.state === 1 /* AutorunState.dependenciesMightHaveChanged */) {\n this.state = 3 /* AutorunState.upToDate */;\n for (const d of this.dependencies) {\n d.reportChanges();\n if (this.state === 2 /* AutorunState.stale */) {\n // The other dependencies will refresh on demand\n break;\n }\n }\n }\n this._runIfNeeded();\n } while (this.state !== 3 /* AutorunState.upToDate */);\n }\n this.updateCount--;\n assertFn(() => this.updateCount >= 0);\n }\n handlePossibleChange(observable) {\n if (this.state === 3 /* AutorunState.upToDate */ && this.dependencies.has(observable) && !this.dependenciesToBeRemoved.has(observable)) {\n this.state = 1 /* AutorunState.dependenciesMightHaveChanged */;\n }\n }\n handleChange(observable, change) {\n if (this.dependencies.has(observable) && !this.dependenciesToBeRemoved.has(observable)) {\n const shouldReact = this._handleChange ? this._handleChange({\n changedObservable: observable,\n change,\n didChange: o => o === observable,\n }, this.changeSummary) : true;\n if (shouldReact) {\n this.state = 2 /* AutorunState.stale */;\n }\n }\n }\n // IReader implementation\n readObservable(observable) {\n // In case the run action disposes the autorun\n if (this.disposed) {\n return observable.get();\n }\n observable.addObserver(this);\n const value = observable.get();\n this.dependencies.add(observable);\n this.dependenciesToBeRemoved.delete(observable);\n return value;\n }\n}\n(function (autorun) {\n autorun.Observer = AutorunObserver;\n})(autorun || (autorun = {}));\n", "/*---------------------------------------------------------------------------------------------\n * 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 { Event } from '../event.js';\nimport { DisposableStore, toDisposable } from '../lifecycle.js';\nimport { BaseObservable, ConvenientObservable, _setKeepObserved, _setRecomputeInitiallyAndOnChange, subtransaction, transaction } from './base.js';\nimport { DebugNameData, getFunctionName } from './debugName.js';\nimport { derived, derivedOpts } from './derived.js';\nimport { getLogger } from './logging.js';\n/**\n * Represents an efficient observable whose value never changes.\n */\nexport function constObservable(value) {\n return new ConstObservable(value);\n}\nclass ConstObservable extends ConvenientObservable {\n constructor(value) {\n super();\n this.value = value;\n }\n get debugName() {\n return this.toString();\n }\n get() {\n return this.value;\n }\n addObserver(observer) {\n // NO OP\n }\n removeObserver(observer) {\n // NO OP\n }\n toString() {\n return `Const: ${this.value}`;\n }\n}\nexport function observableFromEvent(event, getValue) {\n return new FromEventObservable(event, getValue);\n}\nexport class FromEventObservable extends BaseObservable {\n constructor(event, _getValue) {\n super();\n this.event = event;\n this._getValue = _getValue;\n this.hasValue = false;\n this.handleEvent = (args) => {\n var _a;\n const newValue = this._getValue(args);\n const oldValue = this.value;\n const didChange = !this.hasValue || oldValue !== newValue;\n let didRunTransaction = false;\n if (didChange) {\n this.value = newValue;\n if (this.hasValue) {\n didRunTransaction = true;\n subtransaction(FromEventObservable.globalTransaction, (tx) => {\n var _a;\n (_a = getLogger()) === null || _a === void 0 ? void 0 : _a.handleFromEventObservableTriggered(this, { oldValue, newValue, change: undefined, didChange, hadValue: this.hasValue });\n for (const o of this.observers) {\n tx.updateObserver(o, this);\n o.handleChange(this, undefined);\n }\n }, () => {\n const name = this.getDebugName();\n return 'Event fired' + (name ? `: ${name}` : '');\n });\n }\n this.hasValue = true;\n }\n if (!didRunTransaction) {\n (_a = getLogger()) === null || _a === void 0 ? void 0 : _a.handleFromEventObservableTriggered(this, { oldValue, newValue, change: undefined, didChange, hadValue: this.hasValue });\n }\n };\n }\n getDebugName() {\n return getFunctionName(this._getValue);\n }\n get debugName() {\n const name = this.getDebugName();\n return 'From Event' + (name ? `: ${name}` : '');\n }\n onFirstObserverAdded() {\n this.subscription = this.event(this.handleEvent);\n }\n onLastObserverRemoved() {\n this.subscription.dispose();\n this.subscription = undefined;\n this.hasValue = false;\n this.value = undefined;\n }\n get() {\n if (this.subscription) {\n if (!this.hasValue) {\n this.handleEvent(undefined);\n }\n return this.value;\n }\n else {\n // no cache, as there are no subscribers to keep it updated\n const value = this._getValue(undefined);\n return value;\n }\n }\n}\n(function (observableFromEvent) {\n observableFromEvent.Observer = FromEventObservable;\n function batchEventsGlobally(tx, fn) {\n let didSet = false;\n if (FromEventObservable.globalTransaction === undefined) {\n FromEventObservable.globalTransaction = tx;\n didSet = true;\n }\n try {\n fn();\n }\n finally {\n if (didSet) {\n FromEventObservable.globalTransaction = undefined;\n }\n }\n }\n observableFromEvent.batchEventsGlobally = batchEventsGlobally;\n})(observableFromEvent || (observableFromEvent = {}));\nexport function observableSignalFromEvent(debugName, event) {\n return new FromEventObservableSignal(debugName, event);\n}\nclass FromEventObservableSignal extends BaseObservable {\n constructor(debugName, event) {\n super();\n this.debugName = debugName;\n this.event = event;\n this.handleEvent = () => {\n transaction((tx) => {\n for (const o of this.observers) {\n tx.updateObserver(o, this);\n o.handleChange(this, undefined);\n }\n }, () => this.debugName);\n };\n }\n onFirstObserverAdded() {\n this.subscription = this.event(this.handleEvent);\n }\n onLastObserverRemoved() {\n this.subscription.dispose();\n this.subscription = undefined;\n }\n get() {\n // NO OP\n }\n}\nexport function observableSignal(debugNameOrOwner) {\n if (typeof debugNameOrOwner === 'string') {\n return new ObservableSignal(debugNameOrOwner);\n }\n else {\n return new ObservableSignal(undefined, debugNameOrOwner);\n }\n}\nclass ObservableSignal extends BaseObservable {\n get debugName() {\n var _a;\n return (_a = new DebugNameData(this._owner, this._debugName, undefined).getDebugName(this)) !== null && _a !== void 0 ? _a : 'Observable Signal';\n }\n constructor(_debugName, _owner) {\n super();\n this._debugName = _debugName;\n this._owner = _owner;\n }\n trigger(tx, change) {\n if (!tx) {\n transaction(tx => {\n this.trigger(tx, change);\n }, () => `Trigger signal ${this.debugName}`);\n return;\n }\n for (const o of this.observers) {\n tx.updateObserver(o, this);\n o.handleChange(this, change);\n }\n }\n get() {\n // NO OP\n }\n}\n/**\n * This makes sure the observable is being observed and keeps its cache alive.\n */\nexport function keepObserved(observable) {\n const o = new KeepAliveObserver(false, undefined);\n observable.addObserver(o);\n return toDisposable(() => {\n observable.removeObserver(o);\n });\n}\n_setKeepObserved(keepObserved);\n/**\n * This converts the given observable into an autorun.\n */\nexport function recomputeInitiallyAndOnChange(observable, handleValue) {\n const o = new KeepAliveObserver(true, handleValue);\n observable.addObserver(o);\n if (handleValue) {\n handleValue(observable.get());\n }\n else {\n observable.reportChanges();\n }\n return toDisposable(() => {\n observable.removeObserver(o);\n });\n}\n_setRecomputeInitiallyAndOnChange(recomputeInitiallyAndOnChange);\nexport class KeepAliveObserver {\n constructor(_forceRecompute, _handleValue) {\n this._forceRecompute = _forceRecompute;\n this._handleValue = _handleValue;\n this._counter = 0;\n }\n beginUpdate(observable) {\n this._counter++;\n }\n endUpdate(observable) {\n this._counter--;\n if (this._counter === 0 && this._forceRecompute) {\n if (this._handleValue) {\n this._handleValue(observable.get());\n }\n else {\n observable.reportChanges();\n }\n }\n }\n handlePossibleChange(observable) {\n // NO OP\n }\n handleChange(observable, change) {\n // NO OP\n }\n}\nexport function derivedObservableWithWritableCache(owner, computeFn) {\n let lastValue = undefined;\n const onChange = observableSignal('derivedObservableWithWritableCache');\n const observable = derived(owner, reader => {\n onChange.read(reader);\n lastValue = computeFn(reader, lastValue);\n return lastValue;\n });\n return Object.assign(observable, {\n clearCache: (tx) => {\n lastValue = undefined;\n onChange.trigger(tx);\n },\n setCache: (newValue, tx) => {\n lastValue = newValue;\n onChange.trigger(tx);\n }\n });\n}\n/**\n * When the items array changes, referential equal items are not mapped again.\n */\nexport function mapObservableArrayCached(owner, items, map, keySelector) {\n let m = new ArrayMap(map, keySelector);\n const self = derivedOpts({\n debugReferenceFn: map,\n owner,\n onLastObserverRemoved: () => {\n m.dispose();\n m = new ArrayMap(map);\n }\n }, (reader) => {\n m.setItems(items.read(reader));\n return m.getItems();\n });\n return self;\n}\nclass ArrayMap {\n constructor(_map, _keySelector) {\n this._map = _map;\n this._keySelector = _keySelector;\n this._cache = new Map();\n this._items = [];\n }\n dispose() {\n this._cache.forEach(entry => entry.store.dispose());\n this._cache.clear();\n }\n setItems(items) {\n const newItems = [];\n const itemsToRemove = new Set(this._cache.keys());\n for (const item of items) {\n const key = this._keySelector ? this._keySelector(item) : item;\n let entry = this._cache.get(key);\n if (!entry) {\n const store = new DisposableStore();\n const out = this._map(item, store);\n entry = { out, store };\n this._cache.set(key, entry);\n }\n else {\n itemsToRemove.delete(key);\n }\n newItems.push(entry.out);\n }\n for (const item of itemsToRemove) {\n const entry = this._cache.get(item);\n entry.store.dispose();\n this._cache.delete(item);\n }\n this._items = newItems;\n }\n getItems() {\n return this._items;\n }\n}\nexport class ValueWithChangeEventFromObservable {\n constructor(observable) {\n this.observable = observable;\n }\n get onDidChange() {\n return Event.fromObservableLight(this.observable);\n }\n get value() {\n return this.observable.get();\n }\n}\nexport function observableFromValueWithChangeEvent(_owner, value) {\n if (value instanceof ValueWithChangeEventFromObservable) {\n return value.observable;\n }\n return observableFromEvent(value.onDidChange, () => value.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 *--------------------------------------------------------------------------------------------*/\nimport { autorun } from './autorun.js';\nimport { CancellationError } from '../errors.js';\nexport function waitForState(observable, predicate, isError, cancellationToken) {\n if (!predicate) {\n predicate = state => state !== null && state !== undefined;\n }\n return new Promise((resolve, reject) => {\n let isImmediateRun = true;\n let shouldDispose = false;\n const stateObs = observable.map(state => {\n /** @description waitForState.state */\n return {\n isFinished: predicate(state),\n error: isError ? isError(state) : false,\n state\n };\n });\n const d = autorun(reader => {\n /** @description waitForState */\n const { isFinished, error, state } = stateObs.read(reader);\n if (isFinished || error) {\n if (isImmediateRun) {\n // The variable `d` is not initialized yet\n shouldDispose = true;\n }\n else {\n d.dispose();\n }\n if (error) {\n reject(error === true ? state : error);\n }\n else {\n resolve(state);\n }\n }\n });\n if (cancellationToken) {\n const dc = cancellationToken.onCancellationRequested(() => {\n d.dispose();\n dc.dispose();\n reject(new CancellationError());\n });\n if (cancellationToken.isCancellationRequested) {\n d.dispose();\n dc.dispose();\n reject(new CancellationError());\n return;\n }\n }\n isImmediateRun = false;\n if (shouldDispose) {\n d.dispose();\n }\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 *--------------------------------------------------------------------------------------------*/\nexport { observableValue, disposableObservableValue, transaction, subtransaction } from './observableInternal/base.js';\nexport { derived, derivedOpts, derivedHandleChanges, derivedWithStore } from './observableInternal/derived.js';\nexport { autorun, autorunHandleChanges, autorunWithStore, autorunOpts } from './observableInternal/autorun.js';\nexport { constObservable, derivedObservableWithWritableCache, keepObserved, recomputeInitiallyAndOnChange, observableFromEvent, observableSignal, observableSignalFromEvent } from './observableInternal/utils.js';\nexport { waitForState } from './observableInternal/promise.js';\nimport { ConsoleObservableLogger, setLogger } from './observableInternal/logging.js';\n// Remove \"//\" in the next line to enable logging\nconst enableLogging = false;\nif (enableLogging) {\n setLogger(new ConsoleObservableLogger());\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 { createDecorator } from '../../../platform/instantiation/common/instantiation.js';\nexport const IEditorWorkerService = createDecorator('editorWorkerService');\n", "/*---------------------------------------------------------------------------------------------\n * 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 { createDecorator } from '../../../platform/instantiation/common/instantiation.js';\nexport const IStandaloneThemeService = createDecorator('themeService');\n", "/*---------------------------------------------------------------------------------------------\n * 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 { env } from './process.js';\nexport function isHotReloadEnabled() {\n return env && !!env['VSCODE_DEV'];\n}\nexport function registerHotReloadHandler(handler) {\n if (!isHotReloadEnabled()) {\n return { dispose() { } };\n }\n else {\n const handlers = registerGlobalHotReloadHandler();\n handlers.add(handler);\n return {\n dispose() { handlers.delete(handler); }\n };\n }\n}\nfunction registerGlobalHotReloadHandler() {\n if (!hotReloadHandlers) {\n hotReloadHandlers = new Set();\n }\n const g = globalThis;\n if (!g.$hotReload_applyNewExports) {\n g.$hotReload_applyNewExports = args => {\n const args2 = { config: { mode: undefined }, ...args };\n for (const h of hotReloadHandlers) {\n const result = h(args2);\n if (result) {\n return result;\n }\n }\n return undefined;\n };\n }\n return hotReloadHandlers;\n}\nlet hotReloadHandlers = undefined;\nif (isHotReloadEnabled()) {\n // This code does not run in production.\n registerHotReloadHandler(({ oldExports, newSrc, config }) => {\n if (config.mode !== 'patch-prototype') {\n return undefined;\n }\n return newExports => {\n var _a, _b;\n for (const key in newExports) {\n const exportedItem = newExports[key];\n console.log(`[hot-reload] Patching prototype methods of '${key}'`, { exportedItem });\n if (typeof exportedItem === 'function' && exportedItem.prototype) {\n const oldExportedItem = oldExports[key];\n if (oldExportedItem) {\n for (const prop of Object.getOwnPropertyNames(exportedItem.prototype)) {\n const descriptor = Object.getOwnPropertyDescriptor(exportedItem.prototype, prop);\n const oldDescriptor = Object.getOwnPropertyDescriptor(oldExportedItem.prototype, prop);\n if (((_a = descriptor === null || descriptor === void 0 ? void 0 : descriptor.value) === null || _a === void 0 ? void 0 : _a.toString()) !== ((_b = oldDescriptor === null || oldDescriptor === void 0 ? void 0 : oldDescriptor.value) === null || _b === void 0 ? void 0 : _b.toString())) {\n console.log(`[hot-reload] Patching prototype method '${key}.${prop}'`);\n }\n Object.defineProperty(oldExportedItem.prototype, prop, descriptor);\n }\n newExports[key] = oldExportedItem;\n }\n }\n }\n return true;\n };\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 *--------------------------------------------------------------------------------------------*/\nimport { findLast } from '../../../../base/common/arraysFind.js';\nimport { CancellationTokenSource } from '../../../../base/common/cancellation.js';\nimport { isHotReloadEnabled, registerHotReloadHandler } from '../../../../base/common/hotReload.js';\nimport { Disposable, DisposableStore, toDisposable } from '../../../../base/common/lifecycle.js';\nimport { autorun, autorunHandleChanges, autorunOpts, autorunWithStore, observableSignalFromEvent, observableValue, transaction } from '../../../../base/common/observable.js';\nimport { ElementSizeObserver } from '../../config/elementSizeObserver.js';\nimport { Position } from '../../../common/core/position.js';\nimport { Range } from '../../../common/core/range.js';\nimport { TextLength } from '../../../common/core/textLength.js';\nexport function joinCombine(arr1, arr2, keySelector, combine) {\n if (arr1.length === 0) {\n return arr2;\n }\n if (arr2.length === 0) {\n return arr1;\n }\n const result = [];\n let i = 0;\n let j = 0;\n while (i < arr1.length && j < arr2.length) {\n const val1 = arr1[i];\n const val2 = arr2[j];\n const key1 = keySelector(val1);\n const key2 = keySelector(val2);\n if (key1 < key2) {\n result.push(val1);\n i++;\n }\n else if (key1 > key2) {\n result.push(val2);\n j++;\n }\n else {\n result.push(combine(val1, val2));\n i++;\n j++;\n }\n }\n while (i < arr1.length) {\n result.push(arr1[i]);\n i++;\n }\n while (j < arr2.length) {\n result.push(arr2[j]);\n j++;\n }\n return result;\n}\n// TODO make utility\nexport function applyObservableDecorations(editor, decorations) {\n const d = new DisposableStore();\n const decorationsCollection = editor.createDecorationsCollection();\n d.add(autorunOpts({ debugName: () => `Apply decorations from ${decorations.debugName}` }, reader => {\n const d = decorations.read(reader);\n decorationsCollection.set(d);\n }));\n d.add({\n dispose: () => {\n decorationsCollection.clear();\n }\n });\n return d;\n}\nexport function appendRemoveOnDispose(parent, child) {\n parent.appendChild(child);\n return toDisposable(() => {\n parent.removeChild(child);\n });\n}\nexport function prependRemoveOnDispose(parent, child) {\n parent.prepend(child);\n return toDisposable(() => {\n parent.removeChild(child);\n });\n}\nexport class ObservableElementSizeObserver extends Disposable {\n get width() { return this._width; }\n get height() { return this._height; }\n constructor(element, dimension) {\n super();\n this.elementSizeObserver = this._register(new ElementSizeObserver(element, dimension));\n this._width = observableValue(this, this.elementSizeObserver.getWidth());\n this._height = observableValue(this, this.elementSizeObserver.getHeight());\n this._register(this.elementSizeObserver.onDidChange(e => transaction(tx => {\n /** @description Set width/height from elementSizeObserver */\n this._width.set(this.elementSizeObserver.getWidth(), tx);\n this._height.set(this.elementSizeObserver.getHeight(), tx);\n })));\n }\n observe(dimension) {\n this.elementSizeObserver.observe(dimension);\n }\n setAutomaticLayout(automaticLayout) {\n if (automaticLayout) {\n this.elementSizeObserver.startObserving();\n }\n else {\n this.elementSizeObserver.stopObserving();\n }\n }\n}\nexport function animatedObservable(targetWindow, base, store) {\n let targetVal = base.get();\n let startVal = targetVal;\n let curVal = targetVal;\n const result = observableValue('animatedValue', targetVal);\n let animationStartMs = -1;\n const durationMs = 300;\n let animationFrame = undefined;\n store.add(autorunHandleChanges({\n createEmptyChangeSummary: () => ({ animate: false }),\n handleChange: (ctx, s) => {\n if (ctx.didChange(base)) {\n s.animate = s.animate || ctx.change;\n }\n return true;\n }\n }, (reader, s) => {\n /** @description update value */\n if (animationFrame !== undefined) {\n targetWindow.cancelAnimationFrame(animationFrame);\n animationFrame = undefined;\n }\n startVal = curVal;\n targetVal = base.read(reader);\n animationStartMs = Date.now() - (s.animate ? 0 : durationMs);\n update();\n }));\n function update() {\n const passedMs = Date.now() - animationStartMs;\n curVal = Math.floor(easeOutExpo(passedMs, startVal, targetVal - startVal, durationMs));\n if (passedMs < durationMs) {\n animationFrame = targetWindow.requestAnimationFrame(update);\n }\n else {\n curVal = targetVal;\n }\n result.set(curVal, undefined);\n }\n return result;\n}\nfunction easeOutExpo(t, b, c, d) {\n return t === d ? b + c : c * (-Math.pow(2, -10 * t / d) + 1) + b;\n}\nexport class ViewZoneOverlayWidget extends Disposable {\n constructor(editor, viewZone, htmlElement) {\n super();\n this._register(new ManagedOverlayWidget(editor, htmlElement));\n this._register(applyStyle(htmlElement, {\n height: viewZone.actualHeight,\n top: viewZone.actualTop,\n }));\n }\n}\nexport class PlaceholderViewZone {\n get afterLineNumber() { return this._afterLineNumber.get(); }\n constructor(_afterLineNumber, heightInPx) {\n this._afterLineNumber = _afterLineNumber;\n this.heightInPx = heightInPx;\n this.domNode = document.createElement('div');\n this._actualTop = observableValue(this, undefined);\n this._actualHeight = observableValue(this, undefined);\n this.actualTop = this._actualTop;\n this.actualHeight = this._actualHeight;\n this.showInHiddenAreas = true;\n this.onChange = this._afterLineNumber;\n this.onDomNodeTop = (top) => {\n this._actualTop.set(top, undefined);\n };\n this.onComputedHeight = (height) => {\n this._actualHeight.set(height, undefined);\n };\n }\n}\nexport class ManagedOverlayWidget {\n constructor(_editor, _domElement) {\n this._editor = _editor;\n this._domElement = _domElement;\n this._overlayWidgetId = `managedOverlayWidget-${ManagedOverlayWidget._counter++}`;\n this._overlayWidget = {\n getId: () => this._overlayWidgetId,\n getDomNode: () => this._domElement,\n getPosition: () => null\n };\n this._editor.addOverlayWidget(this._overlayWidget);\n }\n dispose() {\n this._editor.removeOverlayWidget(this._overlayWidget);\n }\n}\nManagedOverlayWidget._counter = 0;\nexport function applyStyle(domNode, style) {\n return autorun(reader => {\n /** @description applyStyle */\n for (let [key, val] of Object.entries(style)) {\n if (val && typeof val === 'object' && 'read' in val) {\n val = val.read(reader);\n }\n if (typeof val === 'number') {\n val = `${val}px`;\n }\n key = key.replace(/[A-Z]/g, m => '-' + m.toLowerCase());\n domNode.style[key] = val;\n }\n });\n}\nexport function readHotReloadableExport(value, reader) {\n observeHotReloadableExports([value], reader);\n return value;\n}\nexport function observeHotReloadableExports(values, reader) {\n if (isHotReloadEnabled()) {\n const o = observableSignalFromEvent('reload', event => registerHotReloadHandler(({ oldExports }) => {\n if (![...Object.values(oldExports)].some(v => values.includes(v))) {\n return undefined;\n }\n return (_newExports) => {\n event(undefined);\n return true;\n };\n }));\n o.read(reader);\n }\n}\nexport function applyViewZones(editor, viewZones, setIsUpdating, zoneIds) {\n const store = new DisposableStore();\n const lastViewZoneIds = [];\n store.add(autorunWithStore((reader, store) => {\n /** @description applyViewZones */\n const curViewZones = viewZones.read(reader);\n const viewZonIdsPerViewZone = new Map();\n const viewZoneIdPerOnChangeObservable = new Map();\n // Add/remove view zones\n if (setIsUpdating) {\n setIsUpdating(true);\n }\n editor.changeViewZones(a => {\n for (const id of lastViewZoneIds) {\n a.removeZone(id);\n zoneIds === null || zoneIds === void 0 ? void 0 : zoneIds.delete(id);\n }\n lastViewZoneIds.length = 0;\n for (const z of curViewZones) {\n const id = a.addZone(z);\n if (z.setZoneId) {\n z.setZoneId(id);\n }\n lastViewZoneIds.push(id);\n zoneIds === null || zoneIds === void 0 ? void 0 : zoneIds.add(id);\n viewZonIdsPerViewZone.set(z, id);\n }\n });\n if (setIsUpdating) {\n setIsUpdating(false);\n }\n // Layout zone on change\n store.add(autorunHandleChanges({\n createEmptyChangeSummary() {\n return { zoneIds: [] };\n },\n handleChange(context, changeSummary) {\n const id = viewZoneIdPerOnChangeObservable.get(context.changedObservable);\n if (id !== undefined) {\n changeSummary.zoneIds.push(id);\n }\n return true;\n },\n }, (reader, changeSummary) => {\n /** @description layoutZone on change */\n for (const vz of curViewZones) {\n if (vz.onChange) {\n viewZoneIdPerOnChangeObservable.set(vz.onChange, viewZonIdsPerViewZone.get(vz));\n vz.onChange.read(reader);\n }\n }\n if (setIsUpdating) {\n setIsUpdating(true);\n }\n editor.changeViewZones(a => { for (const id of changeSummary.zoneIds) {\n a.layoutZone(id);\n } });\n if (setIsUpdating) {\n setIsUpdating(false);\n }\n }));\n }));\n store.add({\n dispose() {\n if (setIsUpdating) {\n setIsUpdating(true);\n }\n editor.changeViewZones(a => { for (const id of lastViewZoneIds) {\n a.removeZone(id);\n } });\n zoneIds === null || zoneIds === void 0 ? void 0 : zoneIds.clear();\n if (setIsUpdating) {\n setIsUpdating(false);\n }\n }\n });\n return store;\n}\nexport class DisposableCancellationTokenSource extends CancellationTokenSource {\n dispose() {\n super.dispose(true);\n }\n}\nexport function translatePosition(posInOriginal, mappings) {\n const mapping = findLast(mappings, m => m.original.startLineNumber <= posInOriginal.lineNumber);\n if (!mapping) {\n // No changes before the position\n return Range.fromPositions(posInOriginal);\n }\n if (mapping.original.endLineNumberExclusive <= posInOriginal.lineNumber) {\n const newLineNumber = posInOriginal.lineNumber - mapping.original.endLineNumberExclusive + mapping.modified.endLineNumberExclusive;\n return Range.fromPositions(new Position(newLineNumber, posInOriginal.column));\n }\n if (!mapping.innerChanges) {\n // Only for legacy algorithm\n return Range.fromPositions(new Position(mapping.modified.startLineNumber, 1));\n }\n const innerMapping = findLast(mapping.innerChanges, m => m.originalRange.getStartPosition().isBeforeOrEqual(posInOriginal));\n if (!innerMapping) {\n const newLineNumber = posInOriginal.lineNumber - mapping.original.startLineNumber + mapping.modified.startLineNumber;\n return Range.fromPositions(new Position(newLineNumber, posInOriginal.column));\n }\n if (innerMapping.originalRange.containsPosition(posInOriginal)) {\n return innerMapping.modifiedRange;\n }\n else {\n const l = lengthBetweenPositions(innerMapping.originalRange.getEndPosition(), posInOriginal);\n return Range.fromPositions(l.addToPosition(innerMapping.modifiedRange.getEndPosition()));\n }\n}\nfunction lengthBetweenPositions(position1, position2) {\n if (position1.lineNumber === position2.lineNumber) {\n return new TextLength(0, position2.column - position1.column);\n }\n else {\n return new TextLength(position2.lineNumber - position1.lineNumber, position2.column - 1);\n }\n}\nexport function bindContextKey(key, service, computeValue) {\n const boundKey = key.bindTo(service);\n return autorunOpts({ debugName: () => `Set Context Key \"${key.key}\"` }, reader => {\n boundKey.set(computeValue(reader));\n });\n}\nexport function filterWithPrevious(arr, filter) {\n let prev;\n return arr.filter(cur => {\n const result = filter(cur, prev);\n prev = cur;\n return result;\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 *--------------------------------------------------------------------------------------------*/\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};\nvar HideUnchangedRegionsFeature_1;\nimport { $, addDisposableListener, getWindow, h, reset } from '../../../../../base/browser/dom.js';\nimport { renderIcon, renderLabelWithIcons } from '../../../../../base/browser/ui/iconLabel/iconLabels.js';\nimport { Codicon } from '../../../../../base/common/codicons.js';\nimport { MarkdownString } from '../../../../../base/common/htmlContent.js';\nimport { Disposable } from '../../../../../base/common/lifecycle.js';\nimport { autorun, derived, derivedWithStore, observableFromEvent, observableValue, transaction } from '../../../../../base/common/observable.js';\nimport { derivedDisposable } from '../../../../../base/common/observableInternal/derived.js';\nimport { ThemeIcon } from '../../../../../base/common/themables.js';\nimport { isDefined } from '../../../../../base/common/types.js';\nimport { PlaceholderViewZone, ViewZoneOverlayWidget, applyObservableDecorations, applyStyle } from '../utils.js';\nimport { LineRange } from '../../../../common/core/lineRange.js';\nimport { Position } from '../../../../common/core/position.js';\nimport { Range } from '../../../../common/core/range.js';\nimport { SymbolKinds } from '../../../../common/languages.js';\nimport { localize } from '../../../../../nls.js';\nimport { IInstantiationService } from '../../../../../platform/instantiation/common/instantiation.js';\n/**\n * Make sure to add the view zones to the editor!\n */\nlet HideUnchangedRegionsFeature = HideUnchangedRegionsFeature_1 = class HideUnchangedRegionsFeature extends Disposable {\n static setBreadcrumbsSourceFactory(factory) {\n this._breadcrumbsSourceFactory.set(factory, undefined);\n }\n get isUpdatingHiddenAreas() { return this._isUpdatingHiddenAreas; }\n constructor(_editors, _diffModel, _options, _instantiationService) {\n super();\n this._editors = _editors;\n this._diffModel = _diffModel;\n this._options = _options;\n this._instantiationService = _instantiationService;\n this._modifiedOutlineSource = derivedDisposable(this, (reader) => {\n const m = this._editors.modifiedModel.read(reader);\n const factory = HideUnchangedRegionsFeature_1._breadcrumbsSourceFactory.read(reader);\n return (!m || !factory) ? undefined : factory(m, this._instantiationService);\n });\n this._isUpdatingHiddenAreas = false;\n this._register(this._editors.original.onDidChangeCursorPosition(e => {\n if (e.reason === 1 /* CursorChangeReason.ContentFlush */) {\n return;\n }\n const m = this._diffModel.get();\n transaction(tx => {\n for (const s of this._editors.original.getSelections() || []) {\n m === null || m === void 0 ? void 0 : m.ensureOriginalLineIsVisible(s.getStartPosition().lineNumber, 0 /* RevealPreference.FromCloserSide */, tx);\n m === null || m === void 0 ? void 0 : m.ensureOriginalLineIsVisible(s.getEndPosition().lineNumber, 0 /* RevealPreference.FromCloserSide */, tx);\n }\n });\n }));\n this._register(this._editors.modified.onDidChangeCursorPosition(e => {\n if (e.reason === 1 /* CursorChangeReason.ContentFlush */) {\n return;\n }\n const m = this._diffModel.get();\n transaction(tx => {\n for (const s of this._editors.modified.getSelections() || []) {\n m === null || m === void 0 ? void 0 : m.ensureModifiedLineIsVisible(s.getStartPosition().lineNumber, 0 /* RevealPreference.FromCloserSide */, tx);\n m === null || m === void 0 ? void 0 : m.ensureModifiedLineIsVisible(s.getEndPosition().lineNumber, 0 /* RevealPreference.FromCloserSide */, tx);\n }\n });\n }));\n const unchangedRegions = this._diffModel.map((m, reader) => {\n var _a, _b;\n const regions = (_a = m === null || m === void 0 ? void 0 : m.unchangedRegions.read(reader)) !== null && _a !== void 0 ? _a : [];\n if (regions.length === 1 && regions[0].modifiedLineNumber === 1 && regions[0].lineCount === ((_b = this._editors.modifiedModel.read(reader)) === null || _b === void 0 ? void 0 : _b.getLineCount())) {\n return [];\n }\n return regions;\n });\n this.viewZones = derivedWithStore(this, (reader, store) => {\n /** @description view Zones */\n const modifiedOutlineSource = this._modifiedOutlineSource.read(reader);\n if (!modifiedOutlineSource) {\n return { origViewZones: [], modViewZones: [] };\n }\n const origViewZones = [];\n const modViewZones = [];\n const sideBySide = this._options.renderSideBySide.read(reader);\n const curUnchangedRegions = unchangedRegions.read(reader);\n for (const r of curUnchangedRegions) {\n if (r.shouldHideControls(reader)) {\n continue;\n }\n {\n const d = derived(this, reader => /** @description hiddenOriginalRangeStart */ r.getHiddenOriginalRange(reader).startLineNumber - 1);\n const origVz = new PlaceholderViewZone(d, 24);\n origViewZones.push(origVz);\n store.add(new CollapsedCodeOverlayWidget(this._editors.original, origVz, r, r.originalUnchangedRange, !sideBySide, modifiedOutlineSource, l => this._diffModel.get().ensureModifiedLineIsVisible(l, 2 /* RevealPreference.FromBottom */, undefined), this._options));\n }\n {\n const d = derived(this, reader => /** @description hiddenModifiedRangeStart */ r.getHiddenModifiedRange(reader).startLineNumber - 1);\n const modViewZone = new PlaceholderViewZone(d, 24);\n modViewZones.push(modViewZone);\n store.add(new CollapsedCodeOverlayWidget(this._editors.modified, modViewZone, r, r.modifiedUnchangedRange, false, modifiedOutlineSource, l => this._diffModel.get().ensureModifiedLineIsVisible(l, 2 /* RevealPreference.FromBottom */, undefined), this._options));\n }\n }\n return { origViewZones, modViewZones, };\n });\n const unchangedLinesDecoration = {\n description: 'unchanged lines',\n className: 'diff-unchanged-lines',\n isWholeLine: true,\n };\n const unchangedLinesDecorationShow = {\n description: 'Fold Unchanged',\n glyphMarginHoverMessage: new MarkdownString(undefined, { isTrusted: true, supportThemeIcons: true })\n .appendMarkdown(localize('foldUnchanged', 'Fold Unchanged Region')),\n glyphMarginClassName: 'fold-unchanged ' + ThemeIcon.asClassName(Codicon.fold),\n zIndex: 10001,\n };\n this._register(applyObservableDecorations(this._editors.original, derived(this, reader => {\n /** @description decorations */\n const curUnchangedRegions = unchangedRegions.read(reader);\n const result = curUnchangedRegions.map(r => ({\n range: r.originalUnchangedRange.toInclusiveRange(),\n options: unchangedLinesDecoration,\n }));\n for (const r of curUnchangedRegions) {\n if (r.shouldHideControls(reader)) {\n result.push({\n range: Range.fromPositions(new Position(r.originalLineNumber, 1)),\n options: unchangedLinesDecorationShow,\n });\n }\n }\n return result;\n })));\n this._register(applyObservableDecorations(this._editors.modified, derived(this, reader => {\n /** @description decorations */\n const curUnchangedRegions = unchangedRegions.read(reader);\n const result = curUnchangedRegions.map(r => ({\n range: r.modifiedUnchangedRange.toInclusiveRange(),\n options: unchangedLinesDecoration,\n }));\n for (const r of curUnchangedRegions) {\n if (r.shouldHideControls(reader)) {\n result.push({\n range: LineRange.ofLength(r.modifiedLineNumber, 1).toInclusiveRange(),\n options: unchangedLinesDecorationShow,\n });\n }\n }\n return result;\n })));\n this._register(autorun((reader) => {\n /** @description update folded unchanged regions */\n const curUnchangedRegions = unchangedRegions.read(reader);\n this._isUpdatingHiddenAreas = true;\n try {\n this._editors.original.setHiddenAreas(curUnchangedRegions.map(r => r.getHiddenOriginalRange(reader).toInclusiveRange()).filter(isDefined));\n this._editors.modified.setHiddenAreas(curUnchangedRegions.map(r => r.getHiddenModifiedRange(reader).toInclusiveRange()).filter(isDefined));\n }\n finally {\n this._isUpdatingHiddenAreas = false;\n }\n }));\n this._register(this._editors.modified.onMouseUp(event => {\n var _a;\n if (!event.event.rightButton && event.target.position && ((_a = event.target.element) === null || _a === void 0 ? void 0 : _a.className.includes('fold-unchanged'))) {\n const lineNumber = event.target.position.lineNumber;\n const model = this._diffModel.get();\n if (!model) {\n return;\n }\n const region = model.unchangedRegions.get().find(r => r.modifiedUnchangedRange.includes(lineNumber));\n if (!region) {\n return;\n }\n region.collapseAll(undefined);\n event.event.stopPropagation();\n event.event.preventDefault();\n }\n }));\n this._register(this._editors.original.onMouseUp(event => {\n var _a;\n if (!event.event.rightButton && event.target.position && ((_a = event.target.element) === null || _a === void 0 ? void 0 : _a.className.includes('fold-unchanged'))) {\n const lineNumber = event.target.position.lineNumber;\n const model = this._diffModel.get();\n if (!model) {\n return;\n }\n const region = model.unchangedRegions.get().find(r => r.originalUnchangedRange.includes(lineNumber));\n if (!region) {\n return;\n }\n region.collapseAll(undefined);\n event.event.stopPropagation();\n event.event.preventDefault();\n }\n }));\n }\n};\nHideUnchangedRegionsFeature._breadcrumbsSourceFactory = observableValue('breadcrumbsSourceFactory', undefined);\nHideUnchangedRegionsFeature = HideUnchangedRegionsFeature_1 = __decorate([\n __param(3, IInstantiationService)\n], HideUnchangedRegionsFeature);\nexport { HideUnchangedRegionsFeature };\nclass CollapsedCodeOverlayWidget extends ViewZoneOverlayWidget {\n constructor(_editor, _viewZone, _unchangedRegion, _unchangedRegionRange, _hide, _modifiedOutlineSource, _revealModifiedHiddenLine, _options) {\n const root = h('div.diff-hidden-lines-widget');\n super(_editor, _viewZone, root.root);\n this._editor = _editor;\n this._unchangedRegion = _unchangedRegion;\n this._unchangedRegionRange = _unchangedRegionRange;\n this._hide = _hide;\n this._modifiedOutlineSource = _modifiedOutlineSource;\n this._revealModifiedHiddenLine = _revealModifiedHiddenLine;\n this._options = _options;\n this._nodes = h('div.diff-hidden-lines', [\n h('div.top@top', { title: localize('diff.hiddenLines.top', 'Click or drag to show more above') }),\n h('div.center@content', { style: { display: 'flex' } }, [\n h('div@first', { style: { display: 'flex', justifyContent: 'center', alignItems: 'center', flexShrink: '0' } }, [$('a', { title: localize('showUnchangedRegion', 'Show Unchanged Region'), role: 'button', onclick: () => { this._unchangedRegion.showAll(undefined); } }, ...renderLabelWithIcons('$(unfold)'))]),\n h('div@others', { style: { display: 'flex', justifyContent: 'center', alignItems: 'center' } }),\n ]),\n h('div.bottom@bottom', { title: localize('diff.bottom', 'Click or drag to show more below'), role: 'button' }),\n ]);\n root.root.appendChild(this._nodes.root);\n const layoutInfo = observableFromEvent(this._editor.onDidLayoutChange, () => this._editor.getLayoutInfo());\n if (!this._hide) {\n this._register(applyStyle(this._nodes.first, { width: layoutInfo.map((l) => l.contentLeft) }));\n }\n else {\n reset(this._nodes.first);\n }\n this._register(autorun(reader => {\n /** @description Update CollapsedCodeOverlayWidget canMove* css classes */\n const isFullyRevealed = this._unchangedRegion.visibleLineCountTop.read(reader) + this._unchangedRegion.visibleLineCountBottom.read(reader) === this._unchangedRegion.lineCount;\n this._nodes.bottom.classList.toggle('canMoveTop', !isFullyRevealed);\n this._nodes.bottom.classList.toggle('canMoveBottom', this._unchangedRegion.visibleLineCountBottom.read(reader) > 0);\n this._nodes.top.classList.toggle('canMoveTop', this._unchangedRegion.visibleLineCountTop.read(reader) > 0);\n this._nodes.top.classList.toggle('canMoveBottom', !isFullyRevealed);\n const isDragged = this._unchangedRegion.isDragged.read(reader);\n const domNode = this._editor.getDomNode();\n if (domNode) {\n domNode.classList.toggle('draggingUnchangedRegion', !!isDragged);\n if (isDragged === 'top') {\n domNode.classList.toggle('canMoveTop', this._unchangedRegion.visibleLineCountTop.read(reader) > 0);\n domNode.classList.toggle('canMoveBottom', !isFullyRevealed);\n }\n else if (isDragged === 'bottom') {\n domNode.classList.toggle('canMoveTop', !isFullyRevealed);\n domNode.classList.toggle('canMoveBottom', this._unchangedRegion.visibleLineCountBottom.read(reader) > 0);\n }\n else {\n domNode.classList.toggle('canMoveTop', false);\n domNode.classList.toggle('canMoveBottom', false);\n }\n }\n }));\n const editor = this._editor;\n this._register(addDisposableListener(this._nodes.top, 'mousedown', e => {\n if (e.button !== 0) {\n return;\n }\n this._nodes.top.classList.toggle('dragging', true);\n this._nodes.root.classList.toggle('dragging', true);\n e.preventDefault();\n const startTop = e.clientY;\n let didMove = false;\n const cur = this._unchangedRegion.visibleLineCountTop.get();\n this._unchangedRegion.isDragged.set('top', undefined);\n const window = getWindow(this._nodes.top);\n const mouseMoveListener = addDisposableListener(window, 'mousemove', e => {\n const currentTop = e.clientY;\n const delta = currentTop - startTop;\n didMove = didMove || Math.abs(delta) > 2;\n const lineDelta = Math.round(delta / editor.getOption(67 /* EditorOption.lineHeight */));\n const newVal = Math.max(0, Math.min(cur + lineDelta, this._unchangedRegion.getMaxVisibleLineCountTop()));\n this._unchangedRegion.visibleLineCountTop.set(newVal, undefined);\n });\n const mouseUpListener = addDisposableListener(window, 'mouseup', e => {\n if (!didMove) {\n this._unchangedRegion.showMoreAbove(this._options.hideUnchangedRegionsRevealLineCount.get(), undefined);\n }\n this._nodes.top.classList.toggle('dragging', false);\n this._nodes.root.classList.toggle('dragging', false);\n this._unchangedRegion.isDragged.set(undefined, undefined);\n mouseMoveListener.dispose();\n mouseUpListener.dispose();\n });\n }));\n this._register(addDisposableListener(this._nodes.bottom, 'mousedown', e => {\n if (e.button !== 0) {\n return;\n }\n this._nodes.bottom.classList.toggle('dragging', true);\n this._nodes.root.classList.toggle('dragging', true);\n e.preventDefault();\n const startTop = e.clientY;\n let didMove = false;\n const cur = this._unchangedRegion.visibleLineCountBottom.get();\n this._unchangedRegion.isDragged.set('bottom', undefined);\n const window = getWindow(this._nodes.bottom);\n const mouseMoveListener = addDisposableListener(window, 'mousemove', e => {\n const currentTop = e.clientY;\n const delta = currentTop - startTop;\n didMove = didMove || Math.abs(delta) > 2;\n const lineDelta = Math.round(delta / editor.getOption(67 /* EditorOption.lineHeight */));\n const newVal = Math.max(0, Math.min(cur - lineDelta, this._unchangedRegion.getMaxVisibleLineCountBottom()));\n const top = this._unchangedRegionRange.endLineNumberExclusive > editor.getModel().getLineCount()\n ? editor.getContentHeight()\n : editor.getTopForLineNumber(this._unchangedRegionRange.endLineNumberExclusive);\n this._unchangedRegion.visibleLineCountBottom.set(newVal, undefined);\n const top2 = this._unchangedRegionRange.endLineNumberExclusive > editor.getModel().getLineCount()\n ? editor.getContentHeight()\n : editor.getTopForLineNumber(this._unchangedRegionRange.endLineNumberExclusive);\n editor.setScrollTop(editor.getScrollTop() + (top2 - top));\n });\n const mouseUpListener = addDisposableListener(window, 'mouseup', e => {\n this._unchangedRegion.isDragged.set(undefined, undefined);\n if (!didMove) {\n const top = editor.getTopForLineNumber(this._unchangedRegionRange.endLineNumberExclusive);\n this._unchangedRegion.showMoreBelow(this._options.hideUnchangedRegionsRevealLineCount.get(), undefined);\n const top2 = editor.getTopForLineNumber(this._unchangedRegionRange.endLineNumberExclusive);\n editor.setScrollTop(editor.getScrollTop() + (top2 - top));\n }\n this._nodes.bottom.classList.toggle('dragging', false);\n this._nodes.root.classList.toggle('dragging', false);\n mouseMoveListener.dispose();\n mouseUpListener.dispose();\n });\n }));\n this._register(autorun(reader => {\n /** @description update labels */\n const children = [];\n if (!this._hide) {\n const lineCount = _unchangedRegion.getHiddenModifiedRange(reader).length;\n const linesHiddenText = localize('hiddenLines', '{0} hidden lines', lineCount);\n const span = $('span', { title: localize('diff.hiddenLines.expandAll', 'Double click to unfold') }, linesHiddenText);\n span.addEventListener('dblclick', e => {\n if (e.button !== 0) {\n return;\n }\n e.preventDefault();\n this._unchangedRegion.showAll(undefined);\n });\n children.push(span);\n const range = this._unchangedRegion.getHiddenModifiedRange(reader);\n const items = this._modifiedOutlineSource.getBreadcrumbItems(range, reader);\n if (items.length > 0) {\n children.push($('span', undefined, '\\u00a0\\u00a0|\\u00a0\\u00a0'));\n for (let i = 0; i < items.length; i++) {\n const item = items[i];\n const icon = SymbolKinds.toIcon(item.kind);\n const divItem = h('div.breadcrumb-item', {\n style: { display: 'flex', alignItems: 'center' },\n }, [\n renderIcon(icon),\n '\\u00a0',\n item.name,\n ...(i === items.length - 1\n ? []\n : [renderIcon(Codicon.chevronRight)])\n ]).root;\n children.push(divItem);\n divItem.onclick = () => {\n this._revealModifiedHiddenLine(item.startLineNumber);\n };\n }\n }\n }\n reset(this._nodes.others, ...children);\n }));\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 *--------------------------------------------------------------------------------------------*/\nimport { EditorCommand, registerEditorCommand } from '../../../browser/editorExtensions.js';\nimport { IContextKeyService, RawContextKey } from '../../../../platform/contextkey/common/contextkey.js';\nimport { CancellationTokenSource } from '../../../../base/common/cancellation.js';\nimport { LinkedList } from '../../../../base/common/linkedList.js';\nimport { createDecorator } from '../../../../platform/instantiation/common/instantiation.js';\nimport { registerSingleton } from '../../../../platform/instantiation/common/extensions.js';\nimport { localize } from '../../../../nls.js';\nconst IEditorCancellationTokens = createDecorator('IEditorCancelService');\nconst ctxCancellableOperation = new RawContextKey('cancellableOperation', false, localize('cancellableOperation', 'Whether the editor runs a cancellable operation, e.g. like \\'Peek References\\''));\nregisterSingleton(IEditorCancellationTokens, class {\n constructor() {\n this._tokens = new WeakMap();\n }\n add(editor, cts) {\n let data = this._tokens.get(editor);\n if (!data) {\n data = editor.invokeWithinContext(accessor => {\n const key = ctxCancellableOperation.bindTo(accessor.get(IContextKeyService));\n const tokens = new LinkedList();\n return { key, tokens };\n });\n this._tokens.set(editor, data);\n }\n let removeFn;\n data.key.set(true);\n removeFn = data.tokens.push(cts);\n return () => {\n // remove w/o cancellation\n if (removeFn) {\n removeFn();\n data.key.set(!data.tokens.isEmpty());\n removeFn = undefined;\n }\n };\n }\n cancel(editor) {\n const data = this._tokens.get(editor);\n if (!data) {\n return;\n }\n // remove with cancellation\n const cts = data.tokens.pop();\n if (cts) {\n cts.cancel();\n data.key.set(!data.tokens.isEmpty());\n }\n }\n}, 1 /* InstantiationType.Delayed */);\nexport class EditorKeybindingCancellationTokenSource extends CancellationTokenSource {\n constructor(editor, parent) {\n super(parent);\n this.editor = editor;\n this._unregister = editor.invokeWithinContext(accessor => accessor.get(IEditorCancellationTokens).add(editor, this));\n }\n dispose() {\n this._unregister();\n super.dispose();\n }\n}\nregisterEditorCommand(new class extends EditorCommand {\n constructor() {\n super({\n id: 'editor.cancelOperation',\n kbOpts: {\n weight: 100 /* KeybindingWeight.EditorContrib */,\n primary: 9 /* KeyCode.Escape */\n },\n precondition: ctxCancellableOperation\n });\n }\n runEditorCommand(accessor, editor) {\n accessor.get(IEditorCancellationTokens).cancel(editor);\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 *--------------------------------------------------------------------------------------------*/\nimport * as strings from '../../../../base/common/strings.js';\nimport { Range } from '../../../common/core/range.js';\nimport { CancellationTokenSource } from '../../../../base/common/cancellation.js';\nimport { DisposableStore } from '../../../../base/common/lifecycle.js';\nimport { EditorKeybindingCancellationTokenSource } from './keybindingCancellation.js';\nexport class EditorState {\n constructor(editor, flags) {\n this.flags = flags;\n if ((this.flags & 1 /* CodeEditorStateFlag.Value */) !== 0) {\n const model = editor.getModel();\n this.modelVersionId = model ? strings.format('{0}#{1}', model.uri.toString(), model.getVersionId()) : null;\n }\n else {\n this.modelVersionId = null;\n }\n if ((this.flags & 4 /* CodeEditorStateFlag.Position */) !== 0) {\n this.position = editor.getPosition();\n }\n else {\n this.position = null;\n }\n if ((this.flags & 2 /* CodeEditorStateFlag.Selection */) !== 0) {\n this.selection = editor.getSelection();\n }\n else {\n this.selection = null;\n }\n if ((this.flags & 8 /* CodeEditorStateFlag.Scroll */) !== 0) {\n this.scrollLeft = editor.getScrollLeft();\n this.scrollTop = editor.getScrollTop();\n }\n else {\n this.scrollLeft = -1;\n this.scrollTop = -1;\n }\n }\n _equals(other) {\n if (!(other instanceof EditorState)) {\n return false;\n }\n const state = other;\n if (this.modelVersionId !== state.modelVersionId) {\n return false;\n }\n if (this.scrollLeft !== state.scrollLeft || this.scrollTop !== state.scrollTop) {\n return false;\n }\n if (!this.position && state.position || this.position && !state.position || this.position && state.position && !this.position.equals(state.position)) {\n return false;\n }\n if (!this.selection && state.selection || this.selection && !state.selection || this.selection && state.selection && !this.selection.equalsRange(state.selection)) {\n return false;\n }\n return true;\n }\n validate(editor) {\n return this._equals(new EditorState(editor, this.flags));\n }\n}\n/**\n * A cancellation token source that cancels when the editor changes as expressed\n * by the provided flags\n * @param range If provided, changes in position and selection within this range will not trigger cancellation\n */\nexport class EditorStateCancellationTokenSource extends EditorKeybindingCancellationTokenSource {\n constructor(editor, flags, range, parent) {\n super(editor, parent);\n this._listener = new DisposableStore();\n if (flags & 4 /* CodeEditorStateFlag.Position */) {\n this._listener.add(editor.onDidChangeCursorPosition(e => {\n if (!range || !Range.containsPosition(range, e.position)) {\n this.cancel();\n }\n }));\n }\n if (flags & 2 /* CodeEditorStateFlag.Selection */) {\n this._listener.add(editor.onDidChangeCursorSelection(e => {\n if (!range || !Range.containsRange(range, e.selection)) {\n this.cancel();\n }\n }));\n }\n if (flags & 8 /* CodeEditorStateFlag.Scroll */) {\n this._listener.add(editor.onDidScrollChange(_ => this.cancel()));\n }\n if (flags & 1 /* CodeEditorStateFlag.Value */) {\n this._listener.add(editor.onDidChangeModel(_ => this.cancel()));\n this._listener.add(editor.onDidChangeModelContent(_ => this.cancel()));\n }\n }\n dispose() {\n this._listener.dispose();\n super.dispose();\n }\n}\n/**\n * A cancellation token source that cancels when the provided model changes\n */\nexport class TextModelCancellationTokenSource extends CancellationTokenSource {\n constructor(model, parent) {\n super(parent);\n this._listener = model.onDidChangeContent(() => this.cancel());\n }\n dispose() {\n this._listener.dispose();\n super.dispose();\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 *--------------------------------------------------------------------------------------------*/\nimport { EditorOptions } from './common/config/editorOptions.js';\nimport { createMonacoBaseAPI } from './common/services/editorBaseApi.js';\nimport { createMonacoEditorAPI } from './standalone/browser/standaloneEditor.js';\nimport { createMonacoLanguagesAPI } from './standalone/browser/standaloneLanguages.js';\nimport { FormattingConflicts } from './contrib/format/browser/format.js';\n// Set defaults for standalone editor\nEditorOptions.wrappingIndent.defaultValue = 0 /* WrappingIndent.None */;\nEditorOptions.glyphMargin.defaultValue = false;\nEditorOptions.autoIndent.defaultValue = 3 /* EditorAutoIndentStrategy.Advanced */;\nEditorOptions.overviewRulerLanes.defaultValue = 2;\n// We need to register a formatter selector which simply picks the first available formatter.\n// See https://github.com/microsoft/monaco-editor/issues/2327\nFormattingConflicts.setFormatterSelector((formatter, document, mode) => Promise.resolve(formatter[0]));\nconst api = createMonacoBaseAPI();\napi.editor = createMonacoEditorAPI();\napi.languages = createMonacoLanguagesAPI();\nexport const CancellationTokenSource = api.CancellationTokenSource;\nexport const Emitter = api.Emitter;\nexport const KeyCode = api.KeyCode;\nexport const KeyMod = api.KeyMod;\nexport const Position = api.Position;\nexport const Range = api.Range;\nexport const Selection = api.Selection;\nexport const SelectionDirection = api.SelectionDirection;\nexport const MarkerSeverity = api.MarkerSeverity;\nexport const MarkerTag = api.MarkerTag;\nexport const Uri = api.Uri;\nexport const Token = api.Token;\nexport const editor = api.editor;\nexport const languages = api.languages;\nconst monacoEnvironment = globalThis.MonacoEnvironment;\nif ((monacoEnvironment === null || monacoEnvironment === void 0 ? void 0 : monacoEnvironment.globalAPI) || (typeof define === 'function' && define.amd)) {\n globalThis.monaco = api;\n}\nif (typeof globalThis.require !== 'undefined' && typeof globalThis.require.config === 'function') {\n globalThis.require.config({\n ignoreDuplicateModules: [\n 'vscode-languageserver-types',\n 'vscode-languageserver-types/main',\n 'vscode-languageserver-textdocument',\n 'vscode-languageserver-textdocument/main',\n 'vscode-nls',\n 'vscode-nls/vscode-nls',\n 'jsonc-parser',\n 'jsonc-parser/main',\n 'vscode-uri',\n 'vscode-uri/index',\n 'vs/basic-languages/typescript/typescript'\n ]\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 *--------------------------------------------------------------------------------------------*/\nimport * as arrays from '../../../base/common/arrays.js';\nimport * as objects from '../../../base/common/objects.js';\nimport * as platform from '../../../base/common/platform.js';\nimport { EDITOR_MODEL_DEFAULTS } from '../core/textModelDefaults.js';\nimport { USUAL_WORD_SEPARATORS } from '../core/wordHelper.js';\nimport * as nls from '../../../nls.js';\n/**\n * @internal\n * The width of the minimap gutter, in pixels.\n */\nexport const MINIMAP_GUTTER_WIDTH = 8;\n//#endregion\n/**\n * An event describing that the configuration of the editor has changed.\n */\nexport class ConfigurationChangedEvent {\n /**\n * @internal\n */\n constructor(values) {\n this._values = values;\n }\n hasChanged(id) {\n return this._values[id];\n }\n}\n/**\n * @internal\n */\nexport class ComputeOptionsMemory {\n constructor() {\n this.stableMinimapLayoutInput = null;\n this.stableFitMaxMinimapScale = 0;\n this.stableFitRemainingWidth = 0;\n }\n}\n/**\n * @internal\n */\nclass BaseEditorOption {\n constructor(id, name, defaultValue, schema) {\n this.id = id;\n this.name = name;\n this.defaultValue = defaultValue;\n this.schema = schema;\n }\n applyUpdate(value, update) {\n return applyUpdate(value, update);\n }\n compute(env, options, value) {\n return value;\n }\n}\nexport class ApplyUpdateResult {\n constructor(newValue, didChange) {\n this.newValue = newValue;\n this.didChange = didChange;\n }\n}\nfunction applyUpdate(value, update) {\n if (typeof value !== 'object' || typeof update !== 'object' || !value || !update) {\n return new ApplyUpdateResult(update, value !== update);\n }\n if (Array.isArray(value) || Array.isArray(update)) {\n const arrayEquals = Array.isArray(value) && Array.isArray(update) && arrays.equals(value, update);\n return new ApplyUpdateResult(update, !arrayEquals);\n }\n let didChange = false;\n for (const key in update) {\n if (update.hasOwnProperty(key)) {\n const result = applyUpdate(value[key], update[key]);\n if (result.didChange) {\n value[key] = result.newValue;\n didChange = true;\n }\n }\n }\n return new ApplyUpdateResult(value, didChange);\n}\n/**\n * @internal\n */\nclass ComputedEditorOption {\n constructor(id) {\n this.schema = undefined;\n this.id = id;\n this.name = '_never_';\n this.defaultValue = undefined;\n }\n applyUpdate(value, update) {\n return applyUpdate(value, update);\n }\n validate(input) {\n return this.defaultValue;\n }\n}\nclass SimpleEditorOption {\n constructor(id, name, defaultValue, schema) {\n this.id = id;\n this.name = name;\n this.defaultValue = defaultValue;\n this.schema = schema;\n }\n applyUpdate(value, update) {\n return applyUpdate(value, update);\n }\n validate(input) {\n if (typeof input === 'undefined') {\n return this.defaultValue;\n }\n return input;\n }\n compute(env, options, value) {\n return value;\n }\n}\n/**\n * @internal\n */\nexport function boolean(value, defaultValue) {\n if (typeof value === 'undefined') {\n return defaultValue;\n }\n if (value === 'false') {\n // treat the string 'false' as false\n return false;\n }\n return Boolean(value);\n}\nclass EditorBooleanOption extends SimpleEditorOption {\n constructor(id, name, defaultValue, schema = undefined) {\n if (typeof schema !== 'undefined') {\n schema.type = 'boolean';\n schema.default = defaultValue;\n }\n super(id, name, defaultValue, schema);\n }\n validate(input) {\n return boolean(input, this.defaultValue);\n }\n}\n/**\n * @internal\n */\nexport function clampedInt(value, defaultValue, minimum, maximum) {\n if (typeof value === 'undefined') {\n return defaultValue;\n }\n let r = parseInt(value, 10);\n if (isNaN(r)) {\n return defaultValue;\n }\n r = Math.max(minimum, r);\n r = Math.min(maximum, r);\n return r | 0;\n}\nclass EditorIntOption extends SimpleEditorOption {\n static clampedInt(value, defaultValue, minimum, maximum) {\n return clampedInt(value, defaultValue, minimum, maximum);\n }\n constructor(id, name, defaultValue, minimum, maximum, schema = undefined) {\n if (typeof schema !== 'undefined') {\n schema.type = 'integer';\n schema.default = defaultValue;\n schema.minimum = minimum;\n schema.maximum = maximum;\n }\n super(id, name, defaultValue, schema);\n this.minimum = minimum;\n this.maximum = maximum;\n }\n validate(input) {\n return EditorIntOption.clampedInt(input, this.defaultValue, this.minimum, this.maximum);\n }\n}\n/**\n * @internal\n */\nexport function clampedFloat(value, defaultValue, minimum, maximum) {\n if (typeof value === 'undefined') {\n return defaultValue;\n }\n const r = EditorFloatOption.float(value, defaultValue);\n return EditorFloatOption.clamp(r, minimum, maximum);\n}\nclass EditorFloatOption extends SimpleEditorOption {\n static clamp(n, min, max) {\n if (n < min) {\n return min;\n }\n if (n > max) {\n return max;\n }\n return n;\n }\n static float(value, defaultValue) {\n if (typeof value === 'number') {\n return value;\n }\n if (typeof value === 'undefined') {\n return defaultValue;\n }\n const r = parseFloat(value);\n return (isNaN(r) ? defaultValue : r);\n }\n constructor(id, name, defaultValue, validationFn, schema) {\n if (typeof schema !== 'undefined') {\n schema.type = 'number';\n schema.default = defaultValue;\n }\n super(id, name, defaultValue, schema);\n this.validationFn = validationFn;\n }\n validate(input) {\n return this.validationFn(EditorFloatOption.float(input, this.defaultValue));\n }\n}\nclass EditorStringOption extends SimpleEditorOption {\n static string(value, defaultValue) {\n if (typeof value !== 'string') {\n return defaultValue;\n }\n return value;\n }\n constructor(id, name, defaultValue, schema = undefined) {\n if (typeof schema !== 'undefined') {\n schema.type = 'string';\n schema.default = defaultValue;\n }\n super(id, name, defaultValue, schema);\n }\n validate(input) {\n return EditorStringOption.string(input, this.defaultValue);\n }\n}\n/**\n * @internal\n */\nexport function stringSet(value, defaultValue, allowedValues, renamedValues) {\n if (typeof value !== 'string') {\n return defaultValue;\n }\n if (renamedValues && value in renamedValues) {\n return renamedValues[value];\n }\n if (allowedValues.indexOf(value) === -1) {\n return defaultValue;\n }\n return value;\n}\nclass EditorStringEnumOption extends SimpleEditorOption {\n constructor(id, name, defaultValue, allowedValues, schema = undefined) {\n if (typeof schema !== 'undefined') {\n schema.type = 'string';\n schema.enum = allowedValues;\n schema.default = defaultValue;\n }\n super(id, name, defaultValue, schema);\n this._allowedValues = allowedValues;\n }\n validate(input) {\n return stringSet(input, this.defaultValue, this._allowedValues);\n }\n}\nclass EditorEnumOption extends BaseEditorOption {\n constructor(id, name, defaultValue, defaultStringValue, allowedValues, convert, schema = undefined) {\n if (typeof schema !== 'undefined') {\n schema.type = 'string';\n schema.enum = allowedValues;\n schema.default = defaultStringValue;\n }\n super(id, name, defaultValue, schema);\n this._allowedValues = allowedValues;\n this._convert = convert;\n }\n validate(input) {\n if (typeof input !== 'string') {\n return this.defaultValue;\n }\n if (this._allowedValues.indexOf(input) === -1) {\n return this.defaultValue;\n }\n return this._convert(input);\n }\n}\n//#endregion\n//#region autoIndent\nfunction _autoIndentFromString(autoIndent) {\n switch (autoIndent) {\n case 'none': return 0 /* EditorAutoIndentStrategy.None */;\n case 'keep': return 1 /* EditorAutoIndentStrategy.Keep */;\n case 'brackets': return 2 /* EditorAutoIndentStrategy.Brackets */;\n case 'advanced': return 3 /* EditorAutoIndentStrategy.Advanced */;\n case 'full': return 4 /* EditorAutoIndentStrategy.Full */;\n }\n}\n//#endregion\n//#region accessibilitySupport\nclass EditorAccessibilitySupport extends BaseEditorOption {\n constructor() {\n super(2 /* EditorOption.accessibilitySupport */, 'accessibilitySupport', 0 /* AccessibilitySupport.Unknown */, {\n type: 'string',\n enum: ['auto', 'on', 'off'],\n enumDescriptions: [\n nls.localize('accessibilitySupport.auto', \"Use platform APIs to detect when a Screen Reader is attached.\"),\n nls.localize('accessibilitySupport.on', \"Optimize for usage with a Screen Reader.\"),\n nls.localize('accessibilitySupport.off', \"Assume a screen reader is not attached.\"),\n ],\n default: 'auto',\n tags: ['accessibility'],\n description: nls.localize('accessibilitySupport', \"Controls if the UI should run in a mode where it is optimized for screen readers.\")\n });\n }\n validate(input) {\n switch (input) {\n case 'auto': return 0 /* AccessibilitySupport.Unknown */;\n case 'off': return 1 /* AccessibilitySupport.Disabled */;\n case 'on': return 2 /* AccessibilitySupport.Enabled */;\n }\n return this.defaultValue;\n }\n compute(env, options, value) {\n if (value === 0 /* AccessibilitySupport.Unknown */) {\n // The editor reads the `accessibilitySupport` from the environment\n return env.accessibilitySupport;\n }\n return value;\n }\n}\nclass EditorComments extends BaseEditorOption {\n constructor() {\n const defaults = {\n insertSpace: true,\n ignoreEmptyLines: true,\n };\n super(23 /* EditorOption.comments */, 'comments', defaults, {\n 'editor.comments.insertSpace': {\n type: 'boolean',\n default: defaults.insertSpace,\n description: nls.localize('comments.insertSpace', \"Controls whether a space character is inserted when commenting.\")\n },\n 'editor.comments.ignoreEmptyLines': {\n type: 'boolean',\n default: defaults.ignoreEmptyLines,\n description: nls.localize('comments.ignoreEmptyLines', 'Controls if empty lines should be ignored with toggle, add or remove actions for line comments.')\n },\n });\n }\n validate(_input) {\n if (!_input || typeof _input !== 'object') {\n return this.defaultValue;\n }\n const input = _input;\n return {\n insertSpace: boolean(input.insertSpace, this.defaultValue.insertSpace),\n ignoreEmptyLines: boolean(input.ignoreEmptyLines, this.defaultValue.ignoreEmptyLines),\n };\n }\n}\nfunction _cursorBlinkingStyleFromString(cursorBlinkingStyle) {\n switch (cursorBlinkingStyle) {\n case 'blink': return 1 /* TextEditorCursorBlinkingStyle.Blink */;\n case 'smooth': return 2 /* TextEditorCursorBlinkingStyle.Smooth */;\n case 'phase': return 3 /* TextEditorCursorBlinkingStyle.Phase */;\n case 'expand': return 4 /* TextEditorCursorBlinkingStyle.Expand */;\n case 'solid': return 5 /* TextEditorCursorBlinkingStyle.Solid */;\n }\n}\n//#endregion\n//#region cursorStyle\n/**\n * The style in which the editor's cursor should be rendered.\n */\nexport var TextEditorCursorStyle;\n(function (TextEditorCursorStyle) {\n /**\n * As a vertical line (sitting between two characters).\n */\n TextEditorCursorStyle[TextEditorCursorStyle[\"Line\"] = 1] = \"Line\";\n /**\n * As a block (sitting on top of a character).\n */\n TextEditorCursorStyle[TextEditorCursorStyle[\"Block\"] = 2] = \"Block\";\n /**\n * As a horizontal line (sitting under a character).\n */\n TextEditorCursorStyle[TextEditorCursorStyle[\"Underline\"] = 3] = \"Underline\";\n /**\n * As a thin vertical line (sitting between two characters).\n */\n TextEditorCursorStyle[TextEditorCursorStyle[\"LineThin\"] = 4] = \"LineThin\";\n /**\n * As an outlined block (sitting on top of a character).\n */\n TextEditorCursorStyle[TextEditorCursorStyle[\"BlockOutline\"] = 5] = \"BlockOutline\";\n /**\n * As a thin horizontal line (sitting under a character).\n */\n TextEditorCursorStyle[TextEditorCursorStyle[\"UnderlineThin\"] = 6] = \"UnderlineThin\";\n})(TextEditorCursorStyle || (TextEditorCursorStyle = {}));\nfunction _cursorStyleFromString(cursorStyle) {\n switch (cursorStyle) {\n case 'line': return TextEditorCursorStyle.Line;\n case 'block': return TextEditorCursorStyle.Block;\n case 'underline': return TextEditorCursorStyle.Underline;\n case 'line-thin': return TextEditorCursorStyle.LineThin;\n case 'block-outline': return TextEditorCursorStyle.BlockOutline;\n case 'underline-thin': return TextEditorCursorStyle.UnderlineThin;\n }\n}\n//#endregion\n//#region editorClassName\nclass EditorClassName extends ComputedEditorOption {\n constructor() {\n super(142 /* EditorOption.editorClassName */);\n }\n compute(env, options, _) {\n const classNames = ['monaco-editor'];\n if (options.get(39 /* EditorOption.extraEditorClassName */)) {\n classNames.push(options.get(39 /* EditorOption.extraEditorClassName */));\n }\n if (env.extraEditorClassName) {\n classNames.push(env.extraEditorClassName);\n }\n if (options.get(74 /* EditorOption.mouseStyle */) === 'default') {\n classNames.push('mouse-default');\n }\n else if (options.get(74 /* EditorOption.mouseStyle */) === 'copy') {\n classNames.push('mouse-copy');\n }\n if (options.get(111 /* EditorOption.showUnused */)) {\n classNames.push('showUnused');\n }\n if (options.get(140 /* EditorOption.showDeprecated */)) {\n classNames.push('showDeprecated');\n }\n return classNames.join(' ');\n }\n}\n//#endregion\n//#region emptySelectionClipboard\nclass EditorEmptySelectionClipboard extends EditorBooleanOption {\n constructor() {\n super(37 /* EditorOption.emptySelectionClipboard */, 'emptySelectionClipboard', true, { description: nls.localize('emptySelectionClipboard', \"Controls whether copying without a selection copies the current line.\") });\n }\n compute(env, options, value) {\n return value && env.emptySelectionClipboard;\n }\n}\nclass EditorFind extends BaseEditorOption {\n constructor() {\n const defaults = {\n cursorMoveOnType: true,\n seedSearchStringFromSelection: 'always',\n autoFindInSelection: 'never',\n globalFindClipboard: false,\n addExtraSpaceOnTop: true,\n loop: true\n };\n super(41 /* EditorOption.find */, 'find', defaults, {\n 'editor.find.cursorMoveOnType': {\n type: 'boolean',\n default: defaults.cursorMoveOnType,\n description: nls.localize('find.cursorMoveOnType', \"Controls whether the cursor should jump to find matches while typing.\")\n },\n 'editor.find.seedSearchStringFromSelection': {\n type: 'string',\n enum: ['never', 'always', 'selection'],\n default: defaults.seedSearchStringFromSelection,\n enumDescriptions: [\n nls.localize('editor.find.seedSearchStringFromSelection.never', 'Never seed search string from the editor selection.'),\n nls.localize('editor.find.seedSearchStringFromSelection.always', 'Always seed search string from the editor selection, including word at cursor position.'),\n nls.localize('editor.find.seedSearchStringFromSelection.selection', 'Only seed search string from the editor selection.')\n ],\n description: nls.localize('find.seedSearchStringFromSelection', \"Controls whether the search string in the Find Widget is seeded from the editor selection.\")\n },\n 'editor.find.autoFindInSelection': {\n type: 'string',\n enum: ['never', 'always', 'multiline'],\n default: defaults.autoFindInSelection,\n enumDescriptions: [\n nls.localize('editor.find.autoFindInSelection.never', 'Never turn on Find in Selection automatically (default).'),\n nls.localize('editor.find.autoFindInSelection.always', 'Always turn on Find in Selection automatically.'),\n nls.localize('editor.find.autoFindInSelection.multiline', 'Turn on Find in Selection automatically when multiple lines of content are selected.')\n ],\n description: nls.localize('find.autoFindInSelection', \"Controls the condition for turning on Find in Selection automatically.\")\n },\n 'editor.find.globalFindClipboard': {\n type: 'boolean',\n default: defaults.globalFindClipboard,\n description: nls.localize('find.globalFindClipboard', \"Controls whether the Find Widget should read or modify the shared find clipboard on macOS.\"),\n included: platform.isMacintosh\n },\n 'editor.find.addExtraSpaceOnTop': {\n type: 'boolean',\n default: defaults.addExtraSpaceOnTop,\n description: nls.localize('find.addExtraSpaceOnTop', \"Controls whether the Find Widget should add extra lines on top of the editor. When true, you can scroll beyond the first line when the Find Widget is visible.\")\n },\n 'editor.find.loop': {\n type: 'boolean',\n default: defaults.loop,\n description: nls.localize('find.loop', \"Controls whether the search automatically restarts from the beginning (or the end) when no further matches can be found.\")\n },\n });\n }\n validate(_input) {\n if (!_input || typeof _input !== 'object') {\n return this.defaultValue;\n }\n const input = _input;\n return {\n cursorMoveOnType: boolean(input.cursorMoveOnType, this.defaultValue.cursorMoveOnType),\n seedSearchStringFromSelection: typeof _input.seedSearchStringFromSelection === 'boolean'\n ? (_input.seedSearchStringFromSelection ? 'always' : 'never')\n : stringSet(input.seedSearchStringFromSelection, this.defaultValue.seedSearchStringFromSelection, ['never', 'always', 'selection']),\n autoFindInSelection: typeof _input.autoFindInSelection === 'boolean'\n ? (_input.autoFindInSelection ? 'always' : 'never')\n : stringSet(input.autoFindInSelection, this.defaultValue.autoFindInSelection, ['never', 'always', 'multiline']),\n globalFindClipboard: boolean(input.globalFindClipboard, this.defaultValue.globalFindClipboard),\n addExtraSpaceOnTop: boolean(input.addExtraSpaceOnTop, this.defaultValue.addExtraSpaceOnTop),\n loop: boolean(input.loop, this.defaultValue.loop),\n };\n }\n}\n//#endregion\n//#region fontLigatures\n/**\n * @internal\n */\nexport class EditorFontLigatures extends BaseEditorOption {\n constructor() {\n super(51 /* EditorOption.fontLigatures */, 'fontLigatures', EditorFontLigatures.OFF, {\n anyOf: [\n {\n type: 'boolean',\n description: nls.localize('fontLigatures', \"Enables/Disables font ligatures ('calt' and 'liga' font features). Change this to a string for fine-grained control of the 'font-feature-settings' CSS property.\"),\n },\n {\n type: 'string',\n description: nls.localize('fontFeatureSettings', \"Explicit 'font-feature-settings' CSS property. A boolean can be passed instead if one only needs to turn on/off ligatures.\")\n }\n ],\n description: nls.localize('fontLigaturesGeneral', \"Configures font ligatures or font features. Can be either a boolean to enable/disable ligatures or a string for the value of the CSS 'font-feature-settings' property.\"),\n default: false\n });\n }\n validate(input) {\n if (typeof input === 'undefined') {\n return this.defaultValue;\n }\n if (typeof input === 'string') {\n if (input === 'false' || input.length === 0) {\n return EditorFontLigatures.OFF;\n }\n if (input === 'true') {\n return EditorFontLigatures.ON;\n }\n return input;\n }\n if (Boolean(input)) {\n return EditorFontLigatures.ON;\n }\n return EditorFontLigatures.OFF;\n }\n}\nEditorFontLigatures.OFF = '\"liga\" off, \"calt\" off';\nEditorFontLigatures.ON = '\"liga\" on, \"calt\" on';\n//#endregion\n//#region fontVariations\n/**\n * @internal\n */\nexport class EditorFontVariations extends BaseEditorOption {\n constructor() {\n super(54 /* EditorOption.fontVariations */, 'fontVariations', EditorFontVariations.OFF, {\n anyOf: [\n {\n type: 'boolean',\n description: nls.localize('fontVariations', \"Enables/Disables the translation from font-weight to font-variation-settings. Change this to a string for fine-grained control of the 'font-variation-settings' CSS property.\"),\n },\n {\n type: 'string',\n description: nls.localize('fontVariationSettings', \"Explicit 'font-variation-settings' CSS property. A boolean can be passed instead if one only needs to translate font-weight to font-variation-settings.\")\n }\n ],\n description: nls.localize('fontVariationsGeneral', \"Configures font variations. Can be either a boolean to enable/disable the translation from font-weight to font-variation-settings or a string for the value of the CSS 'font-variation-settings' property.\"),\n default: false\n });\n }\n validate(input) {\n if (typeof input === 'undefined') {\n return this.defaultValue;\n }\n if (typeof input === 'string') {\n if (input === 'false') {\n return EditorFontVariations.OFF;\n }\n if (input === 'true') {\n return EditorFontVariations.TRANSLATE;\n }\n return input;\n }\n if (Boolean(input)) {\n return EditorFontVariations.TRANSLATE;\n }\n return EditorFontVariations.OFF;\n }\n compute(env, options, value) {\n // The value is computed from the fontWeight if it is true.\n // So take the result from env.fontInfo\n return env.fontInfo.fontVariationSettings;\n }\n}\n// Text is laid out using default settings.\nEditorFontVariations.OFF = 'normal';\n// Translate `fontWeight` config to the `font-variation-settings` CSS property.\nEditorFontVariations.TRANSLATE = 'translate';\n//#endregion\n//#region fontInfo\nclass EditorFontInfo extends ComputedEditorOption {\n constructor() {\n super(50 /* EditorOption.fontInfo */);\n }\n compute(env, options, _) {\n return env.fontInfo;\n }\n}\n//#endregion\n//#region fontSize\nclass EditorFontSize extends SimpleEditorOption {\n constructor() {\n super(52 /* EditorOption.fontSize */, 'fontSize', EDITOR_FONT_DEFAULTS.fontSize, {\n type: 'number',\n minimum: 6,\n maximum: 100,\n default: EDITOR_FONT_DEFAULTS.fontSize,\n description: nls.localize('fontSize', \"Controls the font size in pixels.\")\n });\n }\n validate(input) {\n const r = EditorFloatOption.float(input, this.defaultValue);\n if (r === 0) {\n return EDITOR_FONT_DEFAULTS.fontSize;\n }\n return EditorFloatOption.clamp(r, 6, 100);\n }\n compute(env, options, value) {\n // The final fontSize respects the editor zoom level.\n // So take the result from env.fontInfo\n return env.fontInfo.fontSize;\n }\n}\n//#endregion\n//#region fontWeight\nclass EditorFontWeight extends BaseEditorOption {\n constructor() {\n super(53 /* EditorOption.fontWeight */, 'fontWeight', EDITOR_FONT_DEFAULTS.fontWeight, {\n anyOf: [\n {\n type: 'number',\n minimum: EditorFontWeight.MINIMUM_VALUE,\n maximum: EditorFontWeight.MAXIMUM_VALUE,\n errorMessage: nls.localize('fontWeightErrorMessage', \"Only \\\"normal\\\" and \\\"bold\\\" keywords or numbers between 1 and 1000 are allowed.\")\n },\n {\n type: 'string',\n pattern: '^(normal|bold|1000|[1-9][0-9]{0,2})$'\n },\n {\n enum: EditorFontWeight.SUGGESTION_VALUES\n }\n ],\n default: EDITOR_FONT_DEFAULTS.fontWeight,\n description: nls.localize('fontWeight', \"Controls the font weight. Accepts \\\"normal\\\" and \\\"bold\\\" keywords or numbers between 1 and 1000.\")\n });\n }\n validate(input) {\n if (input === 'normal' || input === 'bold') {\n return input;\n }\n return String(EditorIntOption.clampedInt(input, EDITOR_FONT_DEFAULTS.fontWeight, EditorFontWeight.MINIMUM_VALUE, EditorFontWeight.MAXIMUM_VALUE));\n }\n}\nEditorFontWeight.SUGGESTION_VALUES = ['normal', 'bold', '100', '200', '300', '400', '500', '600', '700', '800', '900'];\nEditorFontWeight.MINIMUM_VALUE = 1;\nEditorFontWeight.MAXIMUM_VALUE = 1000;\nclass EditorGoToLocation extends BaseEditorOption {\n constructor() {\n const defaults = {\n multiple: 'peek',\n multipleDefinitions: 'peek',\n multipleTypeDefinitions: 'peek',\n multipleDeclarations: 'peek',\n multipleImplementations: 'peek',\n multipleReferences: 'peek',\n alternativeDefinitionCommand: 'editor.action.goToReferences',\n alternativeTypeDefinitionCommand: 'editor.action.goToReferences',\n alternativeDeclarationCommand: 'editor.action.goToReferences',\n alternativeImplementationCommand: '',\n alternativeReferenceCommand: '',\n };\n const jsonSubset = {\n type: 'string',\n enum: ['peek', 'gotoAndPeek', 'goto'],\n default: defaults.multiple,\n enumDescriptions: [\n nls.localize('editor.gotoLocation.multiple.peek', 'Show Peek view of the results (default)'),\n nls.localize('editor.gotoLocation.multiple.gotoAndPeek', 'Go to the primary result and show a Peek view'),\n nls.localize('editor.gotoLocation.multiple.goto', 'Go to the primary result and enable Peek-less navigation to others')\n ]\n };\n const alternativeCommandOptions = ['', 'editor.action.referenceSearch.trigger', 'editor.action.goToReferences', 'editor.action.peekImplementation', 'editor.action.goToImplementation', 'editor.action.peekTypeDefinition', 'editor.action.goToTypeDefinition', 'editor.action.peekDeclaration', 'editor.action.revealDeclaration', 'editor.action.peekDefinition', 'editor.action.revealDefinitionAside', 'editor.action.revealDefinition'];\n super(58 /* EditorOption.gotoLocation */, 'gotoLocation', defaults, {\n 'editor.gotoLocation.multiple': {\n deprecationMessage: nls.localize('editor.gotoLocation.multiple.deprecated', \"This setting is deprecated, please use separate settings like 'editor.editor.gotoLocation.multipleDefinitions' or 'editor.editor.gotoLocation.multipleImplementations' instead.\"),\n },\n 'editor.gotoLocation.multipleDefinitions': {\n description: nls.localize('editor.editor.gotoLocation.multipleDefinitions', \"Controls the behavior the 'Go to Definition'-command when multiple target locations exist.\"),\n ...jsonSubset,\n },\n 'editor.gotoLocation.multipleTypeDefinitions': {\n description: nls.localize('editor.editor.gotoLocation.multipleTypeDefinitions', \"Controls the behavior the 'Go to Type Definition'-command when multiple target locations exist.\"),\n ...jsonSubset,\n },\n 'editor.gotoLocation.multipleDeclarations': {\n description: nls.localize('editor.editor.gotoLocation.multipleDeclarations', \"Controls the behavior the 'Go to Declaration'-command when multiple target locations exist.\"),\n ...jsonSubset,\n },\n 'editor.gotoLocation.multipleImplementations': {\n description: nls.localize('editor.editor.gotoLocation.multipleImplemenattions', \"Controls the behavior the 'Go to Implementations'-command when multiple target locations exist.\"),\n ...jsonSubset,\n },\n 'editor.gotoLocation.multipleReferences': {\n description: nls.localize('editor.editor.gotoLocation.multipleReferences', \"Controls the behavior the 'Go to References'-command when multiple target locations exist.\"),\n ...jsonSubset,\n },\n 'editor.gotoLocation.alternativeDefinitionCommand': {\n type: 'string',\n default: defaults.alternativeDefinitionCommand,\n enum: alternativeCommandOptions,\n description: nls.localize('alternativeDefinitionCommand', \"Alternative command id that is being executed when the result of 'Go to Definition' is the current location.\")\n },\n 'editor.gotoLocation.alternativeTypeDefinitionCommand': {\n type: 'string',\n default: defaults.alternativeTypeDefinitionCommand,\n enum: alternativeCommandOptions,\n description: nls.localize('alternativeTypeDefinitionCommand', \"Alternative command id that is being executed when the result of 'Go to Type Definition' is the current location.\")\n },\n 'editor.gotoLocation.alternativeDeclarationCommand': {\n type: 'string',\n default: defaults.alternativeDeclarationCommand,\n enum: alternativeCommandOptions,\n description: nls.localize('alternativeDeclarationCommand', \"Alternative command id that is being executed when the result of 'Go to Declaration' is the current location.\")\n },\n 'editor.gotoLocation.alternativeImplementationCommand': {\n type: 'string',\n default: defaults.alternativeImplementationCommand,\n enum: alternativeCommandOptions,\n description: nls.localize('alternativeImplementationCommand', \"Alternative command id that is being executed when the result of 'Go to Implementation' is the current location.\")\n },\n 'editor.gotoLocation.alternativeReferenceCommand': {\n type: 'string',\n default: defaults.alternativeReferenceCommand,\n enum: alternativeCommandOptions,\n description: nls.localize('alternativeReferenceCommand', \"Alternative command id that is being executed when the result of 'Go to Reference' is the current location.\")\n },\n });\n }\n validate(_input) {\n var _a, _b, _c, _d, _e;\n if (!_input || typeof _input !== 'object') {\n return this.defaultValue;\n }\n const input = _input;\n return {\n multiple: stringSet(input.multiple, this.defaultValue.multiple, ['peek', 'gotoAndPeek', 'goto']),\n multipleDefinitions: (_a = input.multipleDefinitions) !== null && _a !== void 0 ? _a : stringSet(input.multipleDefinitions, 'peek', ['peek', 'gotoAndPeek', 'goto']),\n multipleTypeDefinitions: (_b = input.multipleTypeDefinitions) !== null && _b !== void 0 ? _b : stringSet(input.multipleTypeDefinitions, 'peek', ['peek', 'gotoAndPeek', 'goto']),\n multipleDeclarations: (_c = input.multipleDeclarations) !== null && _c !== void 0 ? _c : stringSet(input.multipleDeclarations, 'peek', ['peek', 'gotoAndPeek', 'goto']),\n multipleImplementations: (_d = input.multipleImplementations) !== null && _d !== void 0 ? _d : stringSet(input.multipleImplementations, 'peek', ['peek', 'gotoAndPeek', 'goto']),\n multipleReferences: (_e = input.multipleReferences) !== null && _e !== void 0 ? _e : stringSet(input.multipleReferences, 'peek', ['peek', 'gotoAndPeek', 'goto']),\n alternativeDefinitionCommand: EditorStringOption.string(input.alternativeDefinitionCommand, this.defaultValue.alternativeDefinitionCommand),\n alternativeTypeDefinitionCommand: EditorStringOption.string(input.alternativeTypeDefinitionCommand, this.defaultValue.alternativeTypeDefinitionCommand),\n alternativeDeclarationCommand: EditorStringOption.string(input.alternativeDeclarationCommand, this.defaultValue.alternativeDeclarationCommand),\n alternativeImplementationCommand: EditorStringOption.string(input.alternativeImplementationCommand, this.defaultValue.alternativeImplementationCommand),\n alternativeReferenceCommand: EditorStringOption.string(input.alternativeReferenceCommand, this.defaultValue.alternativeReferenceCommand),\n };\n }\n}\nclass EditorHover extends BaseEditorOption {\n constructor() {\n const defaults = {\n enabled: true,\n delay: 300,\n hidingDelay: 300,\n sticky: true,\n above: true,\n };\n super(60 /* EditorOption.hover */, 'hover', defaults, {\n 'editor.hover.enabled': {\n type: 'boolean',\n default: defaults.enabled,\n description: nls.localize('hover.enabled', \"Controls whether the hover is shown.\")\n },\n 'editor.hover.delay': {\n type: 'number',\n default: defaults.delay,\n minimum: 0,\n maximum: 10000,\n description: nls.localize('hover.delay', \"Controls the delay in milliseconds after which the hover is shown.\")\n },\n 'editor.hover.sticky': {\n type: 'boolean',\n default: defaults.sticky,\n description: nls.localize('hover.sticky', \"Controls whether the hover should remain visible when mouse is moved over it.\")\n },\n 'editor.hover.hidingDelay': {\n type: 'integer',\n minimum: 0,\n default: defaults.hidingDelay,\n description: nls.localize('hover.hidingDelay', \"Controls the delay in milliseconds after which the hover is hidden. Requires `editor.hover.sticky` to be enabled.\")\n },\n 'editor.hover.above': {\n type: 'boolean',\n default: defaults.above,\n description: nls.localize('hover.above', \"Prefer showing hovers above the line, if there's space.\")\n },\n });\n }\n validate(_input) {\n if (!_input || typeof _input !== 'object') {\n return this.defaultValue;\n }\n const input = _input;\n return {\n enabled: boolean(input.enabled, this.defaultValue.enabled),\n delay: EditorIntOption.clampedInt(input.delay, this.defaultValue.delay, 0, 10000),\n sticky: boolean(input.sticky, this.defaultValue.sticky),\n hidingDelay: EditorIntOption.clampedInt(input.hidingDelay, this.defaultValue.hidingDelay, 0, 600000),\n above: boolean(input.above, this.defaultValue.above),\n };\n }\n}\n/**\n * @internal\n */\nexport class EditorLayoutInfoComputer extends ComputedEditorOption {\n constructor() {\n super(145 /* EditorOption.layoutInfo */);\n }\n compute(env, options, _) {\n return EditorLayoutInfoComputer.computeLayout(options, {\n memory: env.memory,\n outerWidth: env.outerWidth,\n outerHeight: env.outerHeight,\n isDominatedByLongLines: env.isDominatedByLongLines,\n lineHeight: env.fontInfo.lineHeight,\n viewLineCount: env.viewLineCount,\n lineNumbersDigitCount: env.lineNumbersDigitCount,\n typicalHalfwidthCharacterWidth: env.fontInfo.typicalHalfwidthCharacterWidth,\n maxDigitWidth: env.fontInfo.maxDigitWidth,\n pixelRatio: env.pixelRatio,\n glyphMarginDecorationLaneCount: env.glyphMarginDecorationLaneCount\n });\n }\n static computeContainedMinimapLineCount(input) {\n const typicalViewportLineCount = input.height / input.lineHeight;\n const extraLinesBeforeFirstLine = Math.floor(input.paddingTop / input.lineHeight);\n let extraLinesBeyondLastLine = Math.floor(input.paddingBottom / input.lineHeight);\n if (input.scrollBeyondLastLine) {\n extraLinesBeyondLastLine = Math.max(extraLinesBeyondLastLine, typicalViewportLineCount - 1);\n }\n const desiredRatio = (extraLinesBeforeFirstLine + input.viewLineCount + extraLinesBeyondLastLine) / (input.pixelRatio * input.height);\n const minimapLineCount = Math.floor(input.viewLineCount / desiredRatio);\n return { typicalViewportLineCount, extraLinesBeforeFirstLine, extraLinesBeyondLastLine, desiredRatio, minimapLineCount };\n }\n static _computeMinimapLayout(input, memory) {\n const outerWidth = input.outerWidth;\n const outerHeight = input.outerHeight;\n const pixelRatio = input.pixelRatio;\n if (!input.minimap.enabled) {\n return {\n renderMinimap: 0 /* RenderMinimap.None */,\n minimapLeft: 0,\n minimapWidth: 0,\n minimapHeightIsEditorHeight: false,\n minimapIsSampling: false,\n minimapScale: 1,\n minimapLineHeight: 1,\n minimapCanvasInnerWidth: 0,\n minimapCanvasInnerHeight: Math.floor(pixelRatio * outerHeight),\n minimapCanvasOuterWidth: 0,\n minimapCanvasOuterHeight: outerHeight,\n };\n }\n // Can use memory if only the `viewLineCount` and `remainingWidth` have changed\n const stableMinimapLayoutInput = memory.stableMinimapLayoutInput;\n const couldUseMemory = (stableMinimapLayoutInput\n // && input.outerWidth === lastMinimapLayoutInput.outerWidth !!! INTENTIONAL OMITTED\n && input.outerHeight === stableMinimapLayoutInput.outerHeight\n && input.lineHeight === stableMinimapLayoutInput.lineHeight\n && input.typicalHalfwidthCharacterWidth === stableMinimapLayoutInput.typicalHalfwidthCharacterWidth\n && input.pixelRatio === stableMinimapLayoutInput.pixelRatio\n && input.scrollBeyondLastLine === stableMinimapLayoutInput.scrollBeyondLastLine\n && input.paddingTop === stableMinimapLayoutInput.paddingTop\n && input.paddingBottom === stableMinimapLayoutInput.paddingBottom\n && input.minimap.enabled === stableMinimapLayoutInput.minimap.enabled\n && input.minimap.side === stableMinimapLayoutInput.minimap.side\n && input.minimap.size === stableMinimapLayoutInput.minimap.size\n && input.minimap.showSlider === stableMinimapLayoutInput.minimap.showSlider\n && input.minimap.renderCharacters === stableMinimapLayoutInput.minimap.renderCharacters\n && input.minimap.maxColumn === stableMinimapLayoutInput.minimap.maxColumn\n && input.minimap.scale === stableMinimapLayoutInput.minimap.scale\n && input.verticalScrollbarWidth === stableMinimapLayoutInput.verticalScrollbarWidth\n // && input.viewLineCount === lastMinimapLayoutInput.viewLineCount !!! INTENTIONAL OMITTED\n // && input.remainingWidth === lastMinimapLayoutInput.remainingWidth !!! INTENTIONAL OMITTED\n && input.isViewportWrapping === stableMinimapLayoutInput.isViewportWrapping);\n const lineHeight = input.lineHeight;\n const typicalHalfwidthCharacterWidth = input.typicalHalfwidthCharacterWidth;\n const scrollBeyondLastLine = input.scrollBeyondLastLine;\n const minimapRenderCharacters = input.minimap.renderCharacters;\n let minimapScale = (pixelRatio >= 2 ? Math.round(input.minimap.scale * 2) : input.minimap.scale);\n const minimapMaxColumn = input.minimap.maxColumn;\n const minimapSize = input.minimap.size;\n const minimapSide = input.minimap.side;\n const verticalScrollbarWidth = input.verticalScrollbarWidth;\n const viewLineCount = input.viewLineCount;\n const remainingWidth = input.remainingWidth;\n const isViewportWrapping = input.isViewportWrapping;\n const baseCharHeight = minimapRenderCharacters ? 2 : 3;\n let minimapCanvasInnerHeight = Math.floor(pixelRatio * outerHeight);\n const minimapCanvasOuterHeight = minimapCanvasInnerHeight / pixelRatio;\n let minimapHeightIsEditorHeight = false;\n let minimapIsSampling = false;\n let minimapLineHeight = baseCharHeight * minimapScale;\n let minimapCharWidth = minimapScale / pixelRatio;\n let minimapWidthMultiplier = 1;\n if (minimapSize === 'fill' || minimapSize === 'fit') {\n const { typicalViewportLineCount, extraLinesBeforeFirstLine, extraLinesBeyondLastLine, desiredRatio, minimapLineCount } = EditorLayoutInfoComputer.computeContainedMinimapLineCount({\n viewLineCount: viewLineCount,\n scrollBeyondLastLine: scrollBeyondLastLine,\n paddingTop: input.paddingTop,\n paddingBottom: input.paddingBottom,\n height: outerHeight,\n lineHeight: lineHeight,\n pixelRatio: pixelRatio\n });\n // ratio is intentionally not part of the layout to avoid the layout changing all the time\n // when doing sampling\n const ratio = viewLineCount / minimapLineCount;\n if (ratio > 1) {\n minimapHeightIsEditorHeight = true;\n minimapIsSampling = true;\n minimapScale = 1;\n minimapLineHeight = 1;\n minimapCharWidth = minimapScale / pixelRatio;\n }\n else {\n let fitBecomesFill = false;\n let maxMinimapScale = minimapScale + 1;\n if (minimapSize === 'fit') {\n const effectiveMinimapHeight = Math.ceil((extraLinesBeforeFirstLine + viewLineCount + extraLinesBeyondLastLine) * minimapLineHeight);\n if (isViewportWrapping && couldUseMemory && remainingWidth <= memory.stableFitRemainingWidth) {\n // There is a loop when using `fit` and viewport wrapping:\n // - view line count impacts minimap layout\n // - minimap layout impacts viewport width\n // - viewport width impacts view line count\n // To break the loop, once we go to a smaller minimap scale, we try to stick with it.\n fitBecomesFill = true;\n maxMinimapScale = memory.stableFitMaxMinimapScale;\n }\n else {\n fitBecomesFill = (effectiveMinimapHeight > minimapCanvasInnerHeight);\n }\n }\n if (minimapSize === 'fill' || fitBecomesFill) {\n minimapHeightIsEditorHeight = true;\n const configuredMinimapScale = minimapScale;\n minimapLineHeight = Math.min(lineHeight * pixelRatio, Math.max(1, Math.floor(1 / desiredRatio)));\n if (isViewportWrapping && couldUseMemory && remainingWidth <= memory.stableFitRemainingWidth) {\n // There is a loop when using `fill` and viewport wrapping:\n // - view line count impacts minimap layout\n // - minimap layout impacts viewport width\n // - viewport width impacts view line count\n // To break the loop, once we go to a smaller minimap scale, we try to stick with it.\n maxMinimapScale = memory.stableFitMaxMinimapScale;\n }\n minimapScale = Math.min(maxMinimapScale, Math.max(1, Math.floor(minimapLineHeight / baseCharHeight)));\n if (minimapScale > configuredMinimapScale) {\n minimapWidthMultiplier = Math.min(2, minimapScale / configuredMinimapScale);\n }\n minimapCharWidth = minimapScale / pixelRatio / minimapWidthMultiplier;\n minimapCanvasInnerHeight = Math.ceil((Math.max(typicalViewportLineCount, extraLinesBeforeFirstLine + viewLineCount + extraLinesBeyondLastLine)) * minimapLineHeight);\n if (isViewportWrapping) {\n // remember for next time\n memory.stableMinimapLayoutInput = input;\n memory.stableFitRemainingWidth = remainingWidth;\n memory.stableFitMaxMinimapScale = minimapScale;\n }\n else {\n memory.stableMinimapLayoutInput = null;\n memory.stableFitRemainingWidth = 0;\n }\n }\n }\n }\n // Given:\n // (leaving 2px for the cursor to have space after the last character)\n // viewportColumn = (contentWidth - verticalScrollbarWidth - 2) / typicalHalfwidthCharacterWidth\n // minimapWidth = viewportColumn * minimapCharWidth\n // contentWidth = remainingWidth - minimapWidth\n // What are good values for contentWidth and minimapWidth ?\n // minimapWidth = ((contentWidth - verticalScrollbarWidth - 2) / typicalHalfwidthCharacterWidth) * minimapCharWidth\n // typicalHalfwidthCharacterWidth * minimapWidth = (contentWidth - verticalScrollbarWidth - 2) * minimapCharWidth\n // typicalHalfwidthCharacterWidth * minimapWidth = (remainingWidth - minimapWidth - verticalScrollbarWidth - 2) * minimapCharWidth\n // (typicalHalfwidthCharacterWidth + minimapCharWidth) * minimapWidth = (remainingWidth - verticalScrollbarWidth - 2) * minimapCharWidth\n // minimapWidth = ((remainingWidth - verticalScrollbarWidth - 2) * minimapCharWidth) / (typicalHalfwidthCharacterWidth + minimapCharWidth)\n const minimapMaxWidth = Math.floor(minimapMaxColumn * minimapCharWidth);\n const minimapWidth = Math.min(minimapMaxWidth, Math.max(0, Math.floor(((remainingWidth - verticalScrollbarWidth - 2) * minimapCharWidth) / (typicalHalfwidthCharacterWidth + minimapCharWidth))) + MINIMAP_GUTTER_WIDTH);\n let minimapCanvasInnerWidth = Math.floor(pixelRatio * minimapWidth);\n const minimapCanvasOuterWidth = minimapCanvasInnerWidth / pixelRatio;\n minimapCanvasInnerWidth = Math.floor(minimapCanvasInnerWidth * minimapWidthMultiplier);\n const renderMinimap = (minimapRenderCharacters ? 1 /* RenderMinimap.Text */ : 2 /* RenderMinimap.Blocks */);\n const minimapLeft = (minimapSide === 'left' ? 0 : (outerWidth - minimapWidth - verticalScrollbarWidth));\n return {\n renderMinimap,\n minimapLeft,\n minimapWidth,\n minimapHeightIsEditorHeight,\n minimapIsSampling,\n minimapScale,\n minimapLineHeight,\n minimapCanvasInnerWidth,\n minimapCanvasInnerHeight,\n minimapCanvasOuterWidth,\n minimapCanvasOuterHeight,\n };\n }\n static computeLayout(options, env) {\n const outerWidth = env.outerWidth | 0;\n const outerHeight = env.outerHeight | 0;\n const lineHeight = env.lineHeight | 0;\n const lineNumbersDigitCount = env.lineNumbersDigitCount | 0;\n const typicalHalfwidthCharacterWidth = env.typicalHalfwidthCharacterWidth;\n const maxDigitWidth = env.maxDigitWidth;\n const pixelRatio = env.pixelRatio;\n const viewLineCount = env.viewLineCount;\n const wordWrapOverride2 = options.get(137 /* EditorOption.wordWrapOverride2 */);\n const wordWrapOverride1 = (wordWrapOverride2 === 'inherit' ? options.get(136 /* EditorOption.wordWrapOverride1 */) : wordWrapOverride2);\n const wordWrap = (wordWrapOverride1 === 'inherit' ? options.get(132 /* EditorOption.wordWrap */) : wordWrapOverride1);\n const wordWrapColumn = options.get(135 /* EditorOption.wordWrapColumn */);\n const isDominatedByLongLines = env.isDominatedByLongLines;\n const showGlyphMargin = options.get(57 /* EditorOption.glyphMargin */);\n const showLineNumbers = (options.get(68 /* EditorOption.lineNumbers */).renderType !== 0 /* RenderLineNumbersType.Off */);\n const lineNumbersMinChars = options.get(69 /* EditorOption.lineNumbersMinChars */);\n const scrollBeyondLastLine = options.get(105 /* EditorOption.scrollBeyondLastLine */);\n const padding = options.get(84 /* EditorOption.padding */);\n const minimap = options.get(73 /* EditorOption.minimap */);\n const scrollbar = options.get(103 /* EditorOption.scrollbar */);\n const verticalScrollbarWidth = scrollbar.verticalScrollbarSize;\n const verticalScrollbarHasArrows = scrollbar.verticalHasArrows;\n const scrollbarArrowSize = scrollbar.arrowSize;\n const horizontalScrollbarHeight = scrollbar.horizontalScrollbarSize;\n const folding = options.get(43 /* EditorOption.folding */);\n const showFoldingDecoration = options.get(110 /* EditorOption.showFoldingControls */) !== 'never';\n let lineDecorationsWidth = options.get(66 /* EditorOption.lineDecorationsWidth */);\n if (folding && showFoldingDecoration) {\n lineDecorationsWidth += 16;\n }\n let lineNumbersWidth = 0;\n if (showLineNumbers) {\n const digitCount = Math.max(lineNumbersDigitCount, lineNumbersMinChars);\n lineNumbersWidth = Math.round(digitCount * maxDigitWidth);\n }\n let glyphMarginWidth = 0;\n if (showGlyphMargin) {\n glyphMarginWidth = lineHeight * env.glyphMarginDecorationLaneCount;\n }\n let glyphMarginLeft = 0;\n let lineNumbersLeft = glyphMarginLeft + glyphMarginWidth;\n let decorationsLeft = lineNumbersLeft + lineNumbersWidth;\n let contentLeft = decorationsLeft + lineDecorationsWidth;\n const remainingWidth = outerWidth - glyphMarginWidth - lineNumbersWidth - lineDecorationsWidth;\n let isWordWrapMinified = false;\n let isViewportWrapping = false;\n let wrappingColumn = -1;\n if (wordWrapOverride1 === 'inherit' && isDominatedByLongLines) {\n // Force viewport width wrapping if model is dominated by long lines\n isWordWrapMinified = true;\n isViewportWrapping = true;\n }\n else if (wordWrap === 'on' || wordWrap === 'bounded') {\n isViewportWrapping = true;\n }\n else if (wordWrap === 'wordWrapColumn') {\n wrappingColumn = wordWrapColumn;\n }\n const minimapLayout = EditorLayoutInfoComputer._computeMinimapLayout({\n outerWidth: outerWidth,\n outerHeight: outerHeight,\n lineHeight: lineHeight,\n typicalHalfwidthCharacterWidth: typicalHalfwidthCharacterWidth,\n pixelRatio: pixelRatio,\n scrollBeyondLastLine: scrollBeyondLastLine,\n paddingTop: padding.top,\n paddingBottom: padding.bottom,\n minimap: minimap,\n verticalScrollbarWidth: verticalScrollbarWidth,\n viewLineCount: viewLineCount,\n remainingWidth: remainingWidth,\n isViewportWrapping: isViewportWrapping,\n }, env.memory || new ComputeOptionsMemory());\n if (minimapLayout.renderMinimap !== 0 /* RenderMinimap.None */ && minimapLayout.minimapLeft === 0) {\n // the minimap is rendered to the left, so move everything to the right\n glyphMarginLeft += minimapLayout.minimapWidth;\n lineNumbersLeft += minimapLayout.minimapWidth;\n decorationsLeft += minimapLayout.minimapWidth;\n contentLeft += minimapLayout.minimapWidth;\n }\n const contentWidth = remainingWidth - minimapLayout.minimapWidth;\n // (leaving 2px for the cursor to have space after the last character)\n const viewportColumn = Math.max(1, Math.floor((contentWidth - verticalScrollbarWidth - 2) / typicalHalfwidthCharacterWidth));\n const verticalArrowSize = (verticalScrollbarHasArrows ? scrollbarArrowSize : 0);\n if (isViewportWrapping) {\n // compute the actual wrappingColumn\n wrappingColumn = Math.max(1, viewportColumn);\n if (wordWrap === 'bounded') {\n wrappingColumn = Math.min(wrappingColumn, wordWrapColumn);\n }\n }\n return {\n width: outerWidth,\n height: outerHeight,\n glyphMarginLeft: glyphMarginLeft,\n glyphMarginWidth: glyphMarginWidth,\n glyphMarginDecorationLaneCount: env.glyphMarginDecorationLaneCount,\n lineNumbersLeft: lineNumbersLeft,\n lineNumbersWidth: lineNumbersWidth,\n decorationsLeft: decorationsLeft,\n decorationsWidth: lineDecorationsWidth,\n contentLeft: contentLeft,\n contentWidth: contentWidth,\n minimap: minimapLayout,\n viewportColumn: viewportColumn,\n isWordWrapMinified: isWordWrapMinified,\n isViewportWrapping: isViewportWrapping,\n wrappingColumn: wrappingColumn,\n verticalScrollbarWidth: verticalScrollbarWidth,\n horizontalScrollbarHeight: horizontalScrollbarHeight,\n overviewRuler: {\n top: verticalArrowSize,\n width: verticalScrollbarWidth,\n height: (outerHeight - 2 * verticalArrowSize),\n right: 0\n }\n };\n }\n}\n//#endregion\n//#region WrappingStrategy\nclass WrappingStrategy extends BaseEditorOption {\n constructor() {\n super(139 /* EditorOption.wrappingStrategy */, 'wrappingStrategy', 'simple', {\n 'editor.wrappingStrategy': {\n enumDescriptions: [\n nls.localize('wrappingStrategy.simple', \"Assumes that all characters are of the same width. This is a fast algorithm that works correctly for monospace fonts and certain scripts (like Latin characters) where glyphs are of equal width.\"),\n nls.localize('wrappingStrategy.advanced', \"Delegates wrapping points computation to the browser. This is a slow algorithm, that might cause freezes for large files, but it works correctly in all cases.\")\n ],\n type: 'string',\n enum: ['simple', 'advanced'],\n default: 'simple',\n description: nls.localize('wrappingStrategy', \"Controls the algorithm that computes wrapping points. Note that when in accessibility mode, advanced will be used for the best experience.\")\n }\n });\n }\n validate(input) {\n return stringSet(input, 'simple', ['simple', 'advanced']);\n }\n compute(env, options, value) {\n const accessibilitySupport = options.get(2 /* EditorOption.accessibilitySupport */);\n if (accessibilitySupport === 2 /* AccessibilitySupport.Enabled */) {\n // if we know for a fact that a screen reader is attached, we switch our strategy to advanced to\n // help that the editor's wrapping points match the textarea's wrapping points\n return 'advanced';\n }\n return value;\n }\n}\n//#endregion\n//#region lightbulb\nexport var ShowLightbulbIconMode;\n(function (ShowLightbulbIconMode) {\n ShowLightbulbIconMode[\"Off\"] = \"off\";\n ShowLightbulbIconMode[\"OnCode\"] = \"onCode\";\n ShowLightbulbIconMode[\"On\"] = \"on\";\n})(ShowLightbulbIconMode || (ShowLightbulbIconMode = {}));\nclass EditorLightbulb extends BaseEditorOption {\n constructor() {\n const defaults = { enabled: ShowLightbulbIconMode.On };\n super(65 /* EditorOption.lightbulb */, 'lightbulb', defaults, {\n 'editor.lightbulb.enabled': {\n type: 'string',\n tags: ['experimental'],\n enum: [ShowLightbulbIconMode.Off, ShowLightbulbIconMode.OnCode, ShowLightbulbIconMode.On],\n default: defaults.enabled,\n enumDescriptions: [\n nls.localize('editor.lightbulb.enabled.off', 'Disable the code action menu.'),\n nls.localize('editor.lightbulb.enabled.onCode', 'Show the code action menu when the cursor is on lines with code.'),\n nls.localize('editor.lightbulb.enabled.on', 'Show the code action menu when the cursor is on lines with code or on empty lines.'),\n ],\n description: nls.localize('enabled', \"Enables the Code Action lightbulb in the editor.\")\n }\n });\n }\n validate(_input) {\n if (!_input || typeof _input !== 'object') {\n return this.defaultValue;\n }\n const input = _input;\n return {\n enabled: stringSet(input.enabled, this.defaultValue.enabled, [ShowLightbulbIconMode.Off, ShowLightbulbIconMode.OnCode, ShowLightbulbIconMode.On])\n };\n }\n}\nclass EditorStickyScroll extends BaseEditorOption {\n constructor() {\n const defaults = { enabled: true, maxLineCount: 5, defaultModel: 'outlineModel', scrollWithEditor: true };\n super(115 /* EditorOption.stickyScroll */, 'stickyScroll', defaults, {\n 'editor.stickyScroll.enabled': {\n type: 'boolean',\n default: defaults.enabled,\n description: nls.localize('editor.stickyScroll.enabled', \"Shows the nested current scopes during the scroll at the top of the editor.\"),\n tags: ['experimental']\n },\n 'editor.stickyScroll.maxLineCount': {\n type: 'number',\n default: defaults.maxLineCount,\n minimum: 1,\n maximum: 20,\n description: nls.localize('editor.stickyScroll.maxLineCount', \"Defines the maximum number of sticky lines to show.\")\n },\n 'editor.stickyScroll.defaultModel': {\n type: 'string',\n enum: ['outlineModel', 'foldingProviderModel', 'indentationModel'],\n default: defaults.defaultModel,\n description: nls.localize('editor.stickyScroll.defaultModel', \"Defines the model to use for determining which lines to stick. If the outline model does not exist, it will fall back on the folding provider model which falls back on the indentation model. This order is respected in all three cases.\")\n },\n 'editor.stickyScroll.scrollWithEditor': {\n type: 'boolean',\n default: defaults.scrollWithEditor,\n description: nls.localize('editor.stickyScroll.scrollWithEditor', \"Enable scrolling of Sticky Scroll with the editor's horizontal scrollbar.\")\n },\n });\n }\n validate(_input) {\n if (!_input || typeof _input !== 'object') {\n return this.defaultValue;\n }\n const input = _input;\n return {\n enabled: boolean(input.enabled, this.defaultValue.enabled),\n maxLineCount: EditorIntOption.clampedInt(input.maxLineCount, this.defaultValue.maxLineCount, 1, 20),\n defaultModel: stringSet(input.defaultModel, this.defaultValue.defaultModel, ['outlineModel', 'foldingProviderModel', 'indentationModel']),\n scrollWithEditor: boolean(input.scrollWithEditor, this.defaultValue.scrollWithEditor)\n };\n }\n}\nclass EditorInlayHints extends BaseEditorOption {\n constructor() {\n const defaults = { enabled: 'on', fontSize: 0, fontFamily: '', padding: false };\n super(141 /* EditorOption.inlayHints */, 'inlayHints', defaults, {\n 'editor.inlayHints.enabled': {\n type: 'string',\n default: defaults.enabled,\n description: nls.localize('inlayHints.enable', \"Enables the inlay hints in the editor.\"),\n enum: ['on', 'onUnlessPressed', 'offUnlessPressed', 'off'],\n markdownEnumDescriptions: [\n nls.localize('editor.inlayHints.on', \"Inlay hints are enabled\"),\n nls.localize('editor.inlayHints.onUnlessPressed', \"Inlay hints are showing by default and hide when holding {0}\", platform.isMacintosh ? `Ctrl+Option` : `Ctrl+Alt`),\n nls.localize('editor.inlayHints.offUnlessPressed', \"Inlay hints are hidden by default and show when holding {0}\", platform.isMacintosh ? `Ctrl+Option` : `Ctrl+Alt`),\n nls.localize('editor.inlayHints.off', \"Inlay hints are disabled\"),\n ],\n },\n 'editor.inlayHints.fontSize': {\n type: 'number',\n default: defaults.fontSize,\n markdownDescription: nls.localize('inlayHints.fontSize', \"Controls font size of inlay hints in the editor. As default the {0} is used when the configured value is less than {1} or greater than the editor font size.\", '`#editor.fontSize#`', '`5`')\n },\n 'editor.inlayHints.fontFamily': {\n type: 'string',\n default: defaults.fontFamily,\n markdownDescription: nls.localize('inlayHints.fontFamily', \"Controls font family of inlay hints in the editor. When set to empty, the {0} is used.\", '`#editor.fontFamily#`')\n },\n 'editor.inlayHints.padding': {\n type: 'boolean',\n default: defaults.padding,\n description: nls.localize('inlayHints.padding', \"Enables the padding around the inlay hints in the editor.\")\n }\n });\n }\n validate(_input) {\n if (!_input || typeof _input !== 'object') {\n return this.defaultValue;\n }\n const input = _input;\n if (typeof input.enabled === 'boolean') {\n input.enabled = input.enabled ? 'on' : 'off';\n }\n return {\n enabled: stringSet(input.enabled, this.defaultValue.enabled, ['on', 'off', 'offUnlessPressed', 'onUnlessPressed']),\n fontSize: EditorIntOption.clampedInt(input.fontSize, this.defaultValue.fontSize, 0, 100),\n fontFamily: EditorStringOption.string(input.fontFamily, this.defaultValue.fontFamily),\n padding: boolean(input.padding, this.defaultValue.padding)\n };\n }\n}\n//#endregion\n//#region lineDecorationsWidth\nclass EditorLineDecorationsWidth extends BaseEditorOption {\n constructor() {\n super(66 /* EditorOption.lineDecorationsWidth */, 'lineDecorationsWidth', 10);\n }\n validate(input) {\n if (typeof input === 'string' && /^\\d+(\\.\\d+)?ch$/.test(input)) {\n const multiple = parseFloat(input.substring(0, input.length - 2));\n return -multiple; // negative numbers signal a multiple\n }\n else {\n return EditorIntOption.clampedInt(input, this.defaultValue, 0, 1000);\n }\n }\n compute(env, options, value) {\n if (value < 0) {\n // negative numbers signal a multiple\n return EditorIntOption.clampedInt(-value * env.fontInfo.typicalHalfwidthCharacterWidth, this.defaultValue, 0, 1000);\n }\n else {\n return value;\n }\n }\n}\n//#endregion\n//#region lineHeight\nclass EditorLineHeight extends EditorFloatOption {\n constructor() {\n super(67 /* EditorOption.lineHeight */, 'lineHeight', EDITOR_FONT_DEFAULTS.lineHeight, x => EditorFloatOption.clamp(x, 0, 150), { markdownDescription: nls.localize('lineHeight', \"Controls the line height. \\n - Use 0 to automatically compute the line height from the font size.\\n - Values between 0 and 8 will be used as a multiplier with the font size.\\n - Values greater than or equal to 8 will be used as effective values.\") });\n }\n compute(env, options, value) {\n // The lineHeight is computed from the fontSize if it is 0.\n // Moreover, the final lineHeight respects the editor zoom level.\n // So take the result from env.fontInfo\n return env.fontInfo.lineHeight;\n }\n}\nclass EditorMinimap extends BaseEditorOption {\n constructor() {\n const defaults = {\n enabled: true,\n size: 'proportional',\n side: 'right',\n showSlider: 'mouseover',\n autohide: false,\n renderCharacters: true,\n maxColumn: 120,\n scale: 1,\n showRegionSectionHeaders: true,\n showMarkSectionHeaders: true,\n sectionHeaderFontSize: 9,\n };\n super(73 /* EditorOption.minimap */, 'minimap', defaults, {\n 'editor.minimap.enabled': {\n type: 'boolean',\n default: defaults.enabled,\n description: nls.localize('minimap.enabled', \"Controls whether the minimap is shown.\")\n },\n 'editor.minimap.autohide': {\n type: 'boolean',\n default: defaults.autohide,\n description: nls.localize('minimap.autohide', \"Controls whether the minimap is hidden automatically.\")\n },\n 'editor.minimap.size': {\n type: 'string',\n enum: ['proportional', 'fill', 'fit'],\n enumDescriptions: [\n nls.localize('minimap.size.proportional', \"The minimap has the same size as the editor contents (and might scroll).\"),\n nls.localize('minimap.size.fill', \"The minimap will stretch or shrink as necessary to fill the height of the editor (no scrolling).\"),\n nls.localize('minimap.size.fit', \"The minimap will shrink as necessary to never be larger than the editor (no scrolling).\"),\n ],\n default: defaults.size,\n description: nls.localize('minimap.size', \"Controls the size of the minimap.\")\n },\n 'editor.minimap.side': {\n type: 'string',\n enum: ['left', 'right'],\n default: defaults.side,\n description: nls.localize('minimap.side', \"Controls the side where to render the minimap.\")\n },\n 'editor.minimap.showSlider': {\n type: 'string',\n enum: ['always', 'mouseover'],\n default: defaults.showSlider,\n description: nls.localize('minimap.showSlider', \"Controls when the minimap slider is shown.\")\n },\n 'editor.minimap.scale': {\n type: 'number',\n default: defaults.scale,\n minimum: 1,\n maximum: 3,\n enum: [1, 2, 3],\n description: nls.localize('minimap.scale', \"Scale of content drawn in the minimap: 1, 2 or 3.\")\n },\n 'editor.minimap.renderCharacters': {\n type: 'boolean',\n default: defaults.renderCharacters,\n description: nls.localize('minimap.renderCharacters', \"Render the actual characters on a line as opposed to color blocks.\")\n },\n 'editor.minimap.maxColumn': {\n type: 'number',\n default: defaults.maxColumn,\n description: nls.localize('minimap.maxColumn', \"Limit the width of the minimap to render at most a certain number of columns.\")\n },\n 'editor.minimap.showRegionSectionHeaders': {\n type: 'boolean',\n default: defaults.showRegionSectionHeaders,\n description: nls.localize('minimap.showRegionSectionHeaders', \"Controls whether named regions are shown as section headers in the minimap.\")\n },\n 'editor.minimap.showMarkSectionHeaders': {\n type: 'boolean',\n default: defaults.showMarkSectionHeaders,\n description: nls.localize('minimap.showMarkSectionHeaders', \"Controls whether MARK: comments are shown as section headers in the minimap.\")\n },\n 'editor.minimap.sectionHeaderFontSize': {\n type: 'number',\n default: defaults.sectionHeaderFontSize,\n description: nls.localize('minimap.sectionHeaderFontSize', \"Controls the font size of section headers in the minimap.\")\n }\n });\n }\n validate(_input) {\n var _a;\n if (!_input || typeof _input !== 'object') {\n return this.defaultValue;\n }\n const input = _input;\n return {\n enabled: boolean(input.enabled, this.defaultValue.enabled),\n autohide: boolean(input.autohide, this.defaultValue.autohide),\n size: stringSet(input.size, this.defaultValue.size, ['proportional', 'fill', 'fit']),\n side: stringSet(input.side, this.defaultValue.side, ['right', 'left']),\n showSlider: stringSet(input.showSlider, this.defaultValue.showSlider, ['always', 'mouseover']),\n renderCharacters: boolean(input.renderCharacters, this.defaultValue.renderCharacters),\n scale: EditorIntOption.clampedInt(input.scale, 1, 1, 3),\n maxColumn: EditorIntOption.clampedInt(input.maxColumn, this.defaultValue.maxColumn, 1, 10000),\n showRegionSectionHeaders: boolean(input.showRegionSectionHeaders, this.defaultValue.showRegionSectionHeaders),\n showMarkSectionHeaders: boolean(input.showMarkSectionHeaders, this.defaultValue.showMarkSectionHeaders),\n sectionHeaderFontSize: EditorFloatOption.clamp((_a = input.sectionHeaderFontSize) !== null && _a !== void 0 ? _a : this.defaultValue.sectionHeaderFontSize, 4, 32),\n };\n }\n}\n//#endregion\n//#region multiCursorModifier\nfunction _multiCursorModifierFromString(multiCursorModifier) {\n if (multiCursorModifier === 'ctrlCmd') {\n return (platform.isMacintosh ? 'metaKey' : 'ctrlKey');\n }\n return 'altKey';\n}\nclass EditorPadding extends BaseEditorOption {\n constructor() {\n super(84 /* EditorOption.padding */, 'padding', { top: 0, bottom: 0 }, {\n 'editor.padding.top': {\n type: 'number',\n default: 0,\n minimum: 0,\n maximum: 1000,\n description: nls.localize('padding.top', \"Controls the amount of space between the top edge of the editor and the first line.\")\n },\n 'editor.padding.bottom': {\n type: 'number',\n default: 0,\n minimum: 0,\n maximum: 1000,\n description: nls.localize('padding.bottom', \"Controls the amount of space between the bottom edge of the editor and the last line.\")\n }\n });\n }\n validate(_input) {\n if (!_input || typeof _input !== 'object') {\n return this.defaultValue;\n }\n const input = _input;\n return {\n top: EditorIntOption.clampedInt(input.top, 0, 0, 1000),\n bottom: EditorIntOption.clampedInt(input.bottom, 0, 0, 1000)\n };\n }\n}\nclass EditorParameterHints extends BaseEditorOption {\n constructor() {\n const defaults = {\n enabled: true,\n cycle: true\n };\n super(86 /* EditorOption.parameterHints */, 'parameterHints', defaults, {\n 'editor.parameterHints.enabled': {\n type: 'boolean',\n default: defaults.enabled,\n description: nls.localize('parameterHints.enabled', \"Enables a pop-up that shows parameter documentation and type information as you type.\")\n },\n 'editor.parameterHints.cycle': {\n type: 'boolean',\n default: defaults.cycle,\n description: nls.localize('parameterHints.cycle', \"Controls whether the parameter hints menu cycles or closes when reaching the end of the list.\")\n },\n });\n }\n validate(_input) {\n if (!_input || typeof _input !== 'object') {\n return this.defaultValue;\n }\n const input = _input;\n return {\n enabled: boolean(input.enabled, this.defaultValue.enabled),\n cycle: boolean(input.cycle, this.defaultValue.cycle)\n };\n }\n}\n//#endregion\n//#region pixelRatio\nclass EditorPixelRatio extends ComputedEditorOption {\n constructor() {\n super(143 /* EditorOption.pixelRatio */);\n }\n compute(env, options, _) {\n return env.pixelRatio;\n }\n}\nclass EditorQuickSuggestions extends BaseEditorOption {\n constructor() {\n const defaults = {\n other: 'on',\n comments: 'off',\n strings: 'off'\n };\n const types = [\n { type: 'boolean' },\n {\n type: 'string',\n enum: ['on', 'inline', 'off'],\n enumDescriptions: [nls.localize('on', \"Quick suggestions show inside the suggest widget\"), nls.localize('inline', \"Quick suggestions show as ghost text\"), nls.localize('off', \"Quick suggestions are disabled\")]\n }\n ];\n super(89 /* EditorOption.quickSuggestions */, 'quickSuggestions', defaults, {\n type: 'object',\n additionalProperties: false,\n properties: {\n strings: {\n anyOf: types,\n default: defaults.strings,\n description: nls.localize('quickSuggestions.strings', \"Enable quick suggestions inside strings.\")\n },\n comments: {\n anyOf: types,\n default: defaults.comments,\n description: nls.localize('quickSuggestions.comments', \"Enable quick suggestions inside comments.\")\n },\n other: {\n anyOf: types,\n default: defaults.other,\n description: nls.localize('quickSuggestions.other', \"Enable quick suggestions outside of strings and comments.\")\n },\n },\n default: defaults,\n markdownDescription: nls.localize('quickSuggestions', \"Controls whether suggestions should automatically show up while typing. This can be controlled for typing in comments, strings, and other code. Quick suggestion can be configured to show as ghost text or with the suggest widget. Also be aware of the '{0}'-setting which controls if suggestions are triggered by special characters.\", `#editor.suggestOnTriggerCharacters#`)\n });\n this.defaultValue = defaults;\n }\n validate(input) {\n if (typeof input === 'boolean') {\n // boolean -> all on/off\n const value = input ? 'on' : 'off';\n return { comments: value, strings: value, other: value };\n }\n if (!input || typeof input !== 'object') {\n // invalid object\n return this.defaultValue;\n }\n const { other, comments, strings } = input;\n const allowedValues = ['on', 'inline', 'off'];\n let validatedOther;\n let validatedComments;\n let validatedStrings;\n if (typeof other === 'boolean') {\n validatedOther = other ? 'on' : 'off';\n }\n else {\n validatedOther = stringSet(other, this.defaultValue.other, allowedValues);\n }\n if (typeof comments === 'boolean') {\n validatedComments = comments ? 'on' : 'off';\n }\n else {\n validatedComments = stringSet(comments, this.defaultValue.comments, allowedValues);\n }\n if (typeof strings === 'boolean') {\n validatedStrings = strings ? 'on' : 'off';\n }\n else {\n validatedStrings = stringSet(strings, this.defaultValue.strings, allowedValues);\n }\n return {\n other: validatedOther,\n comments: validatedComments,\n strings: validatedStrings\n };\n }\n}\nclass EditorRenderLineNumbersOption extends BaseEditorOption {\n constructor() {\n super(68 /* EditorOption.lineNumbers */, 'lineNumbers', { renderType: 1 /* RenderLineNumbersType.On */, renderFn: null }, {\n type: 'string',\n enum: ['off', 'on', 'relative', 'interval'],\n enumDescriptions: [\n nls.localize('lineNumbers.off', \"Line numbers are not rendered.\"),\n nls.localize('lineNumbers.on', \"Line numbers are rendered as absolute number.\"),\n nls.localize('lineNumbers.relative', \"Line numbers are rendered as distance in lines to cursor position.\"),\n nls.localize('lineNumbers.interval', \"Line numbers are rendered every 10 lines.\")\n ],\n default: 'on',\n description: nls.localize('lineNumbers', \"Controls the display of line numbers.\")\n });\n }\n validate(lineNumbers) {\n let renderType = this.defaultValue.renderType;\n let renderFn = this.defaultValue.renderFn;\n if (typeof lineNumbers !== 'undefined') {\n if (typeof lineNumbers === 'function') {\n renderType = 4 /* RenderLineNumbersType.Custom */;\n renderFn = lineNumbers;\n }\n else if (lineNumbers === 'interval') {\n renderType = 3 /* RenderLineNumbersType.Interval */;\n }\n else if (lineNumbers === 'relative') {\n renderType = 2 /* RenderLineNumbersType.Relative */;\n }\n else if (lineNumbers === 'on') {\n renderType = 1 /* RenderLineNumbersType.On */;\n }\n else {\n renderType = 0 /* RenderLineNumbersType.Off */;\n }\n }\n return {\n renderType,\n renderFn\n };\n }\n}\n//#endregion\n//#region renderValidationDecorations\n/**\n * @internal\n */\nexport function filterValidationDecorations(options) {\n const renderValidationDecorations = options.get(98 /* EditorOption.renderValidationDecorations */);\n if (renderValidationDecorations === 'editable') {\n return options.get(91 /* EditorOption.readOnly */);\n }\n return renderValidationDecorations === 'on' ? false : true;\n}\nclass EditorRulers extends BaseEditorOption {\n constructor() {\n const defaults = [];\n const columnSchema = { type: 'number', description: nls.localize('rulers.size', \"Number of monospace characters at which this editor ruler will render.\") };\n super(102 /* EditorOption.rulers */, 'rulers', defaults, {\n type: 'array',\n items: {\n anyOf: [\n columnSchema,\n {\n type: [\n 'object'\n ],\n properties: {\n column: columnSchema,\n color: {\n type: 'string',\n description: nls.localize('rulers.color', \"Color of this editor ruler.\"),\n format: 'color-hex'\n }\n }\n }\n ]\n },\n default: defaults,\n description: nls.localize('rulers', \"Render vertical rulers after a certain number of monospace characters. Use multiple values for multiple rulers. No rulers are drawn if array is empty.\")\n });\n }\n validate(input) {\n if (Array.isArray(input)) {\n const rulers = [];\n for (const _element of input) {\n if (typeof _element === 'number') {\n rulers.push({\n column: EditorIntOption.clampedInt(_element, 0, 0, 10000),\n color: null\n });\n }\n else if (_element && typeof _element === 'object') {\n const element = _element;\n rulers.push({\n column: EditorIntOption.clampedInt(element.column, 0, 0, 10000),\n color: element.color\n });\n }\n }\n rulers.sort((a, b) => a.column - b.column);\n return rulers;\n }\n return this.defaultValue;\n }\n}\n//#endregion\n//#region readonly\n/**\n * Configuration options for readonly message\n */\nclass ReadonlyMessage extends BaseEditorOption {\n constructor() {\n const defaults = undefined;\n super(92 /* EditorOption.readOnlyMessage */, 'readOnlyMessage', defaults);\n }\n validate(_input) {\n if (!_input || typeof _input !== 'object') {\n return this.defaultValue;\n }\n return _input;\n }\n}\nfunction _scrollbarVisibilityFromString(visibility, defaultValue) {\n if (typeof visibility !== 'string') {\n return defaultValue;\n }\n switch (visibility) {\n case 'hidden': return 2 /* ScrollbarVisibility.Hidden */;\n case 'visible': return 3 /* ScrollbarVisibility.Visible */;\n default: return 1 /* ScrollbarVisibility.Auto */;\n }\n}\nclass EditorScrollbar extends BaseEditorOption {\n constructor() {\n const defaults = {\n vertical: 1 /* ScrollbarVisibility.Auto */,\n horizontal: 1 /* ScrollbarVisibility.Auto */,\n arrowSize: 11,\n useShadows: true,\n verticalHasArrows: false,\n horizontalHasArrows: false,\n horizontalScrollbarSize: 12,\n horizontalSliderSize: 12,\n verticalScrollbarSize: 14,\n verticalSliderSize: 14,\n handleMouseWheel: true,\n alwaysConsumeMouseWheel: true,\n scrollByPage: false,\n ignoreHorizontalScrollbarInContentHeight: false,\n };\n super(103 /* EditorOption.scrollbar */, 'scrollbar', defaults, {\n 'editor.scrollbar.vertical': {\n type: 'string',\n enum: ['auto', 'visible', 'hidden'],\n enumDescriptions: [\n nls.localize('scrollbar.vertical.auto', \"The vertical scrollbar will be visible only when necessary.\"),\n nls.localize('scrollbar.vertical.visible', \"The vertical scrollbar will always be visible.\"),\n nls.localize('scrollbar.vertical.fit', \"The vertical scrollbar will always be hidden.\"),\n ],\n default: 'auto',\n description: nls.localize('scrollbar.vertical', \"Controls the visibility of the vertical scrollbar.\")\n },\n 'editor.scrollbar.horizontal': {\n type: 'string',\n enum: ['auto', 'visible', 'hidden'],\n enumDescriptions: [\n nls.localize('scrollbar.horizontal.auto', \"The horizontal scrollbar will be visible only when necessary.\"),\n nls.localize('scrollbar.horizontal.visible', \"The horizontal scrollbar will always be visible.\"),\n nls.localize('scrollbar.horizontal.fit', \"The horizontal scrollbar will always be hidden.\"),\n ],\n default: 'auto',\n description: nls.localize('scrollbar.horizontal', \"Controls the visibility of the horizontal scrollbar.\")\n },\n 'editor.scrollbar.verticalScrollbarSize': {\n type: 'number',\n default: defaults.verticalScrollbarSize,\n description: nls.localize('scrollbar.verticalScrollbarSize', \"The width of the vertical scrollbar.\")\n },\n 'editor.scrollbar.horizontalScrollbarSize': {\n type: 'number',\n default: defaults.horizontalScrollbarSize,\n description: nls.localize('scrollbar.horizontalScrollbarSize', \"The height of the horizontal scrollbar.\")\n },\n 'editor.scrollbar.scrollByPage': {\n type: 'boolean',\n default: defaults.scrollByPage,\n description: nls.localize('scrollbar.scrollByPage', \"Controls whether clicks scroll by page or jump to click position.\")\n },\n 'editor.scrollbar.ignoreHorizontalScrollbarInContentHeight': {\n type: 'boolean',\n default: defaults.ignoreHorizontalScrollbarInContentHeight,\n description: nls.localize('scrollbar.ignoreHorizontalScrollbarInContentHeight', \"When set, the horizontal scrollbar will not increase the size of the editor's content.\")\n }\n });\n }\n validate(_input) {\n if (!_input || typeof _input !== 'object') {\n return this.defaultValue;\n }\n const input = _input;\n const horizontalScrollbarSize = EditorIntOption.clampedInt(input.horizontalScrollbarSize, this.defaultValue.horizontalScrollbarSize, 0, 1000);\n const verticalScrollbarSize = EditorIntOption.clampedInt(input.verticalScrollbarSize, this.defaultValue.verticalScrollbarSize, 0, 1000);\n return {\n arrowSize: EditorIntOption.clampedInt(input.arrowSize, this.defaultValue.arrowSize, 0, 1000),\n vertical: _scrollbarVisibilityFromString(input.vertical, this.defaultValue.vertical),\n horizontal: _scrollbarVisibilityFromString(input.horizontal, this.defaultValue.horizontal),\n useShadows: boolean(input.useShadows, this.defaultValue.useShadows),\n verticalHasArrows: boolean(input.verticalHasArrows, this.defaultValue.verticalHasArrows),\n horizontalHasArrows: boolean(input.horizontalHasArrows, this.defaultValue.horizontalHasArrows),\n handleMouseWheel: boolean(input.handleMouseWheel, this.defaultValue.handleMouseWheel),\n alwaysConsumeMouseWheel: boolean(input.alwaysConsumeMouseWheel, this.defaultValue.alwaysConsumeMouseWheel),\n horizontalScrollbarSize: horizontalScrollbarSize,\n horizontalSliderSize: EditorIntOption.clampedInt(input.horizontalSliderSize, horizontalScrollbarSize, 0, 1000),\n verticalScrollbarSize: verticalScrollbarSize,\n verticalSliderSize: EditorIntOption.clampedInt(input.verticalSliderSize, verticalScrollbarSize, 0, 1000),\n scrollByPage: boolean(input.scrollByPage, this.defaultValue.scrollByPage),\n ignoreHorizontalScrollbarInContentHeight: boolean(input.ignoreHorizontalScrollbarInContentHeight, this.defaultValue.ignoreHorizontalScrollbarInContentHeight),\n };\n }\n}\n/**\n * @internal\n*/\nexport const inUntrustedWorkspace = 'inUntrustedWorkspace';\n/**\n * @internal\n */\nexport const unicodeHighlightConfigKeys = {\n allowedCharacters: 'editor.unicodeHighlight.allowedCharacters',\n invisibleCharacters: 'editor.unicodeHighlight.invisibleCharacters',\n nonBasicASCII: 'editor.unicodeHighlight.nonBasicASCII',\n ambiguousCharacters: 'editor.unicodeHighlight.ambiguousCharacters',\n includeComments: 'editor.unicodeHighlight.includeComments',\n includeStrings: 'editor.unicodeHighlight.includeStrings',\n allowedLocales: 'editor.unicodeHighlight.allowedLocales',\n};\nclass UnicodeHighlight extends BaseEditorOption {\n constructor() {\n const defaults = {\n nonBasicASCII: inUntrustedWorkspace,\n invisibleCharacters: true,\n ambiguousCharacters: true,\n includeComments: inUntrustedWorkspace,\n includeStrings: true,\n allowedCharacters: {},\n allowedLocales: { _os: true, _vscode: true },\n };\n super(125 /* EditorOption.unicodeHighlighting */, 'unicodeHighlight', defaults, {\n [unicodeHighlightConfigKeys.nonBasicASCII]: {\n restricted: true,\n type: ['boolean', 'string'],\n enum: [true, false, inUntrustedWorkspace],\n default: defaults.nonBasicASCII,\n description: nls.localize('unicodeHighlight.nonBasicASCII', \"Controls whether all non-basic ASCII characters are highlighted. Only characters between U+0020 and U+007E, tab, line-feed and carriage-return are considered basic ASCII.\")\n },\n [unicodeHighlightConfigKeys.invisibleCharacters]: {\n restricted: true,\n type: 'boolean',\n default: defaults.invisibleCharacters,\n description: nls.localize('unicodeHighlight.invisibleCharacters', \"Controls whether characters that just reserve space or have no width at all are highlighted.\")\n },\n [unicodeHighlightConfigKeys.ambiguousCharacters]: {\n restricted: true,\n type: 'boolean',\n default: defaults.ambiguousCharacters,\n description: nls.localize('unicodeHighlight.ambiguousCharacters', \"Controls whether characters are highlighted that can be confused with basic ASCII characters, except those that are common in the current user locale.\")\n },\n [unicodeHighlightConfigKeys.includeComments]: {\n restricted: true,\n type: ['boolean', 'string'],\n enum: [true, false, inUntrustedWorkspace],\n default: defaults.includeComments,\n description: nls.localize('unicodeHighlight.includeComments', \"Controls whether characters in comments should also be subject to Unicode highlighting.\")\n },\n [unicodeHighlightConfigKeys.includeStrings]: {\n restricted: true,\n type: ['boolean', 'string'],\n enum: [true, false, inUntrustedWorkspace],\n default: defaults.includeStrings,\n description: nls.localize('unicodeHighlight.includeStrings', \"Controls whether characters in strings should also be subject to Unicode highlighting.\")\n },\n [unicodeHighlightConfigKeys.allowedCharacters]: {\n restricted: true,\n type: 'object',\n default: defaults.allowedCharacters,\n description: nls.localize('unicodeHighlight.allowedCharacters', \"Defines allowed characters that are not being highlighted.\"),\n additionalProperties: {\n type: 'boolean'\n }\n },\n [unicodeHighlightConfigKeys.allowedLocales]: {\n restricted: true,\n type: 'object',\n additionalProperties: {\n type: 'boolean'\n },\n default: defaults.allowedLocales,\n description: nls.localize('unicodeHighlight.allowedLocales', \"Unicode characters that are common in allowed locales are not being highlighted.\")\n },\n });\n }\n applyUpdate(value, update) {\n let didChange = false;\n if (update.allowedCharacters && value) {\n // Treat allowedCharacters atomically\n if (!objects.equals(value.allowedCharacters, update.allowedCharacters)) {\n value = { ...value, allowedCharacters: update.allowedCharacters };\n didChange = true;\n }\n }\n if (update.allowedLocales && value) {\n // Treat allowedLocales atomically\n if (!objects.equals(value.allowedLocales, update.allowedLocales)) {\n value = { ...value, allowedLocales: update.allowedLocales };\n didChange = true;\n }\n }\n const result = super.applyUpdate(value, update);\n if (didChange) {\n return new ApplyUpdateResult(result.newValue, true);\n }\n return result;\n }\n validate(_input) {\n if (!_input || typeof _input !== 'object') {\n return this.defaultValue;\n }\n const input = _input;\n return {\n nonBasicASCII: primitiveSet(input.nonBasicASCII, inUntrustedWorkspace, [true, false, inUntrustedWorkspace]),\n invisibleCharacters: boolean(input.invisibleCharacters, this.defaultValue.invisibleCharacters),\n ambiguousCharacters: boolean(input.ambiguousCharacters, this.defaultValue.ambiguousCharacters),\n includeComments: primitiveSet(input.includeComments, inUntrustedWorkspace, [true, false, inUntrustedWorkspace]),\n includeStrings: primitiveSet(input.includeStrings, inUntrustedWorkspace, [true, false, inUntrustedWorkspace]),\n allowedCharacters: this.validateBooleanMap(_input.allowedCharacters, this.defaultValue.allowedCharacters),\n allowedLocales: this.validateBooleanMap(_input.allowedLocales, this.defaultValue.allowedLocales),\n };\n }\n validateBooleanMap(map, defaultValue) {\n if ((typeof map !== 'object') || !map) {\n return defaultValue;\n }\n const result = {};\n for (const [key, value] of Object.entries(map)) {\n if (value === true) {\n result[key] = true;\n }\n }\n return result;\n }\n}\n/**\n * Configuration options for inline suggestions\n */\nclass InlineEditorSuggest extends BaseEditorOption {\n constructor() {\n const defaults = {\n enabled: true,\n mode: 'subwordSmart',\n showToolbar: 'onHover',\n suppressSuggestions: false,\n keepOnBlur: false,\n fontFamily: 'default'\n };\n super(62 /* EditorOption.inlineSuggest */, 'inlineSuggest', defaults, {\n 'editor.inlineSuggest.enabled': {\n type: 'boolean',\n default: defaults.enabled,\n description: nls.localize('inlineSuggest.enabled', \"Controls whether to automatically show inline suggestions in the editor.\")\n },\n 'editor.inlineSuggest.showToolbar': {\n type: 'string',\n default: defaults.showToolbar,\n enum: ['always', 'onHover', 'never'],\n enumDescriptions: [\n nls.localize('inlineSuggest.showToolbar.always', \"Show the inline suggestion toolbar whenever an inline suggestion is shown.\"),\n nls.localize('inlineSuggest.showToolbar.onHover', \"Show the inline suggestion toolbar when hovering over an inline suggestion.\"),\n nls.localize('inlineSuggest.showToolbar.never', \"Never show the inline suggestion toolbar.\"),\n ],\n description: nls.localize('inlineSuggest.showToolbar', \"Controls when to show the inline suggestion toolbar.\"),\n },\n 'editor.inlineSuggest.suppressSuggestions': {\n type: 'boolean',\n default: defaults.suppressSuggestions,\n description: nls.localize('inlineSuggest.suppressSuggestions', \"Controls how inline suggestions interact with the suggest widget. If enabled, the suggest widget is not shown automatically when inline suggestions are available.\")\n },\n 'editor.inlineSuggest.fontFamily': {\n type: 'string',\n default: defaults.fontFamily,\n description: nls.localize('inlineSuggest.fontFamily', \"Controls the font family of the inline suggestions.\")\n },\n });\n }\n validate(_input) {\n if (!_input || typeof _input !== 'object') {\n return this.defaultValue;\n }\n const input = _input;\n return {\n enabled: boolean(input.enabled, this.defaultValue.enabled),\n mode: stringSet(input.mode, this.defaultValue.mode, ['prefix', 'subword', 'subwordSmart']),\n showToolbar: stringSet(input.showToolbar, this.defaultValue.showToolbar, ['always', 'onHover', 'never']),\n suppressSuggestions: boolean(input.suppressSuggestions, this.defaultValue.suppressSuggestions),\n keepOnBlur: boolean(input.keepOnBlur, this.defaultValue.keepOnBlur),\n fontFamily: EditorStringOption.string(input.fontFamily, this.defaultValue.fontFamily)\n };\n }\n}\nclass InlineEditorEdit extends BaseEditorOption {\n constructor() {\n const defaults = {\n enabled: false,\n showToolbar: 'onHover',\n fontFamily: 'default',\n keepOnBlur: false,\n backgroundColoring: false,\n };\n super(63 /* EditorOption.inlineEdit */, 'experimentalInlineEdit', defaults, {\n 'editor.experimentalInlineEdit.enabled': {\n type: 'boolean',\n default: defaults.enabled,\n description: nls.localize('inlineEdit.enabled', \"Controls whether to show inline edits in the editor.\")\n },\n 'editor.experimentalInlineEdit.showToolbar': {\n type: 'string',\n default: defaults.showToolbar,\n enum: ['always', 'onHover', 'never'],\n enumDescriptions: [\n nls.localize('inlineEdit.showToolbar.always', \"Show the inline edit toolbar whenever an inline suggestion is shown.\"),\n nls.localize('inlineEdit.showToolbar.onHover', \"Show the inline edit toolbar when hovering over an inline suggestion.\"),\n nls.localize('inlineEdit.showToolbar.never', \"Never show the inline edit toolbar.\"),\n ],\n description: nls.localize('inlineEdit.showToolbar', \"Controls when to show the inline edit toolbar.\"),\n },\n 'editor.experimentalInlineEdit.fontFamily': {\n type: 'string',\n default: defaults.fontFamily,\n description: nls.localize('inlineEdit.fontFamily', \"Controls the font family of the inline edit.\")\n },\n 'editor.experimentalInlineEdit.backgroundColoring': {\n type: 'boolean',\n default: defaults.backgroundColoring,\n description: nls.localize('inlineEdit.backgroundColoring', \"Controls whether to color the background of inline edits.\")\n },\n });\n }\n validate(_input) {\n if (!_input || typeof _input !== 'object') {\n return this.defaultValue;\n }\n const input = _input;\n return {\n enabled: boolean(input.enabled, this.defaultValue.enabled),\n showToolbar: stringSet(input.showToolbar, this.defaultValue.showToolbar, ['always', 'onHover', 'never']),\n fontFamily: EditorStringOption.string(input.fontFamily, this.defaultValue.fontFamily),\n keepOnBlur: boolean(input.keepOnBlur, this.defaultValue.keepOnBlur),\n backgroundColoring: boolean(input.backgroundColoring, this.defaultValue.backgroundColoring)\n };\n }\n}\n/**\n * Configuration options for inline suggestions\n */\nclass BracketPairColorization extends BaseEditorOption {\n constructor() {\n const defaults = {\n enabled: EDITOR_MODEL_DEFAULTS.bracketPairColorizationOptions.enabled,\n independentColorPoolPerBracketType: EDITOR_MODEL_DEFAULTS.bracketPairColorizationOptions.independentColorPoolPerBracketType,\n };\n super(15 /* EditorOption.bracketPairColorization */, 'bracketPairColorization', defaults, {\n 'editor.bracketPairColorization.enabled': {\n type: 'boolean',\n default: defaults.enabled,\n markdownDescription: nls.localize('bracketPairColorization.enabled', \"Controls whether bracket pair colorization is enabled or not. Use {0} to override the bracket highlight colors.\", '`#workbench.colorCustomizations#`')\n },\n 'editor.bracketPairColorization.independentColorPoolPerBracketType': {\n type: 'boolean',\n default: defaults.independentColorPoolPerBracketType,\n description: nls.localize('bracketPairColorization.independentColorPoolPerBracketType', \"Controls whether each bracket type has its own independent color pool.\")\n },\n });\n }\n validate(_input) {\n if (!_input || typeof _input !== 'object') {\n return this.defaultValue;\n }\n const input = _input;\n return {\n enabled: boolean(input.enabled, this.defaultValue.enabled),\n independentColorPoolPerBracketType: boolean(input.independentColorPoolPerBracketType, this.defaultValue.independentColorPoolPerBracketType),\n };\n }\n}\n/**\n * Configuration options for inline suggestions\n */\nclass GuideOptions extends BaseEditorOption {\n constructor() {\n const defaults = {\n bracketPairs: false,\n bracketPairsHorizontal: 'active',\n highlightActiveBracketPair: true,\n indentation: true,\n highlightActiveIndentation: true\n };\n super(16 /* EditorOption.guides */, 'guides', defaults, {\n 'editor.guides.bracketPairs': {\n type: ['boolean', 'string'],\n enum: [true, 'active', false],\n enumDescriptions: [\n nls.localize('editor.guides.bracketPairs.true', \"Enables bracket pair guides.\"),\n nls.localize('editor.guides.bracketPairs.active', \"Enables bracket pair guides only for the active bracket pair.\"),\n nls.localize('editor.guides.bracketPairs.false', \"Disables bracket pair guides.\"),\n ],\n default: defaults.bracketPairs,\n description: nls.localize('editor.guides.bracketPairs', \"Controls whether bracket pair guides are enabled or not.\")\n },\n 'editor.guides.bracketPairsHorizontal': {\n type: ['boolean', 'string'],\n enum: [true, 'active', false],\n enumDescriptions: [\n nls.localize('editor.guides.bracketPairsHorizontal.true', \"Enables horizontal guides as addition to vertical bracket pair guides.\"),\n nls.localize('editor.guides.bracketPairsHorizontal.active', \"Enables horizontal guides only for the active bracket pair.\"),\n nls.localize('editor.guides.bracketPairsHorizontal.false', \"Disables horizontal bracket pair guides.\"),\n ],\n default: defaults.bracketPairsHorizontal,\n description: nls.localize('editor.guides.bracketPairsHorizontal', \"Controls whether horizontal bracket pair guides are enabled or not.\")\n },\n 'editor.guides.highlightActiveBracketPair': {\n type: 'boolean',\n default: defaults.highlightActiveBracketPair,\n description: nls.localize('editor.guides.highlightActiveBracketPair', \"Controls whether the editor should highlight the active bracket pair.\")\n },\n 'editor.guides.indentation': {\n type: 'boolean',\n default: defaults.indentation,\n description: nls.localize('editor.guides.indentation', \"Controls whether the editor should render indent guides.\")\n },\n 'editor.guides.highlightActiveIndentation': {\n type: ['boolean', 'string'],\n enum: [true, 'always', false],\n enumDescriptions: [\n nls.localize('editor.guides.highlightActiveIndentation.true', \"Highlights the active indent guide.\"),\n nls.localize('editor.guides.highlightActiveIndentation.always', \"Highlights the active indent guide even if bracket guides are highlighted.\"),\n nls.localize('editor.guides.highlightActiveIndentation.false', \"Do not highlight the active indent guide.\"),\n ],\n default: defaults.highlightActiveIndentation,\n description: nls.localize('editor.guides.highlightActiveIndentation', \"Controls whether the editor should highlight the active indent guide.\")\n }\n });\n }\n validate(_input) {\n if (!_input || typeof _input !== 'object') {\n return this.defaultValue;\n }\n const input = _input;\n return {\n bracketPairs: primitiveSet(input.bracketPairs, this.defaultValue.bracketPairs, [true, false, 'active']),\n bracketPairsHorizontal: primitiveSet(input.bracketPairsHorizontal, this.defaultValue.bracketPairsHorizontal, [true, false, 'active']),\n highlightActiveBracketPair: boolean(input.highlightActiveBracketPair, this.defaultValue.highlightActiveBracketPair),\n indentation: boolean(input.indentation, this.defaultValue.indentation),\n highlightActiveIndentation: primitiveSet(input.highlightActiveIndentation, this.defaultValue.highlightActiveIndentation, [true, false, 'always']),\n };\n }\n}\nfunction primitiveSet(value, defaultValue, allowedValues) {\n const idx = allowedValues.indexOf(value);\n if (idx === -1) {\n return defaultValue;\n }\n return allowedValues[idx];\n}\nclass EditorSuggest extends BaseEditorOption {\n constructor() {\n const defaults = {\n insertMode: 'insert',\n filterGraceful: true,\n snippetsPreventQuickSuggestions: false,\n localityBonus: false,\n shareSuggestSelections: false,\n selectionMode: 'always',\n showIcons: true,\n showStatusBar: false,\n preview: false,\n previewMode: 'subwordSmart',\n showInlineDetails: true,\n showMethods: true,\n showFunctions: true,\n showConstructors: true,\n showDeprecated: true,\n matchOnWordStartOnly: true,\n showFields: true,\n showVariables: true,\n showClasses: true,\n showStructs: true,\n showInterfaces: true,\n showModules: true,\n showProperties: true,\n showEvents: true,\n showOperators: true,\n showUnits: true,\n showValues: true,\n showConstants: true,\n showEnums: true,\n showEnumMembers: true,\n showKeywords: true,\n showWords: true,\n showColors: true,\n showFiles: true,\n showReferences: true,\n showFolders: true,\n showTypeParameters: true,\n showSnippets: true,\n showUsers: true,\n showIssues: true,\n };\n super(118 /* EditorOption.suggest */, 'suggest', defaults, {\n 'editor.suggest.insertMode': {\n type: 'string',\n enum: ['insert', 'replace'],\n enumDescriptions: [\n nls.localize('suggest.insertMode.insert', \"Insert suggestion without overwriting text right of the cursor.\"),\n nls.localize('suggest.insertMode.replace', \"Insert suggestion and overwrite text right of the cursor.\"),\n ],\n default: defaults.insertMode,\n description: nls.localize('suggest.insertMode', \"Controls whether words are overwritten when accepting completions. Note that this depends on extensions opting into this feature.\")\n },\n 'editor.suggest.filterGraceful': {\n type: 'boolean',\n default: defaults.filterGraceful,\n description: nls.localize('suggest.filterGraceful', \"Controls whether filtering and sorting suggestions accounts for small typos.\")\n },\n 'editor.suggest.localityBonus': {\n type: 'boolean',\n default: defaults.localityBonus,\n description: nls.localize('suggest.localityBonus', \"Controls whether sorting favors words that appear close to the cursor.\")\n },\n 'editor.suggest.shareSuggestSelections': {\n type: 'boolean',\n default: defaults.shareSuggestSelections,\n markdownDescription: nls.localize('suggest.shareSuggestSelections', \"Controls whether remembered suggestion selections are shared between multiple workspaces and windows (needs `#editor.suggestSelection#`).\")\n },\n 'editor.suggest.selectionMode': {\n type: 'string',\n enum: ['always', 'never', 'whenTriggerCharacter', 'whenQuickSuggestion'],\n enumDescriptions: [\n nls.localize('suggest.insertMode.always', \"Always select a suggestion when automatically triggering IntelliSense.\"),\n nls.localize('suggest.insertMode.never', \"Never select a suggestion when automatically triggering IntelliSense.\"),\n nls.localize('suggest.insertMode.whenTriggerCharacter', \"Select a suggestion only when triggering IntelliSense from a trigger character.\"),\n nls.localize('suggest.insertMode.whenQuickSuggestion', \"Select a suggestion only when triggering IntelliSense as you type.\"),\n ],\n default: defaults.selectionMode,\n markdownDescription: nls.localize('suggest.selectionMode', \"Controls whether a suggestion is selected when the widget shows. Note that this only applies to automatically triggered suggestions (`#editor.quickSuggestions#` and `#editor.suggestOnTriggerCharacters#`) and that a suggestion is always selected when explicitly invoked, e.g via `Ctrl+Space`.\")\n },\n 'editor.suggest.snippetsPreventQuickSuggestions': {\n type: 'boolean',\n default: defaults.snippetsPreventQuickSuggestions,\n description: nls.localize('suggest.snippetsPreventQuickSuggestions', \"Controls whether an active snippet prevents quick suggestions.\")\n },\n 'editor.suggest.showIcons': {\n type: 'boolean',\n default: defaults.showIcons,\n description: nls.localize('suggest.showIcons', \"Controls whether to show or hide icons in suggestions.\")\n },\n 'editor.suggest.showStatusBar': {\n type: 'boolean',\n default: defaults.showStatusBar,\n description: nls.localize('suggest.showStatusBar', \"Controls the visibility of the status bar at the bottom of the suggest widget.\")\n },\n 'editor.suggest.preview': {\n type: 'boolean',\n default: defaults.preview,\n description: nls.localize('suggest.preview', \"Controls whether to preview the suggestion outcome in the editor.\")\n },\n 'editor.suggest.showInlineDetails': {\n type: 'boolean',\n default: defaults.showInlineDetails,\n description: nls.localize('suggest.showInlineDetails', \"Controls whether suggest details show inline with the label or only in the details widget.\")\n },\n 'editor.suggest.maxVisibleSuggestions': {\n type: 'number',\n deprecationMessage: nls.localize('suggest.maxVisibleSuggestions.dep', \"This setting is deprecated. The suggest widget can now be resized.\"),\n },\n 'editor.suggest.filteredTypes': {\n type: 'object',\n deprecationMessage: nls.localize('deprecated', \"This setting is deprecated, please use separate settings like 'editor.suggest.showKeywords' or 'editor.suggest.showSnippets' instead.\")\n },\n 'editor.suggest.showMethods': {\n type: 'boolean',\n default: true,\n markdownDescription: nls.localize('editor.suggest.showMethods', \"When enabled IntelliSense shows `method`-suggestions.\")\n },\n 'editor.suggest.showFunctions': {\n type: 'boolean',\n default: true,\n markdownDescription: nls.localize('editor.suggest.showFunctions', \"When enabled IntelliSense shows `function`-suggestions.\")\n },\n 'editor.suggest.showConstructors': {\n type: 'boolean',\n default: true,\n markdownDescription: nls.localize('editor.suggest.showConstructors', \"When enabled IntelliSense shows `constructor`-suggestions.\")\n },\n 'editor.suggest.showDeprecated': {\n type: 'boolean',\n default: true,\n markdownDescription: nls.localize('editor.suggest.showDeprecated', \"When enabled IntelliSense shows `deprecated`-suggestions.\")\n },\n 'editor.suggest.matchOnWordStartOnly': {\n type: 'boolean',\n default: true,\n markdownDescription: nls.localize('editor.suggest.matchOnWordStartOnly', \"When enabled IntelliSense filtering requires that the first character matches on a word start. For example, `c` on `Console` or `WebContext` but _not_ on `description`. When disabled IntelliSense will show more results but still sorts them by match quality.\")\n },\n 'editor.suggest.showFields': {\n type: 'boolean',\n default: true,\n markdownDescription: nls.localize('editor.suggest.showFields', \"When enabled IntelliSense shows `field`-suggestions.\")\n },\n 'editor.suggest.showVariables': {\n type: 'boolean',\n default: true,\n markdownDescription: nls.localize('editor.suggest.showVariables', \"When enabled IntelliSense shows `variable`-suggestions.\")\n },\n 'editor.suggest.showClasses': {\n type: 'boolean',\n default: true,\n markdownDescription: nls.localize('editor.suggest.showClasss', \"When enabled IntelliSense shows `class`-suggestions.\")\n },\n 'editor.suggest.showStructs': {\n type: 'boolean',\n default: true,\n markdownDescription: nls.localize('editor.suggest.showStructs', \"When enabled IntelliSense shows `struct`-suggestions.\")\n },\n 'editor.suggest.showInterfaces': {\n type: 'boolean',\n default: true,\n markdownDescription: nls.localize('editor.suggest.showInterfaces', \"When enabled IntelliSense shows `interface`-suggestions.\")\n },\n 'editor.suggest.showModules': {\n type: 'boolean',\n default: true,\n markdownDescription: nls.localize('editor.suggest.showModules', \"When enabled IntelliSense shows `module`-suggestions.\")\n },\n 'editor.suggest.showProperties': {\n type: 'boolean',\n default: true,\n markdownDescription: nls.localize('editor.suggest.showPropertys', \"When enabled IntelliSense shows `property`-suggestions.\")\n },\n 'editor.suggest.showEvents': {\n type: 'boolean',\n default: true,\n markdownDescription: nls.localize('editor.suggest.showEvents', \"When enabled IntelliSense shows `event`-suggestions.\")\n },\n 'editor.suggest.showOperators': {\n type: 'boolean',\n default: true,\n markdownDescription: nls.localize('editor.suggest.showOperators', \"When enabled IntelliSense shows `operator`-suggestions.\")\n },\n 'editor.suggest.showUnits': {\n type: 'boolean',\n default: true,\n markdownDescription: nls.localize('editor.suggest.showUnits', \"When enabled IntelliSense shows `unit`-suggestions.\")\n },\n 'editor.suggest.showValues': {\n type: 'boolean',\n default: true,\n markdownDescription: nls.localize('editor.suggest.showValues', \"When enabled IntelliSense shows `value`-suggestions.\")\n },\n 'editor.suggest.showConstants': {\n type: 'boolean',\n default: true,\n markdownDescription: nls.localize('editor.suggest.showConstants', \"When enabled IntelliSense shows `constant`-suggestions.\")\n },\n 'editor.suggest.showEnums': {\n type: 'boolean',\n default: true,\n markdownDescription: nls.localize('editor.suggest.showEnums', \"When enabled IntelliSense shows `enum`-suggestions.\")\n },\n 'editor.suggest.showEnumMembers': {\n type: 'boolean',\n default: true,\n markdownDescription: nls.localize('editor.suggest.showEnumMembers', \"When enabled IntelliSense shows `enumMember`-suggestions.\")\n },\n 'editor.suggest.showKeywords': {\n type: 'boolean',\n default: true,\n markdownDescription: nls.localize('editor.suggest.showKeywords', \"When enabled IntelliSense shows `keyword`-suggestions.\")\n },\n 'editor.suggest.showWords': {\n type: 'boolean',\n default: true,\n markdownDescription: nls.localize('editor.suggest.showTexts', \"When enabled IntelliSense shows `text`-suggestions.\")\n },\n 'editor.suggest.showColors': {\n type: 'boolean',\n default: true,\n markdownDescription: nls.localize('editor.suggest.showColors', \"When enabled IntelliSense shows `color`-suggestions.\")\n },\n 'editor.suggest.showFiles': {\n type: 'boolean',\n default: true,\n markdownDescription: nls.localize('editor.suggest.showFiles', \"When enabled IntelliSense shows `file`-suggestions.\")\n },\n 'editor.suggest.showReferences': {\n type: 'boolean',\n default: true,\n markdownDescription: nls.localize('editor.suggest.showReferences', \"When enabled IntelliSense shows `reference`-suggestions.\")\n },\n 'editor.suggest.showCustomcolors': {\n type: 'boolean',\n default: true,\n markdownDescription: nls.localize('editor.suggest.showCustomcolors', \"When enabled IntelliSense shows `customcolor`-suggestions.\")\n },\n 'editor.suggest.showFolders': {\n type: 'boolean',\n default: true,\n markdownDescription: nls.localize('editor.suggest.showFolders', \"When enabled IntelliSense shows `folder`-suggestions.\")\n },\n 'editor.suggest.showTypeParameters': {\n type: 'boolean',\n default: true,\n markdownDescription: nls.localize('editor.suggest.showTypeParameters', \"When enabled IntelliSense shows `typeParameter`-suggestions.\")\n },\n 'editor.suggest.showSnippets': {\n type: 'boolean',\n default: true,\n markdownDescription: nls.localize('editor.suggest.showSnippets', \"When enabled IntelliSense shows `snippet`-suggestions.\")\n },\n 'editor.suggest.showUsers': {\n type: 'boolean',\n default: true,\n markdownDescription: nls.localize('editor.suggest.showUsers', \"When enabled IntelliSense shows `user`-suggestions.\")\n },\n 'editor.suggest.showIssues': {\n type: 'boolean',\n default: true,\n markdownDescription: nls.localize('editor.suggest.showIssues', \"When enabled IntelliSense shows `issues`-suggestions.\")\n }\n });\n }\n validate(_input) {\n if (!_input || typeof _input !== 'object') {\n return this.defaultValue;\n }\n const input = _input;\n return {\n insertMode: stringSet(input.insertMode, this.defaultValue.insertMode, ['insert', 'replace']),\n filterGraceful: boolean(input.filterGraceful, this.defaultValue.filterGraceful),\n snippetsPreventQuickSuggestions: boolean(input.snippetsPreventQuickSuggestions, this.defaultValue.filterGraceful),\n localityBonus: boolean(input.localityBonus, this.defaultValue.localityBonus),\n shareSuggestSelections: boolean(input.shareSuggestSelections, this.defaultValue.shareSuggestSelections),\n selectionMode: stringSet(input.selectionMode, this.defaultValue.selectionMode, ['always', 'never', 'whenQuickSuggestion', 'whenTriggerCharacter']),\n showIcons: boolean(input.showIcons, this.defaultValue.showIcons),\n showStatusBar: boolean(input.showStatusBar, this.defaultValue.showStatusBar),\n preview: boolean(input.preview, this.defaultValue.preview),\n previewMode: stringSet(input.previewMode, this.defaultValue.previewMode, ['prefix', 'subword', 'subwordSmart']),\n showInlineDetails: boolean(input.showInlineDetails, this.defaultValue.showInlineDetails),\n showMethods: boolean(input.showMethods, this.defaultValue.showMethods),\n showFunctions: boolean(input.showFunctions, this.defaultValue.showFunctions),\n showConstructors: boolean(input.showConstructors, this.defaultValue.showConstructors),\n showDeprecated: boolean(input.showDeprecated, this.defaultValue.showDeprecated),\n matchOnWordStartOnly: boolean(input.matchOnWordStartOnly, this.defaultValue.matchOnWordStartOnly),\n showFields: boolean(input.showFields, this.defaultValue.showFields),\n showVariables: boolean(input.showVariables, this.defaultValue.showVariables),\n showClasses: boolean(input.showClasses, this.defaultValue.showClasses),\n showStructs: boolean(input.showStructs, this.defaultValue.showStructs),\n showInterfaces: boolean(input.showInterfaces, this.defaultValue.showInterfaces),\n showModules: boolean(input.showModules, this.defaultValue.showModules),\n showProperties: boolean(input.showProperties, this.defaultValue.showProperties),\n showEvents: boolean(input.showEvents, this.defaultValue.showEvents),\n showOperators: boolean(input.showOperators, this.defaultValue.showOperators),\n showUnits: boolean(input.showUnits, this.defaultValue.showUnits),\n showValues: boolean(input.showValues, this.defaultValue.showValues),\n showConstants: boolean(input.showConstants, this.defaultValue.showConstants),\n showEnums: boolean(input.showEnums, this.defaultValue.showEnums),\n showEnumMembers: boolean(input.showEnumMembers, this.defaultValue.showEnumMembers),\n showKeywords: boolean(input.showKeywords, this.defaultValue.showKeywords),\n showWords: boolean(input.showWords, this.defaultValue.showWords),\n showColors: boolean(input.showColors, this.defaultValue.showColors),\n showFiles: boolean(input.showFiles, this.defaultValue.showFiles),\n showReferences: boolean(input.showReferences, this.defaultValue.showReferences),\n showFolders: boolean(input.showFolders, this.defaultValue.showFolders),\n showTypeParameters: boolean(input.showTypeParameters, this.defaultValue.showTypeParameters),\n showSnippets: boolean(input.showSnippets, this.defaultValue.showSnippets),\n showUsers: boolean(input.showUsers, this.defaultValue.showUsers),\n showIssues: boolean(input.showIssues, this.defaultValue.showIssues),\n };\n }\n}\nclass SmartSelect extends BaseEditorOption {\n constructor() {\n super(113 /* EditorOption.smartSelect */, 'smartSelect', {\n selectLeadingAndTrailingWhitespace: true,\n selectSubwords: true,\n }, {\n 'editor.smartSelect.selectLeadingAndTrailingWhitespace': {\n description: nls.localize('selectLeadingAndTrailingWhitespace', \"Whether leading and trailing whitespace should always be selected.\"),\n default: true,\n type: 'boolean'\n },\n 'editor.smartSelect.selectSubwords': {\n description: nls.localize('selectSubwords', \"Whether subwords (like 'foo' in 'fooBar' or 'foo_bar') should be selected.\"),\n default: true,\n type: 'boolean'\n }\n });\n }\n validate(input) {\n if (!input || typeof input !== 'object') {\n return this.defaultValue;\n }\n return {\n selectLeadingAndTrailingWhitespace: boolean(input.selectLeadingAndTrailingWhitespace, this.defaultValue.selectLeadingAndTrailingWhitespace),\n selectSubwords: boolean(input.selectSubwords, this.defaultValue.selectSubwords),\n };\n }\n}\n//#endregion\n//#region wordSegmenterLocales\n/**\n * Locales used for segmenting lines into words when doing word related navigations or operations.\n *\n * Specify the BCP 47 language tag of the word you wish to recognize (e.g., ja, zh-CN, zh-Hant-TW, etc.).\n */\nclass WordSegmenterLocales extends BaseEditorOption {\n constructor() {\n const defaults = [];\n super(130 /* EditorOption.wordSegmenterLocales */, 'wordSegmenterLocales', defaults, {\n anyOf: [\n {\n description: nls.localize('wordSegmenterLocales', \"Locales to be used for word segmentation when doing word related navigations or operations. Specify the BCP 47 language tag of the word you wish to recognize (e.g., ja, zh-CN, zh-Hant-TW, etc.).\"),\n type: 'string',\n }, {\n description: nls.localize('wordSegmenterLocales', \"Locales to be used for word segmentation when doing word related navigations or operations. Specify the BCP 47 language tag of the word you wish to recognize (e.g., ja, zh-CN, zh-Hant-TW, etc.).\"),\n type: 'array',\n items: {\n type: 'string'\n }\n }\n ]\n });\n }\n validate(input) {\n if (typeof input === 'string') {\n input = [input];\n }\n if (Array.isArray(input)) {\n const validLocales = [];\n for (const locale of input) {\n if (typeof locale === 'string') {\n try {\n if (Intl.Segmenter.supportedLocalesOf(locale).length > 0) {\n validLocales.push(locale);\n }\n }\n catch (_a) {\n // ignore invalid locales\n }\n }\n }\n return validLocales;\n }\n return this.defaultValue;\n }\n}\nclass WrappingIndentOption extends BaseEditorOption {\n constructor() {\n super(138 /* EditorOption.wrappingIndent */, 'wrappingIndent', 1 /* WrappingIndent.Same */, {\n 'editor.wrappingIndent': {\n type: 'string',\n enum: ['none', 'same', 'indent', 'deepIndent'],\n enumDescriptions: [\n nls.localize('wrappingIndent.none', \"No indentation. Wrapped lines begin at column 1.\"),\n nls.localize('wrappingIndent.same', \"Wrapped lines get the same indentation as the parent.\"),\n nls.localize('wrappingIndent.indent', \"Wrapped lines get +1 indentation toward the parent.\"),\n nls.localize('wrappingIndent.deepIndent', \"Wrapped lines get +2 indentation toward the parent.\"),\n ],\n description: nls.localize('wrappingIndent', \"Controls the indentation of wrapped lines.\"),\n default: 'same'\n }\n });\n }\n validate(input) {\n switch (input) {\n case 'none': return 0 /* WrappingIndent.None */;\n case 'same': return 1 /* WrappingIndent.Same */;\n case 'indent': return 2 /* WrappingIndent.Indent */;\n case 'deepIndent': return 3 /* WrappingIndent.DeepIndent */;\n }\n return 1 /* WrappingIndent.Same */;\n }\n compute(env, options, value) {\n const accessibilitySupport = options.get(2 /* EditorOption.accessibilitySupport */);\n if (accessibilitySupport === 2 /* AccessibilitySupport.Enabled */) {\n // if we know for a fact that a screen reader is attached, we use no indent wrapping to\n // help that the editor's wrapping points match the textarea's wrapping points\n return 0 /* WrappingIndent.None */;\n }\n return value;\n }\n}\nclass EditorWrappingInfoComputer extends ComputedEditorOption {\n constructor() {\n super(146 /* EditorOption.wrappingInfo */);\n }\n compute(env, options, _) {\n const layoutInfo = options.get(145 /* EditorOption.layoutInfo */);\n return {\n isDominatedByLongLines: env.isDominatedByLongLines,\n isWordWrapMinified: layoutInfo.isWordWrapMinified,\n isViewportWrapping: layoutInfo.isViewportWrapping,\n wrappingColumn: layoutInfo.wrappingColumn,\n };\n }\n}\nclass EditorDropIntoEditor extends BaseEditorOption {\n constructor() {\n const defaults = { enabled: true, showDropSelector: 'afterDrop' };\n super(36 /* EditorOption.dropIntoEditor */, 'dropIntoEditor', defaults, {\n 'editor.dropIntoEditor.enabled': {\n type: 'boolean',\n default: defaults.enabled,\n markdownDescription: nls.localize('dropIntoEditor.enabled', \"Controls whether you can drag and drop a file into a text editor by holding down the `Shift` key (instead of opening the file in an editor).\"),\n },\n 'editor.dropIntoEditor.showDropSelector': {\n type: 'string',\n markdownDescription: nls.localize('dropIntoEditor.showDropSelector', \"Controls if a widget is shown when dropping files into the editor. This widget lets you control how the file is dropped.\"),\n enum: [\n 'afterDrop',\n 'never'\n ],\n enumDescriptions: [\n nls.localize('dropIntoEditor.showDropSelector.afterDrop', \"Show the drop selector widget after a file is dropped into the editor.\"),\n nls.localize('dropIntoEditor.showDropSelector.never', \"Never show the drop selector widget. Instead the default drop provider is always used.\"),\n ],\n default: 'afterDrop',\n },\n });\n }\n validate(_input) {\n if (!_input || typeof _input !== 'object') {\n return this.defaultValue;\n }\n const input = _input;\n return {\n enabled: boolean(input.enabled, this.defaultValue.enabled),\n showDropSelector: stringSet(input.showDropSelector, this.defaultValue.showDropSelector, ['afterDrop', 'never']),\n };\n }\n}\nclass EditorPasteAs extends BaseEditorOption {\n constructor() {\n const defaults = { enabled: true, showPasteSelector: 'afterPaste' };\n super(85 /* EditorOption.pasteAs */, 'pasteAs', defaults, {\n 'editor.pasteAs.enabled': {\n type: 'boolean',\n default: defaults.enabled,\n markdownDescription: nls.localize('pasteAs.enabled', \"Controls whether you can paste content in different ways.\"),\n },\n 'editor.pasteAs.showPasteSelector': {\n type: 'string',\n markdownDescription: nls.localize('pasteAs.showPasteSelector', \"Controls if a widget is shown when pasting content in to the editor. This widget lets you control how the file is pasted.\"),\n enum: [\n 'afterPaste',\n 'never'\n ],\n enumDescriptions: [\n nls.localize('pasteAs.showPasteSelector.afterPaste', \"Show the paste selector widget after content is pasted into the editor.\"),\n nls.localize('pasteAs.showPasteSelector.never', \"Never show the paste selector widget. Instead the default pasting behavior is always used.\"),\n ],\n default: 'afterPaste',\n },\n });\n }\n validate(_input) {\n if (!_input || typeof _input !== 'object') {\n return this.defaultValue;\n }\n const input = _input;\n return {\n enabled: boolean(input.enabled, this.defaultValue.enabled),\n showPasteSelector: stringSet(input.showPasteSelector, this.defaultValue.showPasteSelector, ['afterPaste', 'never']),\n };\n }\n}\n//#endregion\nconst DEFAULT_WINDOWS_FONT_FAMILY = 'Consolas, \\'Courier New\\', monospace';\nconst DEFAULT_MAC_FONT_FAMILY = 'Menlo, Monaco, \\'Courier New\\', monospace';\nconst DEFAULT_LINUX_FONT_FAMILY = '\\'Droid Sans Mono\\', \\'monospace\\', monospace';\n/**\n * @internal\n */\nexport const EDITOR_FONT_DEFAULTS = {\n fontFamily: (platform.isMacintosh ? DEFAULT_MAC_FONT_FAMILY : (platform.isLinux ? DEFAULT_LINUX_FONT_FAMILY : DEFAULT_WINDOWS_FONT_FAMILY)),\n fontWeight: 'normal',\n fontSize: (platform.isMacintosh ? 12 : 14),\n lineHeight: 0,\n letterSpacing: 0,\n};\n/**\n * @internal\n */\nexport const editorOptionsRegistry = [];\nfunction register(option) {\n editorOptionsRegistry[option.id] = option;\n return option;\n}\nexport const EditorOptions = {\n acceptSuggestionOnCommitCharacter: register(new EditorBooleanOption(0 /* EditorOption.acceptSuggestionOnCommitCharacter */, 'acceptSuggestionOnCommitCharacter', true, { markdownDescription: nls.localize('acceptSuggestionOnCommitCharacter', \"Controls whether suggestions should be accepted on commit characters. For example, in JavaScript, the semi-colon (`;`) can be a commit character that accepts a suggestion and types that character.\") })),\n acceptSuggestionOnEnter: register(new EditorStringEnumOption(1 /* EditorOption.acceptSuggestionOnEnter */, 'acceptSuggestionOnEnter', 'on', ['on', 'smart', 'off'], {\n markdownEnumDescriptions: [\n '',\n nls.localize('acceptSuggestionOnEnterSmart', \"Only accept a suggestion with `Enter` when it makes a textual change.\"),\n ''\n ],\n markdownDescription: nls.localize('acceptSuggestionOnEnter', \"Controls whether suggestions should be accepted on `Enter`, in addition to `Tab`. Helps to avoid ambiguity between inserting new lines or accepting suggestions.\")\n })),\n accessibilitySupport: register(new EditorAccessibilitySupport()),\n accessibilityPageSize: register(new EditorIntOption(3 /* EditorOption.accessibilityPageSize */, 'accessibilityPageSize', 10, 1, 1073741824 /* Constants.MAX_SAFE_SMALL_INTEGER */, {\n description: nls.localize('accessibilityPageSize', \"Controls the number of lines in the editor that can be read out by a screen reader at once. When we detect a screen reader we automatically set the default to be 500. Warning: this has a performance implication for numbers larger than the default.\"),\n tags: ['accessibility']\n })),\n ariaLabel: register(new EditorStringOption(4 /* EditorOption.ariaLabel */, 'ariaLabel', nls.localize('editorViewAccessibleLabel', \"Editor content\"))),\n ariaRequired: register(new EditorBooleanOption(5 /* EditorOption.ariaRequired */, 'ariaRequired', false, undefined)),\n screenReaderAnnounceInlineSuggestion: register(new EditorBooleanOption(8 /* EditorOption.screenReaderAnnounceInlineSuggestion */, 'screenReaderAnnounceInlineSuggestion', true, {\n description: nls.localize('screenReaderAnnounceInlineSuggestion', \"Control whether inline suggestions are announced by a screen reader.\"),\n tags: ['accessibility']\n })),\n autoClosingBrackets: register(new EditorStringEnumOption(6 /* EditorOption.autoClosingBrackets */, 'autoClosingBrackets', 'languageDefined', ['always', 'languageDefined', 'beforeWhitespace', 'never'], {\n enumDescriptions: [\n '',\n nls.localize('editor.autoClosingBrackets.languageDefined', \"Use language configurations to determine when to autoclose brackets.\"),\n nls.localize('editor.autoClosingBrackets.beforeWhitespace', \"Autoclose brackets only when the cursor is to the left of whitespace.\"),\n '',\n ],\n description: nls.localize('autoClosingBrackets', \"Controls whether the editor should automatically close brackets after the user adds an opening bracket.\")\n })),\n autoClosingComments: register(new EditorStringEnumOption(7 /* EditorOption.autoClosingComments */, 'autoClosingComments', 'languageDefined', ['always', 'languageDefined', 'beforeWhitespace', 'never'], {\n enumDescriptions: [\n '',\n nls.localize('editor.autoClosingComments.languageDefined', \"Use language configurations to determine when to autoclose comments.\"),\n nls.localize('editor.autoClosingComments.beforeWhitespace', \"Autoclose comments only when the cursor is to the left of whitespace.\"),\n '',\n ],\n description: nls.localize('autoClosingComments', \"Controls whether the editor should automatically close comments after the user adds an opening comment.\")\n })),\n autoClosingDelete: register(new EditorStringEnumOption(9 /* EditorOption.autoClosingDelete */, 'autoClosingDelete', 'auto', ['always', 'auto', 'never'], {\n enumDescriptions: [\n '',\n nls.localize('editor.autoClosingDelete.auto', \"Remove adjacent closing quotes or brackets only if they were automatically inserted.\"),\n '',\n ],\n description: nls.localize('autoClosingDelete', \"Controls whether the editor should remove adjacent closing quotes or brackets when deleting.\")\n })),\n autoClosingOvertype: register(new EditorStringEnumOption(10 /* EditorOption.autoClosingOvertype */, 'autoClosingOvertype', 'auto', ['always', 'auto', 'never'], {\n enumDescriptions: [\n '',\n nls.localize('editor.autoClosingOvertype.auto', \"Type over closing quotes or brackets only if they were automatically inserted.\"),\n '',\n ],\n description: nls.localize('autoClosingOvertype', \"Controls whether the editor should type over closing quotes or brackets.\")\n })),\n autoClosingQuotes: register(new EditorStringEnumOption(11 /* EditorOption.autoClosingQuotes */, 'autoClosingQuotes', 'languageDefined', ['always', 'languageDefined', 'beforeWhitespace', 'never'], {\n enumDescriptions: [\n '',\n nls.localize('editor.autoClosingQuotes.languageDefined', \"Use language configurations to determine when to autoclose quotes.\"),\n nls.localize('editor.autoClosingQuotes.beforeWhitespace', \"Autoclose quotes only when the cursor is to the left of whitespace.\"),\n '',\n ],\n description: nls.localize('autoClosingQuotes', \"Controls whether the editor should automatically close quotes after the user adds an opening quote.\")\n })),\n autoIndent: register(new EditorEnumOption(12 /* EditorOption.autoIndent */, 'autoIndent', 4 /* EditorAutoIndentStrategy.Full */, 'full', ['none', 'keep', 'brackets', 'advanced', 'full'], _autoIndentFromString, {\n enumDescriptions: [\n nls.localize('editor.autoIndent.none', \"The editor will not insert indentation automatically.\"),\n nls.localize('editor.autoIndent.keep', \"The editor will keep the current line's indentation.\"),\n nls.localize('editor.autoIndent.brackets', \"The editor will keep the current line's indentation and honor language defined brackets.\"),\n nls.localize('editor.autoIndent.advanced', \"The editor will keep the current line's indentation, honor language defined brackets and invoke special onEnterRules defined by languages.\"),\n nls.localize('editor.autoIndent.full', \"The editor will keep the current line's indentation, honor language defined brackets, invoke special onEnterRules defined by languages, and honor indentationRules defined by languages.\"),\n ],\n description: nls.localize('autoIndent', \"Controls whether the editor should automatically adjust the indentation when users type, paste, move or indent lines.\")\n })),\n automaticLayout: register(new EditorBooleanOption(13 /* EditorOption.automaticLayout */, 'automaticLayout', false)),\n autoSurround: register(new EditorStringEnumOption(14 /* EditorOption.autoSurround */, 'autoSurround', 'languageDefined', ['languageDefined', 'quotes', 'brackets', 'never'], {\n enumDescriptions: [\n nls.localize('editor.autoSurround.languageDefined', \"Use language configurations to determine when to automatically surround selections.\"),\n nls.localize('editor.autoSurround.quotes', \"Surround with quotes but not brackets.\"),\n nls.localize('editor.autoSurround.brackets', \"Surround with brackets but not quotes.\"),\n ''\n ],\n description: nls.localize('autoSurround', \"Controls whether the editor should automatically surround selections when typing quotes or brackets.\")\n })),\n bracketPairColorization: register(new BracketPairColorization()),\n bracketPairGuides: register(new GuideOptions()),\n stickyTabStops: register(new EditorBooleanOption(116 /* EditorOption.stickyTabStops */, 'stickyTabStops', false, { description: nls.localize('stickyTabStops', \"Emulate selection behavior of tab characters when using spaces for indentation. Selection will stick to tab stops.\") })),\n codeLens: register(new EditorBooleanOption(17 /* EditorOption.codeLens */, 'codeLens', true, { description: nls.localize('codeLens', \"Controls whether the editor shows CodeLens.\") })),\n codeLensFontFamily: register(new EditorStringOption(18 /* EditorOption.codeLensFontFamily */, 'codeLensFontFamily', '', { description: nls.localize('codeLensFontFamily', \"Controls the font family for CodeLens.\") })),\n codeLensFontSize: register(new EditorIntOption(19 /* EditorOption.codeLensFontSize */, 'codeLensFontSize', 0, 0, 100, {\n type: 'number',\n default: 0,\n minimum: 0,\n maximum: 100,\n markdownDescription: nls.localize('codeLensFontSize', \"Controls the font size in pixels for CodeLens. When set to 0, 90% of `#editor.fontSize#` is used.\")\n })),\n colorDecorators: register(new EditorBooleanOption(20 /* EditorOption.colorDecorators */, 'colorDecorators', true, { description: nls.localize('colorDecorators', \"Controls whether the editor should render the inline color decorators and color picker.\") })),\n colorDecoratorActivatedOn: register(new EditorStringEnumOption(148 /* EditorOption.colorDecoratorsActivatedOn */, 'colorDecoratorsActivatedOn', 'clickAndHover', ['clickAndHover', 'hover', 'click'], {\n enumDescriptions: [\n nls.localize('editor.colorDecoratorActivatedOn.clickAndHover', \"Make the color picker appear both on click and hover of the color decorator\"),\n nls.localize('editor.colorDecoratorActivatedOn.hover', \"Make the color picker appear on hover of the color decorator\"),\n nls.localize('editor.colorDecoratorActivatedOn.click', \"Make the color picker appear on click of the color decorator\")\n ],\n description: nls.localize('colorDecoratorActivatedOn', \"Controls the condition to make a color picker appear from a color decorator\")\n })),\n colorDecoratorsLimit: register(new EditorIntOption(21 /* EditorOption.colorDecoratorsLimit */, 'colorDecoratorsLimit', 500, 1, 1000000, {\n markdownDescription: nls.localize('colorDecoratorsLimit', \"Controls the max number of color decorators that can be rendered in an editor at once.\")\n })),\n columnSelection: register(new EditorBooleanOption(22 /* EditorOption.columnSelection */, 'columnSelection', false, { description: nls.localize('columnSelection', \"Enable that the selection with the mouse and keys is doing column selection.\") })),\n comments: register(new EditorComments()),\n contextmenu: register(new EditorBooleanOption(24 /* EditorOption.contextmenu */, 'contextmenu', true)),\n copyWithSyntaxHighlighting: register(new EditorBooleanOption(25 /* EditorOption.copyWithSyntaxHighlighting */, 'copyWithSyntaxHighlighting', true, { description: nls.localize('copyWithSyntaxHighlighting', \"Controls whether syntax highlighting should be copied into the clipboard.\") })),\n cursorBlinking: register(new EditorEnumOption(26 /* EditorOption.cursorBlinking */, 'cursorBlinking', 1 /* TextEditorCursorBlinkingStyle.Blink */, 'blink', ['blink', 'smooth', 'phase', 'expand', 'solid'], _cursorBlinkingStyleFromString, { description: nls.localize('cursorBlinking', \"Control the cursor animation style.\") })),\n cursorSmoothCaretAnimation: register(new EditorStringEnumOption(27 /* EditorOption.cursorSmoothCaretAnimation */, 'cursorSmoothCaretAnimation', 'off', ['off', 'explicit', 'on'], {\n enumDescriptions: [\n nls.localize('cursorSmoothCaretAnimation.off', \"Smooth caret animation is disabled.\"),\n nls.localize('cursorSmoothCaretAnimation.explicit', \"Smooth caret animation is enabled only when the user moves the cursor with an explicit gesture.\"),\n nls.localize('cursorSmoothCaretAnimation.on', \"Smooth caret animation is always enabled.\")\n ],\n description: nls.localize('cursorSmoothCaretAnimation', \"Controls whether the smooth caret animation should be enabled.\")\n })),\n cursorStyle: register(new EditorEnumOption(28 /* EditorOption.cursorStyle */, 'cursorStyle', TextEditorCursorStyle.Line, 'line', ['line', 'block', 'underline', 'line-thin', 'block-outline', 'underline-thin'], _cursorStyleFromString, { description: nls.localize('cursorStyle', \"Controls the cursor style.\") })),\n cursorSurroundingLines: register(new EditorIntOption(29 /* EditorOption.cursorSurroundingLines */, 'cursorSurroundingLines', 0, 0, 1073741824 /* Constants.MAX_SAFE_SMALL_INTEGER */, { description: nls.localize('cursorSurroundingLines', \"Controls the minimal number of visible leading lines (minimum 0) and trailing lines (minimum 1) surrounding the cursor. Known as 'scrollOff' or 'scrollOffset' in some other editors.\") })),\n cursorSurroundingLinesStyle: register(new EditorStringEnumOption(30 /* EditorOption.cursorSurroundingLinesStyle */, 'cursorSurroundingLinesStyle', 'default', ['default', 'all'], {\n enumDescriptions: [\n nls.localize('cursorSurroundingLinesStyle.default', \"`cursorSurroundingLines` is enforced only when triggered via the keyboard or API.\"),\n nls.localize('cursorSurroundingLinesStyle.all', \"`cursorSurroundingLines` is enforced always.\")\n ],\n markdownDescription: nls.localize('cursorSurroundingLinesStyle', \"Controls when `#editor.cursorSurroundingLines#` should be enforced.\")\n })),\n cursorWidth: register(new EditorIntOption(31 /* EditorOption.cursorWidth */, 'cursorWidth', 0, 0, 1073741824 /* Constants.MAX_SAFE_SMALL_INTEGER */, { markdownDescription: nls.localize('cursorWidth', \"Controls the width of the cursor when `#editor.cursorStyle#` is set to `line`.\") })),\n disableLayerHinting: register(new EditorBooleanOption(32 /* EditorOption.disableLayerHinting */, 'disableLayerHinting', false)),\n disableMonospaceOptimizations: register(new EditorBooleanOption(33 /* EditorOption.disableMonospaceOptimizations */, 'disableMonospaceOptimizations', false)),\n domReadOnly: register(new EditorBooleanOption(34 /* EditorOption.domReadOnly */, 'domReadOnly', false)),\n dragAndDrop: register(new EditorBooleanOption(35 /* EditorOption.dragAndDrop */, 'dragAndDrop', true, { description: nls.localize('dragAndDrop', \"Controls whether the editor should allow moving selections via drag and drop.\") })),\n emptySelectionClipboard: register(new EditorEmptySelectionClipboard()),\n dropIntoEditor: register(new EditorDropIntoEditor()),\n stickyScroll: register(new EditorStickyScroll()),\n experimentalWhitespaceRendering: register(new EditorStringEnumOption(38 /* EditorOption.experimentalWhitespaceRendering */, 'experimentalWhitespaceRendering', 'svg', ['svg', 'font', 'off'], {\n enumDescriptions: [\n nls.localize('experimentalWhitespaceRendering.svg', \"Use a new rendering method with svgs.\"),\n nls.localize('experimentalWhitespaceRendering.font', \"Use a new rendering method with font characters.\"),\n nls.localize('experimentalWhitespaceRendering.off', \"Use the stable rendering method.\"),\n ],\n description: nls.localize('experimentalWhitespaceRendering', \"Controls whether whitespace is rendered with a new, experimental method.\")\n })),\n extraEditorClassName: register(new EditorStringOption(39 /* EditorOption.extraEditorClassName */, 'extraEditorClassName', '')),\n fastScrollSensitivity: register(new EditorFloatOption(40 /* EditorOption.fastScrollSensitivity */, 'fastScrollSensitivity', 5, x => (x <= 0 ? 5 : x), { markdownDescription: nls.localize('fastScrollSensitivity', \"Scrolling speed multiplier when pressing `Alt`.\") })),\n find: register(new EditorFind()),\n fixedOverflowWidgets: register(new EditorBooleanOption(42 /* EditorOption.fixedOverflowWidgets */, 'fixedOverflowWidgets', false)),\n folding: register(new EditorBooleanOption(43 /* EditorOption.folding */, 'folding', true, { description: nls.localize('folding', \"Controls whether the editor has code folding enabled.\") })),\n foldingStrategy: register(new EditorStringEnumOption(44 /* EditorOption.foldingStrategy */, 'foldingStrategy', 'auto', ['auto', 'indentation'], {\n enumDescriptions: [\n nls.localize('foldingStrategy.auto', \"Use a language-specific folding strategy if available, else the indentation-based one.\"),\n nls.localize('foldingStrategy.indentation', \"Use the indentation-based folding strategy.\"),\n ],\n description: nls.localize('foldingStrategy', \"Controls the strategy for computing folding ranges.\")\n })),\n foldingHighlight: register(new EditorBooleanOption(45 /* EditorOption.foldingHighlight */, 'foldingHighlight', true, { description: nls.localize('foldingHighlight', \"Controls whether the editor should highlight folded ranges.\") })),\n foldingImportsByDefault: register(new EditorBooleanOption(46 /* EditorOption.foldingImportsByDefault */, 'foldingImportsByDefault', false, { description: nls.localize('foldingImportsByDefault', \"Controls whether the editor automatically collapses import ranges.\") })),\n foldingMaximumRegions: register(new EditorIntOption(47 /* EditorOption.foldingMaximumRegions */, 'foldingMaximumRegions', 5000, 10, 65000, // limit must be less than foldingRanges MAX_FOLDING_REGIONS\n { description: nls.localize('foldingMaximumRegions', \"The maximum number of foldable regions. Increasing this value may result in the editor becoming less responsive when the current source has a large number of foldable regions.\") })),\n unfoldOnClickAfterEndOfLine: register(new EditorBooleanOption(48 /* EditorOption.unfoldOnClickAfterEndOfLine */, 'unfoldOnClickAfterEndOfLine', false, { description: nls.localize('unfoldOnClickAfterEndOfLine', \"Controls whether clicking on the empty content after a folded line will unfold the line.\") })),\n fontFamily: register(new EditorStringOption(49 /* EditorOption.fontFamily */, 'fontFamily', EDITOR_FONT_DEFAULTS.fontFamily, { description: nls.localize('fontFamily', \"Controls the font family.\") })),\n fontInfo: register(new EditorFontInfo()),\n fontLigatures2: register(new EditorFontLigatures()),\n fontSize: register(new EditorFontSize()),\n fontWeight: register(new EditorFontWeight()),\n fontVariations: register(new EditorFontVariations()),\n formatOnPaste: register(new EditorBooleanOption(55 /* EditorOption.formatOnPaste */, 'formatOnPaste', false, { description: nls.localize('formatOnPaste', \"Controls whether the editor should automatically format the pasted content. A formatter must be available and the formatter should be able to format a range in a document.\") })),\n formatOnType: register(new EditorBooleanOption(56 /* EditorOption.formatOnType */, 'formatOnType', false, { description: nls.localize('formatOnType', \"Controls whether the editor should automatically format the line after typing.\") })),\n glyphMargin: register(new EditorBooleanOption(57 /* EditorOption.glyphMargin */, 'glyphMargin', true, { description: nls.localize('glyphMargin', \"Controls whether the editor should render the vertical glyph margin. Glyph margin is mostly used for debugging.\") })),\n gotoLocation: register(new EditorGoToLocation()),\n hideCursorInOverviewRuler: register(new EditorBooleanOption(59 /* EditorOption.hideCursorInOverviewRuler */, 'hideCursorInOverviewRuler', false, { description: nls.localize('hideCursorInOverviewRuler', \"Controls whether the cursor should be hidden in the overview ruler.\") })),\n hover: register(new EditorHover()),\n inDiffEditor: register(new EditorBooleanOption(61 /* EditorOption.inDiffEditor */, 'inDiffEditor', false)),\n letterSpacing: register(new EditorFloatOption(64 /* EditorOption.letterSpacing */, 'letterSpacing', EDITOR_FONT_DEFAULTS.letterSpacing, x => EditorFloatOption.clamp(x, -5, 20), { description: nls.localize('letterSpacing', \"Controls the letter spacing in pixels.\") })),\n lightbulb: register(new EditorLightbulb()),\n lineDecorationsWidth: register(new EditorLineDecorationsWidth()),\n lineHeight: register(new EditorLineHeight()),\n lineNumbers: register(new EditorRenderLineNumbersOption()),\n lineNumbersMinChars: register(new EditorIntOption(69 /* EditorOption.lineNumbersMinChars */, 'lineNumbersMinChars', 5, 1, 300)),\n linkedEditing: register(new EditorBooleanOption(70 /* EditorOption.linkedEditing */, 'linkedEditing', false, { description: nls.localize('linkedEditing', \"Controls whether the editor has linked editing enabled. Depending on the language, related symbols such as HTML tags, are updated while editing.\") })),\n links: register(new EditorBooleanOption(71 /* EditorOption.links */, 'links', true, { description: nls.localize('links', \"Controls whether the editor should detect links and make them clickable.\") })),\n matchBrackets: register(new EditorStringEnumOption(72 /* EditorOption.matchBrackets */, 'matchBrackets', 'always', ['always', 'near', 'never'], { description: nls.localize('matchBrackets', \"Highlight matching brackets.\") })),\n minimap: register(new EditorMinimap()),\n mouseStyle: register(new EditorStringEnumOption(74 /* EditorOption.mouseStyle */, 'mouseStyle', 'text', ['text', 'default', 'copy'])),\n mouseWheelScrollSensitivity: register(new EditorFloatOption(75 /* EditorOption.mouseWheelScrollSensitivity */, 'mouseWheelScrollSensitivity', 1, x => (x === 0 ? 1 : x), { markdownDescription: nls.localize('mouseWheelScrollSensitivity', \"A multiplier to be used on the `deltaX` and `deltaY` of mouse wheel scroll events.\") })),\n mouseWheelZoom: register(new EditorBooleanOption(76 /* EditorOption.mouseWheelZoom */, 'mouseWheelZoom', false, {\n markdownDescription: platform.isMacintosh\n ? nls.localize('mouseWheelZoom.mac', \"Zoom the font of the editor when using mouse wheel and holding `Cmd`.\")\n : nls.localize('mouseWheelZoom', \"Zoom the font of the editor when using mouse wheel and holding `Ctrl`.\")\n })),\n multiCursorMergeOverlapping: register(new EditorBooleanOption(77 /* EditorOption.multiCursorMergeOverlapping */, 'multiCursorMergeOverlapping', true, { description: nls.localize('multiCursorMergeOverlapping', \"Merge multiple cursors when they are overlapping.\") })),\n multiCursorModifier: register(new EditorEnumOption(78 /* EditorOption.multiCursorModifier */, 'multiCursorModifier', 'altKey', 'alt', ['ctrlCmd', 'alt'], _multiCursorModifierFromString, {\n markdownEnumDescriptions: [\n nls.localize('multiCursorModifier.ctrlCmd', \"Maps to `Control` on Windows and Linux and to `Command` on macOS.\"),\n nls.localize('multiCursorModifier.alt', \"Maps to `Alt` on Windows and Linux and to `Option` on macOS.\")\n ],\n markdownDescription: nls.localize({\n key: 'multiCursorModifier',\n comment: [\n '- `ctrlCmd` refers to a value the setting can take and should not be localized.',\n '- `Control` and `Command` refer to the modifier keys Ctrl or Cmd on the keyboard and can be localized.'\n ]\n }, \"The modifier to be used to add multiple cursors with the mouse. The Go to Definition and Open Link mouse gestures will adapt such that they do not conflict with the [multicursor modifier](https://code.visualstudio.com/docs/editor/codebasics#_multicursor-modifier).\")\n })),\n multiCursorPaste: register(new EditorStringEnumOption(79 /* EditorOption.multiCursorPaste */, 'multiCursorPaste', 'spread', ['spread', 'full'], {\n markdownEnumDescriptions: [\n nls.localize('multiCursorPaste.spread', \"Each cursor pastes a single line of the text.\"),\n nls.localize('multiCursorPaste.full', \"Each cursor pastes the full text.\")\n ],\n markdownDescription: nls.localize('multiCursorPaste', \"Controls pasting when the line count of the pasted text matches the cursor count.\")\n })),\n multiCursorLimit: register(new EditorIntOption(80 /* EditorOption.multiCursorLimit */, 'multiCursorLimit', 10000, 1, 100000, {\n markdownDescription: nls.localize('multiCursorLimit', \"Controls the max number of cursors that can be in an active editor at once.\")\n })),\n occurrencesHighlight: register(new EditorStringEnumOption(81 /* EditorOption.occurrencesHighlight */, 'occurrencesHighlight', 'singleFile', ['off', 'singleFile', 'multiFile'], {\n markdownEnumDescriptions: [\n nls.localize('occurrencesHighlight.off', \"Does not highlight occurrences.\"),\n nls.localize('occurrencesHighlight.singleFile', \"Highlights occurrences only in the current file.\"),\n nls.localize('occurrencesHighlight.multiFile', \"Experimental: Highlights occurrences across all valid open files.\")\n ],\n markdownDescription: nls.localize('occurrencesHighlight', \"Controls whether occurrences should be highlighted across open files.\")\n })),\n overviewRulerBorder: register(new EditorBooleanOption(82 /* EditorOption.overviewRulerBorder */, 'overviewRulerBorder', true, { description: nls.localize('overviewRulerBorder', \"Controls whether a border should be drawn around the overview ruler.\") })),\n overviewRulerLanes: register(new EditorIntOption(83 /* EditorOption.overviewRulerLanes */, 'overviewRulerLanes', 3, 0, 3)),\n padding: register(new EditorPadding()),\n pasteAs: register(new EditorPasteAs()),\n parameterHints: register(new EditorParameterHints()),\n peekWidgetDefaultFocus: register(new EditorStringEnumOption(87 /* EditorOption.peekWidgetDefaultFocus */, 'peekWidgetDefaultFocus', 'tree', ['tree', 'editor'], {\n enumDescriptions: [\n nls.localize('peekWidgetDefaultFocus.tree', \"Focus the tree when opening peek\"),\n nls.localize('peekWidgetDefaultFocus.editor', \"Focus the editor when opening peek\")\n ],\n description: nls.localize('peekWidgetDefaultFocus', \"Controls whether to focus the inline editor or the tree in the peek widget.\")\n })),\n definitionLinkOpensInPeek: register(new EditorBooleanOption(88 /* EditorOption.definitionLinkOpensInPeek */, 'definitionLinkOpensInPeek', false, { description: nls.localize('definitionLinkOpensInPeek', \"Controls whether the Go to Definition mouse gesture always opens the peek widget.\") })),\n quickSuggestions: register(new EditorQuickSuggestions()),\n quickSuggestionsDelay: register(new EditorIntOption(90 /* EditorOption.quickSuggestionsDelay */, 'quickSuggestionsDelay', 10, 0, 1073741824 /* Constants.MAX_SAFE_SMALL_INTEGER */, { description: nls.localize('quickSuggestionsDelay', \"Controls the delay in milliseconds after which quick suggestions will show up.\") })),\n readOnly: register(new EditorBooleanOption(91 /* EditorOption.readOnly */, 'readOnly', false)),\n readOnlyMessage: register(new ReadonlyMessage()),\n renameOnType: register(new EditorBooleanOption(93 /* EditorOption.renameOnType */, 'renameOnType', false, { description: nls.localize('renameOnType', \"Controls whether the editor auto renames on type.\"), markdownDeprecationMessage: nls.localize('renameOnTypeDeprecate', \"Deprecated, use `editor.linkedEditing` instead.\") })),\n renderControlCharacters: register(new EditorBooleanOption(94 /* EditorOption.renderControlCharacters */, 'renderControlCharacters', true, { description: nls.localize('renderControlCharacters', \"Controls whether the editor should render control characters.\"), restricted: true })),\n renderFinalNewline: register(new EditorStringEnumOption(95 /* EditorOption.renderFinalNewline */, 'renderFinalNewline', (platform.isLinux ? 'dimmed' : 'on'), ['off', 'on', 'dimmed'], { description: nls.localize('renderFinalNewline', \"Render last line number when the file ends with a newline.\") })),\n renderLineHighlight: register(new EditorStringEnumOption(96 /* EditorOption.renderLineHighlight */, 'renderLineHighlight', 'line', ['none', 'gutter', 'line', 'all'], {\n enumDescriptions: [\n '',\n '',\n '',\n nls.localize('renderLineHighlight.all', \"Highlights both the gutter and the current line.\"),\n ],\n description: nls.localize('renderLineHighlight', \"Controls how the editor should render the current line highlight.\")\n })),\n renderLineHighlightOnlyWhenFocus: register(new EditorBooleanOption(97 /* EditorOption.renderLineHighlightOnlyWhenFocus */, 'renderLineHighlightOnlyWhenFocus', false, { description: nls.localize('renderLineHighlightOnlyWhenFocus', \"Controls if the editor should render the current line highlight only when the editor is focused.\") })),\n renderValidationDecorations: register(new EditorStringEnumOption(98 /* EditorOption.renderValidationDecorations */, 'renderValidationDecorations', 'editable', ['editable', 'on', 'off'])),\n renderWhitespace: register(new EditorStringEnumOption(99 /* EditorOption.renderWhitespace */, 'renderWhitespace', 'selection', ['none', 'boundary', 'selection', 'trailing', 'all'], {\n enumDescriptions: [\n '',\n nls.localize('renderWhitespace.boundary', \"Render whitespace characters except for single spaces between words.\"),\n nls.localize('renderWhitespace.selection', \"Render whitespace characters only on selected text.\"),\n nls.localize('renderWhitespace.trailing', \"Render only trailing whitespace characters.\"),\n ''\n ],\n description: nls.localize('renderWhitespace', \"Controls how the editor should render whitespace characters.\")\n })),\n revealHorizontalRightPadding: register(new EditorIntOption(100 /* EditorOption.revealHorizontalRightPadding */, 'revealHorizontalRightPadding', 15, 0, 1000)),\n roundedSelection: register(new EditorBooleanOption(101 /* EditorOption.roundedSelection */, 'roundedSelection', true, { description: nls.localize('roundedSelection', \"Controls whether selections should have rounded corners.\") })),\n rulers: register(new EditorRulers()),\n scrollbar: register(new EditorScrollbar()),\n scrollBeyondLastColumn: register(new EditorIntOption(104 /* EditorOption.scrollBeyondLastColumn */, 'scrollBeyondLastColumn', 4, 0, 1073741824 /* Constants.MAX_SAFE_SMALL_INTEGER */, { description: nls.localize('scrollBeyondLastColumn', \"Controls the number of extra characters beyond which the editor will scroll horizontally.\") })),\n scrollBeyondLastLine: register(new EditorBooleanOption(105 /* EditorOption.scrollBeyondLastLine */, 'scrollBeyondLastLine', true, { description: nls.localize('scrollBeyondLastLine', \"Controls whether the editor will scroll beyond the last line.\") })),\n scrollPredominantAxis: register(new EditorBooleanOption(106 /* EditorOption.scrollPredominantAxis */, 'scrollPredominantAxis', true, { description: nls.localize('scrollPredominantAxis', \"Scroll only along the predominant axis when scrolling both vertically and horizontally at the same time. Prevents horizontal drift when scrolling vertically on a trackpad.\") })),\n selectionClipboard: register(new EditorBooleanOption(107 /* EditorOption.selectionClipboard */, 'selectionClipboard', true, {\n description: nls.localize('selectionClipboard', \"Controls whether the Linux primary clipboard should be supported.\"),\n included: platform.isLinux\n })),\n selectionHighlight: register(new EditorBooleanOption(108 /* EditorOption.selectionHighlight */, 'selectionHighlight', true, { description: nls.localize('selectionHighlight', \"Controls whether the editor should highlight matches similar to the selection.\") })),\n selectOnLineNumbers: register(new EditorBooleanOption(109 /* EditorOption.selectOnLineNumbers */, 'selectOnLineNumbers', true)),\n showFoldingControls: register(new EditorStringEnumOption(110 /* EditorOption.showFoldingControls */, 'showFoldingControls', 'mouseover', ['always', 'never', 'mouseover'], {\n enumDescriptions: [\n nls.localize('showFoldingControls.always', \"Always show the folding controls.\"),\n nls.localize('showFoldingControls.never', \"Never show the folding controls and reduce the gutter size.\"),\n nls.localize('showFoldingControls.mouseover', \"Only show the folding controls when the mouse is over the gutter.\"),\n ],\n description: nls.localize('showFoldingControls', \"Controls when the folding controls on the gutter are shown.\")\n })),\n showUnused: register(new EditorBooleanOption(111 /* EditorOption.showUnused */, 'showUnused', true, { description: nls.localize('showUnused', \"Controls fading out of unused code.\") })),\n showDeprecated: register(new EditorBooleanOption(140 /* EditorOption.showDeprecated */, 'showDeprecated', true, { description: nls.localize('showDeprecated', \"Controls strikethrough deprecated variables.\") })),\n inlayHints: register(new EditorInlayHints()),\n snippetSuggestions: register(new EditorStringEnumOption(112 /* EditorOption.snippetSuggestions */, 'snippetSuggestions', 'inline', ['top', 'bottom', 'inline', 'none'], {\n enumDescriptions: [\n nls.localize('snippetSuggestions.top', \"Show snippet suggestions on top of other suggestions.\"),\n nls.localize('snippetSuggestions.bottom', \"Show snippet suggestions below other suggestions.\"),\n nls.localize('snippetSuggestions.inline', \"Show snippets suggestions with other suggestions.\"),\n nls.localize('snippetSuggestions.none', \"Do not show snippet suggestions.\"),\n ],\n description: nls.localize('snippetSuggestions', \"Controls whether snippets are shown with other suggestions and how they are sorted.\")\n })),\n smartSelect: register(new SmartSelect()),\n smoothScrolling: register(new EditorBooleanOption(114 /* EditorOption.smoothScrolling */, 'smoothScrolling', false, { description: nls.localize('smoothScrolling', \"Controls whether the editor will scroll using an animation.\") })),\n stopRenderingLineAfter: register(new EditorIntOption(117 /* EditorOption.stopRenderingLineAfter */, 'stopRenderingLineAfter', 10000, -1, 1073741824 /* Constants.MAX_SAFE_SMALL_INTEGER */)),\n suggest: register(new EditorSuggest()),\n inlineSuggest: register(new InlineEditorSuggest()),\n inlineEdit: register(new InlineEditorEdit()),\n inlineCompletionsAccessibilityVerbose: register(new EditorBooleanOption(149 /* EditorOption.inlineCompletionsAccessibilityVerbose */, 'inlineCompletionsAccessibilityVerbose', false, { description: nls.localize('inlineCompletionsAccessibilityVerbose', \"Controls whether the accessibility hint should be provided to screen reader users when an inline completion is shown.\") })),\n suggestFontSize: register(new EditorIntOption(119 /* EditorOption.suggestFontSize */, 'suggestFontSize', 0, 0, 1000, { markdownDescription: nls.localize('suggestFontSize', \"Font size for the suggest widget. When set to {0}, the value of {1} is used.\", '`0`', '`#editor.fontSize#`') })),\n suggestLineHeight: register(new EditorIntOption(120 /* EditorOption.suggestLineHeight */, 'suggestLineHeight', 0, 0, 1000, { markdownDescription: nls.localize('suggestLineHeight', \"Line height for the suggest widget. When set to {0}, the value of {1} is used. The minimum value is 8.\", '`0`', '`#editor.lineHeight#`') })),\n suggestOnTriggerCharacters: register(new EditorBooleanOption(121 /* EditorOption.suggestOnTriggerCharacters */, 'suggestOnTriggerCharacters', true, { description: nls.localize('suggestOnTriggerCharacters', \"Controls whether suggestions should automatically show up when typing trigger characters.\") })),\n suggestSelection: register(new EditorStringEnumOption(122 /* EditorOption.suggestSelection */, 'suggestSelection', 'first', ['first', 'recentlyUsed', 'recentlyUsedByPrefix'], {\n markdownEnumDescriptions: [\n nls.localize('suggestSelection.first', \"Always select the first suggestion.\"),\n nls.localize('suggestSelection.recentlyUsed', \"Select recent suggestions unless further typing selects one, e.g. `console.| -> console.log` because `log` has been completed recently.\"),\n nls.localize('suggestSelection.recentlyUsedByPrefix', \"Select suggestions based on previous prefixes that have completed those suggestions, e.g. `co -> console` and `con -> const`.\"),\n ],\n description: nls.localize('suggestSelection', \"Controls how suggestions are pre-selected when showing the suggest list.\")\n })),\n tabCompletion: register(new EditorStringEnumOption(123 /* EditorOption.tabCompletion */, 'tabCompletion', 'off', ['on', 'off', 'onlySnippets'], {\n enumDescriptions: [\n nls.localize('tabCompletion.on', \"Tab complete will insert the best matching suggestion when pressing tab.\"),\n nls.localize('tabCompletion.off', \"Disable tab completions.\"),\n nls.localize('tabCompletion.onlySnippets', \"Tab complete snippets when their prefix match. Works best when 'quickSuggestions' aren't enabled.\"),\n ],\n description: nls.localize('tabCompletion', \"Enables tab completions.\")\n })),\n tabIndex: register(new EditorIntOption(124 /* EditorOption.tabIndex */, 'tabIndex', 0, -1, 1073741824 /* Constants.MAX_SAFE_SMALL_INTEGER */)),\n unicodeHighlight: register(new UnicodeHighlight()),\n unusualLineTerminators: register(new EditorStringEnumOption(126 /* EditorOption.unusualLineTerminators */, 'unusualLineTerminators', 'prompt', ['auto', 'off', 'prompt'], {\n enumDescriptions: [\n nls.localize('unusualLineTerminators.auto', \"Unusual line terminators are automatically removed.\"),\n nls.localize('unusualLineTerminators.off', \"Unusual line terminators are ignored.\"),\n nls.localize('unusualLineTerminators.prompt', \"Unusual line terminators prompt to be removed.\"),\n ],\n description: nls.localize('unusualLineTerminators', \"Remove unusual line terminators that might cause problems.\")\n })),\n useShadowDOM: register(new EditorBooleanOption(127 /* EditorOption.useShadowDOM */, 'useShadowDOM', true)),\n useTabStops: register(new EditorBooleanOption(128 /* EditorOption.useTabStops */, 'useTabStops', true, { description: nls.localize('useTabStops', \"Spaces and tabs are inserted and deleted in alignment with tab stops.\") })),\n wordBreak: register(new EditorStringEnumOption(129 /* EditorOption.wordBreak */, 'wordBreak', 'normal', ['normal', 'keepAll'], {\n markdownEnumDescriptions: [\n nls.localize('wordBreak.normal', \"Use the default line break rule.\"),\n nls.localize('wordBreak.keepAll', \"Word breaks should not be used for Chinese/Japanese/Korean (CJK) text. Non-CJK text behavior is the same as for normal.\"),\n ],\n description: nls.localize('wordBreak', \"Controls the word break rules used for Chinese/Japanese/Korean (CJK) text.\")\n })),\n wordSegmenterLocales: register(new WordSegmenterLocales()),\n wordSeparators: register(new EditorStringOption(131 /* EditorOption.wordSeparators */, 'wordSeparators', USUAL_WORD_SEPARATORS, { description: nls.localize('wordSeparators', \"Characters that will be used as word separators when doing word related navigations or operations.\") })),\n wordWrap: register(new EditorStringEnumOption(132 /* EditorOption.wordWrap */, 'wordWrap', 'off', ['off', 'on', 'wordWrapColumn', 'bounded'], {\n markdownEnumDescriptions: [\n nls.localize('wordWrap.off', \"Lines will never wrap.\"),\n nls.localize('wordWrap.on', \"Lines will wrap at the viewport width.\"),\n nls.localize({\n key: 'wordWrap.wordWrapColumn',\n comment: [\n '- `editor.wordWrapColumn` refers to a different setting and should not be localized.'\n ]\n }, \"Lines will wrap at `#editor.wordWrapColumn#`.\"),\n nls.localize({\n key: 'wordWrap.bounded',\n comment: [\n '- viewport means the edge of the visible window size.',\n '- `editor.wordWrapColumn` refers to a different setting and should not be localized.'\n ]\n }, \"Lines will wrap at the minimum of viewport and `#editor.wordWrapColumn#`.\"),\n ],\n description: nls.localize({\n key: 'wordWrap',\n comment: [\n '- \\'off\\', \\'on\\', \\'wordWrapColumn\\' and \\'bounded\\' refer to values the setting can take and should not be localized.',\n '- `editor.wordWrapColumn` refers to a different setting and should not be localized.'\n ]\n }, \"Controls how lines should wrap.\")\n })),\n wordWrapBreakAfterCharacters: register(new EditorStringOption(133 /* EditorOption.wordWrapBreakAfterCharacters */, 'wordWrapBreakAfterCharacters', \n // allow-any-unicode-next-line\n ' \\t})]?|/&.,;\u00A2\u00B0\u2032\u2033\u2030\u2103\u3001\u3002\uFF61\uFF64\uFFE0\uFF0C\uFF0E\uFF1A\uFF1B\uFF1F\uFF01\uFF05\u30FB\uFF65\u309D\u309E\u30FD\u30FE\u30FC\u30A1\u30A3\u30A5\u30A7\u30A9\u30C3\u30E3\u30E5\u30E7\u30EE\u30F5\u30F6\u3041\u3043\u3045\u3047\u3049\u3063\u3083\u3085\u3087\u308E\u3095\u3096\u31F0\u31F1\u31F2\u31F3\u31F4\u31F5\u31F6\u31F7\u31F8\u31F9\u31FA\u31FB\u31FC\u31FD\u31FE\u31FF\u3005\u303B\uFF67\uFF68\uFF69\uFF6A\uFF6B\uFF6C\uFF6D\uFF6E\uFF6F\uFF70\u201D\u3009\u300B\u300D\u300F\u3011\u3015\uFF09\uFF3D\uFF5D\uFF63')),\n wordWrapBreakBeforeCharacters: register(new EditorStringOption(134 /* EditorOption.wordWrapBreakBeforeCharacters */, 'wordWrapBreakBeforeCharacters', \n // allow-any-unicode-next-line\n '([{\u2018\u201C\u3008\u300A\u300C\u300E\u3010\u3014\uFF08\uFF3B\uFF5B\uFF62\u00A3\u00A5\uFF04\uFFE1\uFFE5+\uFF0B')),\n wordWrapColumn: register(new EditorIntOption(135 /* EditorOption.wordWrapColumn */, 'wordWrapColumn', 80, 1, 1073741824 /* Constants.MAX_SAFE_SMALL_INTEGER */, {\n markdownDescription: nls.localize({\n key: 'wordWrapColumn',\n comment: [\n '- `editor.wordWrap` refers to a different setting and should not be localized.',\n '- \\'wordWrapColumn\\' and \\'bounded\\' refer to values the different setting can take and should not be localized.'\n ]\n }, \"Controls the wrapping column of the editor when `#editor.wordWrap#` is `wordWrapColumn` or `bounded`.\")\n })),\n wordWrapOverride1: register(new EditorStringEnumOption(136 /* EditorOption.wordWrapOverride1 */, 'wordWrapOverride1', 'inherit', ['off', 'on', 'inherit'])),\n wordWrapOverride2: register(new EditorStringEnumOption(137 /* EditorOption.wordWrapOverride2 */, 'wordWrapOverride2', 'inherit', ['off', 'on', 'inherit'])),\n // Leave these at the end (because they have dependencies!)\n editorClassName: register(new EditorClassName()),\n defaultColorDecorators: register(new EditorBooleanOption(147 /* EditorOption.defaultColorDecorators */, 'defaultColorDecorators', false, { markdownDescription: nls.localize('defaultColorDecorators', \"Controls whether inline color decorations should be shown using the default document color provider\") })),\n pixelRatio: register(new EditorPixelRatio()),\n tabFocusMode: register(new EditorBooleanOption(144 /* EditorOption.tabFocusMode */, 'tabFocusMode', false, { markdownDescription: nls.localize('tabFocusMode', \"Controls whether the editor receives tabs or defers them to the workbench for navigation.\") })),\n layoutInfo: register(new EditorLayoutInfoComputer()),\n wrappingInfo: register(new EditorWrappingInfoComputer()),\n wrappingIndent: register(new WrappingIndentOption()),\n wrappingStrategy: register(new WrappingStrategy())\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 { CancellationTokenSource } from '../../../base/common/cancellation.js';\nimport { Emitter } from '../../../base/common/event.js';\nimport { KeyChord } from '../../../base/common/keyCodes.js';\nimport { URI } from '../../../base/common/uri.js';\nimport { Position } from '../core/position.js';\nimport { Range } from '../core/range.js';\nimport { Selection } from '../core/selection.js';\nimport { Token } from '../languages.js';\nimport * as standaloneEnums from '../standalone/standaloneEnums.js';\nexport class KeyMod {\n static chord(firstPart, secondPart) {\n return KeyChord(firstPart, secondPart);\n }\n}\nKeyMod.CtrlCmd = 2048 /* ConstKeyMod.CtrlCmd */;\nKeyMod.Shift = 1024 /* ConstKeyMod.Shift */;\nKeyMod.Alt = 512 /* ConstKeyMod.Alt */;\nKeyMod.WinCtrl = 256 /* ConstKeyMod.WinCtrl */;\nexport function createMonacoBaseAPI() {\n return {\n editor: undefined, // undefined override expected here\n languages: undefined, // undefined override expected here\n CancellationTokenSource: CancellationTokenSource,\n Emitter: Emitter,\n KeyCode: standaloneEnums.KeyCode,\n KeyMod: KeyMod,\n Position: Position,\n Range: Range,\n Selection: Selection,\n SelectionDirection: standaloneEnums.SelectionDirection,\n MarkerSeverity: standaloneEnums.MarkerSeverity,\n MarkerTag: standaloneEnums.MarkerTag,\n Uri: URI,\n Token: Token\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// THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY.\nexport var AccessibilitySupport;\n(function (AccessibilitySupport) {\n /**\n * This should be the browser case where it is not known if a screen reader is attached or no.\n */\n AccessibilitySupport[AccessibilitySupport[\"Unknown\"] = 0] = \"Unknown\";\n AccessibilitySupport[AccessibilitySupport[\"Disabled\"] = 1] = \"Disabled\";\n AccessibilitySupport[AccessibilitySupport[\"Enabled\"] = 2] = \"Enabled\";\n})(AccessibilitySupport || (AccessibilitySupport = {}));\nexport var CodeActionTriggerType;\n(function (CodeActionTriggerType) {\n CodeActionTriggerType[CodeActionTriggerType[\"Invoke\"] = 1] = \"Invoke\";\n CodeActionTriggerType[CodeActionTriggerType[\"Auto\"] = 2] = \"Auto\";\n})(CodeActionTriggerType || (CodeActionTriggerType = {}));\nexport var CompletionItemInsertTextRule;\n(function (CompletionItemInsertTextRule) {\n CompletionItemInsertTextRule[CompletionItemInsertTextRule[\"None\"] = 0] = \"None\";\n /**\n * Adjust whitespace/indentation of multiline insert texts to\n * match the current line indentation.\n */\n CompletionItemInsertTextRule[CompletionItemInsertTextRule[\"KeepWhitespace\"] = 1] = \"KeepWhitespace\";\n /**\n * `insertText` is a snippet.\n */\n CompletionItemInsertTextRule[CompletionItemInsertTextRule[\"InsertAsSnippet\"] = 4] = \"InsertAsSnippet\";\n})(CompletionItemInsertTextRule || (CompletionItemInsertTextRule = {}));\nexport var CompletionItemKind;\n(function (CompletionItemKind) {\n CompletionItemKind[CompletionItemKind[\"Method\"] = 0] = \"Method\";\n CompletionItemKind[CompletionItemKind[\"Function\"] = 1] = \"Function\";\n CompletionItemKind[CompletionItemKind[\"Constructor\"] = 2] = \"Constructor\";\n CompletionItemKind[CompletionItemKind[\"Field\"] = 3] = \"Field\";\n CompletionItemKind[CompletionItemKind[\"Variable\"] = 4] = \"Variable\";\n CompletionItemKind[CompletionItemKind[\"Class\"] = 5] = \"Class\";\n CompletionItemKind[CompletionItemKind[\"Struct\"] = 6] = \"Struct\";\n CompletionItemKind[CompletionItemKind[\"Interface\"] = 7] = \"Interface\";\n CompletionItemKind[CompletionItemKind[\"Module\"] = 8] = \"Module\";\n CompletionItemKind[CompletionItemKind[\"Property\"] = 9] = \"Property\";\n CompletionItemKind[CompletionItemKind[\"Event\"] = 10] = \"Event\";\n CompletionItemKind[CompletionItemKind[\"Operator\"] = 11] = \"Operator\";\n CompletionItemKind[CompletionItemKind[\"Unit\"] = 12] = \"Unit\";\n CompletionItemKind[CompletionItemKind[\"Value\"] = 13] = \"Value\";\n CompletionItemKind[CompletionItemKind[\"Constant\"] = 14] = \"Constant\";\n CompletionItemKind[CompletionItemKind[\"Enum\"] = 15] = \"Enum\";\n CompletionItemKind[CompletionItemKind[\"EnumMember\"] = 16] = \"EnumMember\";\n CompletionItemKind[CompletionItemKind[\"Keyword\"] = 17] = \"Keyword\";\n CompletionItemKind[CompletionItemKind[\"Text\"] = 18] = \"Text\";\n CompletionItemKind[CompletionItemKind[\"Color\"] = 19] = \"Color\";\n CompletionItemKind[CompletionItemKind[\"File\"] = 20] = \"File\";\n CompletionItemKind[CompletionItemKind[\"Reference\"] = 21] = \"Reference\";\n CompletionItemKind[CompletionItemKind[\"Customcolor\"] = 22] = \"Customcolor\";\n CompletionItemKind[CompletionItemKind[\"Folder\"] = 23] = \"Folder\";\n CompletionItemKind[CompletionItemKind[\"TypeParameter\"] = 24] = \"TypeParameter\";\n CompletionItemKind[CompletionItemKind[\"User\"] = 25] = \"User\";\n CompletionItemKind[CompletionItemKind[\"Issue\"] = 26] = \"Issue\";\n CompletionItemKind[CompletionItemKind[\"Snippet\"] = 27] = \"Snippet\";\n})(CompletionItemKind || (CompletionItemKind = {}));\nexport var CompletionItemTag;\n(function (CompletionItemTag) {\n CompletionItemTag[CompletionItemTag[\"Deprecated\"] = 1] = \"Deprecated\";\n})(CompletionItemTag || (CompletionItemTag = {}));\n/**\n * How a suggest provider was triggered.\n */\nexport var CompletionTriggerKind;\n(function (CompletionTriggerKind) {\n CompletionTriggerKind[CompletionTriggerKind[\"Invoke\"] = 0] = \"Invoke\";\n CompletionTriggerKind[CompletionTriggerKind[\"TriggerCharacter\"] = 1] = \"TriggerCharacter\";\n CompletionTriggerKind[CompletionTriggerKind[\"TriggerForIncompleteCompletions\"] = 2] = \"TriggerForIncompleteCompletions\";\n})(CompletionTriggerKind || (CompletionTriggerKind = {}));\n/**\n * A positioning preference for rendering content widgets.\n */\nexport var ContentWidgetPositionPreference;\n(function (ContentWidgetPositionPreference) {\n /**\n * Place the content widget exactly at a position\n */\n ContentWidgetPositionPreference[ContentWidgetPositionPreference[\"EXACT\"] = 0] = \"EXACT\";\n /**\n * Place the content widget above a position\n */\n ContentWidgetPositionPreference[ContentWidgetPositionPreference[\"ABOVE\"] = 1] = \"ABOVE\";\n /**\n * Place the content widget below a position\n */\n ContentWidgetPositionPreference[ContentWidgetPositionPreference[\"BELOW\"] = 2] = \"BELOW\";\n})(ContentWidgetPositionPreference || (ContentWidgetPositionPreference = {}));\n/**\n * Describes the reason the cursor has changed its position.\n */\nexport var CursorChangeReason;\n(function (CursorChangeReason) {\n /**\n * Unknown or not set.\n */\n CursorChangeReason[CursorChangeReason[\"NotSet\"] = 0] = \"NotSet\";\n /**\n * A `model.setValue()` was called.\n */\n CursorChangeReason[CursorChangeReason[\"ContentFlush\"] = 1] = \"ContentFlush\";\n /**\n * The `model` has been changed outside of this cursor and the cursor recovers its position from associated markers.\n */\n CursorChangeReason[CursorChangeReason[\"RecoverFromMarkers\"] = 2] = \"RecoverFromMarkers\";\n /**\n * There was an explicit user gesture.\n */\n CursorChangeReason[CursorChangeReason[\"Explicit\"] = 3] = \"Explicit\";\n /**\n * There was a Paste.\n */\n CursorChangeReason[CursorChangeReason[\"Paste\"] = 4] = \"Paste\";\n /**\n * There was an Undo.\n */\n CursorChangeReason[CursorChangeReason[\"Undo\"] = 5] = \"Undo\";\n /**\n * There was a Redo.\n */\n CursorChangeReason[CursorChangeReason[\"Redo\"] = 6] = \"Redo\";\n})(CursorChangeReason || (CursorChangeReason = {}));\n/**\n * The default end of line to use when instantiating models.\n */\nexport var DefaultEndOfLine;\n(function (DefaultEndOfLine) {\n /**\n * Use line feed (\\n) as the end of line character.\n */\n DefaultEndOfLine[DefaultEndOfLine[\"LF\"] = 1] = \"LF\";\n /**\n * Use carriage return and line feed (\\r\\n) as the end of line character.\n */\n DefaultEndOfLine[DefaultEndOfLine[\"CRLF\"] = 2] = \"CRLF\";\n})(DefaultEndOfLine || (DefaultEndOfLine = {}));\n/**\n * A document highlight kind.\n */\nexport var DocumentHighlightKind;\n(function (DocumentHighlightKind) {\n /**\n * A textual occurrence.\n */\n DocumentHighlightKind[DocumentHighlightKind[\"Text\"] = 0] = \"Text\";\n /**\n * Read-access of a symbol, like reading a variable.\n */\n DocumentHighlightKind[DocumentHighlightKind[\"Read\"] = 1] = \"Read\";\n /**\n * Write-access of a symbol, like writing to a variable.\n */\n DocumentHighlightKind[DocumentHighlightKind[\"Write\"] = 2] = \"Write\";\n})(DocumentHighlightKind || (DocumentHighlightKind = {}));\n/**\n * Configuration options for auto indentation in the editor\n */\nexport var EditorAutoIndentStrategy;\n(function (EditorAutoIndentStrategy) {\n EditorAutoIndentStrategy[EditorAutoIndentStrategy[\"None\"] = 0] = \"None\";\n EditorAutoIndentStrategy[EditorAutoIndentStrategy[\"Keep\"] = 1] = \"Keep\";\n EditorAutoIndentStrategy[EditorAutoIndentStrategy[\"Brackets\"] = 2] = \"Brackets\";\n EditorAutoIndentStrategy[EditorAutoIndentStrategy[\"Advanced\"] = 3] = \"Advanced\";\n EditorAutoIndentStrategy[EditorAutoIndentStrategy[\"Full\"] = 4] = \"Full\";\n})(EditorAutoIndentStrategy || (EditorAutoIndentStrategy = {}));\nexport var EditorOption;\n(function (EditorOption) {\n EditorOption[EditorOption[\"acceptSuggestionOnCommitCharacter\"] = 0] = \"acceptSuggestionOnCommitCharacter\";\n EditorOption[EditorOption[\"acceptSuggestionOnEnter\"] = 1] = \"acceptSuggestionOnEnter\";\n EditorOption[EditorOption[\"accessibilitySupport\"] = 2] = \"accessibilitySupport\";\n EditorOption[EditorOption[\"accessibilityPageSize\"] = 3] = \"accessibilityPageSize\";\n EditorOption[EditorOption[\"ariaLabel\"] = 4] = \"ariaLabel\";\n EditorOption[EditorOption[\"ariaRequired\"] = 5] = \"ariaRequired\";\n EditorOption[EditorOption[\"autoClosingBrackets\"] = 6] = \"autoClosingBrackets\";\n EditorOption[EditorOption[\"autoClosingComments\"] = 7] = \"autoClosingComments\";\n EditorOption[EditorOption[\"screenReaderAnnounceInlineSuggestion\"] = 8] = \"screenReaderAnnounceInlineSuggestion\";\n EditorOption[EditorOption[\"autoClosingDelete\"] = 9] = \"autoClosingDelete\";\n EditorOption[EditorOption[\"autoClosingOvertype\"] = 10] = \"autoClosingOvertype\";\n EditorOption[EditorOption[\"autoClosingQuotes\"] = 11] = \"autoClosingQuotes\";\n EditorOption[EditorOption[\"autoIndent\"] = 12] = \"autoIndent\";\n EditorOption[EditorOption[\"automaticLayout\"] = 13] = \"automaticLayout\";\n EditorOption[EditorOption[\"autoSurround\"] = 14] = \"autoSurround\";\n EditorOption[EditorOption[\"bracketPairColorization\"] = 15] = \"bracketPairColorization\";\n EditorOption[EditorOption[\"guides\"] = 16] = \"guides\";\n EditorOption[EditorOption[\"codeLens\"] = 17] = \"codeLens\";\n EditorOption[EditorOption[\"codeLensFontFamily\"] = 18] = \"codeLensFontFamily\";\n EditorOption[EditorOption[\"codeLensFontSize\"] = 19] = \"codeLensFontSize\";\n EditorOption[EditorOption[\"colorDecorators\"] = 20] = \"colorDecorators\";\n EditorOption[EditorOption[\"colorDecoratorsLimit\"] = 21] = \"colorDecoratorsLimit\";\n EditorOption[EditorOption[\"columnSelection\"] = 22] = \"columnSelection\";\n EditorOption[EditorOption[\"comments\"] = 23] = \"comments\";\n EditorOption[EditorOption[\"contextmenu\"] = 24] = \"contextmenu\";\n EditorOption[EditorOption[\"copyWithSyntaxHighlighting\"] = 25] = \"copyWithSyntaxHighlighting\";\n EditorOption[EditorOption[\"cursorBlinking\"] = 26] = \"cursorBlinking\";\n EditorOption[EditorOption[\"cursorSmoothCaretAnimation\"] = 27] = \"cursorSmoothCaretAnimation\";\n EditorOption[EditorOption[\"cursorStyle\"] = 28] = \"cursorStyle\";\n EditorOption[EditorOption[\"cursorSurroundingLines\"] = 29] = \"cursorSurroundingLines\";\n EditorOption[EditorOption[\"cursorSurroundingLinesStyle\"] = 30] = \"cursorSurroundingLinesStyle\";\n EditorOption[EditorOption[\"cursorWidth\"] = 31] = \"cursorWidth\";\n EditorOption[EditorOption[\"disableLayerHinting\"] = 32] = \"disableLayerHinting\";\n EditorOption[EditorOption[\"disableMonospaceOptimizations\"] = 33] = \"disableMonospaceOptimizations\";\n EditorOption[EditorOption[\"domReadOnly\"] = 34] = \"domReadOnly\";\n EditorOption[EditorOption[\"dragAndDrop\"] = 35] = \"dragAndDrop\";\n EditorOption[EditorOption[\"dropIntoEditor\"] = 36] = \"dropIntoEditor\";\n EditorOption[EditorOption[\"emptySelectionClipboard\"] = 37] = \"emptySelectionClipboard\";\n EditorOption[EditorOption[\"experimentalWhitespaceRendering\"] = 38] = \"experimentalWhitespaceRendering\";\n EditorOption[EditorOption[\"extraEditorClassName\"] = 39] = \"extraEditorClassName\";\n EditorOption[EditorOption[\"fastScrollSensitivity\"] = 40] = \"fastScrollSensitivity\";\n EditorOption[EditorOption[\"find\"] = 41] = \"find\";\n EditorOption[EditorOption[\"fixedOverflowWidgets\"] = 42] = \"fixedOverflowWidgets\";\n EditorOption[EditorOption[\"folding\"] = 43] = \"folding\";\n EditorOption[EditorOption[\"foldingStrategy\"] = 44] = \"foldingStrategy\";\n EditorOption[EditorOption[\"foldingHighlight\"] = 45] = \"foldingHighlight\";\n EditorOption[EditorOption[\"foldingImportsByDefault\"] = 46] = \"foldingImportsByDefault\";\n EditorOption[EditorOption[\"foldingMaximumRegions\"] = 47] = \"foldingMaximumRegions\";\n EditorOption[EditorOption[\"unfoldOnClickAfterEndOfLine\"] = 48] = \"unfoldOnClickAfterEndOfLine\";\n EditorOption[EditorOption[\"fontFamily\"] = 49] = \"fontFamily\";\n EditorOption[EditorOption[\"fontInfo\"] = 50] = \"fontInfo\";\n EditorOption[EditorOption[\"fontLigatures\"] = 51] = \"fontLigatures\";\n EditorOption[EditorOption[\"fontSize\"] = 52] = \"fontSize\";\n EditorOption[EditorOption[\"fontWeight\"] = 53] = \"fontWeight\";\n EditorOption[EditorOption[\"fontVariations\"] = 54] = \"fontVariations\";\n EditorOption[EditorOption[\"formatOnPaste\"] = 55] = \"formatOnPaste\";\n EditorOption[EditorOption[\"formatOnType\"] = 56] = \"formatOnType\";\n EditorOption[EditorOption[\"glyphMargin\"] = 57] = \"glyphMargin\";\n EditorOption[EditorOption[\"gotoLocation\"] = 58] = \"gotoLocation\";\n EditorOption[EditorOption[\"hideCursorInOverviewRuler\"] = 59] = \"hideCursorInOverviewRuler\";\n EditorOption[EditorOption[\"hover\"] = 60] = \"hover\";\n EditorOption[EditorOption[\"inDiffEditor\"] = 61] = \"inDiffEditor\";\n EditorOption[EditorOption[\"inlineSuggest\"] = 62] = \"inlineSuggest\";\n EditorOption[EditorOption[\"inlineEdit\"] = 63] = \"inlineEdit\";\n EditorOption[EditorOption[\"letterSpacing\"] = 64] = \"letterSpacing\";\n EditorOption[EditorOption[\"lightbulb\"] = 65] = \"lightbulb\";\n EditorOption[EditorOption[\"lineDecorationsWidth\"] = 66] = \"lineDecorationsWidth\";\n EditorOption[EditorOption[\"lineHeight\"] = 67] = \"lineHeight\";\n EditorOption[EditorOption[\"lineNumbers\"] = 68] = \"lineNumbers\";\n EditorOption[EditorOption[\"lineNumbersMinChars\"] = 69] = \"lineNumbersMinChars\";\n EditorOption[EditorOption[\"linkedEditing\"] = 70] = \"linkedEditing\";\n EditorOption[EditorOption[\"links\"] = 71] = \"links\";\n EditorOption[EditorOption[\"matchBrackets\"] = 72] = \"matchBrackets\";\n EditorOption[EditorOption[\"minimap\"] = 73] = \"minimap\";\n EditorOption[EditorOption[\"mouseStyle\"] = 74] = \"mouseStyle\";\n EditorOption[EditorOption[\"mouseWheelScrollSensitivity\"] = 75] = \"mouseWheelScrollSensitivity\";\n EditorOption[EditorOption[\"mouseWheelZoom\"] = 76] = \"mouseWheelZoom\";\n EditorOption[EditorOption[\"multiCursorMergeOverlapping\"] = 77] = \"multiCursorMergeOverlapping\";\n EditorOption[EditorOption[\"multiCursorModifier\"] = 78] = \"multiCursorModifier\";\n EditorOption[EditorOption[\"multiCursorPaste\"] = 79] = \"multiCursorPaste\";\n EditorOption[EditorOption[\"multiCursorLimit\"] = 80] = \"multiCursorLimit\";\n EditorOption[EditorOption[\"occurrencesHighlight\"] = 81] = \"occurrencesHighlight\";\n EditorOption[EditorOption[\"overviewRulerBorder\"] = 82] = \"overviewRulerBorder\";\n EditorOption[EditorOption[\"overviewRulerLanes\"] = 83] = \"overviewRulerLanes\";\n EditorOption[EditorOption[\"padding\"] = 84] = \"padding\";\n EditorOption[EditorOption[\"pasteAs\"] = 85] = \"pasteAs\";\n EditorOption[EditorOption[\"parameterHints\"] = 86] = \"parameterHints\";\n EditorOption[EditorOption[\"peekWidgetDefaultFocus\"] = 87] = \"peekWidgetDefaultFocus\";\n EditorOption[EditorOption[\"definitionLinkOpensInPeek\"] = 88] = \"definitionLinkOpensInPeek\";\n EditorOption[EditorOption[\"quickSuggestions\"] = 89] = \"quickSuggestions\";\n EditorOption[EditorOption[\"quickSuggestionsDelay\"] = 90] = \"quickSuggestionsDelay\";\n EditorOption[EditorOption[\"readOnly\"] = 91] = \"readOnly\";\n EditorOption[EditorOption[\"readOnlyMessage\"] = 92] = \"readOnlyMessage\";\n EditorOption[EditorOption[\"renameOnType\"] = 93] = \"renameOnType\";\n EditorOption[EditorOption[\"renderControlCharacters\"] = 94] = \"renderControlCharacters\";\n EditorOption[EditorOption[\"renderFinalNewline\"] = 95] = \"renderFinalNewline\";\n EditorOption[EditorOption[\"renderLineHighlight\"] = 96] = \"renderLineHighlight\";\n EditorOption[EditorOption[\"renderLineHighlightOnlyWhenFocus\"] = 97] = \"renderLineHighlightOnlyWhenFocus\";\n EditorOption[EditorOption[\"renderValidationDecorations\"] = 98] = \"renderValidationDecorations\";\n EditorOption[EditorOption[\"renderWhitespace\"] = 99] = \"renderWhitespace\";\n EditorOption[EditorOption[\"revealHorizontalRightPadding\"] = 100] = \"revealHorizontalRightPadding\";\n EditorOption[EditorOption[\"roundedSelection\"] = 101] = \"roundedSelection\";\n EditorOption[EditorOption[\"rulers\"] = 102] = \"rulers\";\n EditorOption[EditorOption[\"scrollbar\"] = 103] = \"scrollbar\";\n EditorOption[EditorOption[\"scrollBeyondLastColumn\"] = 104] = \"scrollBeyondLastColumn\";\n EditorOption[EditorOption[\"scrollBeyondLastLine\"] = 105] = \"scrollBeyondLastLine\";\n EditorOption[EditorOption[\"scrollPredominantAxis\"] = 106] = \"scrollPredominantAxis\";\n EditorOption[EditorOption[\"selectionClipboard\"] = 107] = \"selectionClipboard\";\n EditorOption[EditorOption[\"selectionHighlight\"] = 108] = \"selectionHighlight\";\n EditorOption[EditorOption[\"selectOnLineNumbers\"] = 109] = \"selectOnLineNumbers\";\n EditorOption[EditorOption[\"showFoldingControls\"] = 110] = \"showFoldingControls\";\n EditorOption[EditorOption[\"showUnused\"] = 111] = \"showUnused\";\n EditorOption[EditorOption[\"snippetSuggestions\"] = 112] = \"snippetSuggestions\";\n EditorOption[EditorOption[\"smartSelect\"] = 113] = \"smartSelect\";\n EditorOption[EditorOption[\"smoothScrolling\"] = 114] = \"smoothScrolling\";\n EditorOption[EditorOption[\"stickyScroll\"] = 115] = \"stickyScroll\";\n EditorOption[EditorOption[\"stickyTabStops\"] = 116] = \"stickyTabStops\";\n EditorOption[EditorOption[\"stopRenderingLineAfter\"] = 117] = \"stopRenderingLineAfter\";\n EditorOption[EditorOption[\"suggest\"] = 118] = \"suggest\";\n EditorOption[EditorOption[\"suggestFontSize\"] = 119] = \"suggestFontSize\";\n EditorOption[EditorOption[\"suggestLineHeight\"] = 120] = \"suggestLineHeight\";\n EditorOption[EditorOption[\"suggestOnTriggerCharacters\"] = 121] = \"suggestOnTriggerCharacters\";\n EditorOption[EditorOption[\"suggestSelection\"] = 122] = \"suggestSelection\";\n EditorOption[EditorOption[\"tabCompletion\"] = 123] = \"tabCompletion\";\n EditorOption[EditorOption[\"tabIndex\"] = 124] = \"tabIndex\";\n EditorOption[EditorOption[\"unicodeHighlighting\"] = 125] = \"unicodeHighlighting\";\n EditorOption[EditorOption[\"unusualLineTerminators\"] = 126] = \"unusualLineTerminators\";\n EditorOption[EditorOption[\"useShadowDOM\"] = 127] = \"useShadowDOM\";\n EditorOption[EditorOption[\"useTabStops\"] = 128] = \"useTabStops\";\n EditorOption[EditorOption[\"wordBreak\"] = 129] = \"wordBreak\";\n EditorOption[EditorOption[\"wordSegmenterLocales\"] = 130] = \"wordSegmenterLocales\";\n EditorOption[EditorOption[\"wordSeparators\"] = 131] = \"wordSeparators\";\n EditorOption[EditorOption[\"wordWrap\"] = 132] = \"wordWrap\";\n EditorOption[EditorOption[\"wordWrapBreakAfterCharacters\"] = 133] = \"wordWrapBreakAfterCharacters\";\n EditorOption[EditorOption[\"wordWrapBreakBeforeCharacters\"] = 134] = \"wordWrapBreakBeforeCharacters\";\n EditorOption[EditorOption[\"wordWrapColumn\"] = 135] = \"wordWrapColumn\";\n EditorOption[EditorOption[\"wordWrapOverride1\"] = 136] = \"wordWrapOverride1\";\n EditorOption[EditorOption[\"wordWrapOverride2\"] = 137] = \"wordWrapOverride2\";\n EditorOption[EditorOption[\"wrappingIndent\"] = 138] = \"wrappingIndent\";\n EditorOption[EditorOption[\"wrappingStrategy\"] = 139] = \"wrappingStrategy\";\n EditorOption[EditorOption[\"showDeprecated\"] = 140] = \"showDeprecated\";\n EditorOption[EditorOption[\"inlayHints\"] = 141] = \"inlayHints\";\n EditorOption[EditorOption[\"editorClassName\"] = 142] = \"editorClassName\";\n EditorOption[EditorOption[\"pixelRatio\"] = 143] = \"pixelRatio\";\n EditorOption[EditorOption[\"tabFocusMode\"] = 144] = \"tabFocusMode\";\n EditorOption[EditorOption[\"layoutInfo\"] = 145] = \"layoutInfo\";\n EditorOption[EditorOption[\"wrappingInfo\"] = 146] = \"wrappingInfo\";\n EditorOption[EditorOption[\"defaultColorDecorators\"] = 147] = \"defaultColorDecorators\";\n EditorOption[EditorOption[\"colorDecoratorsActivatedOn\"] = 148] = \"colorDecoratorsActivatedOn\";\n EditorOption[EditorOption[\"inlineCompletionsAccessibilityVerbose\"] = 149] = \"inlineCompletionsAccessibilityVerbose\";\n})(EditorOption || (EditorOption = {}));\n/**\n * End of line character preference.\n */\nexport var EndOfLinePreference;\n(function (EndOfLinePreference) {\n /**\n * Use the end of line character identified in the text buffer.\n */\n EndOfLinePreference[EndOfLinePreference[\"TextDefined\"] = 0] = \"TextDefined\";\n /**\n * Use line feed (\\n) as the end of line character.\n */\n EndOfLinePreference[EndOfLinePreference[\"LF\"] = 1] = \"LF\";\n /**\n * Use carriage return and line feed (\\r\\n) as the end of line character.\n */\n EndOfLinePreference[EndOfLinePreference[\"CRLF\"] = 2] = \"CRLF\";\n})(EndOfLinePreference || (EndOfLinePreference = {}));\n/**\n * End of line character preference.\n */\nexport var EndOfLineSequence;\n(function (EndOfLineSequence) {\n /**\n * Use line feed (\\n) as the end of line character.\n */\n EndOfLineSequence[EndOfLineSequence[\"LF\"] = 0] = \"LF\";\n /**\n * Use carriage return and line feed (\\r\\n) as the end of line character.\n */\n EndOfLineSequence[EndOfLineSequence[\"CRLF\"] = 1] = \"CRLF\";\n})(EndOfLineSequence || (EndOfLineSequence = {}));\n/**\n * Vertical Lane in the glyph margin of the editor.\n */\nexport var GlyphMarginLane;\n(function (GlyphMarginLane) {\n GlyphMarginLane[GlyphMarginLane[\"Left\"] = 1] = \"Left\";\n GlyphMarginLane[GlyphMarginLane[\"Center\"] = 2] = \"Center\";\n GlyphMarginLane[GlyphMarginLane[\"Right\"] = 3] = \"Right\";\n})(GlyphMarginLane || (GlyphMarginLane = {}));\nexport var HoverVerbosityAction;\n(function (HoverVerbosityAction) {\n /**\n * Increase the verbosity of the hover\n */\n HoverVerbosityAction[HoverVerbosityAction[\"Increase\"] = 0] = \"Increase\";\n /**\n * Decrease the verbosity of the hover\n */\n HoverVerbosityAction[HoverVerbosityAction[\"Decrease\"] = 1] = \"Decrease\";\n})(HoverVerbosityAction || (HoverVerbosityAction = {}));\n/**\n * Describes what to do with the indentation when pressing Enter.\n */\nexport var IndentAction;\n(function (IndentAction) {\n /**\n * Insert new line and copy the previous line's indentation.\n */\n IndentAction[IndentAction[\"None\"] = 0] = \"None\";\n /**\n * Insert new line and indent once (relative to the previous line's indentation).\n */\n IndentAction[IndentAction[\"Indent\"] = 1] = \"Indent\";\n /**\n * Insert two new lines:\n * - the first one indented which will hold the cursor\n * - the second one at the same indentation level\n */\n IndentAction[IndentAction[\"IndentOutdent\"] = 2] = \"IndentOutdent\";\n /**\n * Insert new line and outdent once (relative to the previous line's indentation).\n */\n IndentAction[IndentAction[\"Outdent\"] = 3] = \"Outdent\";\n})(IndentAction || (IndentAction = {}));\nexport var InjectedTextCursorStops;\n(function (InjectedTextCursorStops) {\n InjectedTextCursorStops[InjectedTextCursorStops[\"Both\"] = 0] = \"Both\";\n InjectedTextCursorStops[InjectedTextCursorStops[\"Right\"] = 1] = \"Right\";\n InjectedTextCursorStops[InjectedTextCursorStops[\"Left\"] = 2] = \"Left\";\n InjectedTextCursorStops[InjectedTextCursorStops[\"None\"] = 3] = \"None\";\n})(InjectedTextCursorStops || (InjectedTextCursorStops = {}));\nexport var InlayHintKind;\n(function (InlayHintKind) {\n InlayHintKind[InlayHintKind[\"Type\"] = 1] = \"Type\";\n InlayHintKind[InlayHintKind[\"Parameter\"] = 2] = \"Parameter\";\n})(InlayHintKind || (InlayHintKind = {}));\n/**\n * How an {@link InlineCompletionsProvider inline completion provider} was triggered.\n */\nexport var InlineCompletionTriggerKind;\n(function (InlineCompletionTriggerKind) {\n /**\n * Completion was triggered automatically while editing.\n * It is sufficient to return a single completion item in this case.\n */\n InlineCompletionTriggerKind[InlineCompletionTriggerKind[\"Automatic\"] = 0] = \"Automatic\";\n /**\n * Completion was triggered explicitly by a user gesture.\n * Return multiple completion items to enable cycling through them.\n */\n InlineCompletionTriggerKind[InlineCompletionTriggerKind[\"Explicit\"] = 1] = \"Explicit\";\n})(InlineCompletionTriggerKind || (InlineCompletionTriggerKind = {}));\nexport var InlineEditTriggerKind;\n(function (InlineEditTriggerKind) {\n InlineEditTriggerKind[InlineEditTriggerKind[\"Invoke\"] = 0] = \"Invoke\";\n InlineEditTriggerKind[InlineEditTriggerKind[\"Automatic\"] = 1] = \"Automatic\";\n})(InlineEditTriggerKind || (InlineEditTriggerKind = {}));\n/**\n * Virtual Key Codes, the value does not hold any inherent meaning.\n * Inspired somewhat from https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx\n * But these are \"more general\", as they should work across browsers & OS`s.\n */\nexport var KeyCode;\n(function (KeyCode) {\n KeyCode[KeyCode[\"DependsOnKbLayout\"] = -1] = \"DependsOnKbLayout\";\n /**\n * Placed first to cover the 0 value of the enum.\n */\n KeyCode[KeyCode[\"Unknown\"] = 0] = \"Unknown\";\n KeyCode[KeyCode[\"Backspace\"] = 1] = \"Backspace\";\n KeyCode[KeyCode[\"Tab\"] = 2] = \"Tab\";\n KeyCode[KeyCode[\"Enter\"] = 3] = \"Enter\";\n KeyCode[KeyCode[\"Shift\"] = 4] = \"Shift\";\n KeyCode[KeyCode[\"Ctrl\"] = 5] = \"Ctrl\";\n KeyCode[KeyCode[\"Alt\"] = 6] = \"Alt\";\n KeyCode[KeyCode[\"PauseBreak\"] = 7] = \"PauseBreak\";\n KeyCode[KeyCode[\"CapsLock\"] = 8] = \"CapsLock\";\n KeyCode[KeyCode[\"Escape\"] = 9] = \"Escape\";\n KeyCode[KeyCode[\"Space\"] = 10] = \"Space\";\n KeyCode[KeyCode[\"PageUp\"] = 11] = \"PageUp\";\n KeyCode[KeyCode[\"PageDown\"] = 12] = \"PageDown\";\n KeyCode[KeyCode[\"End\"] = 13] = \"End\";\n KeyCode[KeyCode[\"Home\"] = 14] = \"Home\";\n KeyCode[KeyCode[\"LeftArrow\"] = 15] = \"LeftArrow\";\n KeyCode[KeyCode[\"UpArrow\"] = 16] = \"UpArrow\";\n KeyCode[KeyCode[\"RightArrow\"] = 17] = \"RightArrow\";\n KeyCode[KeyCode[\"DownArrow\"] = 18] = \"DownArrow\";\n KeyCode[KeyCode[\"Insert\"] = 19] = \"Insert\";\n KeyCode[KeyCode[\"Delete\"] = 20] = \"Delete\";\n KeyCode[KeyCode[\"Digit0\"] = 21] = \"Digit0\";\n KeyCode[KeyCode[\"Digit1\"] = 22] = \"Digit1\";\n KeyCode[KeyCode[\"Digit2\"] = 23] = \"Digit2\";\n KeyCode[KeyCode[\"Digit3\"] = 24] = \"Digit3\";\n KeyCode[KeyCode[\"Digit4\"] = 25] = \"Digit4\";\n KeyCode[KeyCode[\"Digit5\"] = 26] = \"Digit5\";\n KeyCode[KeyCode[\"Digit6\"] = 27] = \"Digit6\";\n KeyCode[KeyCode[\"Digit7\"] = 28] = \"Digit7\";\n KeyCode[KeyCode[\"Digit8\"] = 29] = \"Digit8\";\n KeyCode[KeyCode[\"Digit9\"] = 30] = \"Digit9\";\n KeyCode[KeyCode[\"KeyA\"] = 31] = \"KeyA\";\n KeyCode[KeyCode[\"KeyB\"] = 32] = \"KeyB\";\n KeyCode[KeyCode[\"KeyC\"] = 33] = \"KeyC\";\n KeyCode[KeyCode[\"KeyD\"] = 34] = \"KeyD\";\n KeyCode[KeyCode[\"KeyE\"] = 35] = \"KeyE\";\n KeyCode[KeyCode[\"KeyF\"] = 36] = \"KeyF\";\n KeyCode[KeyCode[\"KeyG\"] = 37] = \"KeyG\";\n KeyCode[KeyCode[\"KeyH\"] = 38] = \"KeyH\";\n KeyCode[KeyCode[\"KeyI\"] = 39] = \"KeyI\";\n KeyCode[KeyCode[\"KeyJ\"] = 40] = \"KeyJ\";\n KeyCode[KeyCode[\"KeyK\"] = 41] = \"KeyK\";\n KeyCode[KeyCode[\"KeyL\"] = 42] = \"KeyL\";\n KeyCode[KeyCode[\"KeyM\"] = 43] = \"KeyM\";\n KeyCode[KeyCode[\"KeyN\"] = 44] = \"KeyN\";\n KeyCode[KeyCode[\"KeyO\"] = 45] = \"KeyO\";\n KeyCode[KeyCode[\"KeyP\"] = 46] = \"KeyP\";\n KeyCode[KeyCode[\"KeyQ\"] = 47] = \"KeyQ\";\n KeyCode[KeyCode[\"KeyR\"] = 48] = \"KeyR\";\n KeyCode[KeyCode[\"KeyS\"] = 49] = \"KeyS\";\n KeyCode[KeyCode[\"KeyT\"] = 50] = \"KeyT\";\n KeyCode[KeyCode[\"KeyU\"] = 51] = \"KeyU\";\n KeyCode[KeyCode[\"KeyV\"] = 52] = \"KeyV\";\n KeyCode[KeyCode[\"KeyW\"] = 53] = \"KeyW\";\n KeyCode[KeyCode[\"KeyX\"] = 54] = \"KeyX\";\n KeyCode[KeyCode[\"KeyY\"] = 55] = \"KeyY\";\n KeyCode[KeyCode[\"KeyZ\"] = 56] = \"KeyZ\";\n KeyCode[KeyCode[\"Meta\"] = 57] = \"Meta\";\n KeyCode[KeyCode[\"ContextMenu\"] = 58] = \"ContextMenu\";\n KeyCode[KeyCode[\"F1\"] = 59] = \"F1\";\n KeyCode[KeyCode[\"F2\"] = 60] = \"F2\";\n KeyCode[KeyCode[\"F3\"] = 61] = \"F3\";\n KeyCode[KeyCode[\"F4\"] = 62] = \"F4\";\n KeyCode[KeyCode[\"F5\"] = 63] = \"F5\";\n KeyCode[KeyCode[\"F6\"] = 64] = \"F6\";\n KeyCode[KeyCode[\"F7\"] = 65] = \"F7\";\n KeyCode[KeyCode[\"F8\"] = 66] = \"F8\";\n KeyCode[KeyCode[\"F9\"] = 67] = \"F9\";\n KeyCode[KeyCode[\"F10\"] = 68] = \"F10\";\n KeyCode[KeyCode[\"F11\"] = 69] = \"F11\";\n KeyCode[KeyCode[\"F12\"] = 70] = \"F12\";\n KeyCode[KeyCode[\"F13\"] = 71] = \"F13\";\n KeyCode[KeyCode[\"F14\"] = 72] = \"F14\";\n KeyCode[KeyCode[\"F15\"] = 73] = \"F15\";\n KeyCode[KeyCode[\"F16\"] = 74] = \"F16\";\n KeyCode[KeyCode[\"F17\"] = 75] = \"F17\";\n KeyCode[KeyCode[\"F18\"] = 76] = \"F18\";\n KeyCode[KeyCode[\"F19\"] = 77] = \"F19\";\n KeyCode[KeyCode[\"F20\"] = 78] = \"F20\";\n KeyCode[KeyCode[\"F21\"] = 79] = \"F21\";\n KeyCode[KeyCode[\"F22\"] = 80] = \"F22\";\n KeyCode[KeyCode[\"F23\"] = 81] = \"F23\";\n KeyCode[KeyCode[\"F24\"] = 82] = \"F24\";\n KeyCode[KeyCode[\"NumLock\"] = 83] = \"NumLock\";\n KeyCode[KeyCode[\"ScrollLock\"] = 84] = \"ScrollLock\";\n /**\n * Used for miscellaneous characters; it can vary by keyboard.\n * For the US standard keyboard, the ';:' key\n */\n KeyCode[KeyCode[\"Semicolon\"] = 85] = \"Semicolon\";\n /**\n * For any country/region, the '+' key\n * For the US standard keyboard, the '=+' key\n */\n KeyCode[KeyCode[\"Equal\"] = 86] = \"Equal\";\n /**\n * For any country/region, the ',' key\n * For the US standard keyboard, the ',<' key\n */\n KeyCode[KeyCode[\"Comma\"] = 87] = \"Comma\";\n /**\n * For any country/region, the '-' key\n * For the US standard keyboard, the '-_' key\n */\n KeyCode[KeyCode[\"Minus\"] = 88] = \"Minus\";\n /**\n * For any country/region, the '.' key\n * For the US standard keyboard, the '.>' key\n */\n KeyCode[KeyCode[\"Period\"] = 89] = \"Period\";\n /**\n * Used for miscellaneous characters; it can vary by keyboard.\n * For the US standard keyboard, the '/?' key\n */\n KeyCode[KeyCode[\"Slash\"] = 90] = \"Slash\";\n /**\n * Used for miscellaneous characters; it can vary by keyboard.\n * For the US standard keyboard, the '`~' key\n */\n KeyCode[KeyCode[\"Backquote\"] = 91] = \"Backquote\";\n /**\n * Used for miscellaneous characters; it can vary by keyboard.\n * For the US standard keyboard, the '[{' key\n */\n KeyCode[KeyCode[\"BracketLeft\"] = 92] = \"BracketLeft\";\n /**\n * Used for miscellaneous characters; it can vary by keyboard.\n * For the US standard keyboard, the '\\|' key\n */\n KeyCode[KeyCode[\"Backslash\"] = 93] = \"Backslash\";\n /**\n * Used for miscellaneous characters; it can vary by keyboard.\n * For the US standard keyboard, the ']}' key\n */\n KeyCode[KeyCode[\"BracketRight\"] = 94] = \"BracketRight\";\n /**\n * Used for miscellaneous characters; it can vary by keyboard.\n * For the US standard keyboard, the ''\"' key\n */\n KeyCode[KeyCode[\"Quote\"] = 95] = \"Quote\";\n /**\n * Used for miscellaneous characters; it can vary by keyboard.\n */\n KeyCode[KeyCode[\"OEM_8\"] = 96] = \"OEM_8\";\n /**\n * Either the angle bracket key or the backslash key on the RT 102-key keyboard.\n */\n KeyCode[KeyCode[\"IntlBackslash\"] = 97] = \"IntlBackslash\";\n KeyCode[KeyCode[\"Numpad0\"] = 98] = \"Numpad0\";\n KeyCode[KeyCode[\"Numpad1\"] = 99] = \"Numpad1\";\n KeyCode[KeyCode[\"Numpad2\"] = 100] = \"Numpad2\";\n KeyCode[KeyCode[\"Numpad3\"] = 101] = \"Numpad3\";\n KeyCode[KeyCode[\"Numpad4\"] = 102] = \"Numpad4\";\n KeyCode[KeyCode[\"Numpad5\"] = 103] = \"Numpad5\";\n KeyCode[KeyCode[\"Numpad6\"] = 104] = \"Numpad6\";\n KeyCode[KeyCode[\"Numpad7\"] = 105] = \"Numpad7\";\n KeyCode[KeyCode[\"Numpad8\"] = 106] = \"Numpad8\";\n KeyCode[KeyCode[\"Numpad9\"] = 107] = \"Numpad9\";\n KeyCode[KeyCode[\"NumpadMultiply\"] = 108] = \"NumpadMultiply\";\n KeyCode[KeyCode[\"NumpadAdd\"] = 109] = \"NumpadAdd\";\n KeyCode[KeyCode[\"NUMPAD_SEPARATOR\"] = 110] = \"NUMPAD_SEPARATOR\";\n KeyCode[KeyCode[\"NumpadSubtract\"] = 111] = \"NumpadSubtract\";\n KeyCode[KeyCode[\"NumpadDecimal\"] = 112] = \"NumpadDecimal\";\n KeyCode[KeyCode[\"NumpadDivide\"] = 113] = \"NumpadDivide\";\n /**\n * Cover all key codes when IME is processing input.\n */\n KeyCode[KeyCode[\"KEY_IN_COMPOSITION\"] = 114] = \"KEY_IN_COMPOSITION\";\n KeyCode[KeyCode[\"ABNT_C1\"] = 115] = \"ABNT_C1\";\n KeyCode[KeyCode[\"ABNT_C2\"] = 116] = \"ABNT_C2\";\n KeyCode[KeyCode[\"AudioVolumeMute\"] = 117] = \"AudioVolumeMute\";\n KeyCode[KeyCode[\"AudioVolumeUp\"] = 118] = \"AudioVolumeUp\";\n KeyCode[KeyCode[\"AudioVolumeDown\"] = 119] = \"AudioVolumeDown\";\n KeyCode[KeyCode[\"BrowserSearch\"] = 120] = \"BrowserSearch\";\n KeyCode[KeyCode[\"BrowserHome\"] = 121] = \"BrowserHome\";\n KeyCode[KeyCode[\"BrowserBack\"] = 122] = \"BrowserBack\";\n KeyCode[KeyCode[\"BrowserForward\"] = 123] = \"BrowserForward\";\n KeyCode[KeyCode[\"MediaTrackNext\"] = 124] = \"MediaTrackNext\";\n KeyCode[KeyCode[\"MediaTrackPrevious\"] = 125] = \"MediaTrackPrevious\";\n KeyCode[KeyCode[\"MediaStop\"] = 126] = \"MediaStop\";\n KeyCode[KeyCode[\"MediaPlayPause\"] = 127] = \"MediaPlayPause\";\n KeyCode[KeyCode[\"LaunchMediaPlayer\"] = 128] = \"LaunchMediaPlayer\";\n KeyCode[KeyCode[\"LaunchMail\"] = 129] = \"LaunchMail\";\n KeyCode[KeyCode[\"LaunchApp2\"] = 130] = \"LaunchApp2\";\n /**\n * VK_CLEAR, 0x0C, CLEAR key\n */\n KeyCode[KeyCode[\"Clear\"] = 131] = \"Clear\";\n /**\n * Placed last to cover the length of the enum.\n * Please do not depend on this value!\n */\n KeyCode[KeyCode[\"MAX_VALUE\"] = 132] = \"MAX_VALUE\";\n})(KeyCode || (KeyCode = {}));\nexport var MarkerSeverity;\n(function (MarkerSeverity) {\n MarkerSeverity[MarkerSeverity[\"Hint\"] = 1] = \"Hint\";\n MarkerSeverity[MarkerSeverity[\"Info\"] = 2] = \"Info\";\n MarkerSeverity[MarkerSeverity[\"Warning\"] = 4] = \"Warning\";\n MarkerSeverity[MarkerSeverity[\"Error\"] = 8] = \"Error\";\n})(MarkerSeverity || (MarkerSeverity = {}));\nexport var MarkerTag;\n(function (MarkerTag) {\n MarkerTag[MarkerTag[\"Unnecessary\"] = 1] = \"Unnecessary\";\n MarkerTag[MarkerTag[\"Deprecated\"] = 2] = \"Deprecated\";\n})(MarkerTag || (MarkerTag = {}));\n/**\n * Position in the minimap to render the decoration.\n */\nexport var MinimapPosition;\n(function (MinimapPosition) {\n MinimapPosition[MinimapPosition[\"Inline\"] = 1] = \"Inline\";\n MinimapPosition[MinimapPosition[\"Gutter\"] = 2] = \"Gutter\";\n})(MinimapPosition || (MinimapPosition = {}));\n/**\n * Section header style.\n */\nexport var MinimapSectionHeaderStyle;\n(function (MinimapSectionHeaderStyle) {\n MinimapSectionHeaderStyle[MinimapSectionHeaderStyle[\"Normal\"] = 1] = \"Normal\";\n MinimapSectionHeaderStyle[MinimapSectionHeaderStyle[\"Underlined\"] = 2] = \"Underlined\";\n})(MinimapSectionHeaderStyle || (MinimapSectionHeaderStyle = {}));\n/**\n * Type of hit element with the mouse in the editor.\n */\nexport var MouseTargetType;\n(function (MouseTargetType) {\n /**\n * Mouse is on top of an unknown element.\n */\n MouseTargetType[MouseTargetType[\"UNKNOWN\"] = 0] = \"UNKNOWN\";\n /**\n * Mouse is on top of the textarea used for input.\n */\n MouseTargetType[MouseTargetType[\"TEXTAREA\"] = 1] = \"TEXTAREA\";\n /**\n * Mouse is on top of the glyph margin\n */\n MouseTargetType[MouseTargetType[\"GUTTER_GLYPH_MARGIN\"] = 2] = \"GUTTER_GLYPH_MARGIN\";\n /**\n * Mouse is on top of the line numbers\n */\n MouseTargetType[MouseTargetType[\"GUTTER_LINE_NUMBERS\"] = 3] = \"GUTTER_LINE_NUMBERS\";\n /**\n * Mouse is on top of the line decorations\n */\n MouseTargetType[MouseTargetType[\"GUTTER_LINE_DECORATIONS\"] = 4] = \"GUTTER_LINE_DECORATIONS\";\n /**\n * Mouse is on top of the whitespace left in the gutter by a view zone.\n */\n MouseTargetType[MouseTargetType[\"GUTTER_VIEW_ZONE\"] = 5] = \"GUTTER_VIEW_ZONE\";\n /**\n * Mouse is on top of text in the content.\n */\n MouseTargetType[MouseTargetType[\"CONTENT_TEXT\"] = 6] = \"CONTENT_TEXT\";\n /**\n * Mouse is on top of empty space in the content (e.g. after line text or below last line)\n */\n MouseTargetType[MouseTargetType[\"CONTENT_EMPTY\"] = 7] = \"CONTENT_EMPTY\";\n /**\n * Mouse is on top of a view zone in the content.\n */\n MouseTargetType[MouseTargetType[\"CONTENT_VIEW_ZONE\"] = 8] = \"CONTENT_VIEW_ZONE\";\n /**\n * Mouse is on top of a content widget.\n */\n MouseTargetType[MouseTargetType[\"CONTENT_WIDGET\"] = 9] = \"CONTENT_WIDGET\";\n /**\n * Mouse is on top of the decorations overview ruler.\n */\n MouseTargetType[MouseTargetType[\"OVERVIEW_RULER\"] = 10] = \"OVERVIEW_RULER\";\n /**\n * Mouse is on top of a scrollbar.\n */\n MouseTargetType[MouseTargetType[\"SCROLLBAR\"] = 11] = \"SCROLLBAR\";\n /**\n * Mouse is on top of an overlay widget.\n */\n MouseTargetType[MouseTargetType[\"OVERLAY_WIDGET\"] = 12] = \"OVERLAY_WIDGET\";\n /**\n * Mouse is outside of the editor.\n */\n MouseTargetType[MouseTargetType[\"OUTSIDE_EDITOR\"] = 13] = \"OUTSIDE_EDITOR\";\n})(MouseTargetType || (MouseTargetType = {}));\nexport var NewSymbolNameTag;\n(function (NewSymbolNameTag) {\n NewSymbolNameTag[NewSymbolNameTag[\"AIGenerated\"] = 1] = \"AIGenerated\";\n})(NewSymbolNameTag || (NewSymbolNameTag = {}));\nexport var NewSymbolNameTriggerKind;\n(function (NewSymbolNameTriggerKind) {\n NewSymbolNameTriggerKind[NewSymbolNameTriggerKind[\"Invoke\"] = 0] = \"Invoke\";\n NewSymbolNameTriggerKind[NewSymbolNameTriggerKind[\"Automatic\"] = 1] = \"Automatic\";\n})(NewSymbolNameTriggerKind || (NewSymbolNameTriggerKind = {}));\n/**\n * A positioning preference for rendering overlay widgets.\n */\nexport var OverlayWidgetPositionPreference;\n(function (OverlayWidgetPositionPreference) {\n /**\n * Position the overlay widget in the top right corner\n */\n OverlayWidgetPositionPreference[OverlayWidgetPositionPreference[\"TOP_RIGHT_CORNER\"] = 0] = \"TOP_RIGHT_CORNER\";\n /**\n * Position the overlay widget in the bottom right corner\n */\n OverlayWidgetPositionPreference[OverlayWidgetPositionPreference[\"BOTTOM_RIGHT_CORNER\"] = 1] = \"BOTTOM_RIGHT_CORNER\";\n /**\n * Position the overlay widget in the top center\n */\n OverlayWidgetPositionPreference[OverlayWidgetPositionPreference[\"TOP_CENTER\"] = 2] = \"TOP_CENTER\";\n})(OverlayWidgetPositionPreference || (OverlayWidgetPositionPreference = {}));\n/**\n * Vertical Lane in the overview ruler of the editor.\n */\nexport var OverviewRulerLane;\n(function (OverviewRulerLane) {\n OverviewRulerLane[OverviewRulerLane[\"Left\"] = 1] = \"Left\";\n OverviewRulerLane[OverviewRulerLane[\"Center\"] = 2] = \"Center\";\n OverviewRulerLane[OverviewRulerLane[\"Right\"] = 4] = \"Right\";\n OverviewRulerLane[OverviewRulerLane[\"Full\"] = 7] = \"Full\";\n})(OverviewRulerLane || (OverviewRulerLane = {}));\n/**\n * How a partial acceptance was triggered.\n */\nexport var PartialAcceptTriggerKind;\n(function (PartialAcceptTriggerKind) {\n PartialAcceptTriggerKind[PartialAcceptTriggerKind[\"Word\"] = 0] = \"Word\";\n PartialAcceptTriggerKind[PartialAcceptTriggerKind[\"Line\"] = 1] = \"Line\";\n PartialAcceptTriggerKind[PartialAcceptTriggerKind[\"Suggest\"] = 2] = \"Suggest\";\n})(PartialAcceptTriggerKind || (PartialAcceptTriggerKind = {}));\nexport var PositionAffinity;\n(function (PositionAffinity) {\n /**\n * Prefers the left most position.\n */\n PositionAffinity[PositionAffinity[\"Left\"] = 0] = \"Left\";\n /**\n * Prefers the right most position.\n */\n PositionAffinity[PositionAffinity[\"Right\"] = 1] = \"Right\";\n /**\n * No preference.\n */\n PositionAffinity[PositionAffinity[\"None\"] = 2] = \"None\";\n /**\n * If the given position is on injected text, prefers the position left of it.\n */\n PositionAffinity[PositionAffinity[\"LeftOfInjectedText\"] = 3] = \"LeftOfInjectedText\";\n /**\n * If the given position is on injected text, prefers the position right of it.\n */\n PositionAffinity[PositionAffinity[\"RightOfInjectedText\"] = 4] = \"RightOfInjectedText\";\n})(PositionAffinity || (PositionAffinity = {}));\nexport var RenderLineNumbersType;\n(function (RenderLineNumbersType) {\n RenderLineNumbersType[RenderLineNumbersType[\"Off\"] = 0] = \"Off\";\n RenderLineNumbersType[RenderLineNumbersType[\"On\"] = 1] = \"On\";\n RenderLineNumbersType[RenderLineNumbersType[\"Relative\"] = 2] = \"Relative\";\n RenderLineNumbersType[RenderLineNumbersType[\"Interval\"] = 3] = \"Interval\";\n RenderLineNumbersType[RenderLineNumbersType[\"Custom\"] = 4] = \"Custom\";\n})(RenderLineNumbersType || (RenderLineNumbersType = {}));\nexport var RenderMinimap;\n(function (RenderMinimap) {\n RenderMinimap[RenderMinimap[\"None\"] = 0] = \"None\";\n RenderMinimap[RenderMinimap[\"Text\"] = 1] = \"Text\";\n RenderMinimap[RenderMinimap[\"Blocks\"] = 2] = \"Blocks\";\n})(RenderMinimap || (RenderMinimap = {}));\nexport var ScrollType;\n(function (ScrollType) {\n ScrollType[ScrollType[\"Smooth\"] = 0] = \"Smooth\";\n ScrollType[ScrollType[\"Immediate\"] = 1] = \"Immediate\";\n})(ScrollType || (ScrollType = {}));\nexport var ScrollbarVisibility;\n(function (ScrollbarVisibility) {\n ScrollbarVisibility[ScrollbarVisibility[\"Auto\"] = 1] = \"Auto\";\n ScrollbarVisibility[ScrollbarVisibility[\"Hidden\"] = 2] = \"Hidden\";\n ScrollbarVisibility[ScrollbarVisibility[\"Visible\"] = 3] = \"Visible\";\n})(ScrollbarVisibility || (ScrollbarVisibility = {}));\n/**\n * The direction of a selection.\n */\nexport var SelectionDirection;\n(function (SelectionDirection) {\n /**\n * The selection starts above where it ends.\n */\n SelectionDirection[SelectionDirection[\"LTR\"] = 0] = \"LTR\";\n /**\n * The selection starts below where it ends.\n */\n SelectionDirection[SelectionDirection[\"RTL\"] = 1] = \"RTL\";\n})(SelectionDirection || (SelectionDirection = {}));\nexport var ShowLightbulbIconMode;\n(function (ShowLightbulbIconMode) {\n ShowLightbulbIconMode[\"Off\"] = \"off\";\n ShowLightbulbIconMode[\"OnCode\"] = \"onCode\";\n ShowLightbulbIconMode[\"On\"] = \"on\";\n})(ShowLightbulbIconMode || (ShowLightbulbIconMode = {}));\nexport var SignatureHelpTriggerKind;\n(function (SignatureHelpTriggerKind) {\n SignatureHelpTriggerKind[SignatureHelpTriggerKind[\"Invoke\"] = 1] = \"Invoke\";\n SignatureHelpTriggerKind[SignatureHelpTriggerKind[\"TriggerCharacter\"] = 2] = \"TriggerCharacter\";\n SignatureHelpTriggerKind[SignatureHelpTriggerKind[\"ContentChange\"] = 3] = \"ContentChange\";\n})(SignatureHelpTriggerKind || (SignatureHelpTriggerKind = {}));\n/**\n * A symbol kind.\n */\nexport var SymbolKind;\n(function (SymbolKind) {\n SymbolKind[SymbolKind[\"File\"] = 0] = \"File\";\n SymbolKind[SymbolKind[\"Module\"] = 1] = \"Module\";\n SymbolKind[SymbolKind[\"Namespace\"] = 2] = \"Namespace\";\n SymbolKind[SymbolKind[\"Package\"] = 3] = \"Package\";\n SymbolKind[SymbolKind[\"Class\"] = 4] = \"Class\";\n SymbolKind[SymbolKind[\"Method\"] = 5] = \"Method\";\n SymbolKind[SymbolKind[\"Property\"] = 6] = \"Property\";\n SymbolKind[SymbolKind[\"Field\"] = 7] = \"Field\";\n SymbolKind[SymbolKind[\"Constructor\"] = 8] = \"Constructor\";\n SymbolKind[SymbolKind[\"Enum\"] = 9] = \"Enum\";\n SymbolKind[SymbolKind[\"Interface\"] = 10] = \"Interface\";\n SymbolKind[SymbolKind[\"Function\"] = 11] = \"Function\";\n SymbolKind[SymbolKind[\"Variable\"] = 12] = \"Variable\";\n SymbolKind[SymbolKind[\"Constant\"] = 13] = \"Constant\";\n SymbolKind[SymbolKind[\"String\"] = 14] = \"String\";\n SymbolKind[SymbolKind[\"Number\"] = 15] = \"Number\";\n SymbolKind[SymbolKind[\"Boolean\"] = 16] = \"Boolean\";\n SymbolKind[SymbolKind[\"Array\"] = 17] = \"Array\";\n SymbolKind[SymbolKind[\"Object\"] = 18] = \"Object\";\n SymbolKind[SymbolKind[\"Key\"] = 19] = \"Key\";\n SymbolKind[SymbolKind[\"Null\"] = 20] = \"Null\";\n SymbolKind[SymbolKind[\"EnumMember\"] = 21] = \"EnumMember\";\n SymbolKind[SymbolKind[\"Struct\"] = 22] = \"Struct\";\n SymbolKind[SymbolKind[\"Event\"] = 23] = \"Event\";\n SymbolKind[SymbolKind[\"Operator\"] = 24] = \"Operator\";\n SymbolKind[SymbolKind[\"TypeParameter\"] = 25] = \"TypeParameter\";\n})(SymbolKind || (SymbolKind = {}));\nexport var SymbolTag;\n(function (SymbolTag) {\n SymbolTag[SymbolTag[\"Deprecated\"] = 1] = \"Deprecated\";\n})(SymbolTag || (SymbolTag = {}));\n/**\n * The kind of animation in which the editor's cursor should be rendered.\n */\nexport var TextEditorCursorBlinkingStyle;\n(function (TextEditorCursorBlinkingStyle) {\n /**\n * Hidden\n */\n TextEditorCursorBlinkingStyle[TextEditorCursorBlinkingStyle[\"Hidden\"] = 0] = \"Hidden\";\n /**\n * Blinking\n */\n TextEditorCursorBlinkingStyle[TextEditorCursorBlinkingStyle[\"Blink\"] = 1] = \"Blink\";\n /**\n * Blinking with smooth fading\n */\n TextEditorCursorBlinkingStyle[TextEditorCursorBlinkingStyle[\"Smooth\"] = 2] = \"Smooth\";\n /**\n * Blinking with prolonged filled state and smooth fading\n */\n TextEditorCursorBlinkingStyle[TextEditorCursorBlinkingStyle[\"Phase\"] = 3] = \"Phase\";\n /**\n * Expand collapse animation on the y axis\n */\n TextEditorCursorBlinkingStyle[TextEditorCursorBlinkingStyle[\"Expand\"] = 4] = \"Expand\";\n /**\n * No-Blinking\n */\n TextEditorCursorBlinkingStyle[TextEditorCursorBlinkingStyle[\"Solid\"] = 5] = \"Solid\";\n})(TextEditorCursorBlinkingStyle || (TextEditorCursorBlinkingStyle = {}));\n/**\n * The style in which the editor's cursor should be rendered.\n */\nexport var TextEditorCursorStyle;\n(function (TextEditorCursorStyle) {\n /**\n * As a vertical line (sitting between two characters).\n */\n TextEditorCursorStyle[TextEditorCursorStyle[\"Line\"] = 1] = \"Line\";\n /**\n * As a block (sitting on top of a character).\n */\n TextEditorCursorStyle[TextEditorCursorStyle[\"Block\"] = 2] = \"Block\";\n /**\n * As a horizontal line (sitting under a character).\n */\n TextEditorCursorStyle[TextEditorCursorStyle[\"Underline\"] = 3] = \"Underline\";\n /**\n * As a thin vertical line (sitting between two characters).\n */\n TextEditorCursorStyle[TextEditorCursorStyle[\"LineThin\"] = 4] = \"LineThin\";\n /**\n * As an outlined block (sitting on top of a character).\n */\n TextEditorCursorStyle[TextEditorCursorStyle[\"BlockOutline\"] = 5] = \"BlockOutline\";\n /**\n * As a thin horizontal line (sitting under a character).\n */\n TextEditorCursorStyle[TextEditorCursorStyle[\"UnderlineThin\"] = 6] = \"UnderlineThin\";\n})(TextEditorCursorStyle || (TextEditorCursorStyle = {}));\n/**\n * Describes the behavior of decorations when typing/editing near their edges.\n * Note: Please do not edit the values, as they very carefully match `DecorationRangeBehavior`\n */\nexport var TrackedRangeStickiness;\n(function (TrackedRangeStickiness) {\n TrackedRangeStickiness[TrackedRangeStickiness[\"AlwaysGrowsWhenTypingAtEdges\"] = 0] = \"AlwaysGrowsWhenTypingAtEdges\";\n TrackedRangeStickiness[TrackedRangeStickiness[\"NeverGrowsWhenTypingAtEdges\"] = 1] = \"NeverGrowsWhenTypingAtEdges\";\n TrackedRangeStickiness[TrackedRangeStickiness[\"GrowsOnlyWhenTypingBefore\"] = 2] = \"GrowsOnlyWhenTypingBefore\";\n TrackedRangeStickiness[TrackedRangeStickiness[\"GrowsOnlyWhenTypingAfter\"] = 3] = \"GrowsOnlyWhenTypingAfter\";\n})(TrackedRangeStickiness || (TrackedRangeStickiness = {}));\n/**\n * Describes how to indent wrapped lines.\n */\nexport var WrappingIndent;\n(function (WrappingIndent) {\n /**\n * No indentation => wrapped lines begin at column 1.\n */\n WrappingIndent[WrappingIndent[\"None\"] = 0] = \"None\";\n /**\n * Same => wrapped lines get the same indentation as the parent.\n */\n WrappingIndent[WrappingIndent[\"Same\"] = 1] = \"Same\";\n /**\n * Indent => wrapped lines get +1 indentation toward the parent.\n */\n WrappingIndent[WrappingIndent[\"Indent\"] = 2] = \"Indent\";\n /**\n * DeepIndent => wrapped lines get +2 indentation toward the parent.\n */\n WrappingIndent[WrappingIndent[\"DeepIndent\"] = 3] = \"DeepIndent\";\n})(WrappingIndent || (WrappingIndent = {}));\n", "/*---------------------------------------------------------------------------------------------\n * 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 { mainWindow } from '../../../base/browser/window.js';\nimport { Disposable, DisposableStore } from '../../../base/common/lifecycle.js';\nimport { splitLines } from '../../../base/common/strings.js';\nimport { URI } from '../../../base/common/uri.js';\nimport './standalone-tokens.css';\nimport { FontMeasurements } from '../../browser/config/fontMeasurements.js';\nimport { EditorCommand } from '../../browser/editorExtensions.js';\nimport { ICodeEditorService } from '../../browser/services/codeEditorService.js';\nimport { createWebWorker as actualCreateWebWorker } from '../../browser/services/webWorker.js';\nimport { ApplyUpdateResult, ConfigurationChangedEvent, EditorOptions } from '../../common/config/editorOptions.js';\nimport { EditorZoom } from '../../common/config/editorZoom.js';\nimport { BareFontInfo, FontInfo } from '../../common/config/fontInfo.js';\nimport { EditorType } from '../../common/editorCommon.js';\nimport * as languages from '../../common/languages.js';\nimport { ILanguageService } from '../../common/languages/language.js';\nimport { ILanguageConfigurationService } from '../../common/languages/languageConfigurationRegistry.js';\nimport { PLAINTEXT_LANGUAGE_ID } from '../../common/languages/modesRegistry.js';\nimport { NullState, nullTokenize } from '../../common/languages/nullTokenize.js';\nimport { FindMatch, TextModelResolvedOptions } from '../../common/model.js';\nimport { IModelService } from '../../common/services/model.js';\nimport * as standaloneEnums from '../../common/standalone/standaloneEnums.js';\nimport { Colorizer } from './colorizer.js';\nimport { StandaloneDiffEditor2, StandaloneEditor, createTextModel } from './standaloneCodeEditor.js';\nimport { StandaloneKeybindingService, StandaloneServices } from './standaloneServices.js';\nimport { IStandaloneThemeService } from '../common/standaloneTheme.js';\nimport { MenuId, MenuRegistry } from '../../../platform/actions/common/actions.js';\nimport { CommandsRegistry } from '../../../platform/commands/common/commands.js';\nimport { ContextKeyExpr } from '../../../platform/contextkey/common/contextkey.js';\nimport { IKeybindingService } from '../../../platform/keybinding/common/keybinding.js';\nimport { IMarkerService } from '../../../platform/markers/common/markers.js';\nimport { IOpenerService } from '../../../platform/opener/common/opener.js';\nimport { MultiDiffEditorWidget } from '../../browser/widget/multiDiffEditor/multiDiffEditorWidget.js';\n/**\n * Create a new editor under `domElement`.\n * `domElement` should be empty (not contain other dom nodes).\n * The editor will read the size of `domElement`.\n */\nexport function create(domElement, options, override) {\n const instantiationService = StandaloneServices.initialize(override || {});\n return instantiationService.createInstance(StandaloneEditor, domElement, options);\n}\n/**\n * Emitted when an editor is created.\n * Creating a diff editor might cause this listener to be invoked with the two editors.\n * @event\n */\nexport function onDidCreateEditor(listener) {\n const codeEditorService = StandaloneServices.get(ICodeEditorService);\n return codeEditorService.onCodeEditorAdd((editor) => {\n listener(editor);\n });\n}\n/**\n * Emitted when an diff editor is created.\n * @event\n */\nexport function onDidCreateDiffEditor(listener) {\n const codeEditorService = StandaloneServices.get(ICodeEditorService);\n return codeEditorService.onDiffEditorAdd((editor) => {\n listener(editor);\n });\n}\n/**\n * Get all the created editors.\n */\nexport function getEditors() {\n const codeEditorService = StandaloneServices.get(ICodeEditorService);\n return codeEditorService.listCodeEditors();\n}\n/**\n * Get all the created diff editors.\n */\nexport function getDiffEditors() {\n const codeEditorService = StandaloneServices.get(ICodeEditorService);\n return codeEditorService.listDiffEditors();\n}\n/**\n * Create a new diff editor under `domElement`.\n * `domElement` should be empty (not contain other dom nodes).\n * The editor will read the size of `domElement`.\n */\nexport function createDiffEditor(domElement, options, override) {\n const instantiationService = StandaloneServices.initialize(override || {});\n return instantiationService.createInstance(StandaloneDiffEditor2, domElement, options);\n}\nexport function createMultiFileDiffEditor(domElement, override) {\n const instantiationService = StandaloneServices.initialize(override || {});\n return new MultiDiffEditorWidget(domElement, {}, instantiationService);\n}\n/**\n * Add a command.\n */\nexport function addCommand(descriptor) {\n if ((typeof descriptor.id !== 'string') || (typeof descriptor.run !== 'function')) {\n throw new Error('Invalid command descriptor, `id` and `run` are required properties!');\n }\n return CommandsRegistry.registerCommand(descriptor.id, descriptor.run);\n}\n/**\n * Add an action to all editors.\n */\nexport function addEditorAction(descriptor) {\n if ((typeof descriptor.id !== 'string') || (typeof descriptor.label !== 'string') || (typeof descriptor.run !== 'function')) {\n throw new Error('Invalid action descriptor, `id`, `label` and `run` are required properties!');\n }\n const precondition = ContextKeyExpr.deserialize(descriptor.precondition);\n const run = (accessor, ...args) => {\n return EditorCommand.runEditorCommand(accessor, args, precondition, (accessor, editor, args) => Promise.resolve(descriptor.run(editor, ...args)));\n };\n const toDispose = new DisposableStore();\n // Register the command\n toDispose.add(CommandsRegistry.registerCommand(descriptor.id, run));\n // Register the context menu item\n if (descriptor.contextMenuGroupId) {\n const menuItem = {\n command: {\n id: descriptor.id,\n title: descriptor.label\n },\n when: precondition,\n group: descriptor.contextMenuGroupId,\n order: descriptor.contextMenuOrder || 0\n };\n toDispose.add(MenuRegistry.appendMenuItem(MenuId.EditorContext, menuItem));\n }\n // Register the keybindings\n if (Array.isArray(descriptor.keybindings)) {\n const keybindingService = StandaloneServices.get(IKeybindingService);\n if (!(keybindingService instanceof StandaloneKeybindingService)) {\n console.warn('Cannot add keybinding because the editor is configured with an unrecognized KeybindingService');\n }\n else {\n const keybindingsWhen = ContextKeyExpr.and(precondition, ContextKeyExpr.deserialize(descriptor.keybindingContext));\n toDispose.add(keybindingService.addDynamicKeybindings(descriptor.keybindings.map((keybinding) => {\n return {\n keybinding,\n command: descriptor.id,\n when: keybindingsWhen\n };\n })));\n }\n }\n return toDispose;\n}\n/**\n * Add a keybinding rule.\n */\nexport function addKeybindingRule(rule) {\n return addKeybindingRules([rule]);\n}\n/**\n * Add keybinding rules.\n */\nexport function addKeybindingRules(rules) {\n const keybindingService = StandaloneServices.get(IKeybindingService);\n if (!(keybindingService instanceof StandaloneKeybindingService)) {\n console.warn('Cannot add keybinding because the editor is configured with an unrecognized KeybindingService');\n return Disposable.None;\n }\n return keybindingService.addDynamicKeybindings(rules.map((rule) => {\n return {\n keybinding: rule.keybinding,\n command: rule.command,\n commandArgs: rule.commandArgs,\n when: ContextKeyExpr.deserialize(rule.when),\n };\n }));\n}\n/**\n * Create a new editor model.\n * You can specify the language that should be set for this model or let the language be inferred from the `uri`.\n */\nexport function createModel(value, language, uri) {\n const languageService = StandaloneServices.get(ILanguageService);\n const languageId = languageService.getLanguageIdByMimeType(language) || language;\n return createTextModel(StandaloneServices.get(IModelService), languageService, value, languageId, uri);\n}\n/**\n * Change the language for a model.\n */\nexport function setModelLanguage(model, mimeTypeOrLanguageId) {\n const languageService = StandaloneServices.get(ILanguageService);\n const languageId = languageService.getLanguageIdByMimeType(mimeTypeOrLanguageId) || mimeTypeOrLanguageId || PLAINTEXT_LANGUAGE_ID;\n model.setLanguage(languageService.createById(languageId));\n}\n/**\n * Set the markers for a model.\n */\nexport function setModelMarkers(model, owner, markers) {\n if (model) {\n const markerService = StandaloneServices.get(IMarkerService);\n markerService.changeOne(owner, model.uri, markers);\n }\n}\n/**\n * Remove all markers of an owner.\n */\nexport function removeAllMarkers(owner) {\n const markerService = StandaloneServices.get(IMarkerService);\n markerService.changeAll(owner, []);\n}\n/**\n * Get markers for owner and/or resource\n *\n * @returns list of markers\n */\nexport function getModelMarkers(filter) {\n const markerService = StandaloneServices.get(IMarkerService);\n return markerService.read(filter);\n}\n/**\n * Emitted when markers change for a model.\n * @event\n */\nexport function onDidChangeMarkers(listener) {\n const markerService = StandaloneServices.get(IMarkerService);\n return markerService.onMarkerChanged(listener);\n}\n/**\n * Get the model that has `uri` if it exists.\n */\nexport function getModel(uri) {\n const modelService = StandaloneServices.get(IModelService);\n return modelService.getModel(uri);\n}\n/**\n * Get all the created models.\n */\nexport function getModels() {\n const modelService = StandaloneServices.get(IModelService);\n return modelService.getModels();\n}\n/**\n * Emitted when a model is created.\n * @event\n */\nexport function onDidCreateModel(listener) {\n const modelService = StandaloneServices.get(IModelService);\n return modelService.onModelAdded(listener);\n}\n/**\n * Emitted right before a model is disposed.\n * @event\n */\nexport function onWillDisposeModel(listener) {\n const modelService = StandaloneServices.get(IModelService);\n return modelService.onModelRemoved(listener);\n}\n/**\n * Emitted when a different language is set to a model.\n * @event\n */\nexport function onDidChangeModelLanguage(listener) {\n const modelService = StandaloneServices.get(IModelService);\n return modelService.onModelLanguageChanged((e) => {\n listener({\n model: e.model,\n oldLanguage: e.oldLanguageId\n });\n });\n}\n/**\n * Create a new web worker that has model syncing capabilities built in.\n * Specify an AMD module to load that will `create` an object that will be proxied.\n */\nexport function createWebWorker(opts) {\n return actualCreateWebWorker(StandaloneServices.get(IModelService), StandaloneServices.get(ILanguageConfigurationService), opts);\n}\n/**\n * Colorize the contents of `domNode` using attribute `data-lang`.\n */\nexport function colorizeElement(domNode, options) {\n const languageService = StandaloneServices.get(ILanguageService);\n const themeService = StandaloneServices.get(IStandaloneThemeService);\n return Colorizer.colorizeElement(themeService, languageService, domNode, options).then(() => {\n themeService.registerEditorContainer(domNode);\n });\n}\n/**\n * Colorize `text` using language `languageId`.\n */\nexport function colorize(text, languageId, options) {\n const languageService = StandaloneServices.get(ILanguageService);\n const themeService = StandaloneServices.get(IStandaloneThemeService);\n themeService.registerEditorContainer(mainWindow.document.body);\n return Colorizer.colorize(languageService, text, languageId, options);\n}\n/**\n * Colorize a line in a model.\n */\nexport function colorizeModelLine(model, lineNumber, tabSize = 4) {\n const themeService = StandaloneServices.get(IStandaloneThemeService);\n themeService.registerEditorContainer(mainWindow.document.body);\n return Colorizer.colorizeModelLine(model, lineNumber, tabSize);\n}\n/**\n * @internal\n */\nfunction getSafeTokenizationSupport(language) {\n const tokenizationSupport = languages.TokenizationRegistry.get(language);\n if (tokenizationSupport) {\n return tokenizationSupport;\n }\n return {\n getInitialState: () => NullState,\n tokenize: (line, hasEOL, state) => nullTokenize(language, state)\n };\n}\n/**\n * Tokenize `text` using language `languageId`\n */\nexport function tokenize(text, languageId) {\n // Needed in order to get the mode registered for subsequent look-ups\n languages.TokenizationRegistry.getOrCreate(languageId);\n const tokenizationSupport = getSafeTokenizationSupport(languageId);\n const lines = splitLines(text);\n const result = [];\n let state = tokenizationSupport.getInitialState();\n for (let i = 0, len = lines.length; i < len; i++) {\n const line = lines[i];\n const tokenizationResult = tokenizationSupport.tokenize(line, true, state);\n result[i] = tokenizationResult.tokens;\n state = tokenizationResult.endState;\n }\n return result;\n}\n/**\n * Define a new theme or update an existing theme.\n */\nexport function defineTheme(themeName, themeData) {\n const standaloneThemeService = StandaloneServices.get(IStandaloneThemeService);\n standaloneThemeService.defineTheme(themeName, themeData);\n}\n/**\n * Switches to a theme.\n */\nexport function setTheme(themeName) {\n const standaloneThemeService = StandaloneServices.get(IStandaloneThemeService);\n standaloneThemeService.setTheme(themeName);\n}\n/**\n * Clears all cached font measurements and triggers re-measurement.\n */\nexport function remeasureFonts() {\n FontMeasurements.clearAllFontInfos();\n}\n/**\n * Register a command.\n */\nexport function registerCommand(id, handler) {\n return CommandsRegistry.registerCommand({ id, handler });\n}\n/**\n * Registers a handler that is called when a link is opened in any editor. The handler callback should return `true` if the link was handled and `false` otherwise.\n * The handler that was registered last will be called first when a link is opened.\n *\n * Returns a disposable that can unregister the opener again.\n */\nexport function registerLinkOpener(opener) {\n const openerService = StandaloneServices.get(IOpenerService);\n return openerService.registerOpener({\n async open(resource) {\n if (typeof resource === 'string') {\n resource = URI.parse(resource);\n }\n return opener.open(resource);\n }\n });\n}\n/**\n * Registers a handler that is called when a resource other than the current model should be opened in the editor (e.g. \"go to definition\").\n * The handler callback should return `true` if the request was handled and `false` otherwise.\n *\n * Returns a disposable that can unregister the opener again.\n *\n * If no handler is registered the default behavior is to do nothing for models other than the currently attached one.\n */\nexport function registerEditorOpener(opener) {\n const codeEditorService = StandaloneServices.get(ICodeEditorService);\n return codeEditorService.registerCodeEditorOpenHandler(async (input, source, sideBySide) => {\n var _a;\n if (!source) {\n return null;\n }\n const selection = (_a = input.options) === null || _a === void 0 ? void 0 : _a.selection;\n let selectionOrPosition;\n if (selection && typeof selection.endLineNumber === 'number' && typeof selection.endColumn === 'number') {\n selectionOrPosition = selection;\n }\n else if (selection) {\n selectionOrPosition = { lineNumber: selection.startLineNumber, column: selection.startColumn };\n }\n if (await opener.openCodeEditor(source, input.resource, selectionOrPosition)) {\n return source; // return source editor to indicate that this handler has successfully handled the opening\n }\n return null; // fallback to other registered handlers\n });\n}\n/**\n * @internal\n */\nexport function createMonacoEditorAPI() {\n return {\n // methods\n create: create,\n getEditors: getEditors,\n getDiffEditors: getDiffEditors,\n onDidCreateEditor: onDidCreateEditor,\n onDidCreateDiffEditor: onDidCreateDiffEditor,\n createDiffEditor: createDiffEditor,\n addCommand: addCommand,\n addEditorAction: addEditorAction,\n addKeybindingRule: addKeybindingRule,\n addKeybindingRules: addKeybindingRules,\n createModel: createModel,\n setModelLanguage: setModelLanguage,\n setModelMarkers: setModelMarkers,\n getModelMarkers: getModelMarkers,\n removeAllMarkers: removeAllMarkers,\n onDidChangeMarkers: onDidChangeMarkers,\n getModels: getModels,\n getModel: getModel,\n onDidCreateModel: onDidCreateModel,\n onWillDisposeModel: onWillDisposeModel,\n onDidChangeModelLanguage: onDidChangeModelLanguage,\n createWebWorker: createWebWorker,\n colorizeElement: colorizeElement,\n colorize: colorize,\n colorizeModelLine: colorizeModelLine,\n tokenize: tokenize,\n defineTheme: defineTheme,\n setTheme: setTheme,\n remeasureFonts: remeasureFonts,\n registerCommand: registerCommand,\n registerLinkOpener: registerLinkOpener,\n registerEditorOpener: registerEditorOpener,\n // enums\n AccessibilitySupport: standaloneEnums.AccessibilitySupport,\n ContentWidgetPositionPreference: standaloneEnums.ContentWidgetPositionPreference,\n CursorChangeReason: standaloneEnums.CursorChangeReason,\n DefaultEndOfLine: standaloneEnums.DefaultEndOfLine,\n EditorAutoIndentStrategy: standaloneEnums.EditorAutoIndentStrategy,\n EditorOption: standaloneEnums.EditorOption,\n EndOfLinePreference: standaloneEnums.EndOfLinePreference,\n EndOfLineSequence: standaloneEnums.EndOfLineSequence,\n MinimapPosition: standaloneEnums.MinimapPosition,\n MinimapSectionHeaderStyle: standaloneEnums.MinimapSectionHeaderStyle,\n MouseTargetType: standaloneEnums.MouseTargetType,\n OverlayWidgetPositionPreference: standaloneEnums.OverlayWidgetPositionPreference,\n OverviewRulerLane: standaloneEnums.OverviewRulerLane,\n GlyphMarginLane: standaloneEnums.GlyphMarginLane,\n RenderLineNumbersType: standaloneEnums.RenderLineNumbersType,\n RenderMinimap: standaloneEnums.RenderMinimap,\n ScrollbarVisibility: standaloneEnums.ScrollbarVisibility,\n ScrollType: standaloneEnums.ScrollType,\n TextEditorCursorBlinkingStyle: standaloneEnums.TextEditorCursorBlinkingStyle,\n TextEditorCursorStyle: standaloneEnums.TextEditorCursorStyle,\n TrackedRangeStickiness: standaloneEnums.TrackedRangeStickiness,\n WrappingIndent: standaloneEnums.WrappingIndent,\n InjectedTextCursorStops: standaloneEnums.InjectedTextCursorStops,\n PositionAffinity: standaloneEnums.PositionAffinity,\n ShowLightbulbIconMode: standaloneEnums.ShowLightbulbIconMode,\n // classes\n ConfigurationChangedEvent: ConfigurationChangedEvent,\n BareFontInfo: BareFontInfo,\n FontInfo: FontInfo,\n TextModelResolvedOptions: TextModelResolvedOptions,\n FindMatch: FindMatch,\n ApplyUpdateResult: ApplyUpdateResult,\n EditorZoom: EditorZoom,\n createMultiFileDiffEditor: createMultiFileDiffEditor,\n // vars\n EditorType: EditorType,\n EditorOptions: EditorOptions\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 *--------------------------------------------------------------------------------------------*/\nimport { getWindowId } from '../../../base/browser/dom.js';\nimport { PixelRatio } from '../../../base/browser/pixelRatio.js';\nimport { Emitter } from '../../../base/common/event.js';\nimport { Disposable } from '../../../base/common/lifecycle.js';\nimport { CharWidthRequest, readCharWidths } from './charWidthReader.js';\nimport { EditorFontLigatures } from '../../common/config/editorOptions.js';\nimport { FontInfo } from '../../common/config/fontInfo.js';\nexport class FontMeasurementsImpl extends Disposable {\n constructor() {\n super(...arguments);\n this._cache = new Map();\n this._evictUntrustedReadingsTimeout = -1;\n this._onDidChange = this._register(new Emitter());\n this.onDidChange = this._onDidChange.event;\n }\n dispose() {\n if (this._evictUntrustedReadingsTimeout !== -1) {\n clearTimeout(this._evictUntrustedReadingsTimeout);\n this._evictUntrustedReadingsTimeout = -1;\n }\n super.dispose();\n }\n /**\n * Clear all cached font information and trigger a change event.\n */\n clearAllFontInfos() {\n this._cache.clear();\n this._onDidChange.fire();\n }\n _ensureCache(targetWindow) {\n const windowId = getWindowId(targetWindow);\n let cache = this._cache.get(windowId);\n if (!cache) {\n cache = new FontMeasurementsCache();\n this._cache.set(windowId, cache);\n }\n return cache;\n }\n _writeToCache(targetWindow, item, value) {\n const cache = this._ensureCache(targetWindow);\n cache.put(item, value);\n if (!value.isTrusted && this._evictUntrustedReadingsTimeout === -1) {\n // Try reading again after some time\n this._evictUntrustedReadingsTimeout = targetWindow.setTimeout(() => {\n this._evictUntrustedReadingsTimeout = -1;\n this._evictUntrustedReadings(targetWindow);\n }, 5000);\n }\n }\n _evictUntrustedReadings(targetWindow) {\n const cache = this._ensureCache(targetWindow);\n const values = cache.getValues();\n let somethingRemoved = false;\n for (const item of values) {\n if (!item.isTrusted) {\n somethingRemoved = true;\n cache.remove(item);\n }\n }\n if (somethingRemoved) {\n this._onDidChange.fire();\n }\n }\n /**\n * Read font information.\n */\n readFontInfo(targetWindow, bareFontInfo) {\n const cache = this._ensureCache(targetWindow);\n if (!cache.has(bareFontInfo)) {\n let readConfig = this._actualReadFontInfo(targetWindow, bareFontInfo);\n if (readConfig.typicalHalfwidthCharacterWidth <= 2 || readConfig.typicalFullwidthCharacterWidth <= 2 || readConfig.spaceWidth <= 2 || readConfig.maxDigitWidth <= 2) {\n // Hey, it's Bug 14341 ... we couldn't read\n readConfig = new FontInfo({\n pixelRatio: PixelRatio.getInstance(targetWindow).value,\n fontFamily: readConfig.fontFamily,\n fontWeight: readConfig.fontWeight,\n fontSize: readConfig.fontSize,\n fontFeatureSettings: readConfig.fontFeatureSettings,\n fontVariationSettings: readConfig.fontVariationSettings,\n lineHeight: readConfig.lineHeight,\n letterSpacing: readConfig.letterSpacing,\n isMonospace: readConfig.isMonospace,\n typicalHalfwidthCharacterWidth: Math.max(readConfig.typicalHalfwidthCharacterWidth, 5),\n typicalFullwidthCharacterWidth: Math.max(readConfig.typicalFullwidthCharacterWidth, 5),\n canUseHalfwidthRightwardsArrow: readConfig.canUseHalfwidthRightwardsArrow,\n spaceWidth: Math.max(readConfig.spaceWidth, 5),\n middotWidth: Math.max(readConfig.middotWidth, 5),\n wsmiddotWidth: Math.max(readConfig.wsmiddotWidth, 5),\n maxDigitWidth: Math.max(readConfig.maxDigitWidth, 5),\n }, false);\n }\n this._writeToCache(targetWindow, bareFontInfo, readConfig);\n }\n return cache.get(bareFontInfo);\n }\n _createRequest(chr, type, all, monospace) {\n const result = new CharWidthRequest(chr, type);\n all.push(result);\n monospace === null || monospace === void 0 ? void 0 : monospace.push(result);\n return result;\n }\n _actualReadFontInfo(targetWindow, bareFontInfo) {\n const all = [];\n const monospace = [];\n const typicalHalfwidthCharacter = this._createRequest('n', 0 /* CharWidthRequestType.Regular */, all, monospace);\n const typicalFullwidthCharacter = this._createRequest('\\uff4d', 0 /* CharWidthRequestType.Regular */, all, null);\n const space = this._createRequest(' ', 0 /* CharWidthRequestType.Regular */, all, monospace);\n const digit0 = this._createRequest('0', 0 /* CharWidthRequestType.Regular */, all, monospace);\n const digit1 = this._createRequest('1', 0 /* CharWidthRequestType.Regular */, all, monospace);\n const digit2 = this._createRequest('2', 0 /* CharWidthRequestType.Regular */, all, monospace);\n const digit3 = this._createRequest('3', 0 /* CharWidthRequestType.Regular */, all, monospace);\n const digit4 = this._createRequest('4', 0 /* CharWidthRequestType.Regular */, all, monospace);\n const digit5 = this._createRequest('5', 0 /* CharWidthRequestType.Regular */, all, monospace);\n const digit6 = this._createRequest('6', 0 /* CharWidthRequestType.Regular */, all, monospace);\n const digit7 = this._createRequest('7', 0 /* CharWidthRequestType.Regular */, all, monospace);\n const digit8 = this._createRequest('8', 0 /* CharWidthRequestType.Regular */, all, monospace);\n const digit9 = this._createRequest('9', 0 /* CharWidthRequestType.Regular */, all, monospace);\n // monospace test: used for whitespace rendering\n const rightwardsArrow = this._createRequest('\u2192', 0 /* CharWidthRequestType.Regular */, all, monospace);\n const halfwidthRightwardsArrow = this._createRequest('\uFFEB', 0 /* CharWidthRequestType.Regular */, all, null);\n // U+00B7 - MIDDLE DOT\n const middot = this._createRequest('\u00B7', 0 /* CharWidthRequestType.Regular */, all, monospace);\n // U+2E31 - WORD SEPARATOR MIDDLE DOT\n const wsmiddotWidth = this._createRequest(String.fromCharCode(0x2E31), 0 /* CharWidthRequestType.Regular */, all, null);\n // monospace test: some characters\n const monospaceTestChars = '|/-_ilm%';\n for (let i = 0, len = monospaceTestChars.length; i < len; i++) {\n this._createRequest(monospaceTestChars.charAt(i), 0 /* CharWidthRequestType.Regular */, all, monospace);\n this._createRequest(monospaceTestChars.charAt(i), 1 /* CharWidthRequestType.Italic */, all, monospace);\n this._createRequest(monospaceTestChars.charAt(i), 2 /* CharWidthRequestType.Bold */, all, monospace);\n }\n readCharWidths(targetWindow, bareFontInfo, all);\n const maxDigitWidth = Math.max(digit0.width, digit1.width, digit2.width, digit3.width, digit4.width, digit5.width, digit6.width, digit7.width, digit8.width, digit9.width);\n let isMonospace = (bareFontInfo.fontFeatureSettings === EditorFontLigatures.OFF);\n const referenceWidth = monospace[0].width;\n for (let i = 1, len = monospace.length; isMonospace && i < len; i++) {\n const diff = referenceWidth - monospace[i].width;\n if (diff < -0.001 || diff > 0.001) {\n isMonospace = false;\n break;\n }\n }\n let canUseHalfwidthRightwardsArrow = true;\n if (isMonospace && halfwidthRightwardsArrow.width !== referenceWidth) {\n // using a halfwidth rightwards arrow would break monospace...\n canUseHalfwidthRightwardsArrow = false;\n }\n if (halfwidthRightwardsArrow.width > rightwardsArrow.width) {\n // using a halfwidth rightwards arrow would paint a larger arrow than a regular rightwards arrow\n canUseHalfwidthRightwardsArrow = false;\n }\n return new FontInfo({\n pixelRatio: PixelRatio.getInstance(targetWindow).value,\n fontFamily: bareFontInfo.fontFamily,\n fontWeight: bareFontInfo.fontWeight,\n fontSize: bareFontInfo.fontSize,\n fontFeatureSettings: bareFontInfo.fontFeatureSettings,\n fontVariationSettings: bareFontInfo.fontVariationSettings,\n lineHeight: bareFontInfo.lineHeight,\n letterSpacing: bareFontInfo.letterSpacing,\n isMonospace: isMonospace,\n typicalHalfwidthCharacterWidth: typicalHalfwidthCharacter.width,\n typicalFullwidthCharacterWidth: typicalFullwidthCharacter.width,\n canUseHalfwidthRightwardsArrow: canUseHalfwidthRightwardsArrow,\n spaceWidth: space.width,\n middotWidth: middot.width,\n wsmiddotWidth: wsmiddotWidth.width,\n maxDigitWidth: maxDigitWidth\n }, true);\n }\n}\nclass FontMeasurementsCache {\n constructor() {\n this._keys = Object.create(null);\n this._values = Object.create(null);\n }\n has(item) {\n const itemId = item.getId();\n return !!this._values[itemId];\n }\n get(item) {\n const itemId = item.getId();\n return this._values[itemId];\n }\n put(item, value) {\n const itemId = item.getId();\n this._keys[itemId] = item;\n this._values[itemId] = value;\n }\n remove(item) {\n const itemId = item.getId();\n delete this._keys[itemId];\n delete this._values[itemId];\n }\n getValues() {\n return Object.keys(this._keys).map(id => this._values[id]);\n }\n}\nexport const FontMeasurements = new FontMeasurementsImpl();\n", "/*---------------------------------------------------------------------------------------------\n * 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 { getWindowId, onDidUnregisterWindow } from './dom.js';\nimport { Emitter, Event } from '../common/event.js';\nimport { Disposable, markAsSingleton } from '../common/lifecycle.js';\n/**\n * See https://developer.mozilla.org/en-US/docs/Web/API/Window/devicePixelRatio#monitoring_screen_resolution_or_zoom_level_changes\n */\nclass DevicePixelRatioMonitor extends Disposable {\n constructor(targetWindow) {\n super();\n this._onDidChange = this._register(new Emitter());\n this.onDidChange = this._onDidChange.event;\n this._listener = () => this._handleChange(targetWindow, true);\n this._mediaQueryList = null;\n this._handleChange(targetWindow, false);\n }\n _handleChange(targetWindow, fireEvent) {\n var _a;\n (_a = this._mediaQueryList) === null || _a === void 0 ? void 0 : _a.removeEventListener('change', this._listener);\n this._mediaQueryList = targetWindow.matchMedia(`(resolution: ${targetWindow.devicePixelRatio}dppx)`);\n this._mediaQueryList.addEventListener('change', this._listener);\n if (fireEvent) {\n this._onDidChange.fire();\n }\n }\n}\nclass PixelRatioMonitorImpl extends Disposable {\n get value() {\n return this._value;\n }\n constructor(targetWindow) {\n super();\n this._onDidChange = this._register(new Emitter());\n this.onDidChange = this._onDidChange.event;\n this._value = this._getPixelRatio(targetWindow);\n const dprMonitor = this._register(new DevicePixelRatioMonitor(targetWindow));\n this._register(dprMonitor.onDidChange(() => {\n this._value = this._getPixelRatio(targetWindow);\n this._onDidChange.fire(this._value);\n }));\n }\n _getPixelRatio(targetWindow) {\n const ctx = document.createElement('canvas').getContext('2d');\n const dpr = targetWindow.devicePixelRatio || 1;\n const bsr = ctx.webkitBackingStorePixelRatio ||\n ctx.mozBackingStorePixelRatio ||\n ctx.msBackingStorePixelRatio ||\n ctx.oBackingStorePixelRatio ||\n ctx.backingStorePixelRatio || 1;\n return dpr / bsr;\n }\n}\nclass PixelRatioMonitorFacade {\n constructor() {\n this.mapWindowIdToPixelRatioMonitor = new Map();\n }\n _getOrCreatePixelRatioMonitor(targetWindow) {\n const targetWindowId = getWindowId(targetWindow);\n let pixelRatioMonitor = this.mapWindowIdToPixelRatioMonitor.get(targetWindowId);\n if (!pixelRatioMonitor) {\n pixelRatioMonitor = markAsSingleton(new PixelRatioMonitorImpl(targetWindow));\n this.mapWindowIdToPixelRatioMonitor.set(targetWindowId, pixelRatioMonitor);\n markAsSingleton(Event.once(onDidUnregisterWindow)(({ vscodeWindowId }) => {\n if (vscodeWindowId === targetWindowId) {\n pixelRatioMonitor === null || pixelRatioMonitor === void 0 ? void 0 : pixelRatioMonitor.dispose();\n this.mapWindowIdToPixelRatioMonitor.delete(targetWindowId);\n }\n }));\n }\n return pixelRatioMonitor;\n }\n getInstance(targetWindow) {\n return this._getOrCreatePixelRatioMonitor(targetWindow);\n }\n}\n/**\n * Returns the pixel ratio.\n *\n * This is useful for rendering elements at native screen resolution or for being used as\n * a cache key when storing font measurements. Fonts might render differently depending on resolution\n * and any measurements need to be discarded for example when a window is moved from a monitor to another.\n */\nexport const PixelRatio = new PixelRatioMonitorFacade();\n", "/*---------------------------------------------------------------------------------------------\n * 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 { applyFontInfo } from './domFontInfo.js';\nexport class CharWidthRequest {\n constructor(chr, type) {\n this.chr = chr;\n this.type = type;\n this.width = 0;\n }\n fulfill(width) {\n this.width = width;\n }\n}\nclass DomCharWidthReader {\n constructor(bareFontInfo, requests) {\n this._bareFontInfo = bareFontInfo;\n this._requests = requests;\n this._container = null;\n this._testElements = null;\n }\n read(targetWindow) {\n // Create a test container with all these test elements\n this._createDomElements();\n // Add the container to the DOM\n targetWindow.document.body.appendChild(this._container);\n // Read character widths\n this._readFromDomElements();\n // Remove the container from the DOM\n targetWindow.document.body.removeChild(this._container);\n this._container = null;\n this._testElements = null;\n }\n _createDomElements() {\n const container = document.createElement('div');\n container.style.position = 'absolute';\n container.style.top = '-50000px';\n container.style.width = '50000px';\n const regularDomNode = document.createElement('div');\n applyFontInfo(regularDomNode, this._bareFontInfo);\n container.appendChild(regularDomNode);\n const boldDomNode = document.createElement('div');\n applyFontInfo(boldDomNode, this._bareFontInfo);\n boldDomNode.style.fontWeight = 'bold';\n container.appendChild(boldDomNode);\n const italicDomNode = document.createElement('div');\n applyFontInfo(italicDomNode, this._bareFontInfo);\n italicDomNode.style.fontStyle = 'italic';\n container.appendChild(italicDomNode);\n const testElements = [];\n for (const request of this._requests) {\n let parent;\n if (request.type === 0 /* CharWidthRequestType.Regular */) {\n parent = regularDomNode;\n }\n if (request.type === 2 /* CharWidthRequestType.Bold */) {\n parent = boldDomNode;\n }\n if (request.type === 1 /* CharWidthRequestType.Italic */) {\n parent = italicDomNode;\n }\n parent.appendChild(document.createElement('br'));\n const testElement = document.createElement('span');\n DomCharWidthReader._render(testElement, request);\n parent.appendChild(testElement);\n testElements.push(testElement);\n }\n this._container = container;\n this._testElements = testElements;\n }\n static _render(testElement, request) {\n if (request.chr === ' ') {\n let htmlString = '\\u00a0';\n // Repeat character 256 (2^8) times\n for (let i = 0; i < 8; i++) {\n htmlString += htmlString;\n }\n testElement.innerText = htmlString;\n }\n else {\n let testString = request.chr;\n // Repeat character 256 (2^8) times\n for (let i = 0; i < 8; i++) {\n testString += testString;\n }\n testElement.textContent = testString;\n }\n }\n _readFromDomElements() {\n for (let i = 0, len = this._requests.length; i < len; i++) {\n const request = this._requests[i];\n const testElement = this._testElements[i];\n request.fulfill(testElement.offsetWidth / 256);\n }\n }\n}\nexport function readCharWidths(targetWindow, bareFontInfo, requests) {\n const reader = new DomCharWidthReader(bareFontInfo, requests);\n reader.read(targetWindow);\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 { FastDomNode } from '../../../base/browser/fastDomNode.js';\nexport function applyFontInfo(domNode, fontInfo) {\n if (domNode instanceof FastDomNode) {\n domNode.setFontFamily(fontInfo.getMassagedFontFamily());\n domNode.setFontWeight(fontInfo.fontWeight);\n domNode.setFontSize(fontInfo.fontSize);\n domNode.setFontFeatureSettings(fontInfo.fontFeatureSettings);\n domNode.setFontVariationSettings(fontInfo.fontVariationSettings);\n domNode.setLineHeight(fontInfo.lineHeight);\n domNode.setLetterSpacing(fontInfo.letterSpacing);\n }\n else {\n domNode.style.fontFamily = fontInfo.getMassagedFontFamily();\n domNode.style.fontWeight = fontInfo.fontWeight;\n domNode.style.fontSize = fontInfo.fontSize + 'px';\n domNode.style.fontFeatureSettings = fontInfo.fontFeatureSettings;\n domNode.style.fontVariationSettings = fontInfo.fontVariationSettings;\n domNode.style.lineHeight = fontInfo.lineHeight + 'px';\n domNode.style.letterSpacing = fontInfo.letterSpacing + 'px';\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 *--------------------------------------------------------------------------------------------*/\nexport class FastDomNode {\n constructor(domNode) {\n this.domNode = domNode;\n this._maxWidth = '';\n this._width = '';\n this._height = '';\n this._top = '';\n this._left = '';\n this._bottom = '';\n this._right = '';\n this._paddingLeft = '';\n this._fontFamily = '';\n this._fontWeight = '';\n this._fontSize = '';\n this._fontStyle = '';\n this._fontFeatureSettings = '';\n this._fontVariationSettings = '';\n this._textDecoration = '';\n this._lineHeight = '';\n this._letterSpacing = '';\n this._className = '';\n this._display = '';\n this._position = '';\n this._visibility = '';\n this._color = '';\n this._backgroundColor = '';\n this._layerHint = false;\n this._contain = 'none';\n this._boxShadow = '';\n }\n setMaxWidth(_maxWidth) {\n const maxWidth = numberAsPixels(_maxWidth);\n if (this._maxWidth === maxWidth) {\n return;\n }\n this._maxWidth = maxWidth;\n this.domNode.style.maxWidth = this._maxWidth;\n }\n setWidth(_width) {\n const width = numberAsPixels(_width);\n if (this._width === width) {\n return;\n }\n this._width = width;\n this.domNode.style.width = this._width;\n }\n setHeight(_height) {\n const height = numberAsPixels(_height);\n if (this._height === height) {\n return;\n }\n this._height = height;\n this.domNode.style.height = this._height;\n }\n setTop(_top) {\n const top = numberAsPixels(_top);\n if (this._top === top) {\n return;\n }\n this._top = top;\n this.domNode.style.top = this._top;\n }\n setLeft(_left) {\n const left = numberAsPixels(_left);\n if (this._left === left) {\n return;\n }\n this._left = left;\n this.domNode.style.left = this._left;\n }\n setBottom(_bottom) {\n const bottom = numberAsPixels(_bottom);\n if (this._bottom === bottom) {\n return;\n }\n this._bottom = bottom;\n this.domNode.style.bottom = this._bottom;\n }\n setRight(_right) {\n const right = numberAsPixels(_right);\n if (this._right === right) {\n return;\n }\n this._right = right;\n this.domNode.style.right = this._right;\n }\n setPaddingLeft(_paddingLeft) {\n const paddingLeft = numberAsPixels(_paddingLeft);\n if (this._paddingLeft === paddingLeft) {\n return;\n }\n this._paddingLeft = paddingLeft;\n this.domNode.style.paddingLeft = this._paddingLeft;\n }\n setFontFamily(fontFamily) {\n if (this._fontFamily === fontFamily) {\n return;\n }\n this._fontFamily = fontFamily;\n this.domNode.style.fontFamily = this._fontFamily;\n }\n setFontWeight(fontWeight) {\n if (this._fontWeight === fontWeight) {\n return;\n }\n this._fontWeight = fontWeight;\n this.domNode.style.fontWeight = this._fontWeight;\n }\n setFontSize(_fontSize) {\n const fontSize = numberAsPixels(_fontSize);\n if (this._fontSize === fontSize) {\n return;\n }\n this._fontSize = fontSize;\n this.domNode.style.fontSize = this._fontSize;\n }\n setFontStyle(fontStyle) {\n if (this._fontStyle === fontStyle) {\n return;\n }\n this._fontStyle = fontStyle;\n this.domNode.style.fontStyle = this._fontStyle;\n }\n setFontFeatureSettings(fontFeatureSettings) {\n if (this._fontFeatureSettings === fontFeatureSettings) {\n return;\n }\n this._fontFeatureSettings = fontFeatureSettings;\n this.domNode.style.fontFeatureSettings = this._fontFeatureSettings;\n }\n setFontVariationSettings(fontVariationSettings) {\n if (this._fontVariationSettings === fontVariationSettings) {\n return;\n }\n this._fontVariationSettings = fontVariationSettings;\n this.domNode.style.fontVariationSettings = this._fontVariationSettings;\n }\n setTextDecoration(textDecoration) {\n if (this._textDecoration === textDecoration) {\n return;\n }\n this._textDecoration = textDecoration;\n this.domNode.style.textDecoration = this._textDecoration;\n }\n setLineHeight(_lineHeight) {\n const lineHeight = numberAsPixels(_lineHeight);\n if (this._lineHeight === lineHeight) {\n return;\n }\n this._lineHeight = lineHeight;\n this.domNode.style.lineHeight = this._lineHeight;\n }\n setLetterSpacing(_letterSpacing) {\n const letterSpacing = numberAsPixels(_letterSpacing);\n if (this._letterSpacing === letterSpacing) {\n return;\n }\n this._letterSpacing = letterSpacing;\n this.domNode.style.letterSpacing = this._letterSpacing;\n }\n setClassName(className) {\n if (this._className === className) {\n return;\n }\n this._className = className;\n this.domNode.className = this._className;\n }\n toggleClassName(className, shouldHaveIt) {\n this.domNode.classList.toggle(className, shouldHaveIt);\n this._className = this.domNode.className;\n }\n setDisplay(display) {\n if (this._display === display) {\n return;\n }\n this._display = display;\n this.domNode.style.display = this._display;\n }\n setPosition(position) {\n if (this._position === position) {\n return;\n }\n this._position = position;\n this.domNode.style.position = this._position;\n }\n setVisibility(visibility) {\n if (this._visibility === visibility) {\n return;\n }\n this._visibility = visibility;\n this.domNode.style.visibility = this._visibility;\n }\n setColor(color) {\n if (this._color === color) {\n return;\n }\n this._color = color;\n this.domNode.style.color = this._color;\n }\n setBackgroundColor(backgroundColor) {\n if (this._backgroundColor === backgroundColor) {\n return;\n }\n this._backgroundColor = backgroundColor;\n this.domNode.style.backgroundColor = this._backgroundColor;\n }\n setLayerHinting(layerHint) {\n if (this._layerHint === layerHint) {\n return;\n }\n this._layerHint = layerHint;\n this.domNode.style.transform = this._layerHint ? 'translate3d(0px, 0px, 0px)' : '';\n }\n setBoxShadow(boxShadow) {\n if (this._boxShadow === boxShadow) {\n return;\n }\n this._boxShadow = boxShadow;\n this.domNode.style.boxShadow = boxShadow;\n }\n setContain(contain) {\n if (this._contain === contain) {\n return;\n }\n this._contain = contain;\n this.domNode.style.contain = this._contain;\n }\n setAttribute(name, value) {\n this.domNode.setAttribute(name, value);\n }\n removeAttribute(name) {\n this.domNode.removeAttribute(name);\n }\n appendChild(child) {\n this.domNode.appendChild(child.domNode);\n }\n removeChild(child) {\n this.domNode.removeChild(child.domNode);\n }\n}\nfunction numberAsPixels(value) {\n return (typeof value === 'number' ? `${value}px` : value);\n}\nexport function createFastDomNode(domNode) {\n return new FastDomNode(domNode);\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 * as platform from '../../../base/common/platform.js';\nimport { EditorFontVariations, EDITOR_FONT_DEFAULTS } from './editorOptions.js';\nimport { EditorZoom } from './editorZoom.js';\n/**\n * Determined from empirical observations.\n * @internal\n */\nconst GOLDEN_LINE_HEIGHT_RATIO = platform.isMacintosh ? 1.5 : 1.35;\n/**\n * @internal\n */\nconst MINIMUM_LINE_HEIGHT = 8;\nexport class BareFontInfo {\n /**\n * @internal\n */\n static createFromValidatedSettings(options, pixelRatio, ignoreEditorZoom) {\n const fontFamily = options.get(49 /* EditorOption.fontFamily */);\n const fontWeight = options.get(53 /* EditorOption.fontWeight */);\n const fontSize = options.get(52 /* EditorOption.fontSize */);\n const fontFeatureSettings = options.get(51 /* EditorOption.fontLigatures */);\n const fontVariationSettings = options.get(54 /* EditorOption.fontVariations */);\n const lineHeight = options.get(67 /* EditorOption.lineHeight */);\n const letterSpacing = options.get(64 /* EditorOption.letterSpacing */);\n return BareFontInfo._create(fontFamily, fontWeight, fontSize, fontFeatureSettings, fontVariationSettings, lineHeight, letterSpacing, pixelRatio, ignoreEditorZoom);\n }\n /**\n * @internal\n */\n static _create(fontFamily, fontWeight, fontSize, fontFeatureSettings, fontVariationSettings, lineHeight, letterSpacing, pixelRatio, ignoreEditorZoom) {\n if (lineHeight === 0) {\n lineHeight = GOLDEN_LINE_HEIGHT_RATIO * fontSize;\n }\n else if (lineHeight < MINIMUM_LINE_HEIGHT) {\n // Values too small to be line heights in pixels are in ems.\n lineHeight = lineHeight * fontSize;\n }\n // Enforce integer, minimum constraints\n lineHeight = Math.round(lineHeight);\n if (lineHeight < MINIMUM_LINE_HEIGHT) {\n lineHeight = MINIMUM_LINE_HEIGHT;\n }\n const editorZoomLevelMultiplier = 1 + (ignoreEditorZoom ? 0 : EditorZoom.getZoomLevel() * 0.1);\n fontSize *= editorZoomLevelMultiplier;\n lineHeight *= editorZoomLevelMultiplier;\n if (fontVariationSettings === EditorFontVariations.TRANSLATE) {\n if (fontWeight === 'normal' || fontWeight === 'bold') {\n fontVariationSettings = EditorFontVariations.OFF;\n }\n else {\n const fontWeightAsNumber = parseInt(fontWeight, 10);\n fontVariationSettings = `'wght' ${fontWeightAsNumber}`;\n fontWeight = 'normal';\n }\n }\n return new BareFontInfo({\n pixelRatio: pixelRatio,\n fontFamily: fontFamily,\n fontWeight: fontWeight,\n fontSize: fontSize,\n fontFeatureSettings: fontFeatureSettings,\n fontVariationSettings,\n lineHeight: lineHeight,\n letterSpacing: letterSpacing\n });\n }\n /**\n * @internal\n */\n constructor(opts) {\n this._bareFontInfoBrand = undefined;\n this.pixelRatio = opts.pixelRatio;\n this.fontFamily = String(opts.fontFamily);\n this.fontWeight = String(opts.fontWeight);\n this.fontSize = opts.fontSize;\n this.fontFeatureSettings = opts.fontFeatureSettings;\n this.fontVariationSettings = opts.fontVariationSettings;\n this.lineHeight = opts.lineHeight | 0;\n this.letterSpacing = opts.letterSpacing;\n }\n /**\n * @internal\n */\n getId() {\n return `${this.pixelRatio}-${this.fontFamily}-${this.fontWeight}-${this.fontSize}-${this.fontFeatureSettings}-${this.fontVariationSettings}-${this.lineHeight}-${this.letterSpacing}`;\n }\n /**\n * @internal\n */\n getMassagedFontFamily() {\n const fallbackFontFamily = EDITOR_FONT_DEFAULTS.fontFamily;\n const fontFamily = BareFontInfo._wrapInQuotes(this.fontFamily);\n if (fallbackFontFamily && this.fontFamily !== fallbackFontFamily) {\n return `${fontFamily}, ${fallbackFontFamily}`;\n }\n return fontFamily;\n }\n static _wrapInQuotes(fontFamily) {\n if (/[,\"']/.test(fontFamily)) {\n // Looks like the font family might be already escaped\n return fontFamily;\n }\n if (/[+ ]/.test(fontFamily)) {\n // Wrap a font family using + or with quotes\n return `\"${fontFamily}\"`;\n }\n return fontFamily;\n }\n}\n// change this whenever `FontInfo` members are changed\nexport const SERIALIZED_FONT_INFO_VERSION = 2;\nexport class FontInfo extends BareFontInfo {\n /**\n * @internal\n */\n constructor(opts, isTrusted) {\n super(opts);\n this._editorStylingBrand = undefined;\n this.version = SERIALIZED_FONT_INFO_VERSION;\n this.isTrusted = isTrusted;\n this.isMonospace = opts.isMonospace;\n this.typicalHalfwidthCharacterWidth = opts.typicalHalfwidthCharacterWidth;\n this.typicalFullwidthCharacterWidth = opts.typicalFullwidthCharacterWidth;\n this.canUseHalfwidthRightwardsArrow = opts.canUseHalfwidthRightwardsArrow;\n this.spaceWidth = opts.spaceWidth;\n this.middotWidth = opts.middotWidth;\n this.wsmiddotWidth = opts.wsmiddotWidth;\n this.maxDigitWidth = opts.maxDigitWidth;\n }\n /**\n * @internal\n */\n equals(other) {\n return (this.fontFamily === other.fontFamily\n && this.fontWeight === other.fontWeight\n && this.fontSize === other.fontSize\n && this.fontFeatureSettings === other.fontFeatureSettings\n && this.fontVariationSettings === other.fontVariationSettings\n && this.lineHeight === other.lineHeight\n && this.letterSpacing === other.letterSpacing\n && this.typicalHalfwidthCharacterWidth === other.typicalHalfwidthCharacterWidth\n && this.typicalFullwidthCharacterWidth === other.typicalFullwidthCharacterWidth\n && this.canUseHalfwidthRightwardsArrow === other.canUseHalfwidthRightwardsArrow\n && this.spaceWidth === other.spaceWidth\n && this.middotWidth === other.middotWidth\n && this.wsmiddotWidth === other.wsmiddotWidth\n && this.maxDigitWidth === other.maxDigitWidth);\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 *--------------------------------------------------------------------------------------------*/\nimport { Emitter } from '../../../base/common/event.js';\nexport const EditorZoom = new class {\n constructor() {\n this._zoomLevel = 0;\n this._onDidChangeZoomLevel = new Emitter();\n this.onDidChangeZoomLevel = this._onDidChangeZoomLevel.event;\n }\n getZoomLevel() {\n return this._zoomLevel;\n }\n setZoomLevel(zoomLevel) {\n zoomLevel = Math.min(Math.max(-5, zoomLevel), 20);\n if (this._zoomLevel === zoomLevel) {\n return;\n }\n this._zoomLevel = zoomLevel;\n this._onDidChangeZoomLevel.fire(this._zoomLevel);\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 *--------------------------------------------------------------------------------------------*/\nimport { getAllMethodNames } from '../../../base/common/objects.js';\nimport { EditorWorkerClient } from './editorWorkerService.js';\n/**\n * Create a new web worker that has model syncing capabilities built in.\n * Specify an AMD module to load that will `create` an object that will be proxied.\n */\nexport function createWebWorker(modelService, languageConfigurationService, opts) {\n return new MonacoWebWorkerImpl(modelService, languageConfigurationService, opts);\n}\nclass MonacoWebWorkerImpl extends EditorWorkerClient {\n constructor(modelService, languageConfigurationService, opts) {\n super(modelService, opts.keepIdleModels || false, opts.label, languageConfigurationService);\n this._foreignModuleId = opts.moduleId;\n this._foreignModuleCreateData = opts.createData || null;\n this._foreignModuleHost = opts.host || null;\n this._foreignProxy = null;\n }\n // foreign host request\n fhr(method, args) {\n if (!this._foreignModuleHost || typeof this._foreignModuleHost[method] !== 'function') {\n return Promise.reject(new Error('Missing method ' + method + ' or missing main thread foreign host.'));\n }\n try {\n return Promise.resolve(this._foreignModuleHost[method].apply(this._foreignModuleHost, args));\n }\n catch (e) {\n return Promise.reject(e);\n }\n }\n _getForeignProxy() {\n if (!this._foreignProxy) {\n this._foreignProxy = this._getProxy().then((proxy) => {\n const foreignHostMethods = this._foreignModuleHost ? getAllMethodNames(this._foreignModuleHost) : [];\n return proxy.loadForeignModule(this._foreignModuleId, this._foreignModuleCreateData, foreignHostMethods).then((foreignMethods) => {\n this._foreignModuleCreateData = null;\n const proxyMethodRequest = (method, args) => {\n return proxy.fmr(method, args);\n };\n const createProxyMethod = (method, proxyMethodRequest) => {\n return function () {\n const args = Array.prototype.slice.call(arguments, 0);\n return proxyMethodRequest(method, args);\n };\n };\n const foreignProxy = {};\n for (const foreignMethod of foreignMethods) {\n foreignProxy[foreignMethod] = createProxyMethod(foreignMethod, proxyMethodRequest);\n }\n return foreignProxy;\n });\n });\n }\n return this._foreignProxy;\n }\n getProxy() {\n return this._getForeignProxy();\n }\n withSyncedResources(resources) {\n return this._withSyncedResources(resources).then(_ => this.getProxy());\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 *--------------------------------------------------------------------------------------------*/\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};\nimport { IntervalTimer, timeout } from '../../../base/common/async.js';\nimport { Disposable, dispose, toDisposable, DisposableStore } from '../../../base/common/lifecycle.js';\nimport { SimpleWorkerClient, logOnceWebWorkerWarning } from '../../../base/common/worker/simpleWorker.js';\nimport { DefaultWorkerFactory } from '../../../base/browser/defaultWorkerFactory.js';\nimport { Range } from '../../common/core/range.js';\nimport { ILanguageConfigurationService } from '../../common/languages/languageConfigurationRegistry.js';\nimport { EditorSimpleWorker } from '../../common/services/editorSimpleWorker.js';\nimport { IModelService } from '../../common/services/model.js';\nimport { ITextResourceConfigurationService } from '../../common/services/textResourceConfiguration.js';\nimport { isNonEmptyArray } from '../../../base/common/arrays.js';\nimport { ILogService } from '../../../platform/log/common/log.js';\nimport { StopWatch } from '../../../base/common/stopwatch.js';\nimport { canceled } from '../../../base/common/errors.js';\nimport { ILanguageFeaturesService } from '../../common/services/languageFeatures.js';\nimport { MovedText } from '../../common/diff/linesDiffComputer.js';\nimport { DetailedLineRangeMapping, RangeMapping, LineRangeMapping } from '../../common/diff/rangeMapping.js';\nimport { LineRange } from '../../common/core/lineRange.js';\nimport { mainWindow } from '../../../base/browser/window.js';\nimport { WindowIntervalTimer } from '../../../base/browser/dom.js';\n/**\n * Stop syncing a model to the worker if it was not needed for 1 min.\n */\nconst STOP_SYNC_MODEL_DELTA_TIME_MS = 60 * 1000;\n/**\n * Stop the worker if it was not needed for 5 min.\n */\nconst STOP_WORKER_DELTA_TIME_MS = 5 * 60 * 1000;\nfunction canSyncModel(modelService, resource) {\n const model = modelService.getModel(resource);\n if (!model) {\n return false;\n }\n if (model.isTooLargeForSyncing()) {\n return false;\n }\n return true;\n}\nlet EditorWorkerService = class EditorWorkerService extends Disposable {\n constructor(modelService, configurationService, logService, languageConfigurationService, languageFeaturesService) {\n super();\n this._modelService = modelService;\n this._workerManager = this._register(new WorkerManager(this._modelService, languageConfigurationService));\n this._logService = logService;\n // register default link-provider and default completions-provider\n this._register(languageFeaturesService.linkProvider.register({ language: '*', hasAccessToAllModels: true }, {\n provideLinks: (model, token) => {\n if (!canSyncModel(this._modelService, model.uri)) {\n return Promise.resolve({ links: [] }); // File too large\n }\n return this._workerManager.withWorker().then(client => client.computeLinks(model.uri)).then(links => {\n return links && { links };\n });\n }\n }));\n this._register(languageFeaturesService.completionProvider.register('*', new WordBasedCompletionItemProvider(this._workerManager, configurationService, this._modelService, languageConfigurationService)));\n }\n dispose() {\n super.dispose();\n }\n canComputeUnicodeHighlights(uri) {\n return canSyncModel(this._modelService, uri);\n }\n computedUnicodeHighlights(uri, options, range) {\n return this._workerManager.withWorker().then(client => client.computedUnicodeHighlights(uri, options, range));\n }\n async computeDiff(original, modified, options, algorithm) {\n const result = await this._workerManager.withWorker().then(client => client.computeDiff(original, modified, options, algorithm));\n if (!result) {\n return null;\n }\n // Convert from space efficient JSON data to rich objects.\n const diff = {\n identical: result.identical,\n quitEarly: result.quitEarly,\n changes: toLineRangeMappings(result.changes),\n moves: result.moves.map(m => new MovedText(new LineRangeMapping(new LineRange(m[0], m[1]), new LineRange(m[2], m[3])), toLineRangeMappings(m[4])))\n };\n return diff;\n function toLineRangeMappings(changes) {\n return changes.map((c) => {\n var _a;\n return new DetailedLineRangeMapping(new LineRange(c[0], c[1]), new LineRange(c[2], c[3]), (_a = c[4]) === null || _a === void 0 ? void 0 : _a.map((c) => new RangeMapping(new Range(c[0], c[1], c[2], c[3]), new Range(c[4], c[5], c[6], c[7]))));\n });\n }\n }\n computeMoreMinimalEdits(resource, edits, pretty = false) {\n if (isNonEmptyArray(edits)) {\n if (!canSyncModel(this._modelService, resource)) {\n return Promise.resolve(edits); // File too large\n }\n const sw = StopWatch.create();\n const result = this._workerManager.withWorker().then(client => client.computeMoreMinimalEdits(resource, edits, pretty));\n result.finally(() => this._logService.trace('FORMAT#computeMoreMinimalEdits', resource.toString(true), sw.elapsed()));\n return Promise.race([result, timeout(1000).then(() => edits)]);\n }\n else {\n return Promise.resolve(undefined);\n }\n }\n canNavigateValueSet(resource) {\n return (canSyncModel(this._modelService, resource));\n }\n navigateValueSet(resource, range, up) {\n return this._workerManager.withWorker().then(client => client.navigateValueSet(resource, range, up));\n }\n canComputeWordRanges(resource) {\n return canSyncModel(this._modelService, resource);\n }\n computeWordRanges(resource, range) {\n return this._workerManager.withWorker().then(client => client.computeWordRanges(resource, range));\n }\n findSectionHeaders(uri, options) {\n return this._workerManager.withWorker().then(client => client.findSectionHeaders(uri, options));\n }\n};\nEditorWorkerService = __decorate([\n __param(0, IModelService),\n __param(1, ITextResourceConfigurationService),\n __param(2, ILogService),\n __param(3, ILanguageConfigurationService),\n __param(4, ILanguageFeaturesService)\n], EditorWorkerService);\nexport { EditorWorkerService };\nclass WordBasedCompletionItemProvider {\n constructor(workerManager, configurationService, modelService, languageConfigurationService) {\n this.languageConfigurationService = languageConfigurationService;\n this._debugDisplayName = 'wordbasedCompletions';\n this._workerManager = workerManager;\n this._configurationService = configurationService;\n this._modelService = modelService;\n }\n async provideCompletionItems(model, position) {\n const config = this._configurationService.getValue(model.uri, position, 'editor');\n if (config.wordBasedSuggestions === 'off') {\n return undefined;\n }\n const models = [];\n if (config.wordBasedSuggestions === 'currentDocument') {\n // only current file and only if not too large\n if (canSyncModel(this._modelService, model.uri)) {\n models.push(model.uri);\n }\n }\n else {\n // either all files or files of same language\n for (const candidate of this._modelService.getModels()) {\n if (!canSyncModel(this._modelService, candidate.uri)) {\n continue;\n }\n if (candidate === model) {\n models.unshift(candidate.uri);\n }\n else if (config.wordBasedSuggestions === 'allDocuments' || candidate.getLanguageId() === model.getLanguageId()) {\n models.push(candidate.uri);\n }\n }\n }\n if (models.length === 0) {\n return undefined; // File too large, no other files\n }\n const wordDefRegExp = this.languageConfigurationService.getLanguageConfiguration(model.getLanguageId()).getWordDefinition();\n const word = model.getWordAtPosition(position);\n const replace = !word ? Range.fromPositions(position) : new Range(position.lineNumber, word.startColumn, position.lineNumber, word.endColumn);\n const insert = replace.setEndPosition(position.lineNumber, position.column);\n const client = await this._workerManager.withWorker();\n const data = await client.textualSuggest(models, word === null || word === void 0 ? void 0 : word.word, wordDefRegExp);\n if (!data) {\n return undefined;\n }\n return {\n duration: data.duration,\n suggestions: data.words.map((word) => {\n return {\n kind: 18 /* languages.CompletionItemKind.Text */,\n label: word,\n insertText: word,\n range: { insert, replace }\n };\n }),\n };\n }\n}\nclass WorkerManager extends Disposable {\n constructor(modelService, languageConfigurationService) {\n super();\n this.languageConfigurationService = languageConfigurationService;\n this._modelService = modelService;\n this._editorWorkerClient = null;\n this._lastWorkerUsedTime = (new Date()).getTime();\n const stopWorkerInterval = this._register(new WindowIntervalTimer());\n stopWorkerInterval.cancelAndSet(() => this._checkStopIdleWorker(), Math.round(STOP_WORKER_DELTA_TIME_MS / 2), mainWindow);\n this._register(this._modelService.onModelRemoved(_ => this._checkStopEmptyWorker()));\n }\n dispose() {\n if (this._editorWorkerClient) {\n this._editorWorkerClient.dispose();\n this._editorWorkerClient = null;\n }\n super.dispose();\n }\n /**\n * Check if the model service has no more models and stop the worker if that is the case.\n */\n _checkStopEmptyWorker() {\n if (!this._editorWorkerClient) {\n return;\n }\n const models = this._modelService.getModels();\n if (models.length === 0) {\n // There are no more models => nothing possible for me to do\n this._editorWorkerClient.dispose();\n this._editorWorkerClient = null;\n }\n }\n /**\n * Check if the worker has been idle for a while and then stop it.\n */\n _checkStopIdleWorker() {\n if (!this._editorWorkerClient) {\n return;\n }\n const timeSinceLastWorkerUsedTime = (new Date()).getTime() - this._lastWorkerUsedTime;\n if (timeSinceLastWorkerUsedTime > STOP_WORKER_DELTA_TIME_MS) {\n this._editorWorkerClient.dispose();\n this._editorWorkerClient = null;\n }\n }\n withWorker() {\n this._lastWorkerUsedTime = (new Date()).getTime();\n if (!this._editorWorkerClient) {\n this._editorWorkerClient = new EditorWorkerClient(this._modelService, false, 'editorWorkerService', this.languageConfigurationService);\n }\n return Promise.resolve(this._editorWorkerClient);\n }\n}\nclass EditorModelManager extends Disposable {\n constructor(proxy, modelService, keepIdleModels) {\n super();\n this._syncedModels = Object.create(null);\n this._syncedModelsLastUsedTime = Object.create(null);\n this._proxy = proxy;\n this._modelService = modelService;\n if (!keepIdleModels) {\n const timer = new IntervalTimer();\n timer.cancelAndSet(() => this._checkStopModelSync(), Math.round(STOP_SYNC_MODEL_DELTA_TIME_MS / 2));\n this._register(timer);\n }\n }\n dispose() {\n for (const modelUrl in this._syncedModels) {\n dispose(this._syncedModels[modelUrl]);\n }\n this._syncedModels = Object.create(null);\n this._syncedModelsLastUsedTime = Object.create(null);\n super.dispose();\n }\n ensureSyncedResources(resources, forceLargeModels) {\n for (const resource of resources) {\n const resourceStr = resource.toString();\n if (!this._syncedModels[resourceStr]) {\n this._beginModelSync(resource, forceLargeModels);\n }\n if (this._syncedModels[resourceStr]) {\n this._syncedModelsLastUsedTime[resourceStr] = (new Date()).getTime();\n }\n }\n }\n _checkStopModelSync() {\n const currentTime = (new Date()).getTime();\n const toRemove = [];\n for (const modelUrl in this._syncedModelsLastUsedTime) {\n const elapsedTime = currentTime - this._syncedModelsLastUsedTime[modelUrl];\n if (elapsedTime > STOP_SYNC_MODEL_DELTA_TIME_MS) {\n toRemove.push(modelUrl);\n }\n }\n for (const e of toRemove) {\n this._stopModelSync(e);\n }\n }\n _beginModelSync(resource, forceLargeModels) {\n const model = this._modelService.getModel(resource);\n if (!model) {\n return;\n }\n if (!forceLargeModels && model.isTooLargeForSyncing()) {\n return;\n }\n const modelUrl = resource.toString();\n this._proxy.acceptNewModel({\n url: model.uri.toString(),\n lines: model.getLinesContent(),\n EOL: model.getEOL(),\n versionId: model.getVersionId()\n });\n const toDispose = new DisposableStore();\n toDispose.add(model.onDidChangeContent((e) => {\n this._proxy.acceptModelChanged(modelUrl.toString(), e);\n }));\n toDispose.add(model.onWillDispose(() => {\n this._stopModelSync(modelUrl);\n }));\n toDispose.add(toDisposable(() => {\n this._proxy.acceptRemovedModel(modelUrl);\n }));\n this._syncedModels[modelUrl] = toDispose;\n }\n _stopModelSync(modelUrl) {\n const toDispose = this._syncedModels[modelUrl];\n delete this._syncedModels[modelUrl];\n delete this._syncedModelsLastUsedTime[modelUrl];\n dispose(toDispose);\n }\n}\nclass SynchronousWorkerClient {\n constructor(instance) {\n this._instance = instance;\n this._proxyObj = Promise.resolve(this._instance);\n }\n dispose() {\n this._instance.dispose();\n }\n getProxyObject() {\n return this._proxyObj;\n }\n}\nexport class EditorWorkerHost {\n constructor(workerClient) {\n this._workerClient = workerClient;\n }\n // foreign host request\n fhr(method, args) {\n return this._workerClient.fhr(method, args);\n }\n}\nexport class EditorWorkerClient extends Disposable {\n constructor(modelService, keepIdleModels, label, languageConfigurationService) {\n super();\n this.languageConfigurationService = languageConfigurationService;\n this._disposed = false;\n this._modelService = modelService;\n this._keepIdleModels = keepIdleModels;\n this._workerFactory = new DefaultWorkerFactory(label);\n this._worker = null;\n this._modelManager = null;\n }\n // foreign host request\n fhr(method, args) {\n throw new Error(`Not implemented!`);\n }\n _getOrCreateWorker() {\n if (!this._worker) {\n try {\n this._worker = this._register(new SimpleWorkerClient(this._workerFactory, 'vs/editor/common/services/editorSimpleWorker', new EditorWorkerHost(this)));\n }\n catch (err) {\n logOnceWebWorkerWarning(err);\n this._worker = new SynchronousWorkerClient(new EditorSimpleWorker(new EditorWorkerHost(this), null));\n }\n }\n return this._worker;\n }\n _getProxy() {\n return this._getOrCreateWorker().getProxyObject().then(undefined, (err) => {\n logOnceWebWorkerWarning(err);\n this._worker = new SynchronousWorkerClient(new EditorSimpleWorker(new EditorWorkerHost(this), null));\n return this._getOrCreateWorker().getProxyObject();\n });\n }\n _getOrCreateModelManager(proxy) {\n if (!this._modelManager) {\n this._modelManager = this._register(new EditorModelManager(proxy, this._modelService, this._keepIdleModels));\n }\n return this._modelManager;\n }\n async _withSyncedResources(resources, forceLargeModels = false) {\n if (this._disposed) {\n return Promise.reject(canceled());\n }\n return this._getProxy().then((proxy) => {\n this._getOrCreateModelManager(proxy).ensureSyncedResources(resources, forceLargeModels);\n return proxy;\n });\n }\n computedUnicodeHighlights(uri, options, range) {\n return this._withSyncedResources([uri]).then(proxy => {\n return proxy.computeUnicodeHighlights(uri.toString(), options, range);\n });\n }\n computeDiff(original, modified, options, algorithm) {\n return this._withSyncedResources([original, modified], /* forceLargeModels */ true).then(proxy => {\n return proxy.computeDiff(original.toString(), modified.toString(), options, algorithm);\n });\n }\n computeMoreMinimalEdits(resource, edits, pretty) {\n return this._withSyncedResources([resource]).then(proxy => {\n return proxy.computeMoreMinimalEdits(resource.toString(), edits, pretty);\n });\n }\n computeLinks(resource) {\n return this._withSyncedResources([resource]).then(proxy => {\n return proxy.computeLinks(resource.toString());\n });\n }\n computeDefaultDocumentColors(resource) {\n return this._withSyncedResources([resource]).then(proxy => {\n return proxy.computeDefaultDocumentColors(resource.toString());\n });\n }\n async textualSuggest(resources, leadingWord, wordDefRegExp) {\n const proxy = await this._withSyncedResources(resources);\n const wordDef = wordDefRegExp.source;\n const wordDefFlags = wordDefRegExp.flags;\n return proxy.textualSuggest(resources.map(r => r.toString()), leadingWord, wordDef, wordDefFlags);\n }\n computeWordRanges(resource, range) {\n return this._withSyncedResources([resource]).then(proxy => {\n const model = this._modelService.getModel(resource);\n if (!model) {\n return Promise.resolve(null);\n }\n const wordDefRegExp = this.languageConfigurationService.getLanguageConfiguration(model.getLanguageId()).getWordDefinition();\n const wordDef = wordDefRegExp.source;\n const wordDefFlags = wordDefRegExp.flags;\n return proxy.computeWordRanges(resource.toString(), range, wordDef, wordDefFlags);\n });\n }\n navigateValueSet(resource, range, up) {\n return this._withSyncedResources([resource]).then(proxy => {\n const model = this._modelService.getModel(resource);\n if (!model) {\n return null;\n }\n const wordDefRegExp = this.languageConfigurationService.getLanguageConfiguration(model.getLanguageId()).getWordDefinition();\n const wordDef = wordDefRegExp.source;\n const wordDefFlags = wordDefRegExp.flags;\n return proxy.navigateValueSet(resource.toString(), range, up, wordDef, wordDefFlags);\n });\n }\n findSectionHeaders(uri, options) {\n return this._withSyncedResources([uri]).then(proxy => {\n return proxy.findSectionHeaders(uri.toString(), options);\n });\n }\n dispose() {\n super.dispose();\n this._disposed = true;\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 *--------------------------------------------------------------------------------------------*/\nimport { transformErrorForSerialization } from '../errors.js';\nimport { Emitter } from '../event.js';\nimport { Disposable } from '../lifecycle.js';\nimport { getAllMethodNames } from '../objects.js';\nimport { isWeb } from '../platform.js';\nimport * as strings from '../strings.js';\nconst INITIALIZE = '$initialize';\nlet webWorkerWarningLogged = false;\nexport function logOnceWebWorkerWarning(err) {\n if (!isWeb) {\n // running tests\n return;\n }\n if (!webWorkerWarningLogged) {\n webWorkerWarningLogged = true;\n console.warn('Could not create web worker(s). Falling back to loading web worker code in main thread, which might cause UI freezes. Please see https://github.com/microsoft/monaco-editor#faq');\n }\n console.warn(err.message);\n}\nclass RequestMessage {\n constructor(vsWorker, req, method, args) {\n this.vsWorker = vsWorker;\n this.req = req;\n this.method = method;\n this.args = args;\n this.type = 0 /* MessageType.Request */;\n }\n}\nclass ReplyMessage {\n constructor(vsWorker, seq, res, err) {\n this.vsWorker = vsWorker;\n this.seq = seq;\n this.res = res;\n this.err = err;\n this.type = 1 /* MessageType.Reply */;\n }\n}\nclass SubscribeEventMessage {\n constructor(vsWorker, req, eventName, arg) {\n this.vsWorker = vsWorker;\n this.req = req;\n this.eventName = eventName;\n this.arg = arg;\n this.type = 2 /* MessageType.SubscribeEvent */;\n }\n}\nclass EventMessage {\n constructor(vsWorker, req, event) {\n this.vsWorker = vsWorker;\n this.req = req;\n this.event = event;\n this.type = 3 /* MessageType.Event */;\n }\n}\nclass UnsubscribeEventMessage {\n constructor(vsWorker, req) {\n this.vsWorker = vsWorker;\n this.req = req;\n this.type = 4 /* MessageType.UnsubscribeEvent */;\n }\n}\nclass SimpleWorkerProtocol {\n constructor(handler) {\n this._workerId = -1;\n this._handler = handler;\n this._lastSentReq = 0;\n this._pendingReplies = Object.create(null);\n this._pendingEmitters = new Map();\n this._pendingEvents = new Map();\n }\n setWorkerId(workerId) {\n this._workerId = workerId;\n }\n sendMessage(method, args) {\n const req = String(++this._lastSentReq);\n return new Promise((resolve, reject) => {\n this._pendingReplies[req] = {\n resolve: resolve,\n reject: reject\n };\n this._send(new RequestMessage(this._workerId, req, method, args));\n });\n }\n listen(eventName, arg) {\n let req = null;\n const emitter = new Emitter({\n onWillAddFirstListener: () => {\n req = String(++this._lastSentReq);\n this._pendingEmitters.set(req, emitter);\n this._send(new SubscribeEventMessage(this._workerId, req, eventName, arg));\n },\n onDidRemoveLastListener: () => {\n this._pendingEmitters.delete(req);\n this._send(new UnsubscribeEventMessage(this._workerId, req));\n req = null;\n }\n });\n return emitter.event;\n }\n handleMessage(message) {\n if (!message || !message.vsWorker) {\n return;\n }\n if (this._workerId !== -1 && message.vsWorker !== this._workerId) {\n return;\n }\n this._handleMessage(message);\n }\n _handleMessage(msg) {\n switch (msg.type) {\n case 1 /* MessageType.Reply */:\n return this._handleReplyMessage(msg);\n case 0 /* MessageType.Request */:\n return this._handleRequestMessage(msg);\n case 2 /* MessageType.SubscribeEvent */:\n return this._handleSubscribeEventMessage(msg);\n case 3 /* MessageType.Event */:\n return this._handleEventMessage(msg);\n case 4 /* MessageType.UnsubscribeEvent */:\n return this._handleUnsubscribeEventMessage(msg);\n }\n }\n _handleReplyMessage(replyMessage) {\n if (!this._pendingReplies[replyMessage.seq]) {\n console.warn('Got reply to unknown seq');\n return;\n }\n const reply = this._pendingReplies[replyMessage.seq];\n delete this._pendingReplies[replyMessage.seq];\n if (replyMessage.err) {\n let err = replyMessage.err;\n if (replyMessage.err.$isError) {\n err = new Error();\n err.name = replyMessage.err.name;\n err.message = replyMessage.err.message;\n err.stack = replyMessage.err.stack;\n }\n reply.reject(err);\n return;\n }\n reply.resolve(replyMessage.res);\n }\n _handleRequestMessage(requestMessage) {\n const req = requestMessage.req;\n const result = this._handler.handleMessage(requestMessage.method, requestMessage.args);\n result.then((r) => {\n this._send(new ReplyMessage(this._workerId, req, r, undefined));\n }, (e) => {\n if (e.detail instanceof Error) {\n // Loading errors have a detail property that points to the actual error\n e.detail = transformErrorForSerialization(e.detail);\n }\n this._send(new ReplyMessage(this._workerId, req, undefined, transformErrorForSerialization(e)));\n });\n }\n _handleSubscribeEventMessage(msg) {\n const req = msg.req;\n const disposable = this._handler.handleEvent(msg.eventName, msg.arg)((event) => {\n this._send(new EventMessage(this._workerId, req, event));\n });\n this._pendingEvents.set(req, disposable);\n }\n _handleEventMessage(msg) {\n if (!this._pendingEmitters.has(msg.req)) {\n console.warn('Got event for unknown req');\n return;\n }\n this._pendingEmitters.get(msg.req).fire(msg.event);\n }\n _handleUnsubscribeEventMessage(msg) {\n if (!this._pendingEvents.has(msg.req)) {\n console.warn('Got unsubscribe for unknown req');\n return;\n }\n this._pendingEvents.get(msg.req).dispose();\n this._pendingEvents.delete(msg.req);\n }\n _send(msg) {\n const transfer = [];\n if (msg.type === 0 /* MessageType.Request */) {\n for (let i = 0; i < msg.args.length; i++) {\n if (msg.args[i] instanceof ArrayBuffer) {\n transfer.push(msg.args[i]);\n }\n }\n }\n else if (msg.type === 1 /* MessageType.Reply */) {\n if (msg.res instanceof ArrayBuffer) {\n transfer.push(msg.res);\n }\n }\n this._handler.sendMessage(msg, transfer);\n }\n}\n/**\n * Main thread side\n */\nexport class SimpleWorkerClient extends Disposable {\n constructor(workerFactory, moduleId, host) {\n super();\n let lazyProxyReject = null;\n this._worker = this._register(workerFactory.create('vs/base/common/worker/simpleWorker', (msg) => {\n this._protocol.handleMessage(msg);\n }, (err) => {\n // in Firefox, web workers fail lazily :(\n // we will reject the proxy\n lazyProxyReject === null || lazyProxyReject === void 0 ? void 0 : lazyProxyReject(err);\n }));\n this._protocol = new SimpleWorkerProtocol({\n sendMessage: (msg, transfer) => {\n this._worker.postMessage(msg, transfer);\n },\n handleMessage: (method, args) => {\n if (typeof host[method] !== 'function') {\n return Promise.reject(new Error('Missing method ' + method + ' on main thread host.'));\n }\n try {\n return Promise.resolve(host[method].apply(host, args));\n }\n catch (e) {\n return Promise.reject(e);\n }\n },\n handleEvent: (eventName, arg) => {\n if (propertyIsDynamicEvent(eventName)) {\n const event = host[eventName].call(host, arg);\n if (typeof event !== 'function') {\n throw new Error(`Missing dynamic event ${eventName} on main thread host.`);\n }\n return event;\n }\n if (propertyIsEvent(eventName)) {\n const event = host[eventName];\n if (typeof event !== 'function') {\n throw new Error(`Missing event ${eventName} on main thread host.`);\n }\n return event;\n }\n throw new Error(`Malformed event name ${eventName}`);\n }\n });\n this._protocol.setWorkerId(this._worker.getId());\n // Gather loader configuration\n let loaderConfiguration = null;\n const globalRequire = globalThis.require;\n if (typeof globalRequire !== 'undefined' && typeof globalRequire.getConfig === 'function') {\n // Get the configuration from the Monaco AMD Loader\n loaderConfiguration = globalRequire.getConfig();\n }\n else if (typeof globalThis.requirejs !== 'undefined') {\n // Get the configuration from requirejs\n loaderConfiguration = globalThis.requirejs.s.contexts._.config;\n }\n const hostMethods = getAllMethodNames(host);\n // Send initialize message\n this._onModuleLoaded = this._protocol.sendMessage(INITIALIZE, [\n this._worker.getId(),\n JSON.parse(JSON.stringify(loaderConfiguration)),\n moduleId,\n hostMethods,\n ]);\n // Create proxy to loaded code\n const proxyMethodRequest = (method, args) => {\n return this._request(method, args);\n };\n const proxyListen = (eventName, arg) => {\n return this._protocol.listen(eventName, arg);\n };\n this._lazyProxy = new Promise((resolve, reject) => {\n lazyProxyReject = reject;\n this._onModuleLoaded.then((availableMethods) => {\n resolve(createProxyObject(availableMethods, proxyMethodRequest, proxyListen));\n }, (e) => {\n reject(e);\n this._onError('Worker failed to load ' + moduleId, e);\n });\n });\n }\n getProxyObject() {\n return this._lazyProxy;\n }\n _request(method, args) {\n return new Promise((resolve, reject) => {\n this._onModuleLoaded.then(() => {\n this._protocol.sendMessage(method, args).then(resolve, reject);\n }, reject);\n });\n }\n _onError(message, error) {\n console.error(message);\n console.info(error);\n }\n}\nfunction propertyIsEvent(name) {\n // Assume a property is an event if it has a form of \"onSomething\"\n return name[0] === 'o' && name[1] === 'n' && strings.isUpperAsciiLetter(name.charCodeAt(2));\n}\nfunction propertyIsDynamicEvent(name) {\n // Assume a property is a dynamic event (a method that returns an event) if it has a form of \"onDynamicSomething\"\n return /^onDynamic/.test(name) && strings.isUpperAsciiLetter(name.charCodeAt(9));\n}\nfunction createProxyObject(methodNames, invoke, proxyListen) {\n const createProxyMethod = (method) => {\n return function () {\n const args = Array.prototype.slice.call(arguments, 0);\n return invoke(method, args);\n };\n };\n const createProxyDynamicEvent = (eventName) => {\n return function (arg) {\n return proxyListen(eventName, arg);\n };\n };\n const result = {};\n for (const methodName of methodNames) {\n if (propertyIsDynamicEvent(methodName)) {\n result[methodName] = createProxyDynamicEvent(methodName);\n continue;\n }\n if (propertyIsEvent(methodName)) {\n result[methodName] = proxyListen(methodName, undefined);\n continue;\n }\n result[methodName] = createProxyMethod(methodName);\n }\n return result;\n}\n/**\n * Worker side\n */\nexport class SimpleWorkerServer {\n constructor(postMessage, requestHandlerFactory) {\n this._requestHandlerFactory = requestHandlerFactory;\n this._requestHandler = null;\n this._protocol = new SimpleWorkerProtocol({\n sendMessage: (msg, transfer) => {\n postMessage(msg, transfer);\n },\n handleMessage: (method, args) => this._handleMessage(method, args),\n handleEvent: (eventName, arg) => this._handleEvent(eventName, arg)\n });\n }\n onmessage(msg) {\n this._protocol.handleMessage(msg);\n }\n _handleMessage(method, args) {\n if (method === INITIALIZE) {\n return this.initialize(args[0], args[1], args[2], args[3]);\n }\n if (!this._requestHandler || typeof this._requestHandler[method] !== 'function') {\n return Promise.reject(new Error('Missing requestHandler or method: ' + method));\n }\n try {\n return Promise.resolve(this._requestHandler[method].apply(this._requestHandler, args));\n }\n catch (e) {\n return Promise.reject(e);\n }\n }\n _handleEvent(eventName, arg) {\n if (!this._requestHandler) {\n throw new Error(`Missing requestHandler`);\n }\n if (propertyIsDynamicEvent(eventName)) {\n const event = this._requestHandler[eventName].call(this._requestHandler, arg);\n if (typeof event !== 'function') {\n throw new Error(`Missing dynamic event ${eventName} on request handler.`);\n }\n return event;\n }\n if (propertyIsEvent(eventName)) {\n const event = this._requestHandler[eventName];\n if (typeof event !== 'function') {\n throw new Error(`Missing event ${eventName} on request handler.`);\n }\n return event;\n }\n throw new Error(`Malformed event name ${eventName}`);\n }\n initialize(workerId, loaderConfig, moduleId, hostMethods) {\n this._protocol.setWorkerId(workerId);\n const proxyMethodRequest = (method, args) => {\n return this._protocol.sendMessage(method, args);\n };\n const proxyListen = (eventName, arg) => {\n return this._protocol.listen(eventName, arg);\n };\n const hostProxy = createProxyObject(hostMethods, proxyMethodRequest, proxyListen);\n if (this._requestHandlerFactory) {\n // static request handler\n this._requestHandler = this._requestHandlerFactory(hostProxy);\n return Promise.resolve(getAllMethodNames(this._requestHandler));\n }\n if (loaderConfig) {\n // Remove 'baseUrl', handling it is beyond scope for now\n if (typeof loaderConfig.baseUrl !== 'undefined') {\n delete loaderConfig['baseUrl'];\n }\n if (typeof loaderConfig.paths !== 'undefined') {\n if (typeof loaderConfig.paths.vs !== 'undefined') {\n delete loaderConfig.paths['vs'];\n }\n }\n if (typeof loaderConfig.trustedTypesPolicy !== 'undefined') {\n // don't use, it has been destroyed during serialize\n delete loaderConfig['trustedTypesPolicy'];\n }\n // Since this is in a web worker, enable catching errors\n loaderConfig.catchError = true;\n globalThis.require.config(loaderConfig);\n }\n return new Promise((resolve, reject) => {\n // Use the global require to be sure to get the global config\n // ESM-comment-begin\n // \t\t\tconst req = (globalThis.require || require);\n // ESM-comment-end\n // ESM-uncomment-begin\n const req = globalThis.require;\n // ESM-uncomment-end\n req([moduleId], (module) => {\n this._requestHandler = module.create(hostProxy);\n if (!this._requestHandler) {\n reject(new Error(`No RequestHandler!`));\n return;\n }\n resolve(getAllMethodNames(this._requestHandler));\n }, reject);\n });\n }\n}\n/**\n * Called on the worker side\n * @skipMangle\n */\nexport function create(postMessage) {\n return new SimpleWorkerServer(postMessage, 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 *--------------------------------------------------------------------------------------------*/\nimport { createTrustedTypesPolicy } from './trustedTypes.js';\nimport { onUnexpectedError } from '../common/errors.js';\nimport { logOnceWebWorkerWarning } from '../common/worker/simpleWorker.js';\nimport { Disposable, toDisposable } from '../common/lifecycle.js';\nconst ttPolicy = createTrustedTypesPolicy('defaultWorkerFactory', { createScriptURL: value => value });\nfunction getWorker(label) {\n const monacoEnvironment = globalThis.MonacoEnvironment;\n if (monacoEnvironment) {\n if (typeof monacoEnvironment.getWorker === 'function') {\n return monacoEnvironment.getWorker('workerMain.js', label);\n }\n if (typeof monacoEnvironment.getWorkerUrl === 'function') {\n const workerUrl = monacoEnvironment.getWorkerUrl('workerMain.js', label);\n return new Worker(ttPolicy ? ttPolicy.createScriptURL(workerUrl) : workerUrl, { name: label });\n }\n }\n // ESM-comment-begin\n // \tif (typeof require === 'function') {\n // \t\t// check if the JS lives on a different origin\n // \t\tconst workerMain = require.toUrl('vs/base/worker/workerMain.js'); // explicitly using require.toUrl(), see https://github.com/microsoft/vscode/issues/107440#issuecomment-698982321\n // \t\tconst workerUrl = getWorkerBootstrapUrl(workerMain, label);\n // \t\treturn new Worker(ttPolicy ? ttPolicy.createScriptURL(workerUrl) as unknown as string : workerUrl, { name: label });\n // \t}\n // ESM-comment-end\n throw new Error(`You must define a function MonacoEnvironment.getWorkerUrl or MonacoEnvironment.getWorker`);\n}\n// ESM-comment-begin\n// export function getWorkerBootstrapUrl(scriptPath: string, label: string): string {\n// \tif (/^((http:)|(https:)|(file:))/.test(scriptPath) && scriptPath.substring(0, globalThis.origin.length) !== globalThis.origin) {\n// \t\t// this is the cross-origin case\n// \t\t// i.e. the webpage is running at a different origin than where the scripts are loaded from\n// \t\tconst myPath = 'vs/base/worker/defaultWorkerFactory.js';\n// \t\tconst workerBaseUrl = require.toUrl(myPath).slice(0, -myPath.length); // explicitly using require.toUrl(), see https://github.com/microsoft/vscode/issues/107440#issuecomment-698982321\n// \t\tconst js = `/*${label}*/globalThis.MonacoEnvironment={baseUrl: '${workerBaseUrl}'};const ttPolicy = globalThis.trustedTypes?.createPolicy('defaultWorkerFactory', { createScriptURL: value => value });importScripts(ttPolicy?.createScriptURL('${scriptPath}') ?? '${scriptPath}');/*${label}*/`;\n// \t\tconst blob = new Blob([js], { type: 'application/javascript' });\n// \t\treturn URL.createObjectURL(blob);\n// \t}\n// \n// \tconst start = scriptPath.lastIndexOf('?');\n// \tconst end = scriptPath.lastIndexOf('#', start);\n// \tconst params = start > 0\n// \t\t? new URLSearchParams(scriptPath.substring(start + 1, ~end ? end : undefined))\n// \t\t: new URLSearchParams();\n// \n// \tCOI.addSearchParam(params, true, true);\n// \tconst search = params.toString();\n// \n// \tif (!search) {\n// \t\treturn `${scriptPath}#${label}`;\n// \t} else {\n// \t\treturn `${scriptPath}?${params.toString()}#${label}`;\n// \t}\n// }\n// ESM-comment-end\nfunction isPromiseLike(obj) {\n if (typeof obj.then === 'function') {\n return true;\n }\n return false;\n}\n/**\n * A worker that uses HTML5 web workers so that is has\n * its own global scope and its own thread.\n */\nclass WebWorker extends Disposable {\n constructor(moduleId, id, label, onMessageCallback, onErrorCallback) {\n super();\n this.id = id;\n this.label = label;\n const workerOrPromise = getWorker(label);\n if (isPromiseLike(workerOrPromise)) {\n this.worker = workerOrPromise;\n }\n else {\n this.worker = Promise.resolve(workerOrPromise);\n }\n this.postMessage(moduleId, []);\n this.worker.then((w) => {\n w.onmessage = function (ev) {\n onMessageCallback(ev.data);\n };\n w.onmessageerror = onErrorCallback;\n if (typeof w.addEventListener === 'function') {\n w.addEventListener('error', onErrorCallback);\n }\n });\n this._register(toDisposable(() => {\n var _a;\n (_a = this.worker) === null || _a === void 0 ? void 0 : _a.then(w => {\n w.onmessage = null;\n w.onmessageerror = null;\n w.removeEventListener('error', onErrorCallback);\n w.terminate();\n });\n this.worker = null;\n }));\n }\n getId() {\n return this.id;\n }\n postMessage(message, transfer) {\n var _a;\n (_a = this.worker) === null || _a === void 0 ? void 0 : _a.then(w => {\n try {\n w.postMessage(message, transfer);\n }\n catch (err) {\n onUnexpectedError(err);\n onUnexpectedError(new Error(`FAILED to post message to '${this.label}'-worker`, { cause: err }));\n }\n });\n }\n}\nexport class DefaultWorkerFactory {\n constructor(label) {\n this._label = label;\n this._webWorkerFailedBeforeError = false;\n }\n create(moduleId, onMessageCallback, onErrorCallback) {\n const workerId = (++DefaultWorkerFactory.LAST_WORKER_ID);\n if (this._webWorkerFailedBeforeError) {\n throw this._webWorkerFailedBeforeError;\n }\n return new WebWorker(moduleId, workerId, this._label || 'anonymous' + workerId, onMessageCallback, (err) => {\n logOnceWebWorkerWarning(err);\n this._webWorkerFailedBeforeError = err;\n onErrorCallback(err);\n });\n }\n}\nDefaultWorkerFactory.LAST_WORKER_ID = 0;\n", "/*---------------------------------------------------------------------------------------------\n * 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 { mainWindow } from './window.js';\nimport { onUnexpectedError } from '../common/errors.js';\nexport function createTrustedTypesPolicy(policyName, policyOptions) {\n var _a;\n const monacoEnvironment = globalThis.MonacoEnvironment;\n if (monacoEnvironment === null || monacoEnvironment === void 0 ? void 0 : monacoEnvironment.createTrustedTypesPolicy) {\n try {\n return monacoEnvironment.createTrustedTypesPolicy(policyName, policyOptions);\n }\n catch (err) {\n onUnexpectedError(err);\n return undefined;\n }\n }\n try {\n return (_a = mainWindow.trustedTypes) === null || _a === void 0 ? void 0 : _a.createPolicy(policyName, policyOptions);\n }\n catch (err) {\n onUnexpectedError(err);\n return 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 *--------------------------------------------------------------------------------------------*/\nimport { stringDiff } from '../../../base/common/diff/diff.js';\nimport { URI } from '../../../base/common/uri.js';\nimport { Position } from '../core/position.js';\nimport { Range } from '../core/range.js';\nimport { MirrorTextModel as BaseMirrorModel } from '../model/mirrorTextModel.js';\nimport { ensureValidWordDefinition, getWordAtText } from '../core/wordHelper.js';\nimport { computeLinks } from '../languages/linkComputer.js';\nimport { BasicInplaceReplace } from '../languages/supports/inplaceReplaceSupport.js';\nimport { createMonacoBaseAPI } from './editorBaseApi.js';\nimport { StopWatch } from '../../../base/common/stopwatch.js';\nimport { UnicodeTextModelHighlighter } from './unicodeTextModelHighlighter.js';\nimport { linesDiffComputers } from '../diff/linesDiffComputers.js';\nimport { createProxyObject, getAllMethodNames } from '../../../base/common/objects.js';\nimport { computeDefaultDocumentColors } from '../languages/defaultDocumentColorsComputer.js';\nimport { findSectionHeaders } from './findSectionHeaders.js';\n/**\n * @internal\n */\nclass MirrorModel extends BaseMirrorModel {\n get uri() {\n return this._uri;\n }\n get eol() {\n return this._eol;\n }\n getValue() {\n return this.getText();\n }\n findMatches(regex) {\n const matches = [];\n for (let i = 0; i < this._lines.length; i++) {\n const line = this._lines[i];\n const offsetToAdd = this.offsetAt(new Position(i + 1, 1));\n const iteratorOverMatches = line.matchAll(regex);\n for (const match of iteratorOverMatches) {\n if (match.index || match.index === 0) {\n match.index = match.index + offsetToAdd;\n }\n matches.push(match);\n }\n }\n return matches;\n }\n getLinesContent() {\n return this._lines.slice(0);\n }\n getLineCount() {\n return this._lines.length;\n }\n getLineContent(lineNumber) {\n return this._lines[lineNumber - 1];\n }\n getWordAtPosition(position, wordDefinition) {\n const wordAtText = getWordAtText(position.column, ensureValidWordDefinition(wordDefinition), this._lines[position.lineNumber - 1], 0);\n if (wordAtText) {\n return new Range(position.lineNumber, wordAtText.startColumn, position.lineNumber, wordAtText.endColumn);\n }\n return null;\n }\n words(wordDefinition) {\n const lines = this._lines;\n const wordenize = this._wordenize.bind(this);\n let lineNumber = 0;\n let lineText = '';\n let wordRangesIdx = 0;\n let wordRanges = [];\n return {\n *[Symbol.iterator]() {\n while (true) {\n if (wordRangesIdx < wordRanges.length) {\n const value = lineText.substring(wordRanges[wordRangesIdx].start, wordRanges[wordRangesIdx].end);\n wordRangesIdx += 1;\n yield value;\n }\n else {\n if (lineNumber < lines.length) {\n lineText = lines[lineNumber];\n wordRanges = wordenize(lineText, wordDefinition);\n wordRangesIdx = 0;\n lineNumber += 1;\n }\n else {\n break;\n }\n }\n }\n }\n };\n }\n getLineWords(lineNumber, wordDefinition) {\n const content = this._lines[lineNumber - 1];\n const ranges = this._wordenize(content, wordDefinition);\n const words = [];\n for (const range of ranges) {\n words.push({\n word: content.substring(range.start, range.end),\n startColumn: range.start + 1,\n endColumn: range.end + 1\n });\n }\n return words;\n }\n _wordenize(content, wordDefinition) {\n const result = [];\n let match;\n wordDefinition.lastIndex = 0; // reset lastIndex just to be sure\n while (match = wordDefinition.exec(content)) {\n if (match[0].length === 0) {\n // it did match the empty string\n break;\n }\n result.push({ start: match.index, end: match.index + match[0].length });\n }\n return result;\n }\n getValueInRange(range) {\n range = this._validateRange(range);\n if (range.startLineNumber === range.endLineNumber) {\n return this._lines[range.startLineNumber - 1].substring(range.startColumn - 1, range.endColumn - 1);\n }\n const lineEnding = this._eol;\n const startLineIndex = range.startLineNumber - 1;\n const endLineIndex = range.endLineNumber - 1;\n const resultLines = [];\n resultLines.push(this._lines[startLineIndex].substring(range.startColumn - 1));\n for (let i = startLineIndex + 1; i < endLineIndex; i++) {\n resultLines.push(this._lines[i]);\n }\n resultLines.push(this._lines[endLineIndex].substring(0, range.endColumn - 1));\n return resultLines.join(lineEnding);\n }\n offsetAt(position) {\n position = this._validatePosition(position);\n this._ensureLineStarts();\n return this._lineStarts.getPrefixSum(position.lineNumber - 2) + (position.column - 1);\n }\n positionAt(offset) {\n offset = Math.floor(offset);\n offset = Math.max(0, offset);\n this._ensureLineStarts();\n const out = this._lineStarts.getIndexOf(offset);\n const lineLength = this._lines[out.index].length;\n // Ensure we return a valid position\n return {\n lineNumber: 1 + out.index,\n column: 1 + Math.min(out.remainder, lineLength)\n };\n }\n _validateRange(range) {\n const start = this._validatePosition({ lineNumber: range.startLineNumber, column: range.startColumn });\n const end = this._validatePosition({ lineNumber: range.endLineNumber, column: range.endColumn });\n if (start.lineNumber !== range.startLineNumber\n || start.column !== range.startColumn\n || end.lineNumber !== range.endLineNumber\n || end.column !== range.endColumn) {\n return {\n startLineNumber: start.lineNumber,\n startColumn: start.column,\n endLineNumber: end.lineNumber,\n endColumn: end.column\n };\n }\n return range;\n }\n _validatePosition(position) {\n if (!Position.isIPosition(position)) {\n throw new Error('bad position');\n }\n let { lineNumber, column } = position;\n let hasChanged = false;\n if (lineNumber < 1) {\n lineNumber = 1;\n column = 1;\n hasChanged = true;\n }\n else if (lineNumber > this._lines.length) {\n lineNumber = this._lines.length;\n column = this._lines[lineNumber - 1].length + 1;\n hasChanged = true;\n }\n else {\n const maxCharacter = this._lines[lineNumber - 1].length + 1;\n if (column < 1) {\n column = 1;\n hasChanged = true;\n }\n else if (column > maxCharacter) {\n column = maxCharacter;\n hasChanged = true;\n }\n }\n if (!hasChanged) {\n return position;\n }\n else {\n return { lineNumber, column };\n }\n }\n}\n/**\n * @internal\n */\nexport class EditorSimpleWorker {\n constructor(host, foreignModuleFactory) {\n this._host = host;\n this._models = Object.create(null);\n this._foreignModuleFactory = foreignModuleFactory;\n this._foreignModule = null;\n }\n dispose() {\n this._models = Object.create(null);\n }\n _getModel(uri) {\n return this._models[uri];\n }\n _getModels() {\n const all = [];\n Object.keys(this._models).forEach((key) => all.push(this._models[key]));\n return all;\n }\n acceptNewModel(data) {\n this._models[data.url] = new MirrorModel(URI.parse(data.url), data.lines, data.EOL, data.versionId);\n }\n acceptModelChanged(strURL, e) {\n if (!this._models[strURL]) {\n return;\n }\n const model = this._models[strURL];\n model.onEvents(e);\n }\n acceptRemovedModel(strURL) {\n if (!this._models[strURL]) {\n return;\n }\n delete this._models[strURL];\n }\n async computeUnicodeHighlights(url, options, range) {\n const model = this._getModel(url);\n if (!model) {\n return { ranges: [], hasMore: false, ambiguousCharacterCount: 0, invisibleCharacterCount: 0, nonBasicAsciiCharacterCount: 0 };\n }\n return UnicodeTextModelHighlighter.computeUnicodeHighlights(model, options, range);\n }\n async findSectionHeaders(url, options) {\n const model = this._getModel(url);\n if (!model) {\n return [];\n }\n return findSectionHeaders(model, options);\n }\n // ---- BEGIN diff --------------------------------------------------------------------------\n async computeDiff(originalUrl, modifiedUrl, options, algorithm) {\n const original = this._getModel(originalUrl);\n const modified = this._getModel(modifiedUrl);\n if (!original || !modified) {\n return null;\n }\n const result = EditorSimpleWorker.computeDiff(original, modified, options, algorithm);\n return result;\n }\n static computeDiff(originalTextModel, modifiedTextModel, options, algorithm) {\n const diffAlgorithm = algorithm === 'advanced' ? linesDiffComputers.getDefault() : linesDiffComputers.getLegacy();\n const originalLines = originalTextModel.getLinesContent();\n const modifiedLines = modifiedTextModel.getLinesContent();\n const result = diffAlgorithm.computeDiff(originalLines, modifiedLines, options);\n const identical = (result.changes.length > 0 ? false : this._modelsAreIdentical(originalTextModel, modifiedTextModel));\n function getLineChanges(changes) {\n return changes.map(m => {\n var _a;\n return ([m.original.startLineNumber, m.original.endLineNumberExclusive, m.modified.startLineNumber, m.modified.endLineNumberExclusive, (_a = m.innerChanges) === null || _a === void 0 ? void 0 : _a.map(m => [\n m.originalRange.startLineNumber,\n m.originalRange.startColumn,\n m.originalRange.endLineNumber,\n m.originalRange.endColumn,\n m.modifiedRange.startLineNumber,\n m.modifiedRange.startColumn,\n m.modifiedRange.endLineNumber,\n m.modifiedRange.endColumn,\n ])]);\n });\n }\n return {\n identical,\n quitEarly: result.hitTimeout,\n changes: getLineChanges(result.changes),\n moves: result.moves.map(m => ([\n m.lineRangeMapping.original.startLineNumber,\n m.lineRangeMapping.original.endLineNumberExclusive,\n m.lineRangeMapping.modified.startLineNumber,\n m.lineRangeMapping.modified.endLineNumberExclusive,\n getLineChanges(m.changes)\n ])),\n };\n }\n static _modelsAreIdentical(original, modified) {\n const originalLineCount = original.getLineCount();\n const modifiedLineCount = modified.getLineCount();\n if (originalLineCount !== modifiedLineCount) {\n return false;\n }\n for (let line = 1; line <= originalLineCount; line++) {\n const originalLine = original.getLineContent(line);\n const modifiedLine = modified.getLineContent(line);\n if (originalLine !== modifiedLine) {\n return false;\n }\n }\n return true;\n }\n async computeMoreMinimalEdits(modelUrl, edits, pretty) {\n const model = this._getModel(modelUrl);\n if (!model) {\n return edits;\n }\n const result = [];\n let lastEol = undefined;\n edits = edits.slice(0).sort((a, b) => {\n if (a.range && b.range) {\n return Range.compareRangesUsingStarts(a.range, b.range);\n }\n // eol only changes should go to the end\n const aRng = a.range ? 0 : 1;\n const bRng = b.range ? 0 : 1;\n return aRng - bRng;\n });\n // merge adjacent edits\n let writeIndex = 0;\n for (let readIndex = 1; readIndex < edits.length; readIndex++) {\n if (Range.getEndPosition(edits[writeIndex].range).equals(Range.getStartPosition(edits[readIndex].range))) {\n edits[writeIndex].range = Range.fromPositions(Range.getStartPosition(edits[writeIndex].range), Range.getEndPosition(edits[readIndex].range));\n edits[writeIndex].text += edits[readIndex].text;\n }\n else {\n writeIndex++;\n edits[writeIndex] = edits[readIndex];\n }\n }\n edits.length = writeIndex + 1;\n for (let { range, text, eol } of edits) {\n if (typeof eol === 'number') {\n lastEol = eol;\n }\n if (Range.isEmpty(range) && !text) {\n // empty change\n continue;\n }\n const original = model.getValueInRange(range);\n text = text.replace(/\\r\\n|\\n|\\r/g, model.eol);\n if (original === text) {\n // noop\n continue;\n }\n // make sure diff won't take too long\n if (Math.max(text.length, original.length) > EditorSimpleWorker._diffLimit) {\n result.push({ range, text });\n continue;\n }\n // compute diff between original and edit.text\n const changes = stringDiff(original, text, pretty);\n const editOffset = model.offsetAt(Range.lift(range).getStartPosition());\n for (const change of changes) {\n const start = model.positionAt(editOffset + change.originalStart);\n const end = model.positionAt(editOffset + change.originalStart + change.originalLength);\n const newEdit = {\n text: text.substr(change.modifiedStart, change.modifiedLength),\n range: { startLineNumber: start.lineNumber, startColumn: start.column, endLineNumber: end.lineNumber, endColumn: end.column }\n };\n if (model.getValueInRange(newEdit.range) !== newEdit.text) {\n result.push(newEdit);\n }\n }\n }\n if (typeof lastEol === 'number') {\n result.push({ eol: lastEol, text: '', range: { startLineNumber: 0, startColumn: 0, endLineNumber: 0, endColumn: 0 } });\n }\n return result;\n }\n // ---- END minimal edits ---------------------------------------------------------------\n async computeLinks(modelUrl) {\n const model = this._getModel(modelUrl);\n if (!model) {\n return null;\n }\n return computeLinks(model);\n }\n // --- BEGIN default document colors -----------------------------------------------------------\n async computeDefaultDocumentColors(modelUrl) {\n const model = this._getModel(modelUrl);\n if (!model) {\n return null;\n }\n return computeDefaultDocumentColors(model);\n }\n async textualSuggest(modelUrls, leadingWord, wordDef, wordDefFlags) {\n const sw = new StopWatch();\n const wordDefRegExp = new RegExp(wordDef, wordDefFlags);\n const seen = new Set();\n outer: for (const url of modelUrls) {\n const model = this._getModel(url);\n if (!model) {\n continue;\n }\n for (const word of model.words(wordDefRegExp)) {\n if (word === leadingWord || !isNaN(Number(word))) {\n continue;\n }\n seen.add(word);\n if (seen.size > EditorSimpleWorker._suggestionsLimit) {\n break outer;\n }\n }\n }\n return { words: Array.from(seen), duration: sw.elapsed() };\n }\n // ---- END suggest --------------------------------------------------------------------------\n //#region -- word ranges --\n async computeWordRanges(modelUrl, range, wordDef, wordDefFlags) {\n const model = this._getModel(modelUrl);\n if (!model) {\n return Object.create(null);\n }\n const wordDefRegExp = new RegExp(wordDef, wordDefFlags);\n const result = Object.create(null);\n for (let line = range.startLineNumber; line < range.endLineNumber; line++) {\n const words = model.getLineWords(line, wordDefRegExp);\n for (const word of words) {\n if (!isNaN(Number(word.word))) {\n continue;\n }\n let array = result[word.word];\n if (!array) {\n array = [];\n result[word.word] = array;\n }\n array.push({\n startLineNumber: line,\n startColumn: word.startColumn,\n endLineNumber: line,\n endColumn: word.endColumn\n });\n }\n }\n return result;\n }\n //#endregion\n async navigateValueSet(modelUrl, range, up, wordDef, wordDefFlags) {\n const model = this._getModel(modelUrl);\n if (!model) {\n return null;\n }\n const wordDefRegExp = new RegExp(wordDef, wordDefFlags);\n if (range.startColumn === range.endColumn) {\n range = {\n startLineNumber: range.startLineNumber,\n startColumn: range.startColumn,\n endLineNumber: range.endLineNumber,\n endColumn: range.endColumn + 1\n };\n }\n const selectionText = model.getValueInRange(range);\n const wordRange = model.getWordAtPosition({ lineNumber: range.startLineNumber, column: range.startColumn }, wordDefRegExp);\n if (!wordRange) {\n return null;\n }\n const word = model.getValueInRange(wordRange);\n const result = BasicInplaceReplace.INSTANCE.navigateValueSet(range, selectionText, wordRange, word, up);\n return result;\n }\n // ---- BEGIN foreign module support --------------------------------------------------------------------------\n loadForeignModule(moduleId, createData, foreignHostMethods) {\n const proxyMethodRequest = (method, args) => {\n return this._host.fhr(method, args);\n };\n const foreignHost = createProxyObject(foreignHostMethods, proxyMethodRequest);\n const ctx = {\n host: foreignHost,\n getMirrorModels: () => {\n return this._getModels();\n }\n };\n if (this._foreignModuleFactory) {\n this._foreignModule = this._foreignModuleFactory(ctx, createData);\n // static foreing module\n return Promise.resolve(getAllMethodNames(this._foreignModule));\n }\n // ESM-comment-begin\n // \t\treturn new Promise((resolve, reject) => {\n // \t\t\trequire([moduleId], (foreignModule: { create: IForeignModuleFactory }) => {\n // \t\t\t\tthis._foreignModule = foreignModule.create(ctx, createData);\n // \n // \t\t\t\tresolve(getAllMethodNames(this._foreignModule));\n // \n // \t\t\t}, reject);\n // \t\t});\n // ESM-comment-end\n // ESM-uncomment-begin\n return Promise.reject(new Error(`Unexpected usage`));\n // ESM-uncomment-end\n }\n // foreign method request\n fmr(method, args) {\n if (!this._foreignModule || typeof this._foreignModule[method] !== 'function') {\n return Promise.reject(new Error('Missing requestHandler or method: ' + method));\n }\n try {\n return Promise.resolve(this._foreignModule[method].apply(this._foreignModule, args));\n }\n catch (e) {\n return Promise.reject(e);\n }\n }\n}\n// ---- END diff --------------------------------------------------------------------------\n// ---- BEGIN minimal edits ---------------------------------------------------------------\nEditorSimpleWorker._diffLimit = 100000;\n// ---- BEGIN suggest --------------------------------------------------------------------------\nEditorSimpleWorker._suggestionsLimit = 10000;\n/**\n * Called on the worker side\n * @internal\n */\nexport function create(host) {\n return new EditorSimpleWorker(host, null);\n}\nif (typeof importScripts === 'function') {\n // Running in a web worker\n globalThis.monaco = createMonacoBaseAPI();\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 { DiffChange } from './diffChange.js';\nimport { stringHash } from '../hash.js';\nexport class StringDiffSequence {\n constructor(source) {\n this.source = source;\n }\n getElements() {\n const source = this.source;\n const characters = new Int32Array(source.length);\n for (let i = 0, len = source.length; i < len; i++) {\n characters[i] = source.charCodeAt(i);\n }\n return characters;\n }\n}\nexport function stringDiff(original, modified, pretty) {\n return new LcsDiff(new StringDiffSequence(original), new StringDiffSequence(modified)).ComputeDiff(pretty).changes;\n}\n//\n// The code below has been ported from a C# implementation in VS\n//\nclass Debug {\n static Assert(condition, message) {\n if (!condition) {\n throw new Error(message);\n }\n }\n}\nclass MyArray {\n /**\n * Copies a range of elements from an Array starting at the specified source index and pastes\n * them to another Array starting at the specified destination index. The length and the indexes\n * are specified as 64-bit integers.\n * sourceArray:\n *\t\tThe Array that contains the data to copy.\n * sourceIndex:\n *\t\tA 64-bit integer that represents the index in the sourceArray at which copying begins.\n * destinationArray:\n *\t\tThe Array that receives the data.\n * destinationIndex:\n *\t\tA 64-bit integer that represents the index in the destinationArray at which storing begins.\n * length:\n *\t\tA 64-bit integer that represents the number of elements to copy.\n */\n static Copy(sourceArray, sourceIndex, destinationArray, destinationIndex, length) {\n for (let i = 0; i < length; i++) {\n destinationArray[destinationIndex + i] = sourceArray[sourceIndex + i];\n }\n }\n static Copy2(sourceArray, sourceIndex, destinationArray, destinationIndex, length) {\n for (let i = 0; i < length; i++) {\n destinationArray[destinationIndex + i] = sourceArray[sourceIndex + i];\n }\n }\n}\n/**\n * A utility class which helps to create the set of DiffChanges from\n * a difference operation. This class accepts original DiffElements and\n * modified DiffElements that are involved in a particular change. The\n * MarkNextChange() method can be called to mark the separation between\n * distinct changes. At the end, the Changes property can be called to retrieve\n * the constructed changes.\n */\nclass DiffChangeHelper {\n /**\n * Constructs a new DiffChangeHelper for the given DiffSequences.\n */\n constructor() {\n this.m_changes = [];\n this.m_originalStart = 1073741824 /* Constants.MAX_SAFE_SMALL_INTEGER */;\n this.m_modifiedStart = 1073741824 /* Constants.MAX_SAFE_SMALL_INTEGER */;\n this.m_originalCount = 0;\n this.m_modifiedCount = 0;\n }\n /**\n * Marks the beginning of the next change in the set of differences.\n */\n MarkNextChange() {\n // Only add to the list if there is something to add\n if (this.m_originalCount > 0 || this.m_modifiedCount > 0) {\n // Add the new change to our list\n this.m_changes.push(new DiffChange(this.m_originalStart, this.m_originalCount, this.m_modifiedStart, this.m_modifiedCount));\n }\n // Reset for the next change\n this.m_originalCount = 0;\n this.m_modifiedCount = 0;\n this.m_originalStart = 1073741824 /* Constants.MAX_SAFE_SMALL_INTEGER */;\n this.m_modifiedStart = 1073741824 /* Constants.MAX_SAFE_SMALL_INTEGER */;\n }\n /**\n * Adds the original element at the given position to the elements\n * affected by the current change. The modified index gives context\n * to the change position with respect to the original sequence.\n * @param originalIndex The index of the original element to add.\n * @param modifiedIndex The index of the modified element that provides corresponding position in the modified sequence.\n */\n AddOriginalElement(originalIndex, modifiedIndex) {\n // The 'true' start index is the smallest of the ones we've seen\n this.m_originalStart = Math.min(this.m_originalStart, originalIndex);\n this.m_modifiedStart = Math.min(this.m_modifiedStart, modifiedIndex);\n this.m_originalCount++;\n }\n /**\n * Adds the modified element at the given position to the elements\n * affected by the current change. The original index gives context\n * to the change position with respect to the modified sequence.\n * @param originalIndex The index of the original element that provides corresponding position in the original sequence.\n * @param modifiedIndex The index of the modified element to add.\n */\n AddModifiedElement(originalIndex, modifiedIndex) {\n // The 'true' start index is the smallest of the ones we've seen\n this.m_originalStart = Math.min(this.m_originalStart, originalIndex);\n this.m_modifiedStart = Math.min(this.m_modifiedStart, modifiedIndex);\n this.m_modifiedCount++;\n }\n /**\n * Retrieves all of the changes marked by the class.\n */\n getChanges() {\n if (this.m_originalCount > 0 || this.m_modifiedCount > 0) {\n // Finish up on whatever is left\n this.MarkNextChange();\n }\n return this.m_changes;\n }\n /**\n * Retrieves all of the changes marked by the class in the reverse order\n */\n getReverseChanges() {\n if (this.m_originalCount > 0 || this.m_modifiedCount > 0) {\n // Finish up on whatever is left\n this.MarkNextChange();\n }\n this.m_changes.reverse();\n return this.m_changes;\n }\n}\n/**\n * An implementation of the difference algorithm described in\n * \"An O(ND) Difference Algorithm and its variations\" by Eugene W. Myers\n */\nexport class LcsDiff {\n /**\n * Constructs the DiffFinder\n */\n constructor(originalSequence, modifiedSequence, continueProcessingPredicate = null) {\n this.ContinueProcessingPredicate = continueProcessingPredicate;\n this._originalSequence = originalSequence;\n this._modifiedSequence = modifiedSequence;\n const [originalStringElements, originalElementsOrHash, originalHasStrings] = LcsDiff._getElements(originalSequence);\n const [modifiedStringElements, modifiedElementsOrHash, modifiedHasStrings] = LcsDiff._getElements(modifiedSequence);\n this._hasStrings = (originalHasStrings && modifiedHasStrings);\n this._originalStringElements = originalStringElements;\n this._originalElementsOrHash = originalElementsOrHash;\n this._modifiedStringElements = modifiedStringElements;\n this._modifiedElementsOrHash = modifiedElementsOrHash;\n this.m_forwardHistory = [];\n this.m_reverseHistory = [];\n }\n static _isStringArray(arr) {\n return (arr.length > 0 && typeof arr[0] === 'string');\n }\n static _getElements(sequence) {\n const elements = sequence.getElements();\n if (LcsDiff._isStringArray(elements)) {\n const hashes = new Int32Array(elements.length);\n for (let i = 0, len = elements.length; i < len; i++) {\n hashes[i] = stringHash(elements[i], 0);\n }\n return [elements, hashes, true];\n }\n if (elements instanceof Int32Array) {\n return [[], elements, false];\n }\n return [[], new Int32Array(elements), false];\n }\n ElementsAreEqual(originalIndex, newIndex) {\n if (this._originalElementsOrHash[originalIndex] !== this._modifiedElementsOrHash[newIndex]) {\n return false;\n }\n return (this._hasStrings ? this._originalStringElements[originalIndex] === this._modifiedStringElements[newIndex] : true);\n }\n ElementsAreStrictEqual(originalIndex, newIndex) {\n if (!this.ElementsAreEqual(originalIndex, newIndex)) {\n return false;\n }\n const originalElement = LcsDiff._getStrictElement(this._originalSequence, originalIndex);\n const modifiedElement = LcsDiff._getStrictElement(this._modifiedSequence, newIndex);\n return (originalElement === modifiedElement);\n }\n static _getStrictElement(sequence, index) {\n if (typeof sequence.getStrictElement === 'function') {\n return sequence.getStrictElement(index);\n }\n return null;\n }\n OriginalElementsAreEqual(index1, index2) {\n if (this._originalElementsOrHash[index1] !== this._originalElementsOrHash[index2]) {\n return false;\n }\n return (this._hasStrings ? this._originalStringElements[index1] === this._originalStringElements[index2] : true);\n }\n ModifiedElementsAreEqual(index1, index2) {\n if (this._modifiedElementsOrHash[index1] !== this._modifiedElementsOrHash[index2]) {\n return false;\n }\n return (this._hasStrings ? this._modifiedStringElements[index1] === this._modifiedStringElements[index2] : true);\n }\n ComputeDiff(pretty) {\n return this._ComputeDiff(0, this._originalElementsOrHash.length - 1, 0, this._modifiedElementsOrHash.length - 1, pretty);\n }\n /**\n * Computes the differences between the original and modified input\n * sequences on the bounded range.\n * @returns An array of the differences between the two input sequences.\n */\n _ComputeDiff(originalStart, originalEnd, modifiedStart, modifiedEnd, pretty) {\n const quitEarlyArr = [false];\n let changes = this.ComputeDiffRecursive(originalStart, originalEnd, modifiedStart, modifiedEnd, quitEarlyArr);\n if (pretty) {\n // We have to clean up the computed diff to be more intuitive\n // but it turns out this cannot be done correctly until the entire set\n // of diffs have been computed\n changes = this.PrettifyChanges(changes);\n }\n return {\n quitEarly: quitEarlyArr[0],\n changes: changes\n };\n }\n /**\n * Private helper method which computes the differences on the bounded range\n * recursively.\n * @returns An array of the differences between the two input sequences.\n */\n ComputeDiffRecursive(originalStart, originalEnd, modifiedStart, modifiedEnd, quitEarlyArr) {\n quitEarlyArr[0] = false;\n // Find the start of the differences\n while (originalStart <= originalEnd && modifiedStart <= modifiedEnd && this.ElementsAreEqual(originalStart, modifiedStart)) {\n originalStart++;\n modifiedStart++;\n }\n // Find the end of the differences\n while (originalEnd >= originalStart && modifiedEnd >= modifiedStart && this.ElementsAreEqual(originalEnd, modifiedEnd)) {\n originalEnd--;\n modifiedEnd--;\n }\n // In the special case where we either have all insertions or all deletions or the sequences are identical\n if (originalStart > originalEnd || modifiedStart > modifiedEnd) {\n let changes;\n if (modifiedStart <= modifiedEnd) {\n Debug.Assert(originalStart === originalEnd + 1, 'originalStart should only be one more than originalEnd');\n // All insertions\n changes = [\n new DiffChange(originalStart, 0, modifiedStart, modifiedEnd - modifiedStart + 1)\n ];\n }\n else if (originalStart <= originalEnd) {\n Debug.Assert(modifiedStart === modifiedEnd + 1, 'modifiedStart should only be one more than modifiedEnd');\n // All deletions\n changes = [\n new DiffChange(originalStart, originalEnd - originalStart + 1, modifiedStart, 0)\n ];\n }\n else {\n Debug.Assert(originalStart === originalEnd + 1, 'originalStart should only be one more than originalEnd');\n Debug.Assert(modifiedStart === modifiedEnd + 1, 'modifiedStart should only be one more than modifiedEnd');\n // Identical sequences - No differences\n changes = [];\n }\n return changes;\n }\n // This problem can be solved using the Divide-And-Conquer technique.\n const midOriginalArr = [0];\n const midModifiedArr = [0];\n const result = this.ComputeRecursionPoint(originalStart, originalEnd, modifiedStart, modifiedEnd, midOriginalArr, midModifiedArr, quitEarlyArr);\n const midOriginal = midOriginalArr[0];\n const midModified = midModifiedArr[0];\n if (result !== null) {\n // Result is not-null when there was enough memory to compute the changes while\n // searching for the recursion point\n return result;\n }\n else if (!quitEarlyArr[0]) {\n // We can break the problem down recursively by finding the changes in the\n // First Half: (originalStart, modifiedStart) to (midOriginal, midModified)\n // Second Half: (midOriginal + 1, minModified + 1) to (originalEnd, modifiedEnd)\n // NOTE: ComputeDiff() is inclusive, therefore the second range starts on the next point\n const leftChanges = this.ComputeDiffRecursive(originalStart, midOriginal, modifiedStart, midModified, quitEarlyArr);\n let rightChanges = [];\n if (!quitEarlyArr[0]) {\n rightChanges = this.ComputeDiffRecursive(midOriginal + 1, originalEnd, midModified + 1, modifiedEnd, quitEarlyArr);\n }\n else {\n // We didn't have time to finish the first half, so we don't have time to compute this half.\n // Consider the entire rest of the sequence different.\n rightChanges = [\n new DiffChange(midOriginal + 1, originalEnd - (midOriginal + 1) + 1, midModified + 1, modifiedEnd - (midModified + 1) + 1)\n ];\n }\n return this.ConcatenateChanges(leftChanges, rightChanges);\n }\n // If we hit here, we quit early, and so can't return anything meaningful\n return [\n new DiffChange(originalStart, originalEnd - originalStart + 1, modifiedStart, modifiedEnd - modifiedStart + 1)\n ];\n }\n WALKTRACE(diagonalForwardBase, diagonalForwardStart, diagonalForwardEnd, diagonalForwardOffset, diagonalReverseBase, diagonalReverseStart, diagonalReverseEnd, diagonalReverseOffset, forwardPoints, reversePoints, originalIndex, originalEnd, midOriginalArr, modifiedIndex, modifiedEnd, midModifiedArr, deltaIsEven, quitEarlyArr) {\n let forwardChanges = null;\n let reverseChanges = null;\n // First, walk backward through the forward diagonals history\n let changeHelper = new DiffChangeHelper();\n let diagonalMin = diagonalForwardStart;\n let diagonalMax = diagonalForwardEnd;\n let diagonalRelative = (midOriginalArr[0] - midModifiedArr[0]) - diagonalForwardOffset;\n let lastOriginalIndex = -1073741824 /* Constants.MIN_SAFE_SMALL_INTEGER */;\n let historyIndex = this.m_forwardHistory.length - 1;\n do {\n // Get the diagonal index from the relative diagonal number\n const diagonal = diagonalRelative + diagonalForwardBase;\n // Figure out where we came from\n if (diagonal === diagonalMin || (diagonal < diagonalMax && forwardPoints[diagonal - 1] < forwardPoints[diagonal + 1])) {\n // Vertical line (the element is an insert)\n originalIndex = forwardPoints[diagonal + 1];\n modifiedIndex = originalIndex - diagonalRelative - diagonalForwardOffset;\n if (originalIndex < lastOriginalIndex) {\n changeHelper.MarkNextChange();\n }\n lastOriginalIndex = originalIndex;\n changeHelper.AddModifiedElement(originalIndex + 1, modifiedIndex);\n diagonalRelative = (diagonal + 1) - diagonalForwardBase; //Setup for the next iteration\n }\n else {\n // Horizontal line (the element is a deletion)\n originalIndex = forwardPoints[diagonal - 1] + 1;\n modifiedIndex = originalIndex - diagonalRelative - diagonalForwardOffset;\n if (originalIndex < lastOriginalIndex) {\n changeHelper.MarkNextChange();\n }\n lastOriginalIndex = originalIndex - 1;\n changeHelper.AddOriginalElement(originalIndex, modifiedIndex + 1);\n diagonalRelative = (diagonal - 1) - diagonalForwardBase; //Setup for the next iteration\n }\n if (historyIndex >= 0) {\n forwardPoints = this.m_forwardHistory[historyIndex];\n diagonalForwardBase = forwardPoints[0]; //We stored this in the first spot\n diagonalMin = 1;\n diagonalMax = forwardPoints.length - 1;\n }\n } while (--historyIndex >= -1);\n // Ironically, we get the forward changes as the reverse of the\n // order we added them since we technically added them backwards\n forwardChanges = changeHelper.getReverseChanges();\n if (quitEarlyArr[0]) {\n // TODO: Calculate a partial from the reverse diagonals.\n // For now, just assume everything after the midOriginal/midModified point is a diff\n let originalStartPoint = midOriginalArr[0] + 1;\n let modifiedStartPoint = midModifiedArr[0] + 1;\n if (forwardChanges !== null && forwardChanges.length > 0) {\n const lastForwardChange = forwardChanges[forwardChanges.length - 1];\n originalStartPoint = Math.max(originalStartPoint, lastForwardChange.getOriginalEnd());\n modifiedStartPoint = Math.max(modifiedStartPoint, lastForwardChange.getModifiedEnd());\n }\n reverseChanges = [\n new DiffChange(originalStartPoint, originalEnd - originalStartPoint + 1, modifiedStartPoint, modifiedEnd - modifiedStartPoint + 1)\n ];\n }\n else {\n // Now walk backward through the reverse diagonals history\n changeHelper = new DiffChangeHelper();\n diagonalMin = diagonalReverseStart;\n diagonalMax = diagonalReverseEnd;\n diagonalRelative = (midOriginalArr[0] - midModifiedArr[0]) - diagonalReverseOffset;\n lastOriginalIndex = 1073741824 /* Constants.MAX_SAFE_SMALL_INTEGER */;\n historyIndex = (deltaIsEven) ? this.m_reverseHistory.length - 1 : this.m_reverseHistory.length - 2;\n do {\n // Get the diagonal index from the relative diagonal number\n const diagonal = diagonalRelative + diagonalReverseBase;\n // Figure out where we came from\n if (diagonal === diagonalMin || (diagonal < diagonalMax && reversePoints[diagonal - 1] >= reversePoints[diagonal + 1])) {\n // Horizontal line (the element is a deletion))\n originalIndex = reversePoints[diagonal + 1] - 1;\n modifiedIndex = originalIndex - diagonalRelative - diagonalReverseOffset;\n if (originalIndex > lastOriginalIndex) {\n changeHelper.MarkNextChange();\n }\n lastOriginalIndex = originalIndex + 1;\n changeHelper.AddOriginalElement(originalIndex + 1, modifiedIndex + 1);\n diagonalRelative = (diagonal + 1) - diagonalReverseBase; //Setup for the next iteration\n }\n else {\n // Vertical line (the element is an insertion)\n originalIndex = reversePoints[diagonal - 1];\n modifiedIndex = originalIndex - diagonalRelative - diagonalReverseOffset;\n if (originalIndex > lastOriginalIndex) {\n changeHelper.MarkNextChange();\n }\n lastOriginalIndex = originalIndex;\n changeHelper.AddModifiedElement(originalIndex + 1, modifiedIndex + 1);\n diagonalRelative = (diagonal - 1) - diagonalReverseBase; //Setup for the next iteration\n }\n if (historyIndex >= 0) {\n reversePoints = this.m_reverseHistory[historyIndex];\n diagonalReverseBase = reversePoints[0]; //We stored this in the first spot\n diagonalMin = 1;\n diagonalMax = reversePoints.length - 1;\n }\n } while (--historyIndex >= -1);\n // There are cases where the reverse history will find diffs that\n // are correct, but not intuitive, so we need shift them.\n reverseChanges = changeHelper.getChanges();\n }\n return this.ConcatenateChanges(forwardChanges, reverseChanges);\n }\n /**\n * Given the range to compute the diff on, this method finds the point:\n * (midOriginal, midModified)\n * that exists in the middle of the LCS of the two sequences and\n * is the point at which the LCS problem may be broken down recursively.\n * This method will try to keep the LCS trace in memory. If the LCS recursion\n * point is calculated and the full trace is available in memory, then this method\n * will return the change list.\n * @param originalStart The start bound of the original sequence range\n * @param originalEnd The end bound of the original sequence range\n * @param modifiedStart The start bound of the modified sequence range\n * @param modifiedEnd The end bound of the modified sequence range\n * @param midOriginal The middle point of the original sequence range\n * @param midModified The middle point of the modified sequence range\n * @returns The diff changes, if available, otherwise null\n */\n ComputeRecursionPoint(originalStart, originalEnd, modifiedStart, modifiedEnd, midOriginalArr, midModifiedArr, quitEarlyArr) {\n let originalIndex = 0, modifiedIndex = 0;\n let diagonalForwardStart = 0, diagonalForwardEnd = 0;\n let diagonalReverseStart = 0, diagonalReverseEnd = 0;\n // To traverse the edit graph and produce the proper LCS, our actual\n // start position is just outside the given boundary\n originalStart--;\n modifiedStart--;\n // We set these up to make the compiler happy, but they will\n // be replaced before we return with the actual recursion point\n midOriginalArr[0] = 0;\n midModifiedArr[0] = 0;\n // Clear out the history\n this.m_forwardHistory = [];\n this.m_reverseHistory = [];\n // Each cell in the two arrays corresponds to a diagonal in the edit graph.\n // The integer value in the cell represents the originalIndex of the furthest\n // reaching point found so far that ends in that diagonal.\n // The modifiedIndex can be computed mathematically from the originalIndex and the diagonal number.\n const maxDifferences = (originalEnd - originalStart) + (modifiedEnd - modifiedStart);\n const numDiagonals = maxDifferences + 1;\n const forwardPoints = new Int32Array(numDiagonals);\n const reversePoints = new Int32Array(numDiagonals);\n // diagonalForwardBase: Index into forwardPoints of the diagonal which passes through (originalStart, modifiedStart)\n // diagonalReverseBase: Index into reversePoints of the diagonal which passes through (originalEnd, modifiedEnd)\n const diagonalForwardBase = (modifiedEnd - modifiedStart);\n const diagonalReverseBase = (originalEnd - originalStart);\n // diagonalForwardOffset: Geometric offset which allows modifiedIndex to be computed from originalIndex and the\n // diagonal number (relative to diagonalForwardBase)\n // diagonalReverseOffset: Geometric offset which allows modifiedIndex to be computed from originalIndex and the\n // diagonal number (relative to diagonalReverseBase)\n const diagonalForwardOffset = (originalStart - modifiedStart);\n const diagonalReverseOffset = (originalEnd - modifiedEnd);\n // delta: The difference between the end diagonal and the start diagonal. This is used to relate diagonal numbers\n // relative to the start diagonal with diagonal numbers relative to the end diagonal.\n // The Even/Oddn-ness of this delta is important for determining when we should check for overlap\n const delta = diagonalReverseBase - diagonalForwardBase;\n const deltaIsEven = (delta % 2 === 0);\n // Here we set up the start and end points as the furthest points found so far\n // in both the forward and reverse directions, respectively\n forwardPoints[diagonalForwardBase] = originalStart;\n reversePoints[diagonalReverseBase] = originalEnd;\n // Remember if we quit early, and thus need to do a best-effort result instead of a real result.\n quitEarlyArr[0] = false;\n // A couple of points:\n // --With this method, we iterate on the number of differences between the two sequences.\n // The more differences there actually are, the longer this will take.\n // --Also, as the number of differences increases, we have to search on diagonals further\n // away from the reference diagonal (which is diagonalForwardBase for forward, diagonalReverseBase for reverse).\n // --We extend on even diagonals (relative to the reference diagonal) only when numDifferences\n // is even and odd diagonals only when numDifferences is odd.\n for (let numDifferences = 1; numDifferences <= (maxDifferences / 2) + 1; numDifferences++) {\n let furthestOriginalIndex = 0;\n let furthestModifiedIndex = 0;\n // Run the algorithm in the forward direction\n diagonalForwardStart = this.ClipDiagonalBound(diagonalForwardBase - numDifferences, numDifferences, diagonalForwardBase, numDiagonals);\n diagonalForwardEnd = this.ClipDiagonalBound(diagonalForwardBase + numDifferences, numDifferences, diagonalForwardBase, numDiagonals);\n for (let diagonal = diagonalForwardStart; diagonal <= diagonalForwardEnd; diagonal += 2) {\n // STEP 1: We extend the furthest reaching point in the present diagonal\n // by looking at the diagonals above and below and picking the one whose point\n // is further away from the start point (originalStart, modifiedStart)\n if (diagonal === diagonalForwardStart || (diagonal < diagonalForwardEnd && forwardPoints[diagonal - 1] < forwardPoints[diagonal + 1])) {\n originalIndex = forwardPoints[diagonal + 1];\n }\n else {\n originalIndex = forwardPoints[diagonal - 1] + 1;\n }\n modifiedIndex = originalIndex - (diagonal - diagonalForwardBase) - diagonalForwardOffset;\n // Save the current originalIndex so we can test for false overlap in step 3\n const tempOriginalIndex = originalIndex;\n // STEP 2: We can continue to extend the furthest reaching point in the present diagonal\n // so long as the elements are equal.\n while (originalIndex < originalEnd && modifiedIndex < modifiedEnd && this.ElementsAreEqual(originalIndex + 1, modifiedIndex + 1)) {\n originalIndex++;\n modifiedIndex++;\n }\n forwardPoints[diagonal] = originalIndex;\n if (originalIndex + modifiedIndex > furthestOriginalIndex + furthestModifiedIndex) {\n furthestOriginalIndex = originalIndex;\n furthestModifiedIndex = modifiedIndex;\n }\n // STEP 3: If delta is odd (overlap first happens on forward when delta is odd)\n // and diagonal is in the range of reverse diagonals computed for numDifferences-1\n // (the previous iteration; we haven't computed reverse diagonals for numDifferences yet)\n // then check for overlap.\n if (!deltaIsEven && Math.abs(diagonal - diagonalReverseBase) <= (numDifferences - 1)) {\n if (originalIndex >= reversePoints[diagonal]) {\n midOriginalArr[0] = originalIndex;\n midModifiedArr[0] = modifiedIndex;\n if (tempOriginalIndex <= reversePoints[diagonal] && 1447 /* LocalConstants.MaxDifferencesHistory */ > 0 && numDifferences <= (1447 /* LocalConstants.MaxDifferencesHistory */ + 1)) {\n // BINGO! We overlapped, and we have the full trace in memory!\n return this.WALKTRACE(diagonalForwardBase, diagonalForwardStart, diagonalForwardEnd, diagonalForwardOffset, diagonalReverseBase, diagonalReverseStart, diagonalReverseEnd, diagonalReverseOffset, forwardPoints, reversePoints, originalIndex, originalEnd, midOriginalArr, modifiedIndex, modifiedEnd, midModifiedArr, deltaIsEven, quitEarlyArr);\n }\n else {\n // Either false overlap, or we didn't have enough memory for the full trace\n // Just return the recursion point\n return null;\n }\n }\n }\n }\n // Check to see if we should be quitting early, before moving on to the next iteration.\n const matchLengthOfLongest = ((furthestOriginalIndex - originalStart) + (furthestModifiedIndex - modifiedStart) - numDifferences) / 2;\n if (this.ContinueProcessingPredicate !== null && !this.ContinueProcessingPredicate(furthestOriginalIndex, matchLengthOfLongest)) {\n // We can't finish, so skip ahead to generating a result from what we have.\n quitEarlyArr[0] = true;\n // Use the furthest distance we got in the forward direction.\n midOriginalArr[0] = furthestOriginalIndex;\n midModifiedArr[0] = furthestModifiedIndex;\n if (matchLengthOfLongest > 0 && 1447 /* LocalConstants.MaxDifferencesHistory */ > 0 && numDifferences <= (1447 /* LocalConstants.MaxDifferencesHistory */ + 1)) {\n // Enough of the history is in memory to walk it backwards\n return this.WALKTRACE(diagonalForwardBase, diagonalForwardStart, diagonalForwardEnd, diagonalForwardOffset, diagonalReverseBase, diagonalReverseStart, diagonalReverseEnd, diagonalReverseOffset, forwardPoints, reversePoints, originalIndex, originalEnd, midOriginalArr, modifiedIndex, modifiedEnd, midModifiedArr, deltaIsEven, quitEarlyArr);\n }\n else {\n // We didn't actually remember enough of the history.\n //Since we are quitting the diff early, we need to shift back the originalStart and modified start\n //back into the boundary limits since we decremented their value above beyond the boundary limit.\n originalStart++;\n modifiedStart++;\n return [\n new DiffChange(originalStart, originalEnd - originalStart + 1, modifiedStart, modifiedEnd - modifiedStart + 1)\n ];\n }\n }\n // Run the algorithm in the reverse direction\n diagonalReverseStart = this.ClipDiagonalBound(diagonalReverseBase - numDifferences, numDifferences, diagonalReverseBase, numDiagonals);\n diagonalReverseEnd = this.ClipDiagonalBound(diagonalReverseBase + numDifferences, numDifferences, diagonalReverseBase, numDiagonals);\n for (let diagonal = diagonalReverseStart; diagonal <= diagonalReverseEnd; diagonal += 2) {\n // STEP 1: We extend the furthest reaching point in the present diagonal\n // by looking at the diagonals above and below and picking the one whose point\n // is further away from the start point (originalEnd, modifiedEnd)\n if (diagonal === diagonalReverseStart || (diagonal < diagonalReverseEnd && reversePoints[diagonal - 1] >= reversePoints[diagonal + 1])) {\n originalIndex = reversePoints[diagonal + 1] - 1;\n }\n else {\n originalIndex = reversePoints[diagonal - 1];\n }\n modifiedIndex = originalIndex - (diagonal - diagonalReverseBase) - diagonalReverseOffset;\n // Save the current originalIndex so we can test for false overlap\n const tempOriginalIndex = originalIndex;\n // STEP 2: We can continue to extend the furthest reaching point in the present diagonal\n // as long as the elements are equal.\n while (originalIndex > originalStart && modifiedIndex > modifiedStart && this.ElementsAreEqual(originalIndex, modifiedIndex)) {\n originalIndex--;\n modifiedIndex--;\n }\n reversePoints[diagonal] = originalIndex;\n // STEP 4: If delta is even (overlap first happens on reverse when delta is even)\n // and diagonal is in the range of forward diagonals computed for numDifferences\n // then check for overlap.\n if (deltaIsEven && Math.abs(diagonal - diagonalForwardBase) <= numDifferences) {\n if (originalIndex <= forwardPoints[diagonal]) {\n midOriginalArr[0] = originalIndex;\n midModifiedArr[0] = modifiedIndex;\n if (tempOriginalIndex >= forwardPoints[diagonal] && 1447 /* LocalConstants.MaxDifferencesHistory */ > 0 && numDifferences <= (1447 /* LocalConstants.MaxDifferencesHistory */ + 1)) {\n // BINGO! We overlapped, and we have the full trace in memory!\n return this.WALKTRACE(diagonalForwardBase, diagonalForwardStart, diagonalForwardEnd, diagonalForwardOffset, diagonalReverseBase, diagonalReverseStart, diagonalReverseEnd, diagonalReverseOffset, forwardPoints, reversePoints, originalIndex, originalEnd, midOriginalArr, modifiedIndex, modifiedEnd, midModifiedArr, deltaIsEven, quitEarlyArr);\n }\n else {\n // Either false overlap, or we didn't have enough memory for the full trace\n // Just return the recursion point\n return null;\n }\n }\n }\n }\n // Save current vectors to history before the next iteration\n if (numDifferences <= 1447 /* LocalConstants.MaxDifferencesHistory */) {\n // We are allocating space for one extra int, which we fill with\n // the index of the diagonal base index\n let temp = new Int32Array(diagonalForwardEnd - diagonalForwardStart + 2);\n temp[0] = diagonalForwardBase - diagonalForwardStart + 1;\n MyArray.Copy2(forwardPoints, diagonalForwardStart, temp, 1, diagonalForwardEnd - diagonalForwardStart + 1);\n this.m_forwardHistory.push(temp);\n temp = new Int32Array(diagonalReverseEnd - diagonalReverseStart + 2);\n temp[0] = diagonalReverseBase - diagonalReverseStart + 1;\n MyArray.Copy2(reversePoints, diagonalReverseStart, temp, 1, diagonalReverseEnd - diagonalReverseStart + 1);\n this.m_reverseHistory.push(temp);\n }\n }\n // If we got here, then we have the full trace in history. We just have to convert it to a change list\n // NOTE: This part is a bit messy\n return this.WALKTRACE(diagonalForwardBase, diagonalForwardStart, diagonalForwardEnd, diagonalForwardOffset, diagonalReverseBase, diagonalReverseStart, diagonalReverseEnd, diagonalReverseOffset, forwardPoints, reversePoints, originalIndex, originalEnd, midOriginalArr, modifiedIndex, modifiedEnd, midModifiedArr, deltaIsEven, quitEarlyArr);\n }\n /**\n * Shifts the given changes to provide a more intuitive diff.\n * While the first element in a diff matches the first element after the diff,\n * we shift the diff down.\n *\n * @param changes The list of changes to shift\n * @returns The shifted changes\n */\n PrettifyChanges(changes) {\n // Shift all the changes down first\n for (let i = 0; i < changes.length; i++) {\n const change = changes[i];\n const originalStop = (i < changes.length - 1) ? changes[i + 1].originalStart : this._originalElementsOrHash.length;\n const modifiedStop = (i < changes.length - 1) ? changes[i + 1].modifiedStart : this._modifiedElementsOrHash.length;\n const checkOriginal = change.originalLength > 0;\n const checkModified = change.modifiedLength > 0;\n while (change.originalStart + change.originalLength < originalStop\n && change.modifiedStart + change.modifiedLength < modifiedStop\n && (!checkOriginal || this.OriginalElementsAreEqual(change.originalStart, change.originalStart + change.originalLength))\n && (!checkModified || this.ModifiedElementsAreEqual(change.modifiedStart, change.modifiedStart + change.modifiedLength))) {\n const startStrictEqual = this.ElementsAreStrictEqual(change.originalStart, change.modifiedStart);\n const endStrictEqual = this.ElementsAreStrictEqual(change.originalStart + change.originalLength, change.modifiedStart + change.modifiedLength);\n if (endStrictEqual && !startStrictEqual) {\n // moving the change down would create an equal change, but the elements are not strict equal\n break;\n }\n change.originalStart++;\n change.modifiedStart++;\n }\n const mergedChangeArr = [null];\n if (i < changes.length - 1 && this.ChangesOverlap(changes[i], changes[i + 1], mergedChangeArr)) {\n changes[i] = mergedChangeArr[0];\n changes.splice(i + 1, 1);\n i--;\n continue;\n }\n }\n // Shift changes back up until we hit empty or whitespace-only lines\n for (let i = changes.length - 1; i >= 0; i--) {\n const change = changes[i];\n let originalStop = 0;\n let modifiedStop = 0;\n if (i > 0) {\n const prevChange = changes[i - 1];\n originalStop = prevChange.originalStart + prevChange.originalLength;\n modifiedStop = prevChange.modifiedStart + prevChange.modifiedLength;\n }\n const checkOriginal = change.originalLength > 0;\n const checkModified = change.modifiedLength > 0;\n let bestDelta = 0;\n let bestScore = this._boundaryScore(change.originalStart, change.originalLength, change.modifiedStart, change.modifiedLength);\n for (let delta = 1;; delta++) {\n const originalStart = change.originalStart - delta;\n const modifiedStart = change.modifiedStart - delta;\n if (originalStart < originalStop || modifiedStart < modifiedStop) {\n break;\n }\n if (checkOriginal && !this.OriginalElementsAreEqual(originalStart, originalStart + change.originalLength)) {\n break;\n }\n if (checkModified && !this.ModifiedElementsAreEqual(modifiedStart, modifiedStart + change.modifiedLength)) {\n break;\n }\n const touchingPreviousChange = (originalStart === originalStop && modifiedStart === modifiedStop);\n const score = ((touchingPreviousChange ? 5 : 0)\n + this._boundaryScore(originalStart, change.originalLength, modifiedStart, change.modifiedLength));\n if (score > bestScore) {\n bestScore = score;\n bestDelta = delta;\n }\n }\n change.originalStart -= bestDelta;\n change.modifiedStart -= bestDelta;\n const mergedChangeArr = [null];\n if (i > 0 && this.ChangesOverlap(changes[i - 1], changes[i], mergedChangeArr)) {\n changes[i - 1] = mergedChangeArr[0];\n changes.splice(i, 1);\n i++;\n continue;\n }\n }\n // There could be multiple longest common substrings.\n // Give preference to the ones containing longer lines\n if (this._hasStrings) {\n for (let i = 1, len = changes.length; i < len; i++) {\n const aChange = changes[i - 1];\n const bChange = changes[i];\n const matchedLength = bChange.originalStart - aChange.originalStart - aChange.originalLength;\n const aOriginalStart = aChange.originalStart;\n const bOriginalEnd = bChange.originalStart + bChange.originalLength;\n const abOriginalLength = bOriginalEnd - aOriginalStart;\n const aModifiedStart = aChange.modifiedStart;\n const bModifiedEnd = bChange.modifiedStart + bChange.modifiedLength;\n const abModifiedLength = bModifiedEnd - aModifiedStart;\n // Avoid wasting a lot of time with these searches\n if (matchedLength < 5 && abOriginalLength < 20 && abModifiedLength < 20) {\n const t = this._findBetterContiguousSequence(aOriginalStart, abOriginalLength, aModifiedStart, abModifiedLength, matchedLength);\n if (t) {\n const [originalMatchStart, modifiedMatchStart] = t;\n if (originalMatchStart !== aChange.originalStart + aChange.originalLength || modifiedMatchStart !== aChange.modifiedStart + aChange.modifiedLength) {\n // switch to another sequence that has a better score\n aChange.originalLength = originalMatchStart - aChange.originalStart;\n aChange.modifiedLength = modifiedMatchStart - aChange.modifiedStart;\n bChange.originalStart = originalMatchStart + matchedLength;\n bChange.modifiedStart = modifiedMatchStart + matchedLength;\n bChange.originalLength = bOriginalEnd - bChange.originalStart;\n bChange.modifiedLength = bModifiedEnd - bChange.modifiedStart;\n }\n }\n }\n }\n }\n return changes;\n }\n _findBetterContiguousSequence(originalStart, originalLength, modifiedStart, modifiedLength, desiredLength) {\n if (originalLength < desiredLength || modifiedLength < desiredLength) {\n return null;\n }\n const originalMax = originalStart + originalLength - desiredLength + 1;\n const modifiedMax = modifiedStart + modifiedLength - desiredLength + 1;\n let bestScore = 0;\n let bestOriginalStart = 0;\n let bestModifiedStart = 0;\n for (let i = originalStart; i < originalMax; i++) {\n for (let j = modifiedStart; j < modifiedMax; j++) {\n const score = this._contiguousSequenceScore(i, j, desiredLength);\n if (score > 0 && score > bestScore) {\n bestScore = score;\n bestOriginalStart = i;\n bestModifiedStart = j;\n }\n }\n }\n if (bestScore > 0) {\n return [bestOriginalStart, bestModifiedStart];\n }\n return null;\n }\n _contiguousSequenceScore(originalStart, modifiedStart, length) {\n let score = 0;\n for (let l = 0; l < length; l++) {\n if (!this.ElementsAreEqual(originalStart + l, modifiedStart + l)) {\n return 0;\n }\n score += this._originalStringElements[originalStart + l].length;\n }\n return score;\n }\n _OriginalIsBoundary(index) {\n if (index <= 0 || index >= this._originalElementsOrHash.length - 1) {\n return true;\n }\n return (this._hasStrings && /^\\s*$/.test(this._originalStringElements[index]));\n }\n _OriginalRegionIsBoundary(originalStart, originalLength) {\n if (this._OriginalIsBoundary(originalStart) || this._OriginalIsBoundary(originalStart - 1)) {\n return true;\n }\n if (originalLength > 0) {\n const originalEnd = originalStart + originalLength;\n if (this._OriginalIsBoundary(originalEnd - 1) || this._OriginalIsBoundary(originalEnd)) {\n return true;\n }\n }\n return false;\n }\n _ModifiedIsBoundary(index) {\n if (index <= 0 || index >= this._modifiedElementsOrHash.length - 1) {\n return true;\n }\n return (this._hasStrings && /^\\s*$/.test(this._modifiedStringElements[index]));\n }\n _ModifiedRegionIsBoundary(modifiedStart, modifiedLength) {\n if (this._ModifiedIsBoundary(modifiedStart) || this._ModifiedIsBoundary(modifiedStart - 1)) {\n return true;\n }\n if (modifiedLength > 0) {\n const modifiedEnd = modifiedStart + modifiedLength;\n if (this._ModifiedIsBoundary(modifiedEnd - 1) || this._ModifiedIsBoundary(modifiedEnd)) {\n return true;\n }\n }\n return false;\n }\n _boundaryScore(originalStart, originalLength, modifiedStart, modifiedLength) {\n const originalScore = (this._OriginalRegionIsBoundary(originalStart, originalLength) ? 1 : 0);\n const modifiedScore = (this._ModifiedRegionIsBoundary(modifiedStart, modifiedLength) ? 1 : 0);\n return (originalScore + modifiedScore);\n }\n /**\n * Concatenates the two input DiffChange lists and returns the resulting\n * list.\n * @param The left changes\n * @param The right changes\n * @returns The concatenated list\n */\n ConcatenateChanges(left, right) {\n const mergedChangeArr = [];\n if (left.length === 0 || right.length === 0) {\n return (right.length > 0) ? right : left;\n }\n else if (this.ChangesOverlap(left[left.length - 1], right[0], mergedChangeArr)) {\n // Since we break the problem down recursively, it is possible that we\n // might recurse in the middle of a change thereby splitting it into\n // two changes. Here in the combining stage, we detect and fuse those\n // changes back together\n const result = new Array(left.length + right.length - 1);\n MyArray.Copy(left, 0, result, 0, left.length - 1);\n result[left.length - 1] = mergedChangeArr[0];\n MyArray.Copy(right, 1, result, left.length, right.length - 1);\n return result;\n }\n else {\n const result = new Array(left.length + right.length);\n MyArray.Copy(left, 0, result, 0, left.length);\n MyArray.Copy(right, 0, result, left.length, right.length);\n return result;\n }\n }\n /**\n * Returns true if the two changes overlap and can be merged into a single\n * change\n * @param left The left change\n * @param right The right change\n * @param mergedChange The merged change if the two overlap, null otherwise\n * @returns True if the two changes overlap\n */\n ChangesOverlap(left, right, mergedChangeArr) {\n Debug.Assert(left.originalStart <= right.originalStart, 'Left change is not less than or equal to right change');\n Debug.Assert(left.modifiedStart <= right.modifiedStart, 'Left change is not less than or equal to right change');\n if (left.originalStart + left.originalLength >= right.originalStart || left.modifiedStart + left.modifiedLength >= right.modifiedStart) {\n const originalStart = left.originalStart;\n let originalLength = left.originalLength;\n const modifiedStart = left.modifiedStart;\n let modifiedLength = left.modifiedLength;\n if (left.originalStart + left.originalLength >= right.originalStart) {\n originalLength = right.originalStart + right.originalLength - left.originalStart;\n }\n if (left.modifiedStart + left.modifiedLength >= right.modifiedStart) {\n modifiedLength = right.modifiedStart + right.modifiedLength - left.modifiedStart;\n }\n mergedChangeArr[0] = new DiffChange(originalStart, originalLength, modifiedStart, modifiedLength);\n return true;\n }\n else {\n mergedChangeArr[0] = null;\n return false;\n }\n }\n /**\n * Helper method used to clip a diagonal index to the range of valid\n * diagonals. This also decides whether or not the diagonal index,\n * if it exceeds the boundary, should be clipped to the boundary or clipped\n * one inside the boundary depending on the Even/Odd status of the boundary\n * and numDifferences.\n * @param diagonal The index of the diagonal to clip.\n * @param numDifferences The current number of differences being iterated upon.\n * @param diagonalBaseIndex The base reference diagonal.\n * @param numDiagonals The total number of diagonals.\n * @returns The clipped diagonal index.\n */\n ClipDiagonalBound(diagonal, numDifferences, diagonalBaseIndex, numDiagonals) {\n if (diagonal >= 0 && diagonal < numDiagonals) {\n // Nothing to clip, its in range\n return diagonal;\n }\n // diagonalsBelow: The number of diagonals below the reference diagonal\n // diagonalsAbove: The number of diagonals above the reference diagonal\n const diagonalsBelow = diagonalBaseIndex;\n const diagonalsAbove = numDiagonals - diagonalBaseIndex - 1;\n const diffEven = (numDifferences % 2 === 0);\n if (diagonal < 0) {\n const lowerBoundEven = (diagonalsBelow % 2 === 0);\n return (diffEven === lowerBoundEven) ? 0 : 1;\n }\n else {\n const upperBoundEven = (diagonalsAbove % 2 === 0);\n return (diffEven === upperBoundEven) ? numDiagonals - 1 : numDiagonals - 2;\n }\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 * Represents information about a specific difference between two sequences.\n */\nexport class DiffChange {\n /**\n * Constructs a new DiffChange with the given sequence information\n * and content.\n */\n constructor(originalStart, originalLength, modifiedStart, modifiedLength) {\n //Debug.Assert(originalLength > 0 || modifiedLength > 0, \"originalLength and modifiedLength cannot both be <= 0\");\n this.originalStart = originalStart;\n this.originalLength = originalLength;\n this.modifiedStart = modifiedStart;\n this.modifiedLength = modifiedLength;\n }\n /**\n * The end point (exclusive) of the change in the original sequence.\n */\n getOriginalEnd() {\n return this.originalStart + this.originalLength;\n }\n /**\n * The end point (exclusive) of the change in the modified sequence.\n */\n getModifiedEnd() {\n return this.modifiedStart + this.modifiedLength;\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 *--------------------------------------------------------------------------------------------*/\nimport { splitLines } from '../../../base/common/strings.js';\nimport { Position } from '../core/position.js';\nimport { PrefixSumComputer } from './prefixSumComputer.js';\nexport class MirrorTextModel {\n constructor(uri, lines, eol, versionId) {\n this._uri = uri;\n this._lines = lines;\n this._eol = eol;\n this._versionId = versionId;\n this._lineStarts = null;\n this._cachedTextValue = null;\n }\n dispose() {\n this._lines.length = 0;\n }\n get version() {\n return this._versionId;\n }\n getText() {\n if (this._cachedTextValue === null) {\n this._cachedTextValue = this._lines.join(this._eol);\n }\n return this._cachedTextValue;\n }\n onEvents(e) {\n if (e.eol && e.eol !== this._eol) {\n this._eol = e.eol;\n this._lineStarts = null;\n }\n // Update my lines\n const changes = e.changes;\n for (const change of changes) {\n this._acceptDeleteRange(change.range);\n this._acceptInsertText(new Position(change.range.startLineNumber, change.range.startColumn), change.text);\n }\n this._versionId = e.versionId;\n this._cachedTextValue = null;\n }\n _ensureLineStarts() {\n if (!this._lineStarts) {\n const eolLength = this._eol.length;\n const linesLength = this._lines.length;\n const lineStartValues = new Uint32Array(linesLength);\n for (let i = 0; i < linesLength; i++) {\n lineStartValues[i] = this._lines[i].length + eolLength;\n }\n this._lineStarts = new PrefixSumComputer(lineStartValues);\n }\n }\n /**\n * All changes to a line's text go through this method\n */\n _setLineText(lineIndex, newValue) {\n this._lines[lineIndex] = newValue;\n if (this._lineStarts) {\n // update prefix sum\n this._lineStarts.setValue(lineIndex, this._lines[lineIndex].length + this._eol.length);\n }\n }\n _acceptDeleteRange(range) {\n if (range.startLineNumber === range.endLineNumber) {\n if (range.startColumn === range.endColumn) {\n // Nothing to delete\n return;\n }\n // Delete text on the affected line\n this._setLineText(range.startLineNumber - 1, this._lines[range.startLineNumber - 1].substring(0, range.startColumn - 1)\n + this._lines[range.startLineNumber - 1].substring(range.endColumn - 1));\n return;\n }\n // Take remaining text on last line and append it to remaining text on first line\n this._setLineText(range.startLineNumber - 1, this._lines[range.startLineNumber - 1].substring(0, range.startColumn - 1)\n + this._lines[range.endLineNumber - 1].substring(range.endColumn - 1));\n // Delete middle lines\n this._lines.splice(range.startLineNumber, range.endLineNumber - range.startLineNumber);\n if (this._lineStarts) {\n // update prefix sum\n this._lineStarts.removeValues(range.startLineNumber, range.endLineNumber - range.startLineNumber);\n }\n }\n _acceptInsertText(position, insertText) {\n if (insertText.length === 0) {\n // Nothing to insert\n return;\n }\n const insertLines = splitLines(insertText);\n if (insertLines.length === 1) {\n // Inserting text on one line\n this._setLineText(position.lineNumber - 1, this._lines[position.lineNumber - 1].substring(0, position.column - 1)\n + insertLines[0]\n + this._lines[position.lineNumber - 1].substring(position.column - 1));\n return;\n }\n // Append overflowing text from first line to the end of text to insert\n insertLines[insertLines.length - 1] += this._lines[position.lineNumber - 1].substring(position.column - 1);\n // Delete overflowing text from first line and insert text on first line\n this._setLineText(position.lineNumber - 1, this._lines[position.lineNumber - 1].substring(0, position.column - 1)\n + insertLines[0]);\n // Insert new lines & store lengths\n const newLengths = new Uint32Array(insertLines.length - 1);\n for (let i = 1; i < insertLines.length; i++) {\n this._lines.splice(position.lineNumber + i - 1, 0, insertLines[i]);\n newLengths[i - 1] = insertLines[i].length + this._eol.length;\n }\n if (this._lineStarts) {\n // update prefix sum\n this._lineStarts.insertValues(position.lineNumber, newLengths);\n }\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 *--------------------------------------------------------------------------------------------*/\nimport { arrayInsert } from '../../../base/common/arrays.js';\nimport { toUint32 } from '../../../base/common/uint.js';\nexport class PrefixSumComputer {\n constructor(values) {\n this.values = values;\n this.prefixSum = new Uint32Array(values.length);\n this.prefixSumValidIndex = new Int32Array(1);\n this.prefixSumValidIndex[0] = -1;\n }\n insertValues(insertIndex, insertValues) {\n insertIndex = toUint32(insertIndex);\n const oldValues = this.values;\n const oldPrefixSum = this.prefixSum;\n const insertValuesLen = insertValues.length;\n if (insertValuesLen === 0) {\n return false;\n }\n this.values = new Uint32Array(oldValues.length + insertValuesLen);\n this.values.set(oldValues.subarray(0, insertIndex), 0);\n this.values.set(oldValues.subarray(insertIndex), insertIndex + insertValuesLen);\n this.values.set(insertValues, insertIndex);\n if (insertIndex - 1 < this.prefixSumValidIndex[0]) {\n this.prefixSumValidIndex[0] = insertIndex - 1;\n }\n this.prefixSum = new Uint32Array(this.values.length);\n if (this.prefixSumValidIndex[0] >= 0) {\n this.prefixSum.set(oldPrefixSum.subarray(0, this.prefixSumValidIndex[0] + 1));\n }\n return true;\n }\n setValue(index, value) {\n index = toUint32(index);\n value = toUint32(value);\n if (this.values[index] === value) {\n return false;\n }\n this.values[index] = value;\n if (index - 1 < this.prefixSumValidIndex[0]) {\n this.prefixSumValidIndex[0] = index - 1;\n }\n return true;\n }\n removeValues(startIndex, count) {\n startIndex = toUint32(startIndex);\n count = toUint32(count);\n const oldValues = this.values;\n const oldPrefixSum = this.prefixSum;\n if (startIndex >= oldValues.length) {\n return false;\n }\n const maxCount = oldValues.length - startIndex;\n if (count >= maxCount) {\n count = maxCount;\n }\n if (count === 0) {\n return false;\n }\n this.values = new Uint32Array(oldValues.length - count);\n this.values.set(oldValues.subarray(0, startIndex), 0);\n this.values.set(oldValues.subarray(startIndex + count), startIndex);\n this.prefixSum = new Uint32Array(this.values.length);\n if (startIndex - 1 < this.prefixSumValidIndex[0]) {\n this.prefixSumValidIndex[0] = startIndex - 1;\n }\n if (this.prefixSumValidIndex[0] >= 0) {\n this.prefixSum.set(oldPrefixSum.subarray(0, this.prefixSumValidIndex[0] + 1));\n }\n return true;\n }\n getTotalSum() {\n if (this.values.length === 0) {\n return 0;\n }\n return this._getPrefixSum(this.values.length - 1);\n }\n /**\n * Returns the sum of the first `index + 1` many items.\n * @returns `SUM(0 <= j <= index, values[j])`.\n */\n getPrefixSum(index) {\n if (index < 0) {\n return 0;\n }\n index = toUint32(index);\n return this._getPrefixSum(index);\n }\n _getPrefixSum(index) {\n if (index <= this.prefixSumValidIndex[0]) {\n return this.prefixSum[index];\n }\n let startIndex = this.prefixSumValidIndex[0] + 1;\n if (startIndex === 0) {\n this.prefixSum[0] = this.values[0];\n startIndex++;\n }\n if (index >= this.values.length) {\n index = this.values.length - 1;\n }\n for (let i = startIndex; i <= index; i++) {\n this.prefixSum[i] = this.prefixSum[i - 1] + this.values[i];\n }\n this.prefixSumValidIndex[0] = Math.max(this.prefixSumValidIndex[0], index);\n return this.prefixSum[index];\n }\n getIndexOf(sum) {\n sum = Math.floor(sum);\n // Compute all sums (to get a fully valid prefixSum)\n this.getTotalSum();\n let low = 0;\n let high = this.values.length - 1;\n let mid = 0;\n let midStop = 0;\n let midStart = 0;\n while (low <= high) {\n mid = low + ((high - low) / 2) | 0;\n midStop = this.prefixSum[mid];\n midStart = midStop - this.values[mid];\n if (sum < midStart) {\n high = mid - 1;\n }\n else if (sum >= midStop) {\n low = mid + 1;\n }\n else {\n break;\n }\n }\n return new PrefixSumIndexOfResult(mid, sum - midStart);\n }\n}\n/**\n * {@link getIndexOf} has an amortized runtime complexity of O(1).\n *\n * ({@link PrefixSumComputer.getIndexOf} is just O(log n))\n*/\nexport class ConstantTimePrefixSumComputer {\n constructor(values) {\n this._values = values;\n this._isValid = false;\n this._validEndIndex = -1;\n this._prefixSum = [];\n this._indexBySum = [];\n }\n /**\n * @returns SUM(0 <= j < values.length, values[j])\n */\n getTotalSum() {\n this._ensureValid();\n return this._indexBySum.length;\n }\n /**\n * Returns the sum of the first `count` many items.\n * @returns `SUM(0 <= j < count, values[j])`.\n */\n getPrefixSum(count) {\n this._ensureValid();\n if (count === 0) {\n return 0;\n }\n return this._prefixSum[count - 1];\n }\n /**\n * @returns `result`, such that `getPrefixSum(result.index) + result.remainder = sum`\n */\n getIndexOf(sum) {\n this._ensureValid();\n const idx = this._indexBySum[sum];\n const viewLinesAbove = idx > 0 ? this._prefixSum[idx - 1] : 0;\n return new PrefixSumIndexOfResult(idx, sum - viewLinesAbove);\n }\n removeValues(start, deleteCount) {\n this._values.splice(start, deleteCount);\n this._invalidate(start);\n }\n insertValues(insertIndex, insertArr) {\n this._values = arrayInsert(this._values, insertIndex, insertArr);\n this._invalidate(insertIndex);\n }\n _invalidate(index) {\n this._isValid = false;\n this._validEndIndex = Math.min(this._validEndIndex, index - 1);\n }\n _ensureValid() {\n if (this._isValid) {\n return;\n }\n for (let i = this._validEndIndex + 1, len = this._values.length; i < len; i++) {\n const value = this._values[i];\n const sumAbove = i > 0 ? this._prefixSum[i - 1] : 0;\n this._prefixSum[i] = sumAbove + value;\n for (let j = 0; j < value; j++) {\n this._indexBySum[sumAbove + j] = i;\n }\n }\n // trim things\n this._prefixSum.length = this._values.length;\n this._indexBySum.length = this._prefixSum[this._prefixSum.length - 1];\n // mark as valid\n this._isValid = true;\n this._validEndIndex = this._values.length - 1;\n }\n setValue(index, value) {\n if (this._values[index] === value) {\n // no change\n return;\n }\n this._values[index] = value;\n this._invalidate(index);\n }\n}\nexport class PrefixSumIndexOfResult {\n constructor(index, remainder) {\n this.index = index;\n this.remainder = remainder;\n this._prefixSumIndexOfResultBrand = undefined;\n this.index = index;\n this.remainder = remainder;\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 *--------------------------------------------------------------------------------------------*/\nimport { CharacterClassifier } from '../core/characterClassifier.js';\nclass Uint8Matrix {\n constructor(rows, cols, defaultValue) {\n const data = new Uint8Array(rows * cols);\n for (let i = 0, len = rows * cols; i < len; i++) {\n data[i] = defaultValue;\n }\n this._data = data;\n this.rows = rows;\n this.cols = cols;\n }\n get(row, col) {\n return this._data[row * this.cols + col];\n }\n set(row, col, value) {\n this._data[row * this.cols + col] = value;\n }\n}\nexport class StateMachine {\n constructor(edges) {\n let maxCharCode = 0;\n let maxState = 0 /* State.Invalid */;\n for (let i = 0, len = edges.length; i < len; i++) {\n const [from, chCode, to] = edges[i];\n if (chCode > maxCharCode) {\n maxCharCode = chCode;\n }\n if (from > maxState) {\n maxState = from;\n }\n if (to > maxState) {\n maxState = to;\n }\n }\n maxCharCode++;\n maxState++;\n const states = new Uint8Matrix(maxState, maxCharCode, 0 /* State.Invalid */);\n for (let i = 0, len = edges.length; i < len; i++) {\n const [from, chCode, to] = edges[i];\n states.set(from, chCode, to);\n }\n this._states = states;\n this._maxCharCode = maxCharCode;\n }\n nextState(currentState, chCode) {\n if (chCode < 0 || chCode >= this._maxCharCode) {\n return 0 /* State.Invalid */;\n }\n return this._states.get(currentState, chCode);\n }\n}\n// State machine for http:// or https:// or file://\nlet _stateMachine = null;\nfunction getStateMachine() {\n if (_stateMachine === null) {\n _stateMachine = new StateMachine([\n [1 /* State.Start */, 104 /* CharCode.h */, 2 /* State.H */],\n [1 /* State.Start */, 72 /* CharCode.H */, 2 /* State.H */],\n [1 /* State.Start */, 102 /* CharCode.f */, 6 /* State.F */],\n [1 /* State.Start */, 70 /* CharCode.F */, 6 /* State.F */],\n [2 /* State.H */, 116 /* CharCode.t */, 3 /* State.HT */],\n [2 /* State.H */, 84 /* CharCode.T */, 3 /* State.HT */],\n [3 /* State.HT */, 116 /* CharCode.t */, 4 /* State.HTT */],\n [3 /* State.HT */, 84 /* CharCode.T */, 4 /* State.HTT */],\n [4 /* State.HTT */, 112 /* CharCode.p */, 5 /* State.HTTP */],\n [4 /* State.HTT */, 80 /* CharCode.P */, 5 /* State.HTTP */],\n [5 /* State.HTTP */, 115 /* CharCode.s */, 9 /* State.BeforeColon */],\n [5 /* State.HTTP */, 83 /* CharCode.S */, 9 /* State.BeforeColon */],\n [5 /* State.HTTP */, 58 /* CharCode.Colon */, 10 /* State.AfterColon */],\n [6 /* State.F */, 105 /* CharCode.i */, 7 /* State.FI */],\n [6 /* State.F */, 73 /* CharCode.I */, 7 /* State.FI */],\n [7 /* State.FI */, 108 /* CharCode.l */, 8 /* State.FIL */],\n [7 /* State.FI */, 76 /* CharCode.L */, 8 /* State.FIL */],\n [8 /* State.FIL */, 101 /* CharCode.e */, 9 /* State.BeforeColon */],\n [8 /* State.FIL */, 69 /* CharCode.E */, 9 /* State.BeforeColon */],\n [9 /* State.BeforeColon */, 58 /* CharCode.Colon */, 10 /* State.AfterColon */],\n [10 /* State.AfterColon */, 47 /* CharCode.Slash */, 11 /* State.AlmostThere */],\n [11 /* State.AlmostThere */, 47 /* CharCode.Slash */, 12 /* State.End */],\n ]);\n }\n return _stateMachine;\n}\nlet _classifier = null;\nfunction getClassifier() {\n if (_classifier === null) {\n _classifier = new CharacterClassifier(0 /* CharacterClass.None */);\n // allow-any-unicode-next-line\n const FORCE_TERMINATION_CHARACTERS = ' \\t<>\\'\\\"\u3001\u3002\uFF61\uFF64\uFF0C\uFF0E\uFF1A\uFF1B\u2018\u3008\u300C\u300E\u3014\uFF08\uFF3B\uFF5B\uFF62\uFF63\uFF5D\uFF3D\uFF09\u3015\u300F\u300D\u3009\u2019\uFF40\uFF5E\u2026';\n for (let i = 0; i < FORCE_TERMINATION_CHARACTERS.length; i++) {\n _classifier.set(FORCE_TERMINATION_CHARACTERS.charCodeAt(i), 1 /* CharacterClass.ForceTermination */);\n }\n const CANNOT_END_WITH_CHARACTERS = '.,;:';\n for (let i = 0; i < CANNOT_END_WITH_CHARACTERS.length; i++) {\n _classifier.set(CANNOT_END_WITH_CHARACTERS.charCodeAt(i), 2 /* CharacterClass.CannotEndIn */);\n }\n }\n return _classifier;\n}\nexport class LinkComputer {\n static _createLink(classifier, line, lineNumber, linkBeginIndex, linkEndIndex) {\n // Do not allow to end link in certain characters...\n let lastIncludedCharIndex = linkEndIndex - 1;\n do {\n const chCode = line.charCodeAt(lastIncludedCharIndex);\n const chClass = classifier.get(chCode);\n if (chClass !== 2 /* CharacterClass.CannotEndIn */) {\n break;\n }\n lastIncludedCharIndex--;\n } while (lastIncludedCharIndex > linkBeginIndex);\n // Handle links enclosed in parens, square brackets and curlys.\n if (linkBeginIndex > 0) {\n const charCodeBeforeLink = line.charCodeAt(linkBeginIndex - 1);\n const lastCharCodeInLink = line.charCodeAt(lastIncludedCharIndex);\n if ((charCodeBeforeLink === 40 /* CharCode.OpenParen */ && lastCharCodeInLink === 41 /* CharCode.CloseParen */)\n || (charCodeBeforeLink === 91 /* CharCode.OpenSquareBracket */ && lastCharCodeInLink === 93 /* CharCode.CloseSquareBracket */)\n || (charCodeBeforeLink === 123 /* CharCode.OpenCurlyBrace */ && lastCharCodeInLink === 125 /* CharCode.CloseCurlyBrace */)) {\n // Do not end in ) if ( is before the link start\n // Do not end in ] if [ is before the link start\n // Do not end in } if { is before the link start\n lastIncludedCharIndex--;\n }\n }\n return {\n range: {\n startLineNumber: lineNumber,\n startColumn: linkBeginIndex + 1,\n endLineNumber: lineNumber,\n endColumn: lastIncludedCharIndex + 2\n },\n url: line.substring(linkBeginIndex, lastIncludedCharIndex + 1)\n };\n }\n static computeLinks(model, stateMachine = getStateMachine()) {\n const classifier = getClassifier();\n const result = [];\n for (let i = 1, lineCount = model.getLineCount(); i <= lineCount; i++) {\n const line = model.getLineContent(i);\n const len = line.length;\n let j = 0;\n let linkBeginIndex = 0;\n let linkBeginChCode = 0;\n let state = 1 /* State.Start */;\n let hasOpenParens = false;\n let hasOpenSquareBracket = false;\n let inSquareBrackets = false;\n let hasOpenCurlyBracket = false;\n while (j < len) {\n let resetStateMachine = false;\n const chCode = line.charCodeAt(j);\n if (state === 13 /* State.Accept */) {\n let chClass;\n switch (chCode) {\n case 40 /* CharCode.OpenParen */:\n hasOpenParens = true;\n chClass = 0 /* CharacterClass.None */;\n break;\n case 41 /* CharCode.CloseParen */:\n chClass = (hasOpenParens ? 0 /* CharacterClass.None */ : 1 /* CharacterClass.ForceTermination */);\n break;\n case 91 /* CharCode.OpenSquareBracket */:\n inSquareBrackets = true;\n hasOpenSquareBracket = true;\n chClass = 0 /* CharacterClass.None */;\n break;\n case 93 /* CharCode.CloseSquareBracket */:\n inSquareBrackets = false;\n chClass = (hasOpenSquareBracket ? 0 /* CharacterClass.None */ : 1 /* CharacterClass.ForceTermination */);\n break;\n case 123 /* CharCode.OpenCurlyBrace */:\n hasOpenCurlyBracket = true;\n chClass = 0 /* CharacterClass.None */;\n break;\n case 125 /* CharCode.CloseCurlyBrace */:\n chClass = (hasOpenCurlyBracket ? 0 /* CharacterClass.None */ : 1 /* CharacterClass.ForceTermination */);\n break;\n // The following three rules make it that ' or \" or ` are allowed inside links\n // only if the link is wrapped by some other quote character\n case 39 /* CharCode.SingleQuote */:\n case 34 /* CharCode.DoubleQuote */:\n case 96 /* CharCode.BackTick */:\n if (linkBeginChCode === chCode) {\n chClass = 1 /* CharacterClass.ForceTermination */;\n }\n else if (linkBeginChCode === 39 /* CharCode.SingleQuote */ || linkBeginChCode === 34 /* CharCode.DoubleQuote */ || linkBeginChCode === 96 /* CharCode.BackTick */) {\n chClass = 0 /* CharacterClass.None */;\n }\n else {\n chClass = 1 /* CharacterClass.ForceTermination */;\n }\n break;\n case 42 /* CharCode.Asterisk */:\n // `*` terminates a link if the link began with `*`\n chClass = (linkBeginChCode === 42 /* CharCode.Asterisk */) ? 1 /* CharacterClass.ForceTermination */ : 0 /* CharacterClass.None */;\n break;\n case 124 /* CharCode.Pipe */:\n // `|` terminates a link if the link began with `|`\n chClass = (linkBeginChCode === 124 /* CharCode.Pipe */) ? 1 /* CharacterClass.ForceTermination */ : 0 /* CharacterClass.None */;\n break;\n case 32 /* CharCode.Space */:\n // ` ` allow space in between [ and ]\n chClass = (inSquareBrackets ? 0 /* CharacterClass.None */ : 1 /* CharacterClass.ForceTermination */);\n break;\n default:\n chClass = classifier.get(chCode);\n }\n // Check if character terminates link\n if (chClass === 1 /* CharacterClass.ForceTermination */) {\n result.push(LinkComputer._createLink(classifier, line, i, linkBeginIndex, j));\n resetStateMachine = true;\n }\n }\n else if (state === 12 /* State.End */) {\n let chClass;\n if (chCode === 91 /* CharCode.OpenSquareBracket */) {\n // Allow for the authority part to contain ipv6 addresses which contain [ and ]\n hasOpenSquareBracket = true;\n chClass = 0 /* CharacterClass.None */;\n }\n else {\n chClass = classifier.get(chCode);\n }\n // Check if character terminates link\n if (chClass === 1 /* CharacterClass.ForceTermination */) {\n resetStateMachine = true;\n }\n else {\n state = 13 /* State.Accept */;\n }\n }\n else {\n state = stateMachine.nextState(state, chCode);\n if (state === 0 /* State.Invalid */) {\n resetStateMachine = true;\n }\n }\n if (resetStateMachine) {\n state = 1 /* State.Start */;\n hasOpenParens = false;\n hasOpenSquareBracket = false;\n hasOpenCurlyBracket = false;\n // Record where the link started\n linkBeginIndex = j + 1;\n linkBeginChCode = chCode;\n }\n j++;\n }\n if (state === 13 /* State.Accept */) {\n result.push(LinkComputer._createLink(classifier, line, i, linkBeginIndex, len));\n }\n }\n return result;\n }\n}\n/**\n * Returns an array of all links contains in the provided\n * document. *Note* that this operation is computational\n * expensive and should not run in the UI thread.\n */\nexport function computeLinks(model) {\n if (!model || typeof model.getLineCount !== 'function' || typeof model.getLineContent !== 'function') {\n // Unknown caller!\n return [];\n }\n return LinkComputer.computeLinks(model);\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 *--------------------------------------------------------------------------------------------*/\nexport class BasicInplaceReplace {\n constructor() {\n this._defaultValueSet = [\n ['true', 'false'],\n ['True', 'False'],\n ['Private', 'Public', 'Friend', 'ReadOnly', 'Partial', 'Protected', 'WriteOnly'],\n ['public', 'protected', 'private'],\n ];\n }\n navigateValueSet(range1, text1, range2, text2, up) {\n if (range1 && text1) {\n const result = this.doNavigateValueSet(text1, up);\n if (result) {\n return {\n range: range1,\n value: result\n };\n }\n }\n if (range2 && text2) {\n const result = this.doNavigateValueSet(text2, up);\n if (result) {\n return {\n range: range2,\n value: result\n };\n }\n }\n return null;\n }\n doNavigateValueSet(text, up) {\n const numberResult = this.numberReplace(text, up);\n if (numberResult !== null) {\n return numberResult;\n }\n return this.textReplace(text, up);\n }\n numberReplace(value, up) {\n const precision = Math.pow(10, value.length - (value.lastIndexOf('.') + 1));\n let n1 = Number(value);\n const n2 = parseFloat(value);\n if (!isNaN(n1) && !isNaN(n2) && n1 === n2) {\n if (n1 === 0 && !up) {\n return null; // don't do negative\n //\t\t\t} else if(n1 === 9 && up) {\n //\t\t\t\treturn null; // don't insert 10 into a number\n }\n else {\n n1 = Math.floor(n1 * precision);\n n1 += up ? precision : -precision;\n return String(n1 / precision);\n }\n }\n return null;\n }\n textReplace(value, up) {\n return this.valueSetsReplace(this._defaultValueSet, value, up);\n }\n valueSetsReplace(valueSets, value, up) {\n let result = null;\n for (let i = 0, len = valueSets.length; result === null && i < len; i++) {\n result = this.valueSetReplace(valueSets[i], value, up);\n }\n return result;\n }\n valueSetReplace(valueSet, value, up) {\n let idx = valueSet.indexOf(value);\n if (idx >= 0) {\n idx += up ? +1 : -1;\n if (idx < 0) {\n idx = valueSet.length - 1;\n }\n else {\n idx %= valueSet.length;\n }\n return valueSet[idx];\n }\n return null;\n }\n}\nBasicInplaceReplace.INSTANCE = new BasicInplaceReplace();\n", "/*---------------------------------------------------------------------------------------------\n * 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 { Range } from '../core/range.js';\nimport { Searcher } from '../model/textModelSearch.js';\nimport * as strings from '../../../base/common/strings.js';\nimport { assertNever } from '../../../base/common/assert.js';\nimport { DEFAULT_WORD_REGEXP, getWordAtText } from '../core/wordHelper.js';\nexport class UnicodeTextModelHighlighter {\n static computeUnicodeHighlights(model, options, range) {\n const startLine = range ? range.startLineNumber : 1;\n const endLine = range ? range.endLineNumber : model.getLineCount();\n const codePointHighlighter = new CodePointHighlighter(options);\n const candidates = codePointHighlighter.getCandidateCodePoints();\n let regex;\n if (candidates === 'allNonBasicAscii') {\n regex = new RegExp('[^\\\\t\\\\n\\\\r\\\\x20-\\\\x7E]', 'g');\n }\n else {\n regex = new RegExp(`${buildRegExpCharClassExpr(Array.from(candidates))}`, 'g');\n }\n const searcher = new Searcher(null, regex);\n const ranges = [];\n let hasMore = false;\n let m;\n let ambiguousCharacterCount = 0;\n let invisibleCharacterCount = 0;\n let nonBasicAsciiCharacterCount = 0;\n forLoop: for (let lineNumber = startLine, lineCount = endLine; lineNumber <= lineCount; lineNumber++) {\n const lineContent = model.getLineContent(lineNumber);\n const lineLength = lineContent.length;\n // Reset regex to search from the beginning\n searcher.reset(0);\n do {\n m = searcher.next(lineContent);\n if (m) {\n let startIndex = m.index;\n let endIndex = m.index + m[0].length;\n // Extend range to entire code point\n if (startIndex > 0) {\n const charCodeBefore = lineContent.charCodeAt(startIndex - 1);\n if (strings.isHighSurrogate(charCodeBefore)) {\n startIndex--;\n }\n }\n if (endIndex + 1 < lineLength) {\n const charCodeBefore = lineContent.charCodeAt(endIndex - 1);\n if (strings.isHighSurrogate(charCodeBefore)) {\n endIndex++;\n }\n }\n const str = lineContent.substring(startIndex, endIndex);\n let word = getWordAtText(startIndex + 1, DEFAULT_WORD_REGEXP, lineContent, 0);\n if (word && word.endColumn <= startIndex + 1) {\n // The word does not include the problematic character, ignore the word\n word = null;\n }\n const highlightReason = codePointHighlighter.shouldHighlightNonBasicASCII(str, word ? word.word : null);\n if (highlightReason !== 0 /* SimpleHighlightReason.None */) {\n if (highlightReason === 3 /* SimpleHighlightReason.Ambiguous */) {\n ambiguousCharacterCount++;\n }\n else if (highlightReason === 2 /* SimpleHighlightReason.Invisible */) {\n invisibleCharacterCount++;\n }\n else if (highlightReason === 1 /* SimpleHighlightReason.NonBasicASCII */) {\n nonBasicAsciiCharacterCount++;\n }\n else {\n assertNever(highlightReason);\n }\n const MAX_RESULT_LENGTH = 1000;\n if (ranges.length >= MAX_RESULT_LENGTH) {\n hasMore = true;\n break forLoop;\n }\n ranges.push(new Range(lineNumber, startIndex + 1, lineNumber, endIndex + 1));\n }\n }\n } while (m);\n }\n return {\n ranges,\n hasMore,\n ambiguousCharacterCount,\n invisibleCharacterCount,\n nonBasicAsciiCharacterCount\n };\n }\n static computeUnicodeHighlightReason(char, options) {\n const codePointHighlighter = new CodePointHighlighter(options);\n const reason = codePointHighlighter.shouldHighlightNonBasicASCII(char, null);\n switch (reason) {\n case 0 /* SimpleHighlightReason.None */:\n return null;\n case 2 /* SimpleHighlightReason.Invisible */:\n return { kind: 1 /* UnicodeHighlighterReasonKind.Invisible */ };\n case 3 /* SimpleHighlightReason.Ambiguous */: {\n const codePoint = char.codePointAt(0);\n const primaryConfusable = codePointHighlighter.ambiguousCharacters.getPrimaryConfusable(codePoint);\n const notAmbiguousInLocales = strings.AmbiguousCharacters.getLocales().filter((l) => !strings.AmbiguousCharacters.getInstance(new Set([...options.allowedLocales, l])).isAmbiguous(codePoint));\n return { kind: 0 /* UnicodeHighlighterReasonKind.Ambiguous */, confusableWith: String.fromCodePoint(primaryConfusable), notAmbiguousInLocales };\n }\n case 1 /* SimpleHighlightReason.NonBasicASCII */:\n return { kind: 2 /* UnicodeHighlighterReasonKind.NonBasicAscii */ };\n }\n }\n}\nfunction buildRegExpCharClassExpr(codePoints, flags) {\n const src = `[${strings.escapeRegExpCharacters(codePoints.map((i) => String.fromCodePoint(i)).join(''))}]`;\n return src;\n}\nclass CodePointHighlighter {\n constructor(options) {\n this.options = options;\n this.allowedCodePoints = new Set(options.allowedCodePoints);\n this.ambiguousCharacters = strings.AmbiguousCharacters.getInstance(new Set(options.allowedLocales));\n }\n getCandidateCodePoints() {\n if (this.options.nonBasicASCII) {\n return 'allNonBasicAscii';\n }\n const set = new Set();\n if (this.options.invisibleCharacters) {\n for (const cp of strings.InvisibleCharacters.codePoints) {\n if (!isAllowedInvisibleCharacter(String.fromCodePoint(cp))) {\n set.add(cp);\n }\n }\n }\n if (this.options.ambiguousCharacters) {\n for (const cp of this.ambiguousCharacters.getConfusableCodePoints()) {\n set.add(cp);\n }\n }\n for (const cp of this.allowedCodePoints) {\n set.delete(cp);\n }\n return set;\n }\n shouldHighlightNonBasicASCII(character, wordContext) {\n const codePoint = character.codePointAt(0);\n if (this.allowedCodePoints.has(codePoint)) {\n return 0 /* SimpleHighlightReason.None */;\n }\n if (this.options.nonBasicASCII) {\n return 1 /* SimpleHighlightReason.NonBasicASCII */;\n }\n let hasBasicASCIICharacters = false;\n let hasNonConfusableNonBasicAsciiCharacter = false;\n if (wordContext) {\n for (const char of wordContext) {\n const codePoint = char.codePointAt(0);\n const isBasicASCII = strings.isBasicASCII(char);\n hasBasicASCIICharacters = hasBasicASCIICharacters || isBasicASCII;\n if (!isBasicASCII &&\n !this.ambiguousCharacters.isAmbiguous(codePoint) &&\n !strings.InvisibleCharacters.isInvisibleCharacter(codePoint)) {\n hasNonConfusableNonBasicAsciiCharacter = true;\n }\n }\n }\n if (\n /* Don't allow mixing weird looking characters with ASCII */ !hasBasicASCIICharacters &&\n /* Is there an obviously weird looking character? */ hasNonConfusableNonBasicAsciiCharacter) {\n return 0 /* SimpleHighlightReason.None */;\n }\n if (this.options.invisibleCharacters) {\n // TODO check for emojis\n if (!isAllowedInvisibleCharacter(character) && strings.InvisibleCharacters.isInvisibleCharacter(codePoint)) {\n return 2 /* SimpleHighlightReason.Invisible */;\n }\n }\n if (this.options.ambiguousCharacters) {\n if (this.ambiguousCharacters.isAmbiguous(codePoint)) {\n return 3 /* SimpleHighlightReason.Ambiguous */;\n }\n }\n return 0 /* SimpleHighlightReason.None */;\n }\n}\nfunction isAllowedInvisibleCharacter(character) {\n return character === ' ' || character === '\\n' || character === '\\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 *--------------------------------------------------------------------------------------------*/\nimport { LegacyLinesDiffComputer } from './legacyLinesDiffComputer.js';\nimport { DefaultLinesDiffComputer } from './defaultLinesDiffComputer/defaultLinesDiffComputer.js';\nexport const linesDiffComputers = {\n getLegacy: () => new LegacyLinesDiffComputer(),\n getDefault: () => new DefaultLinesDiffComputer(),\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 { LcsDiff } from '../../../base/common/diff/diff.js';\nimport { LinesDiff } from './linesDiffComputer.js';\nimport { RangeMapping, DetailedLineRangeMapping } from './rangeMapping.js';\nimport * as strings from '../../../base/common/strings.js';\nimport { Range } from '../core/range.js';\nimport { assertFn, checkAdjacentItems } from '../../../base/common/assert.js';\nimport { LineRange } from '../core/lineRange.js';\nconst MINIMUM_MATCHING_CHARACTER_LENGTH = 3;\nexport class LegacyLinesDiffComputer {\n computeDiff(originalLines, modifiedLines, options) {\n var _a;\n const diffComputer = new DiffComputer(originalLines, modifiedLines, {\n maxComputationTime: options.maxComputationTimeMs,\n shouldIgnoreTrimWhitespace: options.ignoreTrimWhitespace,\n shouldComputeCharChanges: true,\n shouldMakePrettyDiff: true,\n shouldPostProcessCharChanges: true,\n });\n const result = diffComputer.computeDiff();\n const changes = [];\n let lastChange = null;\n for (const c of result.changes) {\n let originalRange;\n if (c.originalEndLineNumber === 0) {\n // Insertion\n originalRange = new LineRange(c.originalStartLineNumber + 1, c.originalStartLineNumber + 1);\n }\n else {\n originalRange = new LineRange(c.originalStartLineNumber, c.originalEndLineNumber + 1);\n }\n let modifiedRange;\n if (c.modifiedEndLineNumber === 0) {\n // Deletion\n modifiedRange = new LineRange(c.modifiedStartLineNumber + 1, c.modifiedStartLineNumber + 1);\n }\n else {\n modifiedRange = new LineRange(c.modifiedStartLineNumber, c.modifiedEndLineNumber + 1);\n }\n let change = new DetailedLineRangeMapping(originalRange, modifiedRange, (_a = c.charChanges) === null || _a === void 0 ? void 0 : _a.map(c => new RangeMapping(new Range(c.originalStartLineNumber, c.originalStartColumn, c.originalEndLineNumber, c.originalEndColumn), new Range(c.modifiedStartLineNumber, c.modifiedStartColumn, c.modifiedEndLineNumber, c.modifiedEndColumn))));\n if (lastChange) {\n if (lastChange.modified.endLineNumberExclusive === change.modified.startLineNumber\n || lastChange.original.endLineNumberExclusive === change.original.startLineNumber) {\n // join touching diffs. Probably moving diffs up/down in the algorithm causes touching diffs.\n change = new DetailedLineRangeMapping(lastChange.original.join(change.original), lastChange.modified.join(change.modified), lastChange.innerChanges && change.innerChanges ?\n lastChange.innerChanges.concat(change.innerChanges) : undefined);\n changes.pop();\n }\n }\n changes.push(change);\n lastChange = change;\n }\n assertFn(() => {\n return checkAdjacentItems(changes, (m1, m2) => m2.original.startLineNumber - m1.original.endLineNumberExclusive === m2.modified.startLineNumber - m1.modified.endLineNumberExclusive &&\n // There has to be an unchanged line in between (otherwise both diffs should have been joined)\n m1.original.endLineNumberExclusive < m2.original.startLineNumber &&\n m1.modified.endLineNumberExclusive < m2.modified.startLineNumber);\n });\n return new LinesDiff(changes, [], result.quitEarly);\n }\n}\nfunction computeDiff(originalSequence, modifiedSequence, continueProcessingPredicate, pretty) {\n const diffAlgo = new LcsDiff(originalSequence, modifiedSequence, continueProcessingPredicate);\n return diffAlgo.ComputeDiff(pretty);\n}\nclass LineSequence {\n constructor(lines) {\n const startColumns = [];\n const endColumns = [];\n for (let i = 0, length = lines.length; i < length; i++) {\n startColumns[i] = getFirstNonBlankColumn(lines[i], 1);\n endColumns[i] = getLastNonBlankColumn(lines[i], 1);\n }\n this.lines = lines;\n this._startColumns = startColumns;\n this._endColumns = endColumns;\n }\n getElements() {\n const elements = [];\n for (let i = 0, len = this.lines.length; i < len; i++) {\n elements[i] = this.lines[i].substring(this._startColumns[i] - 1, this._endColumns[i] - 1);\n }\n return elements;\n }\n getStrictElement(index) {\n return this.lines[index];\n }\n getStartLineNumber(i) {\n return i + 1;\n }\n getEndLineNumber(i) {\n return i + 1;\n }\n createCharSequence(shouldIgnoreTrimWhitespace, startIndex, endIndex) {\n const charCodes = [];\n const lineNumbers = [];\n const columns = [];\n let len = 0;\n for (let index = startIndex; index <= endIndex; index++) {\n const lineContent = this.lines[index];\n const startColumn = (shouldIgnoreTrimWhitespace ? this._startColumns[index] : 1);\n const endColumn = (shouldIgnoreTrimWhitespace ? this._endColumns[index] : lineContent.length + 1);\n for (let col = startColumn; col < endColumn; col++) {\n charCodes[len] = lineContent.charCodeAt(col - 1);\n lineNumbers[len] = index + 1;\n columns[len] = col;\n len++;\n }\n if (!shouldIgnoreTrimWhitespace && index < endIndex) {\n // Add \\n if trim whitespace is not ignored\n charCodes[len] = 10 /* CharCode.LineFeed */;\n lineNumbers[len] = index + 1;\n columns[len] = lineContent.length + 1;\n len++;\n }\n }\n return new CharSequence(charCodes, lineNumbers, columns);\n }\n}\nclass CharSequence {\n constructor(charCodes, lineNumbers, columns) {\n this._charCodes = charCodes;\n this._lineNumbers = lineNumbers;\n this._columns = columns;\n }\n toString() {\n return ('[' + this._charCodes.map((s, idx) => (s === 10 /* CharCode.LineFeed */ ? '\\\\n' : String.fromCharCode(s)) + `-(${this._lineNumbers[idx]},${this._columns[idx]})`).join(', ') + ']');\n }\n _assertIndex(index, arr) {\n if (index < 0 || index >= arr.length) {\n throw new Error(`Illegal index`);\n }\n }\n getElements() {\n return this._charCodes;\n }\n getStartLineNumber(i) {\n if (i > 0 && i === this._lineNumbers.length) {\n // the start line number of the element after the last element\n // is the end line number of the last element\n return this.getEndLineNumber(i - 1);\n }\n this._assertIndex(i, this._lineNumbers);\n return this._lineNumbers[i];\n }\n getEndLineNumber(i) {\n if (i === -1) {\n // the end line number of the element before the first element\n // is the start line number of the first element\n return this.getStartLineNumber(i + 1);\n }\n this._assertIndex(i, this._lineNumbers);\n if (this._charCodes[i] === 10 /* CharCode.LineFeed */) {\n return this._lineNumbers[i] + 1;\n }\n return this._lineNumbers[i];\n }\n getStartColumn(i) {\n if (i > 0 && i === this._columns.length) {\n // the start column of the element after the last element\n // is the end column of the last element\n return this.getEndColumn(i - 1);\n }\n this._assertIndex(i, this._columns);\n return this._columns[i];\n }\n getEndColumn(i) {\n if (i === -1) {\n // the end column of the element before the first element\n // is the start column of the first element\n return this.getStartColumn(i + 1);\n }\n this._assertIndex(i, this._columns);\n if (this._charCodes[i] === 10 /* CharCode.LineFeed */) {\n return 1;\n }\n return this._columns[i] + 1;\n }\n}\nclass CharChange {\n constructor(originalStartLineNumber, originalStartColumn, originalEndLineNumber, originalEndColumn, modifiedStartLineNumber, modifiedStartColumn, modifiedEndLineNumber, modifiedEndColumn) {\n this.originalStartLineNumber = originalStartLineNumber;\n this.originalStartColumn = originalStartColumn;\n this.originalEndLineNumber = originalEndLineNumber;\n this.originalEndColumn = originalEndColumn;\n this.modifiedStartLineNumber = modifiedStartLineNumber;\n this.modifiedStartColumn = modifiedStartColumn;\n this.modifiedEndLineNumber = modifiedEndLineNumber;\n this.modifiedEndColumn = modifiedEndColumn;\n }\n static createFromDiffChange(diffChange, originalCharSequence, modifiedCharSequence) {\n const originalStartLineNumber = originalCharSequence.getStartLineNumber(diffChange.originalStart);\n const originalStartColumn = originalCharSequence.getStartColumn(diffChange.originalStart);\n const originalEndLineNumber = originalCharSequence.getEndLineNumber(diffChange.originalStart + diffChange.originalLength - 1);\n const originalEndColumn = originalCharSequence.getEndColumn(diffChange.originalStart + diffChange.originalLength - 1);\n const modifiedStartLineNumber = modifiedCharSequence.getStartLineNumber(diffChange.modifiedStart);\n const modifiedStartColumn = modifiedCharSequence.getStartColumn(diffChange.modifiedStart);\n const modifiedEndLineNumber = modifiedCharSequence.getEndLineNumber(diffChange.modifiedStart + diffChange.modifiedLength - 1);\n const modifiedEndColumn = modifiedCharSequence.getEndColumn(diffChange.modifiedStart + diffChange.modifiedLength - 1);\n return new CharChange(originalStartLineNumber, originalStartColumn, originalEndLineNumber, originalEndColumn, modifiedStartLineNumber, modifiedStartColumn, modifiedEndLineNumber, modifiedEndColumn);\n }\n}\nfunction postProcessCharChanges(rawChanges) {\n if (rawChanges.length <= 1) {\n return rawChanges;\n }\n const result = [rawChanges[0]];\n let prevChange = result[0];\n for (let i = 1, len = rawChanges.length; i < len; i++) {\n const currChange = rawChanges[i];\n const originalMatchingLength = currChange.originalStart - (prevChange.originalStart + prevChange.originalLength);\n const modifiedMatchingLength = currChange.modifiedStart - (prevChange.modifiedStart + prevChange.modifiedLength);\n // Both of the above should be equal, but the continueProcessingPredicate may prevent this from being true\n const matchingLength = Math.min(originalMatchingLength, modifiedMatchingLength);\n if (matchingLength < MINIMUM_MATCHING_CHARACTER_LENGTH) {\n // Merge the current change into the previous one\n prevChange.originalLength = (currChange.originalStart + currChange.originalLength) - prevChange.originalStart;\n prevChange.modifiedLength = (currChange.modifiedStart + currChange.modifiedLength) - prevChange.modifiedStart;\n }\n else {\n // Add the current change\n result.push(currChange);\n prevChange = currChange;\n }\n }\n return result;\n}\nclass LineChange {\n constructor(originalStartLineNumber, originalEndLineNumber, modifiedStartLineNumber, modifiedEndLineNumber, charChanges) {\n this.originalStartLineNumber = originalStartLineNumber;\n this.originalEndLineNumber = originalEndLineNumber;\n this.modifiedStartLineNumber = modifiedStartLineNumber;\n this.modifiedEndLineNumber = modifiedEndLineNumber;\n this.charChanges = charChanges;\n }\n static createFromDiffResult(shouldIgnoreTrimWhitespace, diffChange, originalLineSequence, modifiedLineSequence, continueCharDiff, shouldComputeCharChanges, shouldPostProcessCharChanges) {\n let originalStartLineNumber;\n let originalEndLineNumber;\n let modifiedStartLineNumber;\n let modifiedEndLineNumber;\n let charChanges = undefined;\n if (diffChange.originalLength === 0) {\n originalStartLineNumber = originalLineSequence.getStartLineNumber(diffChange.originalStart) - 1;\n originalEndLineNumber = 0;\n }\n else {\n originalStartLineNumber = originalLineSequence.getStartLineNumber(diffChange.originalStart);\n originalEndLineNumber = originalLineSequence.getEndLineNumber(diffChange.originalStart + diffChange.originalLength - 1);\n }\n if (diffChange.modifiedLength === 0) {\n modifiedStartLineNumber = modifiedLineSequence.getStartLineNumber(diffChange.modifiedStart) - 1;\n modifiedEndLineNumber = 0;\n }\n else {\n modifiedStartLineNumber = modifiedLineSequence.getStartLineNumber(diffChange.modifiedStart);\n modifiedEndLineNumber = modifiedLineSequence.getEndLineNumber(diffChange.modifiedStart + diffChange.modifiedLength - 1);\n }\n if (shouldComputeCharChanges && diffChange.originalLength > 0 && diffChange.originalLength < 20 && diffChange.modifiedLength > 0 && diffChange.modifiedLength < 20 && continueCharDiff()) {\n // Compute character changes for diff chunks of at most 20 lines...\n const originalCharSequence = originalLineSequence.createCharSequence(shouldIgnoreTrimWhitespace, diffChange.originalStart, diffChange.originalStart + diffChange.originalLength - 1);\n const modifiedCharSequence = modifiedLineSequence.createCharSequence(shouldIgnoreTrimWhitespace, diffChange.modifiedStart, diffChange.modifiedStart + diffChange.modifiedLength - 1);\n if (originalCharSequence.getElements().length > 0 && modifiedCharSequence.getElements().length > 0) {\n let rawChanges = computeDiff(originalCharSequence, modifiedCharSequence, continueCharDiff, true).changes;\n if (shouldPostProcessCharChanges) {\n rawChanges = postProcessCharChanges(rawChanges);\n }\n charChanges = [];\n for (let i = 0, length = rawChanges.length; i < length; i++) {\n charChanges.push(CharChange.createFromDiffChange(rawChanges[i], originalCharSequence, modifiedCharSequence));\n }\n }\n }\n return new LineChange(originalStartLineNumber, originalEndLineNumber, modifiedStartLineNumber, modifiedEndLineNumber, charChanges);\n }\n}\nexport class DiffComputer {\n constructor(originalLines, modifiedLines, opts) {\n this.shouldComputeCharChanges = opts.shouldComputeCharChanges;\n this.shouldPostProcessCharChanges = opts.shouldPostProcessCharChanges;\n this.shouldIgnoreTrimWhitespace = opts.shouldIgnoreTrimWhitespace;\n this.shouldMakePrettyDiff = opts.shouldMakePrettyDiff;\n this.originalLines = originalLines;\n this.modifiedLines = modifiedLines;\n this.original = new LineSequence(originalLines);\n this.modified = new LineSequence(modifiedLines);\n this.continueLineDiff = createContinueProcessingPredicate(opts.maxComputationTime);\n this.continueCharDiff = createContinueProcessingPredicate(opts.maxComputationTime === 0 ? 0 : Math.min(opts.maxComputationTime, 5000)); // never run after 5s for character changes...\n }\n computeDiff() {\n if (this.original.lines.length === 1 && this.original.lines[0].length === 0) {\n // empty original => fast path\n if (this.modified.lines.length === 1 && this.modified.lines[0].length === 0) {\n return {\n quitEarly: false,\n changes: []\n };\n }\n return {\n quitEarly: false,\n changes: [{\n originalStartLineNumber: 1,\n originalEndLineNumber: 1,\n modifiedStartLineNumber: 1,\n modifiedEndLineNumber: this.modified.lines.length,\n charChanges: undefined\n }]\n };\n }\n if (this.modified.lines.length === 1 && this.modified.lines[0].length === 0) {\n // empty modified => fast path\n return {\n quitEarly: false,\n changes: [{\n originalStartLineNumber: 1,\n originalEndLineNumber: this.original.lines.length,\n modifiedStartLineNumber: 1,\n modifiedEndLineNumber: 1,\n charChanges: undefined\n }]\n };\n }\n const diffResult = computeDiff(this.original, this.modified, this.continueLineDiff, this.shouldMakePrettyDiff);\n const rawChanges = diffResult.changes;\n const quitEarly = diffResult.quitEarly;\n // The diff is always computed with ignoring trim whitespace\n // This ensures we get the prettiest diff\n if (this.shouldIgnoreTrimWhitespace) {\n const lineChanges = [];\n for (let i = 0, length = rawChanges.length; i < length; i++) {\n lineChanges.push(LineChange.createFromDiffResult(this.shouldIgnoreTrimWhitespace, rawChanges[i], this.original, this.modified, this.continueCharDiff, this.shouldComputeCharChanges, this.shouldPostProcessCharChanges));\n }\n return {\n quitEarly: quitEarly,\n changes: lineChanges\n };\n }\n // Need to post-process and introduce changes where the trim whitespace is different\n // Note that we are looping starting at -1 to also cover the lines before the first change\n const result = [];\n let originalLineIndex = 0;\n let modifiedLineIndex = 0;\n for (let i = -1 /* !!!! */, len = rawChanges.length; i < len; i++) {\n const nextChange = (i + 1 < len ? rawChanges[i + 1] : null);\n const originalStop = (nextChange ? nextChange.originalStart : this.originalLines.length);\n const modifiedStop = (nextChange ? nextChange.modifiedStart : this.modifiedLines.length);\n while (originalLineIndex < originalStop && modifiedLineIndex < modifiedStop) {\n const originalLine = this.originalLines[originalLineIndex];\n const modifiedLine = this.modifiedLines[modifiedLineIndex];\n if (originalLine !== modifiedLine) {\n // These lines differ only in trim whitespace\n // Check the leading whitespace\n {\n let originalStartColumn = getFirstNonBlankColumn(originalLine, 1);\n let modifiedStartColumn = getFirstNonBlankColumn(modifiedLine, 1);\n while (originalStartColumn > 1 && modifiedStartColumn > 1) {\n const originalChar = originalLine.charCodeAt(originalStartColumn - 2);\n const modifiedChar = modifiedLine.charCodeAt(modifiedStartColumn - 2);\n if (originalChar !== modifiedChar) {\n break;\n }\n originalStartColumn--;\n modifiedStartColumn--;\n }\n if (originalStartColumn > 1 || modifiedStartColumn > 1) {\n this._pushTrimWhitespaceCharChange(result, originalLineIndex + 1, 1, originalStartColumn, modifiedLineIndex + 1, 1, modifiedStartColumn);\n }\n }\n // Check the trailing whitespace\n {\n let originalEndColumn = getLastNonBlankColumn(originalLine, 1);\n let modifiedEndColumn = getLastNonBlankColumn(modifiedLine, 1);\n const originalMaxColumn = originalLine.length + 1;\n const modifiedMaxColumn = modifiedLine.length + 1;\n while (originalEndColumn < originalMaxColumn && modifiedEndColumn < modifiedMaxColumn) {\n const originalChar = originalLine.charCodeAt(originalEndColumn - 1);\n const modifiedChar = originalLine.charCodeAt(modifiedEndColumn - 1);\n if (originalChar !== modifiedChar) {\n break;\n }\n originalEndColumn++;\n modifiedEndColumn++;\n }\n if (originalEndColumn < originalMaxColumn || modifiedEndColumn < modifiedMaxColumn) {\n this._pushTrimWhitespaceCharChange(result, originalLineIndex + 1, originalEndColumn, originalMaxColumn, modifiedLineIndex + 1, modifiedEndColumn, modifiedMaxColumn);\n }\n }\n }\n originalLineIndex++;\n modifiedLineIndex++;\n }\n if (nextChange) {\n // Emit the actual change\n result.push(LineChange.createFromDiffResult(this.shouldIgnoreTrimWhitespace, nextChange, this.original, this.modified, this.continueCharDiff, this.shouldComputeCharChanges, this.shouldPostProcessCharChanges));\n originalLineIndex += nextChange.originalLength;\n modifiedLineIndex += nextChange.modifiedLength;\n }\n }\n return {\n quitEarly: quitEarly,\n changes: result\n };\n }\n _pushTrimWhitespaceCharChange(result, originalLineNumber, originalStartColumn, originalEndColumn, modifiedLineNumber, modifiedStartColumn, modifiedEndColumn) {\n if (this._mergeTrimWhitespaceCharChange(result, originalLineNumber, originalStartColumn, originalEndColumn, modifiedLineNumber, modifiedStartColumn, modifiedEndColumn)) {\n // Merged into previous\n return;\n }\n let charChanges = undefined;\n if (this.shouldComputeCharChanges) {\n charChanges = [new CharChange(originalLineNumber, originalStartColumn, originalLineNumber, originalEndColumn, modifiedLineNumber, modifiedStartColumn, modifiedLineNumber, modifiedEndColumn)];\n }\n result.push(new LineChange(originalLineNumber, originalLineNumber, modifiedLineNumber, modifiedLineNumber, charChanges));\n }\n _mergeTrimWhitespaceCharChange(result, originalLineNumber, originalStartColumn, originalEndColumn, modifiedLineNumber, modifiedStartColumn, modifiedEndColumn) {\n const len = result.length;\n if (len === 0) {\n return false;\n }\n const prevChange = result[len - 1];\n if (prevChange.originalEndLineNumber === 0 || prevChange.modifiedEndLineNumber === 0) {\n // Don't merge with inserts/deletes\n return false;\n }\n if (prevChange.originalEndLineNumber === originalLineNumber && prevChange.modifiedEndLineNumber === modifiedLineNumber) {\n if (this.shouldComputeCharChanges && prevChange.charChanges) {\n prevChange.charChanges.push(new CharChange(originalLineNumber, originalStartColumn, originalLineNumber, originalEndColumn, modifiedLineNumber, modifiedStartColumn, modifiedLineNumber, modifiedEndColumn));\n }\n return true;\n }\n if (prevChange.originalEndLineNumber + 1 === originalLineNumber && prevChange.modifiedEndLineNumber + 1 === modifiedLineNumber) {\n prevChange.originalEndLineNumber = originalLineNumber;\n prevChange.modifiedEndLineNumber = modifiedLineNumber;\n if (this.shouldComputeCharChanges && prevChange.charChanges) {\n prevChange.charChanges.push(new CharChange(originalLineNumber, originalStartColumn, originalLineNumber, originalEndColumn, modifiedLineNumber, modifiedStartColumn, modifiedLineNumber, modifiedEndColumn));\n }\n return true;\n }\n return false;\n }\n}\nfunction getFirstNonBlankColumn(txt, defaultValue) {\n const r = strings.firstNonWhitespaceIndex(txt);\n if (r === -1) {\n return defaultValue;\n }\n return r + 1;\n}\nfunction getLastNonBlankColumn(txt, defaultValue) {\n const r = strings.lastNonWhitespaceIndex(txt);\n if (r === -1) {\n return defaultValue;\n }\n return r + 2;\n}\nfunction createContinueProcessingPredicate(maximumRuntime) {\n if (maximumRuntime === 0) {\n return () => true;\n }\n const startTime = Date.now();\n return () => {\n return Date.now() - startTime < maximumRuntime;\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 *--------------------------------------------------------------------------------------------*/\nexport class LinesDiff {\n constructor(changes, \n /**\n * Sorted by original line ranges.\n * The original line ranges and the modified line ranges must be disjoint (but can be touching).\n */\n moves, \n /**\n * Indicates if the time out was reached.\n * In that case, the diffs might be an approximation and the user should be asked to rerun the diff with more time.\n */\n hitTimeout) {\n this.changes = changes;\n this.moves = moves;\n this.hitTimeout = hitTimeout;\n }\n}\nexport class MovedText {\n constructor(lineRangeMapping, changes) {\n this.lineRangeMapping = lineRangeMapping;\n this.changes = changes;\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 *--------------------------------------------------------------------------------------------*/\nimport { BugIndicatingError } from '../../../base/common/errors.js';\nimport { LineRange } from '../core/lineRange.js';\nimport { Range } from '../core/range.js';\nimport { SingleTextEdit } from '../core/textEdit.js';\n/**\n * Maps a line range in the original text model to a line range in the modified text model.\n */\nexport class LineRangeMapping {\n static inverse(mapping, originalLineCount, modifiedLineCount) {\n const result = [];\n let lastOriginalEndLineNumber = 1;\n let lastModifiedEndLineNumber = 1;\n for (const m of mapping) {\n const r = new LineRangeMapping(new LineRange(lastOriginalEndLineNumber, m.original.startLineNumber), new LineRange(lastModifiedEndLineNumber, m.modified.startLineNumber));\n if (!r.modified.isEmpty) {\n result.push(r);\n }\n lastOriginalEndLineNumber = m.original.endLineNumberExclusive;\n lastModifiedEndLineNumber = m.modified.endLineNumberExclusive;\n }\n const r = new LineRangeMapping(new LineRange(lastOriginalEndLineNumber, originalLineCount + 1), new LineRange(lastModifiedEndLineNumber, modifiedLineCount + 1));\n if (!r.modified.isEmpty) {\n result.push(r);\n }\n return result;\n }\n static clip(mapping, originalRange, modifiedRange) {\n const result = [];\n for (const m of mapping) {\n const original = m.original.intersect(originalRange);\n const modified = m.modified.intersect(modifiedRange);\n if (original && !original.isEmpty && modified && !modified.isEmpty) {\n result.push(new LineRangeMapping(original, modified));\n }\n }\n return result;\n }\n constructor(originalRange, modifiedRange) {\n this.original = originalRange;\n this.modified = modifiedRange;\n }\n toString() {\n return `{${this.original.toString()}->${this.modified.toString()}}`;\n }\n flip() {\n return new LineRangeMapping(this.modified, this.original);\n }\n join(other) {\n return new LineRangeMapping(this.original.join(other.original), this.modified.join(other.modified));\n }\n /**\n * This method assumes that the LineRangeMapping describes a valid diff!\n * I.e. if one range is empty, the other range cannot be the entire document.\n * It avoids various problems when the line range points to non-existing line-numbers.\n */\n toRangeMapping() {\n const origInclusiveRange = this.original.toInclusiveRange();\n const modInclusiveRange = this.modified.toInclusiveRange();\n if (origInclusiveRange && modInclusiveRange) {\n return new RangeMapping(origInclusiveRange, modInclusiveRange);\n }\n else if (this.original.startLineNumber === 1 || this.modified.startLineNumber === 1) {\n if (!(this.modified.startLineNumber === 1 && this.original.startLineNumber === 1)) {\n // If one line range starts at 1, the other one must start at 1 as well.\n throw new BugIndicatingError('not a valid diff');\n }\n // Because one range is empty and both ranges start at line 1, none of the ranges can cover all lines.\n // Thus, `endLineNumberExclusive` is a valid line number.\n return new RangeMapping(new Range(this.original.startLineNumber, 1, this.original.endLineNumberExclusive, 1), new Range(this.modified.startLineNumber, 1, this.modified.endLineNumberExclusive, 1));\n }\n else {\n // We can assume here that both startLineNumbers are greater than 1.\n return new RangeMapping(new Range(this.original.startLineNumber - 1, Number.MAX_SAFE_INTEGER, this.original.endLineNumberExclusive - 1, Number.MAX_SAFE_INTEGER), new Range(this.modified.startLineNumber - 1, Number.MAX_SAFE_INTEGER, this.modified.endLineNumberExclusive - 1, Number.MAX_SAFE_INTEGER));\n }\n }\n}\n/**\n * Maps a line range in the original text model to a line range in the modified text model.\n * Also contains inner range mappings.\n */\nexport class DetailedLineRangeMapping extends LineRangeMapping {\n static fromRangeMappings(rangeMappings) {\n const originalRange = LineRange.join(rangeMappings.map(r => LineRange.fromRangeInclusive(r.originalRange)));\n const modifiedRange = LineRange.join(rangeMappings.map(r => LineRange.fromRangeInclusive(r.modifiedRange)));\n return new DetailedLineRangeMapping(originalRange, modifiedRange, rangeMappings);\n }\n constructor(originalRange, modifiedRange, innerChanges) {\n super(originalRange, modifiedRange);\n this.innerChanges = innerChanges;\n }\n flip() {\n var _a;\n return new DetailedLineRangeMapping(this.modified, this.original, (_a = this.innerChanges) === null || _a === void 0 ? void 0 : _a.map(c => c.flip()));\n }\n withInnerChangesFromLineRanges() {\n return new DetailedLineRangeMapping(this.original, this.modified, [this.toRangeMapping()]);\n }\n}\n/**\n * Maps a range in the original text model to a range in the modified text model.\n */\nexport class RangeMapping {\n constructor(originalRange, modifiedRange) {\n this.originalRange = originalRange;\n this.modifiedRange = modifiedRange;\n }\n toString() {\n return `{${this.originalRange.toString()}->${this.modifiedRange.toString()}}`;\n }\n flip() {\n return new RangeMapping(this.modifiedRange, this.originalRange);\n }\n /**\n * Creates a single text edit that describes the change from the original to the modified text.\n */\n toTextEdit(modified) {\n const newText = modified.getValueOfRange(this.modifiedRange);\n return new SingleTextEdit(this.originalRange, newText);\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 *--------------------------------------------------------------------------------------------*/\nimport { assertFn, checkAdjacentItems } from '../../../base/common/assert.js';\nimport { BugIndicatingError } from '../../../base/common/errors.js';\nimport { Position } from './position.js';\nimport { PositionOffsetTransformer } from './positionToOffset.js';\nimport { Range } from './range.js';\nimport { TextLength } from './textLength.js';\nexport class TextEdit {\n constructor(edits) {\n this.edits = edits;\n assertFn(() => checkAdjacentItems(edits, (a, b) => a.range.getEndPosition().isBeforeOrEqual(b.range.getStartPosition())));\n }\n apply(text) {\n let result = '';\n let lastEditEnd = new Position(1, 1);\n for (const edit of this.edits) {\n const editRange = edit.range;\n const editStart = editRange.getStartPosition();\n const editEnd = editRange.getEndPosition();\n const r = rangeFromPositions(lastEditEnd, editStart);\n if (!r.isEmpty()) {\n result += text.getValueOfRange(r);\n }\n result += edit.text;\n lastEditEnd = editEnd;\n }\n const r = rangeFromPositions(lastEditEnd, text.endPositionExclusive);\n if (!r.isEmpty()) {\n result += text.getValueOfRange(r);\n }\n return result;\n }\n applyToString(str) {\n const strText = new StringText(str);\n return this.apply(strText);\n }\n getNewRanges() {\n const newRanges = [];\n let previousEditEndLineNumber = 0;\n let lineOffset = 0;\n let columnOffset = 0;\n for (const edit of this.edits) {\n const textLength = TextLength.ofText(edit.text);\n const newRangeStart = Position.lift({\n lineNumber: edit.range.startLineNumber + lineOffset,\n column: edit.range.startColumn + (edit.range.startLineNumber === previousEditEndLineNumber ? columnOffset : 0)\n });\n const newRange = textLength.createRange(newRangeStart);\n newRanges.push(newRange);\n lineOffset = newRange.endLineNumber - edit.range.endLineNumber;\n columnOffset = newRange.endColumn - edit.range.endColumn;\n previousEditEndLineNumber = edit.range.endLineNumber;\n }\n return newRanges;\n }\n}\nexport class SingleTextEdit {\n constructor(range, text) {\n this.range = range;\n this.text = text;\n }\n}\nfunction rangeFromPositions(start, end) {\n if (start.lineNumber === end.lineNumber && start.column === Number.MAX_SAFE_INTEGER) {\n return Range.fromPositions(end, end);\n }\n else if (!start.isBeforeOrEqual(end)) {\n throw new BugIndicatingError('start must be before end');\n }\n return new Range(start.lineNumber, start.column, end.lineNumber, end.column);\n}\nexport class AbstractText {\n get endPositionExclusive() {\n return this.length.addToPosition(new Position(1, 1));\n }\n}\nexport class StringText extends AbstractText {\n constructor(value) {\n super();\n this.value = value;\n this._t = new PositionOffsetTransformer(this.value);\n }\n getValueOfRange(range) {\n return this._t.getOffsetRange(range).substring(this.value);\n }\n get length() {\n return this._t.textLength;\n }\n}\n", "import { OffsetRange } from './offsetRange.js';\nimport { TextLength } from './textLength.js';\nexport class PositionOffsetTransformer {\n constructor(text) {\n this.text = text;\n this.lineStartOffsetByLineIdx = [];\n this.lineStartOffsetByLineIdx.push(0);\n for (let i = 0; i < text.length; i++) {\n if (text.charAt(i) === '\\n') {\n this.lineStartOffsetByLineIdx.push(i + 1);\n }\n }\n }\n getOffset(position) {\n return this.lineStartOffsetByLineIdx[position.lineNumber - 1] + position.column - 1;\n }\n getOffsetRange(range) {\n return new OffsetRange(this.getOffset(range.getStartPosition()), this.getOffset(range.getEndPosition()));\n }\n get textLength() {\n const lineIdx = this.lineStartOffsetByLineIdx.length - 1;\n return new TextLength(lineIdx, this.text.length - this.lineStartOffsetByLineIdx[lineIdx]);\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 *--------------------------------------------------------------------------------------------*/\nimport { equals, groupAdjacentBy } from '../../../../base/common/arrays.js';\nimport { assertFn, checkAdjacentItems } from '../../../../base/common/assert.js';\nimport { LineRange } from '../../core/lineRange.js';\nimport { OffsetRange } from '../../core/offsetRange.js';\nimport { Range } from '../../core/range.js';\nimport { DateTimeout, InfiniteTimeout, SequenceDiff } from './algorithms/diffAlgorithm.js';\nimport { DynamicProgrammingDiffing } from './algorithms/dynamicProgrammingDiffing.js';\nimport { MyersDiffAlgorithm } from './algorithms/myersDiffAlgorithm.js';\nimport { computeMovedLines } from './computeMovedLines.js';\nimport { extendDiffsToEntireWordIfAppropriate, optimizeSequenceDiffs, removeShortMatches, removeVeryShortMatchingLinesBetweenDiffs, removeVeryShortMatchingTextBetweenLongDiffs } from './heuristicSequenceOptimizations.js';\nimport { LineSequence } from './lineSequence.js';\nimport { LinesSliceCharSequence } from './linesSliceCharSequence.js';\nimport { LinesDiff, MovedText } from '../linesDiffComputer.js';\nimport { DetailedLineRangeMapping, RangeMapping } from '../rangeMapping.js';\nexport class DefaultLinesDiffComputer {\n constructor() {\n this.dynamicProgrammingDiffing = new DynamicProgrammingDiffing();\n this.myersDiffingAlgorithm = new MyersDiffAlgorithm();\n }\n computeDiff(originalLines, modifiedLines, options) {\n if (originalLines.length <= 1 && equals(originalLines, modifiedLines, (a, b) => a === b)) {\n return new LinesDiff([], [], false);\n }\n if (originalLines.length === 1 && originalLines[0].length === 0 || modifiedLines.length === 1 && modifiedLines[0].length === 0) {\n return new LinesDiff([\n new DetailedLineRangeMapping(new LineRange(1, originalLines.length + 1), new LineRange(1, modifiedLines.length + 1), [\n new RangeMapping(new Range(1, 1, originalLines.length, originalLines[originalLines.length - 1].length + 1), new Range(1, 1, modifiedLines.length, modifiedLines[modifiedLines.length - 1].length + 1))\n ])\n ], [], false);\n }\n const timeout = options.maxComputationTimeMs === 0 ? InfiniteTimeout.instance : new DateTimeout(options.maxComputationTimeMs);\n const considerWhitespaceChanges = !options.ignoreTrimWhitespace;\n const perfectHashes = new Map();\n function getOrCreateHash(text) {\n let hash = perfectHashes.get(text);\n if (hash === undefined) {\n hash = perfectHashes.size;\n perfectHashes.set(text, hash);\n }\n return hash;\n }\n const originalLinesHashes = originalLines.map((l) => getOrCreateHash(l.trim()));\n const modifiedLinesHashes = modifiedLines.map((l) => getOrCreateHash(l.trim()));\n const sequence1 = new LineSequence(originalLinesHashes, originalLines);\n const sequence2 = new LineSequence(modifiedLinesHashes, modifiedLines);\n const lineAlignmentResult = (() => {\n if (sequence1.length + sequence2.length < 1700) {\n // Use the improved algorithm for small files\n return this.dynamicProgrammingDiffing.compute(sequence1, sequence2, timeout, (offset1, offset2) => originalLines[offset1] === modifiedLines[offset2]\n ? modifiedLines[offset2].length === 0\n ? 0.1\n : 1 + Math.log(1 + modifiedLines[offset2].length)\n : 0.99);\n }\n return this.myersDiffingAlgorithm.compute(sequence1, sequence2);\n })();\n let lineAlignments = lineAlignmentResult.diffs;\n let hitTimeout = lineAlignmentResult.hitTimeout;\n lineAlignments = optimizeSequenceDiffs(sequence1, sequence2, lineAlignments);\n lineAlignments = removeVeryShortMatchingLinesBetweenDiffs(sequence1, sequence2, lineAlignments);\n const alignments = [];\n const scanForWhitespaceChanges = (equalLinesCount) => {\n if (!considerWhitespaceChanges) {\n return;\n }\n for (let i = 0; i < equalLinesCount; i++) {\n const seq1Offset = seq1LastStart + i;\n const seq2Offset = seq2LastStart + i;\n if (originalLines[seq1Offset] !== modifiedLines[seq2Offset]) {\n // This is because of whitespace changes, diff these lines\n const characterDiffs = this.refineDiff(originalLines, modifiedLines, new SequenceDiff(new OffsetRange(seq1Offset, seq1Offset + 1), new OffsetRange(seq2Offset, seq2Offset + 1)), timeout, considerWhitespaceChanges);\n for (const a of characterDiffs.mappings) {\n alignments.push(a);\n }\n if (characterDiffs.hitTimeout) {\n hitTimeout = true;\n }\n }\n }\n };\n let seq1LastStart = 0;\n let seq2LastStart = 0;\n for (const diff of lineAlignments) {\n assertFn(() => diff.seq1Range.start - seq1LastStart === diff.seq2Range.start - seq2LastStart);\n const equalLinesCount = diff.seq1Range.start - seq1LastStart;\n scanForWhitespaceChanges(equalLinesCount);\n seq1LastStart = diff.seq1Range.endExclusive;\n seq2LastStart = diff.seq2Range.endExclusive;\n const characterDiffs = this.refineDiff(originalLines, modifiedLines, diff, timeout, considerWhitespaceChanges);\n if (characterDiffs.hitTimeout) {\n hitTimeout = true;\n }\n for (const a of characterDiffs.mappings) {\n alignments.push(a);\n }\n }\n scanForWhitespaceChanges(originalLines.length - seq1LastStart);\n const changes = lineRangeMappingFromRangeMappings(alignments, originalLines, modifiedLines);\n let moves = [];\n if (options.computeMoves) {\n moves = this.computeMoves(changes, originalLines, modifiedLines, originalLinesHashes, modifiedLinesHashes, timeout, considerWhitespaceChanges);\n }\n // Make sure all ranges are valid\n assertFn(() => {\n function validatePosition(pos, lines) {\n if (pos.lineNumber < 1 || pos.lineNumber > lines.length) {\n return false;\n }\n const line = lines[pos.lineNumber - 1];\n if (pos.column < 1 || pos.column > line.length + 1) {\n return false;\n }\n return true;\n }\n function validateRange(range, lines) {\n if (range.startLineNumber < 1 || range.startLineNumber > lines.length + 1) {\n return false;\n }\n if (range.endLineNumberExclusive < 1 || range.endLineNumberExclusive > lines.length + 1) {\n return false;\n }\n return true;\n }\n for (const c of changes) {\n if (!c.innerChanges) {\n return false;\n }\n for (const ic of c.innerChanges) {\n const valid = validatePosition(ic.modifiedRange.getStartPosition(), modifiedLines) && validatePosition(ic.modifiedRange.getEndPosition(), modifiedLines) &&\n validatePosition(ic.originalRange.getStartPosition(), originalLines) && validatePosition(ic.originalRange.getEndPosition(), originalLines);\n if (!valid) {\n return false;\n }\n }\n if (!validateRange(c.modified, modifiedLines) || !validateRange(c.original, originalLines)) {\n return false;\n }\n }\n return true;\n });\n return new LinesDiff(changes, moves, hitTimeout);\n }\n computeMoves(changes, originalLines, modifiedLines, hashedOriginalLines, hashedModifiedLines, timeout, considerWhitespaceChanges) {\n const moves = computeMovedLines(changes, originalLines, modifiedLines, hashedOriginalLines, hashedModifiedLines, timeout);\n const movesWithDiffs = moves.map(m => {\n const moveChanges = this.refineDiff(originalLines, modifiedLines, new SequenceDiff(m.original.toOffsetRange(), m.modified.toOffsetRange()), timeout, considerWhitespaceChanges);\n const mappings = lineRangeMappingFromRangeMappings(moveChanges.mappings, originalLines, modifiedLines, true);\n return new MovedText(m, mappings);\n });\n return movesWithDiffs;\n }\n refineDiff(originalLines, modifiedLines, diff, timeout, considerWhitespaceChanges) {\n const slice1 = new LinesSliceCharSequence(originalLines, diff.seq1Range, considerWhitespaceChanges);\n const slice2 = new LinesSliceCharSequence(modifiedLines, diff.seq2Range, considerWhitespaceChanges);\n const diffResult = slice1.length + slice2.length < 500\n ? this.dynamicProgrammingDiffing.compute(slice1, slice2, timeout)\n : this.myersDiffingAlgorithm.compute(slice1, slice2, timeout);\n let diffs = diffResult.diffs;\n diffs = optimizeSequenceDiffs(slice1, slice2, diffs);\n diffs = extendDiffsToEntireWordIfAppropriate(slice1, slice2, diffs);\n diffs = removeShortMatches(slice1, slice2, diffs);\n diffs = removeVeryShortMatchingTextBetweenLongDiffs(slice1, slice2, diffs);\n const result = diffs.map((d) => new RangeMapping(slice1.translateRange(d.seq1Range), slice2.translateRange(d.seq2Range)));\n // Assert: result applied on original should be the same as diff applied to original\n return {\n mappings: result,\n hitTimeout: diffResult.hitTimeout,\n };\n }\n}\nexport function lineRangeMappingFromRangeMappings(alignments, originalLines, modifiedLines, dontAssertStartLine = false) {\n const changes = [];\n for (const g of groupAdjacentBy(alignments.map(a => getLineRangeMapping(a, originalLines, modifiedLines)), (a1, a2) => a1.original.overlapOrTouch(a2.original)\n || a1.modified.overlapOrTouch(a2.modified))) {\n const first = g[0];\n const last = g[g.length - 1];\n changes.push(new DetailedLineRangeMapping(first.original.join(last.original), first.modified.join(last.modified), g.map(a => a.innerChanges[0])));\n }\n assertFn(() => {\n if (!dontAssertStartLine && changes.length > 0) {\n if (changes[0].modified.startLineNumber !== changes[0].original.startLineNumber) {\n return false;\n }\n if (modifiedLines.length - changes[changes.length - 1].modified.endLineNumberExclusive !== originalLines.length - changes[changes.length - 1].original.endLineNumberExclusive) {\n return false;\n }\n }\n return checkAdjacentItems(changes, (m1, m2) => m2.original.startLineNumber - m1.original.endLineNumberExclusive === m2.modified.startLineNumber - m1.modified.endLineNumberExclusive &&\n // There has to be an unchanged line in between (otherwise both diffs should have been joined)\n m1.original.endLineNumberExclusive < m2.original.startLineNumber &&\n m1.modified.endLineNumberExclusive < m2.modified.startLineNumber);\n });\n return changes;\n}\nexport function getLineRangeMapping(rangeMapping, originalLines, modifiedLines) {\n let lineStartDelta = 0;\n let lineEndDelta = 0;\n // rangeMapping describes the edit that replaces `rangeMapping.originalRange` with `newText := getText(modifiedLines, rangeMapping.modifiedRange)`.\n // original: ]xxx \\n <- this line is not modified\n // modified: ]xx \\n\n if (rangeMapping.modifiedRange.endColumn === 1 && rangeMapping.originalRange.endColumn === 1\n && rangeMapping.originalRange.startLineNumber + lineStartDelta <= rangeMapping.originalRange.endLineNumber\n && rangeMapping.modifiedRange.startLineNumber + lineStartDelta <= rangeMapping.modifiedRange.endLineNumber) {\n // We can only do this if the range is not empty yet\n lineEndDelta = -1;\n }\n // original: xxx[ \\n <- this line is not modified\n // modified: xxx[ \\n\n if (rangeMapping.modifiedRange.startColumn - 1 >= modifiedLines[rangeMapping.modifiedRange.startLineNumber - 1].length\n && rangeMapping.originalRange.startColumn - 1 >= originalLines[rangeMapping.originalRange.startLineNumber - 1].length\n && rangeMapping.originalRange.startLineNumber <= rangeMapping.originalRange.endLineNumber + lineEndDelta\n && rangeMapping.modifiedRange.startLineNumber <= rangeMapping.modifiedRange.endLineNumber + lineEndDelta) {\n // We can only do this if the range is not empty yet\n lineStartDelta = 1;\n }\n const originalLineRange = new LineRange(rangeMapping.originalRange.startLineNumber + lineStartDelta, rangeMapping.originalRange.endLineNumber + 1 + lineEndDelta);\n const modifiedLineRange = new LineRange(rangeMapping.modifiedRange.startLineNumber + lineStartDelta, rangeMapping.modifiedRange.endLineNumber + 1 + lineEndDelta);\n return new DetailedLineRangeMapping(originalLineRange, modifiedLineRange, [rangeMapping]);\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 { forEachAdjacent } from '../../../../../base/common/arrays.js';\nimport { BugIndicatingError } from '../../../../../base/common/errors.js';\nimport { OffsetRange } from '../../../core/offsetRange.js';\nexport class DiffAlgorithmResult {\n static trivial(seq1, seq2) {\n return new DiffAlgorithmResult([new SequenceDiff(OffsetRange.ofLength(seq1.length), OffsetRange.ofLength(seq2.length))], false);\n }\n static trivialTimedOut(seq1, seq2) {\n return new DiffAlgorithmResult([new SequenceDiff(OffsetRange.ofLength(seq1.length), OffsetRange.ofLength(seq2.length))], true);\n }\n constructor(diffs, \n /**\n * Indicates if the time out was reached.\n * In that case, the diffs might be an approximation and the user should be asked to rerun the diff with more time.\n */\n hitTimeout) {\n this.diffs = diffs;\n this.hitTimeout = hitTimeout;\n }\n}\nexport class SequenceDiff {\n static invert(sequenceDiffs, doc1Length) {\n const result = [];\n forEachAdjacent(sequenceDiffs, (a, b) => {\n result.push(SequenceDiff.fromOffsetPairs(a ? a.getEndExclusives() : OffsetPair.zero, b ? b.getStarts() : new OffsetPair(doc1Length, (a ? a.seq2Range.endExclusive - a.seq1Range.endExclusive : 0) + doc1Length)));\n });\n return result;\n }\n static fromOffsetPairs(start, endExclusive) {\n return new SequenceDiff(new OffsetRange(start.offset1, endExclusive.offset1), new OffsetRange(start.offset2, endExclusive.offset2));\n }\n constructor(seq1Range, seq2Range) {\n this.seq1Range = seq1Range;\n this.seq2Range = seq2Range;\n }\n swap() {\n return new SequenceDiff(this.seq2Range, this.seq1Range);\n }\n toString() {\n return `${this.seq1Range} <-> ${this.seq2Range}`;\n }\n join(other) {\n return new SequenceDiff(this.seq1Range.join(other.seq1Range), this.seq2Range.join(other.seq2Range));\n }\n delta(offset) {\n if (offset === 0) {\n return this;\n }\n return new SequenceDiff(this.seq1Range.delta(offset), this.seq2Range.delta(offset));\n }\n deltaStart(offset) {\n if (offset === 0) {\n return this;\n }\n return new SequenceDiff(this.seq1Range.deltaStart(offset), this.seq2Range.deltaStart(offset));\n }\n deltaEnd(offset) {\n if (offset === 0) {\n return this;\n }\n return new SequenceDiff(this.seq1Range.deltaEnd(offset), this.seq2Range.deltaEnd(offset));\n }\n intersect(other) {\n const i1 = this.seq1Range.intersect(other.seq1Range);\n const i2 = this.seq2Range.intersect(other.seq2Range);\n if (!i1 || !i2) {\n return undefined;\n }\n return new SequenceDiff(i1, i2);\n }\n getStarts() {\n return new OffsetPair(this.seq1Range.start, this.seq2Range.start);\n }\n getEndExclusives() {\n return new OffsetPair(this.seq1Range.endExclusive, this.seq2Range.endExclusive);\n }\n}\nexport class OffsetPair {\n constructor(offset1, offset2) {\n this.offset1 = offset1;\n this.offset2 = offset2;\n }\n toString() {\n return `${this.offset1} <-> ${this.offset2}`;\n }\n delta(offset) {\n if (offset === 0) {\n return this;\n }\n return new OffsetPair(this.offset1 + offset, this.offset2 + offset);\n }\n equals(other) {\n return this.offset1 === other.offset1 && this.offset2 === other.offset2;\n }\n}\nOffsetPair.zero = new OffsetPair(0, 0);\nOffsetPair.max = new OffsetPair(Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER);\nexport class InfiniteTimeout {\n isValid() {\n return true;\n }\n}\nInfiniteTimeout.instance = new InfiniteTimeout();\nexport class DateTimeout {\n constructor(timeout) {\n this.timeout = timeout;\n this.startTime = Date.now();\n this.valid = true;\n if (timeout <= 0) {\n throw new BugIndicatingError('timeout must be positive');\n }\n }\n // Recommendation: Set a log-point `{this.disable()}` in the body\n isValid() {\n const valid = Date.now() - this.startTime < this.timeout;\n if (!valid && this.valid) {\n this.valid = false; // timeout reached\n // eslint-disable-next-line no-debugger\n debugger; // WARNING: Most likely debugging caused the timeout. Call `this.disable()` to continue without timing out.\n }\n return this.valid;\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 *--------------------------------------------------------------------------------------------*/\nimport { OffsetRange } from '../../../core/offsetRange.js';\nimport { SequenceDiff, InfiniteTimeout, DiffAlgorithmResult } from './diffAlgorithm.js';\nimport { Array2D } from '../utils.js';\n/**\n * A O(MN) diffing algorithm that supports a score function.\n * The algorithm can be improved by processing the 2d array diagonally.\n*/\nexport class DynamicProgrammingDiffing {\n compute(sequence1, sequence2, timeout = InfiniteTimeout.instance, equalityScore) {\n if (sequence1.length === 0 || sequence2.length === 0) {\n return DiffAlgorithmResult.trivial(sequence1, sequence2);\n }\n /**\n * lcsLengths.get(i, j): Length of the longest common subsequence of sequence1.substring(0, i + 1) and sequence2.substring(0, j + 1).\n */\n const lcsLengths = new Array2D(sequence1.length, sequence2.length);\n const directions = new Array2D(sequence1.length, sequence2.length);\n const lengths = new Array2D(sequence1.length, sequence2.length);\n // ==== Initializing lcsLengths ====\n for (let s1 = 0; s1 < sequence1.length; s1++) {\n for (let s2 = 0; s2 < sequence2.length; s2++) {\n if (!timeout.isValid()) {\n return DiffAlgorithmResult.trivialTimedOut(sequence1, sequence2);\n }\n const horizontalLen = s1 === 0 ? 0 : lcsLengths.get(s1 - 1, s2);\n const verticalLen = s2 === 0 ? 0 : lcsLengths.get(s1, s2 - 1);\n let extendedSeqScore;\n if (sequence1.getElement(s1) === sequence2.getElement(s2)) {\n if (s1 === 0 || s2 === 0) {\n extendedSeqScore = 0;\n }\n else {\n extendedSeqScore = lcsLengths.get(s1 - 1, s2 - 1);\n }\n if (s1 > 0 && s2 > 0 && directions.get(s1 - 1, s2 - 1) === 3) {\n // Prefer consecutive diagonals\n extendedSeqScore += lengths.get(s1 - 1, s2 - 1);\n }\n extendedSeqScore += (equalityScore ? equalityScore(s1, s2) : 1);\n }\n else {\n extendedSeqScore = -1;\n }\n const newValue = Math.max(horizontalLen, verticalLen, extendedSeqScore);\n if (newValue === extendedSeqScore) {\n // Prefer diagonals\n const prevLen = s1 > 0 && s2 > 0 ? lengths.get(s1 - 1, s2 - 1) : 0;\n lengths.set(s1, s2, prevLen + 1);\n directions.set(s1, s2, 3);\n }\n else if (newValue === horizontalLen) {\n lengths.set(s1, s2, 0);\n directions.set(s1, s2, 1);\n }\n else if (newValue === verticalLen) {\n lengths.set(s1, s2, 0);\n directions.set(s1, s2, 2);\n }\n lcsLengths.set(s1, s2, newValue);\n }\n }\n // ==== Backtracking ====\n const result = [];\n let lastAligningPosS1 = sequence1.length;\n let lastAligningPosS2 = sequence2.length;\n function reportDecreasingAligningPositions(s1, s2) {\n if (s1 + 1 !== lastAligningPosS1 || s2 + 1 !== lastAligningPosS2) {\n result.push(new SequenceDiff(new OffsetRange(s1 + 1, lastAligningPosS1), new OffsetRange(s2 + 1, lastAligningPosS2)));\n }\n lastAligningPosS1 = s1;\n lastAligningPosS2 = s2;\n }\n let s1 = sequence1.length - 1;\n let s2 = sequence2.length - 1;\n while (s1 >= 0 && s2 >= 0) {\n if (directions.get(s1, s2) === 3) {\n reportDecreasingAligningPositions(s1, s2);\n s1--;\n s2--;\n }\n else {\n if (directions.get(s1, s2) === 1) {\n s1--;\n }\n else {\n s2--;\n }\n }\n }\n reportDecreasingAligningPositions(-1, -1);\n result.reverse();\n return new DiffAlgorithmResult(result, false);\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 *--------------------------------------------------------------------------------------------*/\nexport class Array2D {\n constructor(width, height) {\n this.width = width;\n this.height = height;\n this.array = [];\n this.array = new Array(width * height);\n }\n get(x, y) {\n return this.array[x + y * this.width];\n }\n set(x, y, value) {\n this.array[x + y * this.width] = value;\n }\n}\nexport function isSpace(charCode) {\n return charCode === 32 /* CharCode.Space */ || charCode === 9 /* CharCode.Tab */;\n}\nexport class LineRangeFragment {\n static getKey(chr) {\n let key = this.chrKeys.get(chr);\n if (key === undefined) {\n key = this.chrKeys.size;\n this.chrKeys.set(chr, key);\n }\n return key;\n }\n constructor(range, lines, source) {\n this.range = range;\n this.lines = lines;\n this.source = source;\n this.histogram = [];\n let counter = 0;\n for (let i = range.startLineNumber - 1; i < range.endLineNumberExclusive - 1; i++) {\n const line = lines[i];\n for (let j = 0; j < line.length; j++) {\n counter++;\n const chr = line[j];\n const key = LineRangeFragment.getKey(chr);\n this.histogram[key] = (this.histogram[key] || 0) + 1;\n }\n counter++;\n const key = LineRangeFragment.getKey('\\n');\n this.histogram[key] = (this.histogram[key] || 0) + 1;\n }\n this.totalCount = counter;\n }\n computeSimilarity(other) {\n var _a, _b;\n let sumDifferences = 0;\n const maxLength = Math.max(this.histogram.length, other.histogram.length);\n for (let i = 0; i < maxLength; i++) {\n sumDifferences += Math.abs(((_a = this.histogram[i]) !== null && _a !== void 0 ? _a : 0) - ((_b = other.histogram[i]) !== null && _b !== void 0 ? _b : 0));\n }\n return 1 - (sumDifferences / (this.totalCount + other.totalCount));\n }\n}\nLineRangeFragment.chrKeys = new 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 *--------------------------------------------------------------------------------------------*/\nimport { OffsetRange } from '../../../core/offsetRange.js';\nimport { DiffAlgorithmResult, InfiniteTimeout, SequenceDiff } from './diffAlgorithm.js';\n/**\n * An O(ND) diff algorithm that has a quadratic space worst-case complexity.\n*/\nexport class MyersDiffAlgorithm {\n compute(seq1, seq2, timeout = InfiniteTimeout.instance) {\n // These are common special cases.\n // The early return improves performance dramatically.\n if (seq1.length === 0 || seq2.length === 0) {\n return DiffAlgorithmResult.trivial(seq1, seq2);\n }\n const seqX = seq1; // Text on the x axis\n const seqY = seq2; // Text on the y axis\n function getXAfterSnake(x, y) {\n while (x < seqX.length && y < seqY.length && seqX.getElement(x) === seqY.getElement(y)) {\n x++;\n y++;\n }\n return x;\n }\n let d = 0;\n // V[k]: X value of longest d-line that ends in diagonal k.\n // d-line: path from (0,0) to (x,y) that uses exactly d non-diagonals.\n // diagonal k: Set of points (x,y) with x-y = k.\n // k=1 -> (1,0),(2,1)\n const V = new FastInt32Array();\n V.set(0, getXAfterSnake(0, 0));\n const paths = new FastArrayNegativeIndices();\n paths.set(0, V.get(0) === 0 ? null : new SnakePath(null, 0, 0, V.get(0)));\n let k = 0;\n loop: while (true) {\n d++;\n if (!timeout.isValid()) {\n return DiffAlgorithmResult.trivialTimedOut(seqX, seqY);\n }\n // The paper has `for (k = -d; k <= d; k += 2)`, but we can ignore diagonals that cannot influence the result.\n const lowerBound = -Math.min(d, seqY.length + (d % 2));\n const upperBound = Math.min(d, seqX.length + (d % 2));\n for (k = lowerBound; k <= upperBound; k += 2) {\n let step = 0;\n // We can use the X values of (d-1)-lines to compute X value of the longest d-lines.\n const maxXofDLineTop = k === upperBound ? -1 : V.get(k + 1); // We take a vertical non-diagonal (add a symbol in seqX)\n const maxXofDLineLeft = k === lowerBound ? -1 : V.get(k - 1) + 1; // We take a horizontal non-diagonal (+1 x) (delete a symbol in seqX)\n step++;\n const x = Math.min(Math.max(maxXofDLineTop, maxXofDLineLeft), seqX.length);\n const y = x - k;\n step++;\n if (x > seqX.length || y > seqY.length) {\n // This diagonal is irrelevant for the result.\n // TODO: Don't pay the cost for this in the next iteration.\n continue;\n }\n const newMaxX = getXAfterSnake(x, y);\n V.set(k, newMaxX);\n const lastPath = x === maxXofDLineTop ? paths.get(k + 1) : paths.get(k - 1);\n paths.set(k, newMaxX !== x ? new SnakePath(lastPath, x, y, newMaxX - x) : lastPath);\n if (V.get(k) === seqX.length && V.get(k) - k === seqY.length) {\n break loop;\n }\n }\n }\n let path = paths.get(k);\n const result = [];\n let lastAligningPosS1 = seqX.length;\n let lastAligningPosS2 = seqY.length;\n while (true) {\n const endX = path ? path.x + path.length : 0;\n const endY = path ? path.y + path.length : 0;\n if (endX !== lastAligningPosS1 || endY !== lastAligningPosS2) {\n result.push(new SequenceDiff(new OffsetRange(endX, lastAligningPosS1), new OffsetRange(endY, lastAligningPosS2)));\n }\n if (!path) {\n break;\n }\n lastAligningPosS1 = path.x;\n lastAligningPosS2 = path.y;\n path = path.prev;\n }\n result.reverse();\n return new DiffAlgorithmResult(result, false);\n }\n}\nclass SnakePath {\n constructor(prev, x, y, length) {\n this.prev = prev;\n this.x = x;\n this.y = y;\n this.length = length;\n }\n}\n/**\n * An array that supports fast negative indices.\n*/\nclass FastInt32Array {\n constructor() {\n this.positiveArr = new Int32Array(10);\n this.negativeArr = new Int32Array(10);\n }\n get(idx) {\n if (idx < 0) {\n idx = -idx - 1;\n return this.negativeArr[idx];\n }\n else {\n return this.positiveArr[idx];\n }\n }\n set(idx, value) {\n if (idx < 0) {\n idx = -idx - 1;\n if (idx >= this.negativeArr.length) {\n const arr = this.negativeArr;\n this.negativeArr = new Int32Array(arr.length * 2);\n this.negativeArr.set(arr);\n }\n this.negativeArr[idx] = value;\n }\n else {\n if (idx >= this.positiveArr.length) {\n const arr = this.positiveArr;\n this.positiveArr = new Int32Array(arr.length * 2);\n this.positiveArr.set(arr);\n }\n this.positiveArr[idx] = value;\n }\n }\n}\n/**\n * An array that supports fast negative indices.\n*/\nclass FastArrayNegativeIndices {\n constructor() {\n this.positiveArr = [];\n this.negativeArr = [];\n }\n get(idx) {\n if (idx < 0) {\n idx = -idx - 1;\n return this.negativeArr[idx];\n }\n else {\n return this.positiveArr[idx];\n }\n }\n set(idx, value) {\n if (idx < 0) {\n idx = -idx - 1;\n this.negativeArr[idx] = value;\n }\n else {\n this.positiveArr[idx] = value;\n }\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 *--------------------------------------------------------------------------------------------*/\nimport { SequenceDiff } from './algorithms/diffAlgorithm.js';\nimport { LineRangeMapping } from '../rangeMapping.js';\nimport { pushMany, compareBy, numberComparator, reverseOrder } from '../../../../base/common/arrays.js';\nimport { MonotonousArray, findLastMonotonous } from '../../../../base/common/arraysFind.js';\nimport { SetMap } from '../../../../base/common/map.js';\nimport { LineRange, LineRangeSet } from '../../core/lineRange.js';\nimport { OffsetRange } from '../../core/offsetRange.js';\nimport { LinesSliceCharSequence } from './linesSliceCharSequence.js';\nimport { LineRangeFragment, isSpace } from './utils.js';\nimport { MyersDiffAlgorithm } from './algorithms/myersDiffAlgorithm.js';\nexport function computeMovedLines(changes, originalLines, modifiedLines, hashedOriginalLines, hashedModifiedLines, timeout) {\n let { moves, excludedChanges } = computeMovesFromSimpleDeletionsToSimpleInsertions(changes, originalLines, modifiedLines, timeout);\n if (!timeout.isValid()) {\n return [];\n }\n const filteredChanges = changes.filter(c => !excludedChanges.has(c));\n const unchangedMoves = computeUnchangedMoves(filteredChanges, hashedOriginalLines, hashedModifiedLines, originalLines, modifiedLines, timeout);\n pushMany(moves, unchangedMoves);\n moves = joinCloseConsecutiveMoves(moves);\n // Ignore too short moves\n moves = moves.filter(current => {\n const lines = current.original.toOffsetRange().slice(originalLines).map(l => l.trim());\n const originalText = lines.join('\\n');\n return originalText.length >= 15 && countWhere(lines, l => l.length >= 2) >= 2;\n });\n moves = removeMovesInSameDiff(changes, moves);\n return moves;\n}\nfunction countWhere(arr, predicate) {\n let count = 0;\n for (const t of arr) {\n if (predicate(t)) {\n count++;\n }\n }\n return count;\n}\nfunction computeMovesFromSimpleDeletionsToSimpleInsertions(changes, originalLines, modifiedLines, timeout) {\n const moves = [];\n const deletions = changes\n .filter(c => c.modified.isEmpty && c.original.length >= 3)\n .map(d => new LineRangeFragment(d.original, originalLines, d));\n const insertions = new Set(changes\n .filter(c => c.original.isEmpty && c.modified.length >= 3)\n .map(d => new LineRangeFragment(d.modified, modifiedLines, d)));\n const excludedChanges = new Set();\n for (const deletion of deletions) {\n let highestSimilarity = -1;\n let best;\n for (const insertion of insertions) {\n const similarity = deletion.computeSimilarity(insertion);\n if (similarity > highestSimilarity) {\n highestSimilarity = similarity;\n best = insertion;\n }\n }\n if (highestSimilarity > 0.90 && best) {\n insertions.delete(best);\n moves.push(new LineRangeMapping(deletion.range, best.range));\n excludedChanges.add(deletion.source);\n excludedChanges.add(best.source);\n }\n if (!timeout.isValid()) {\n return { moves, excludedChanges };\n }\n }\n return { moves, excludedChanges };\n}\nfunction computeUnchangedMoves(changes, hashedOriginalLines, hashedModifiedLines, originalLines, modifiedLines, timeout) {\n const moves = [];\n const original3LineHashes = new SetMap();\n for (const change of changes) {\n for (let i = change.original.startLineNumber; i < change.original.endLineNumberExclusive - 2; i++) {\n const key = `${hashedOriginalLines[i - 1]}:${hashedOriginalLines[i + 1 - 1]}:${hashedOriginalLines[i + 2 - 1]}`;\n original3LineHashes.add(key, { range: new LineRange(i, i + 3) });\n }\n }\n const possibleMappings = [];\n changes.sort(compareBy(c => c.modified.startLineNumber, numberComparator));\n for (const change of changes) {\n let lastMappings = [];\n for (let i = change.modified.startLineNumber; i < change.modified.endLineNumberExclusive - 2; i++) {\n const key = `${hashedModifiedLines[i - 1]}:${hashedModifiedLines[i + 1 - 1]}:${hashedModifiedLines[i + 2 - 1]}`;\n const currentModifiedRange = new LineRange(i, i + 3);\n const nextMappings = [];\n original3LineHashes.forEach(key, ({ range }) => {\n for (const lastMapping of lastMappings) {\n // does this match extend some last match?\n if (lastMapping.originalLineRange.endLineNumberExclusive + 1 === range.endLineNumberExclusive &&\n lastMapping.modifiedLineRange.endLineNumberExclusive + 1 === currentModifiedRange.endLineNumberExclusive) {\n lastMapping.originalLineRange = new LineRange(lastMapping.originalLineRange.startLineNumber, range.endLineNumberExclusive);\n lastMapping.modifiedLineRange = new LineRange(lastMapping.modifiedLineRange.startLineNumber, currentModifiedRange.endLineNumberExclusive);\n nextMappings.push(lastMapping);\n return;\n }\n }\n const mapping = {\n modifiedLineRange: currentModifiedRange,\n originalLineRange: range,\n };\n possibleMappings.push(mapping);\n nextMappings.push(mapping);\n });\n lastMappings = nextMappings;\n }\n if (!timeout.isValid()) {\n return [];\n }\n }\n possibleMappings.sort(reverseOrder(compareBy(m => m.modifiedLineRange.length, numberComparator)));\n const modifiedSet = new LineRangeSet();\n const originalSet = new LineRangeSet();\n for (const mapping of possibleMappings) {\n const diffOrigToMod = mapping.modifiedLineRange.startLineNumber - mapping.originalLineRange.startLineNumber;\n const modifiedSections = modifiedSet.subtractFrom(mapping.modifiedLineRange);\n const originalTranslatedSections = originalSet.subtractFrom(mapping.originalLineRange).getWithDelta(diffOrigToMod);\n const modifiedIntersectedSections = modifiedSections.getIntersection(originalTranslatedSections);\n for (const s of modifiedIntersectedSections.ranges) {\n if (s.length < 3) {\n continue;\n }\n const modifiedLineRange = s;\n const originalLineRange = s.delta(-diffOrigToMod);\n moves.push(new LineRangeMapping(originalLineRange, modifiedLineRange));\n modifiedSet.addRange(modifiedLineRange);\n originalSet.addRange(originalLineRange);\n }\n }\n moves.sort(compareBy(m => m.original.startLineNumber, numberComparator));\n const monotonousChanges = new MonotonousArray(changes);\n for (let i = 0; i < moves.length; i++) {\n const move = moves[i];\n const firstTouchingChangeOrig = monotonousChanges.findLastMonotonous(c => c.original.startLineNumber <= move.original.startLineNumber);\n const firstTouchingChangeMod = findLastMonotonous(changes, c => c.modified.startLineNumber <= move.modified.startLineNumber);\n const linesAbove = Math.max(move.original.startLineNumber - firstTouchingChangeOrig.original.startLineNumber, move.modified.startLineNumber - firstTouchingChangeMod.modified.startLineNumber);\n const lastTouchingChangeOrig = monotonousChanges.findLastMonotonous(c => c.original.startLineNumber < move.original.endLineNumberExclusive);\n const lastTouchingChangeMod = findLastMonotonous(changes, c => c.modified.startLineNumber < move.modified.endLineNumberExclusive);\n const linesBelow = Math.max(lastTouchingChangeOrig.original.endLineNumberExclusive - move.original.endLineNumberExclusive, lastTouchingChangeMod.modified.endLineNumberExclusive - move.modified.endLineNumberExclusive);\n let extendToTop;\n for (extendToTop = 0; extendToTop < linesAbove; extendToTop++) {\n const origLine = move.original.startLineNumber - extendToTop - 1;\n const modLine = move.modified.startLineNumber - extendToTop - 1;\n if (origLine > originalLines.length || modLine > modifiedLines.length) {\n break;\n }\n if (modifiedSet.contains(modLine) || originalSet.contains(origLine)) {\n break;\n }\n if (!areLinesSimilar(originalLines[origLine - 1], modifiedLines[modLine - 1], timeout)) {\n break;\n }\n }\n if (extendToTop > 0) {\n originalSet.addRange(new LineRange(move.original.startLineNumber - extendToTop, move.original.startLineNumber));\n modifiedSet.addRange(new LineRange(move.modified.startLineNumber - extendToTop, move.modified.startLineNumber));\n }\n let extendToBottom;\n for (extendToBottom = 0; extendToBottom < linesBelow; extendToBottom++) {\n const origLine = move.original.endLineNumberExclusive + extendToBottom;\n const modLine = move.modified.endLineNumberExclusive + extendToBottom;\n if (origLine > originalLines.length || modLine > modifiedLines.length) {\n break;\n }\n if (modifiedSet.contains(modLine) || originalSet.contains(origLine)) {\n break;\n }\n if (!areLinesSimilar(originalLines[origLine - 1], modifiedLines[modLine - 1], timeout)) {\n break;\n }\n }\n if (extendToBottom > 0) {\n originalSet.addRange(new LineRange(move.original.endLineNumberExclusive, move.original.endLineNumberExclusive + extendToBottom));\n modifiedSet.addRange(new LineRange(move.modified.endLineNumberExclusive, move.modified.endLineNumberExclusive + extendToBottom));\n }\n if (extendToTop > 0 || extendToBottom > 0) {\n moves[i] = new LineRangeMapping(new LineRange(move.original.startLineNumber - extendToTop, move.original.endLineNumberExclusive + extendToBottom), new LineRange(move.modified.startLineNumber - extendToTop, move.modified.endLineNumberExclusive + extendToBottom));\n }\n }\n return moves;\n}\nfunction areLinesSimilar(line1, line2, timeout) {\n if (line1.trim() === line2.trim()) {\n return true;\n }\n if (line1.length > 300 && line2.length > 300) {\n return false;\n }\n const myersDiffingAlgorithm = new MyersDiffAlgorithm();\n const result = myersDiffingAlgorithm.compute(new LinesSliceCharSequence([line1], new OffsetRange(0, 1), false), new LinesSliceCharSequence([line2], new OffsetRange(0, 1), false), timeout);\n let commonNonSpaceCharCount = 0;\n const inverted = SequenceDiff.invert(result.diffs, line1.length);\n for (const seq of inverted) {\n seq.seq1Range.forEach(idx => {\n if (!isSpace(line1.charCodeAt(idx))) {\n commonNonSpaceCharCount++;\n }\n });\n }\n function countNonWsChars(str) {\n let count = 0;\n for (let i = 0; i < line1.length; i++) {\n if (!isSpace(str.charCodeAt(i))) {\n count++;\n }\n }\n return count;\n }\n const longerLineLength = countNonWsChars(line1.length > line2.length ? line1 : line2);\n const r = commonNonSpaceCharCount / longerLineLength > 0.6 && longerLineLength > 10;\n return r;\n}\nfunction joinCloseConsecutiveMoves(moves) {\n if (moves.length === 0) {\n return moves;\n }\n moves.sort(compareBy(m => m.original.startLineNumber, numberComparator));\n const result = [moves[0]];\n for (let i = 1; i < moves.length; i++) {\n const last = result[result.length - 1];\n const current = moves[i];\n const originalDist = current.original.startLineNumber - last.original.endLineNumberExclusive;\n const modifiedDist = current.modified.startLineNumber - last.modified.endLineNumberExclusive;\n const currentMoveAfterLast = originalDist >= 0 && modifiedDist >= 0;\n if (currentMoveAfterLast && originalDist + modifiedDist <= 2) {\n result[result.length - 1] = last.join(current);\n continue;\n }\n result.push(current);\n }\n return result;\n}\nfunction removeMovesInSameDiff(changes, moves) {\n const changesMonotonous = new MonotonousArray(changes);\n moves = moves.filter(m => {\n const diffBeforeEndOfMoveOriginal = changesMonotonous.findLastMonotonous(c => c.original.startLineNumber < m.original.endLineNumberExclusive)\n || new LineRangeMapping(new LineRange(1, 1), new LineRange(1, 1));\n const diffBeforeEndOfMoveModified = findLastMonotonous(changes, c => c.modified.startLineNumber < m.modified.endLineNumberExclusive);\n const differentDiffs = diffBeforeEndOfMoveOriginal !== diffBeforeEndOfMoveModified;\n return differentDiffs;\n });\n return moves;\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 { findLastIdxMonotonous, findLastMonotonous, findFirstMonotonous } from '../../../../base/common/arraysFind.js';\nimport { OffsetRange } from '../../core/offsetRange.js';\nimport { Position } from '../../core/position.js';\nimport { Range } from '../../core/range.js';\nimport { isSpace } from './utils.js';\nexport class LinesSliceCharSequence {\n constructor(lines, lineRange, considerWhitespaceChanges) {\n // This slice has to have lineRange.length many \\n! (otherwise diffing against an empty slice will be problematic)\n // (Unless it covers the entire document, in that case the other slice also has to cover the entire document ands it's okay)\n this.lines = lines;\n this.considerWhitespaceChanges = considerWhitespaceChanges;\n this.elements = [];\n this.firstCharOffsetByLine = [];\n // To account for trimming\n this.additionalOffsetByLine = [];\n // If the slice covers the end, but does not start at the beginning, we include just the \\n of the previous line.\n let trimFirstLineFully = false;\n if (lineRange.start > 0 && lineRange.endExclusive >= lines.length) {\n lineRange = new OffsetRange(lineRange.start - 1, lineRange.endExclusive);\n trimFirstLineFully = true;\n }\n this.lineRange = lineRange;\n this.firstCharOffsetByLine[0] = 0;\n for (let i = this.lineRange.start; i < this.lineRange.endExclusive; i++) {\n let line = lines[i];\n let offset = 0;\n if (trimFirstLineFully) {\n offset = line.length;\n line = '';\n trimFirstLineFully = false;\n }\n else if (!considerWhitespaceChanges) {\n const trimmedStartLine = line.trimStart();\n offset = line.length - trimmedStartLine.length;\n line = trimmedStartLine.trimEnd();\n }\n this.additionalOffsetByLine.push(offset);\n for (let i = 0; i < line.length; i++) {\n this.elements.push(line.charCodeAt(i));\n }\n // Don't add an \\n that does not exist in the document.\n if (i < lines.length - 1) {\n this.elements.push('\\n'.charCodeAt(0));\n this.firstCharOffsetByLine[i - this.lineRange.start + 1] = this.elements.length;\n }\n }\n // To account for the last line\n this.additionalOffsetByLine.push(0);\n }\n toString() {\n return `Slice: \"${this.text}\"`;\n }\n get text() {\n return this.getText(new OffsetRange(0, this.length));\n }\n getText(range) {\n return this.elements.slice(range.start, range.endExclusive).map(e => String.fromCharCode(e)).join('');\n }\n getElement(offset) {\n return this.elements[offset];\n }\n get length() {\n return this.elements.length;\n }\n getBoundaryScore(length) {\n // a b c , d e f\n // 11 0 0 12 15 6 13 0 0 11\n const prevCategory = getCategory(length > 0 ? this.elements[length - 1] : -1);\n const nextCategory = getCategory(length < this.elements.length ? this.elements[length] : -1);\n if (prevCategory === 7 /* CharBoundaryCategory.LineBreakCR */ && nextCategory === 8 /* CharBoundaryCategory.LineBreakLF */) {\n // don't break between \\r and \\n\n return 0;\n }\n if (prevCategory === 8 /* CharBoundaryCategory.LineBreakLF */) {\n // prefer the linebreak before the change\n return 150;\n }\n let score = 0;\n if (prevCategory !== nextCategory) {\n score += 10;\n if (prevCategory === 0 /* CharBoundaryCategory.WordLower */ && nextCategory === 1 /* CharBoundaryCategory.WordUpper */) {\n score += 1;\n }\n }\n score += getCategoryBoundaryScore(prevCategory);\n score += getCategoryBoundaryScore(nextCategory);\n return score;\n }\n translateOffset(offset) {\n // find smallest i, so that lineBreakOffsets[i] <= offset using binary search\n if (this.lineRange.isEmpty) {\n return new Position(this.lineRange.start + 1, 1);\n }\n const i = findLastIdxMonotonous(this.firstCharOffsetByLine, (value) => value <= offset);\n return new Position(this.lineRange.start + i + 1, offset - this.firstCharOffsetByLine[i] + this.additionalOffsetByLine[i] + 1);\n }\n translateRange(range) {\n return Range.fromPositions(this.translateOffset(range.start), this.translateOffset(range.endExclusive));\n }\n /**\n * Finds the word that contains the character at the given offset\n */\n findWordContaining(offset) {\n if (offset < 0 || offset >= this.elements.length) {\n return undefined;\n }\n if (!isWordChar(this.elements[offset])) {\n return undefined;\n }\n // find start\n let start = offset;\n while (start > 0 && isWordChar(this.elements[start - 1])) {\n start--;\n }\n // find end\n let end = offset;\n while (end < this.elements.length && isWordChar(this.elements[end])) {\n end++;\n }\n return new OffsetRange(start, end);\n }\n countLinesIn(range) {\n return this.translateOffset(range.endExclusive).lineNumber - this.translateOffset(range.start).lineNumber;\n }\n isStronglyEqual(offset1, offset2) {\n return this.elements[offset1] === this.elements[offset2];\n }\n extendToFullLines(range) {\n var _a, _b;\n const start = (_a = findLastMonotonous(this.firstCharOffsetByLine, x => x <= range.start)) !== null && _a !== void 0 ? _a : 0;\n const end = (_b = findFirstMonotonous(this.firstCharOffsetByLine, x => range.endExclusive <= x)) !== null && _b !== void 0 ? _b : this.elements.length;\n return new OffsetRange(start, end);\n }\n}\nfunction isWordChar(charCode) {\n return charCode >= 97 /* CharCode.a */ && charCode <= 122 /* CharCode.z */\n || charCode >= 65 /* CharCode.A */ && charCode <= 90 /* CharCode.Z */\n || charCode >= 48 /* CharCode.Digit0 */ && charCode <= 57 /* CharCode.Digit9 */;\n}\nconst score = {\n [0 /* CharBoundaryCategory.WordLower */]: 0,\n [1 /* CharBoundaryCategory.WordUpper */]: 0,\n [2 /* CharBoundaryCategory.WordNumber */]: 0,\n [3 /* CharBoundaryCategory.End */]: 10,\n [4 /* CharBoundaryCategory.Other */]: 2,\n [5 /* CharBoundaryCategory.Separator */]: 30,\n [6 /* CharBoundaryCategory.Space */]: 3,\n [7 /* CharBoundaryCategory.LineBreakCR */]: 10,\n [8 /* CharBoundaryCategory.LineBreakLF */]: 10,\n};\nfunction getCategoryBoundaryScore(category) {\n return score[category];\n}\nfunction getCategory(charCode) {\n if (charCode === 10 /* CharCode.LineFeed */) {\n return 8 /* CharBoundaryCategory.LineBreakLF */;\n }\n else if (charCode === 13 /* CharCode.CarriageReturn */) {\n return 7 /* CharBoundaryCategory.LineBreakCR */;\n }\n else if (isSpace(charCode)) {\n return 6 /* CharBoundaryCategory.Space */;\n }\n else if (charCode >= 97 /* CharCode.a */ && charCode <= 122 /* CharCode.z */) {\n return 0 /* CharBoundaryCategory.WordLower */;\n }\n else if (charCode >= 65 /* CharCode.A */ && charCode <= 90 /* CharCode.Z */) {\n return 1 /* CharBoundaryCategory.WordUpper */;\n }\n else if (charCode >= 48 /* CharCode.Digit0 */ && charCode <= 57 /* CharCode.Digit9 */) {\n return 2 /* CharBoundaryCategory.WordNumber */;\n }\n else if (charCode === -1) {\n return 3 /* CharBoundaryCategory.End */;\n }\n else if (charCode === 44 /* CharCode.Comma */ || charCode === 59 /* CharCode.Semicolon */) {\n return 5 /* CharBoundaryCategory.Separator */;\n }\n else {\n return 4 /* CharBoundaryCategory.Other */;\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 *--------------------------------------------------------------------------------------------*/\nimport { forEachWithNeighbors } from '../../../../base/common/arrays.js';\nimport { OffsetRange } from '../../core/offsetRange.js';\nimport { OffsetPair, SequenceDiff } from './algorithms/diffAlgorithm.js';\nexport function optimizeSequenceDiffs(sequence1, sequence2, sequenceDiffs) {\n let result = sequenceDiffs;\n result = joinSequenceDiffsByShifting(sequence1, sequence2, result);\n // Sometimes, calling this function twice improves the result.\n // Uncomment the second invocation and run the tests to see the difference.\n result = joinSequenceDiffsByShifting(sequence1, sequence2, result);\n result = shiftSequenceDiffs(sequence1, sequence2, result);\n return result;\n}\n/**\n * This function fixes issues like this:\n * ```\n * import { Baz, Bar } from \"foo\";\n * ```\n * <->\n * ```\n * import { Baz, Bar, Foo } from \"foo\";\n * ```\n * Computed diff: [ {Add \",\" after Bar}, {Add \"Foo \" after space} }\n * Improved diff: [{Add \", Foo\" after Bar}]\n */\nfunction joinSequenceDiffsByShifting(sequence1, sequence2, sequenceDiffs) {\n if (sequenceDiffs.length === 0) {\n return sequenceDiffs;\n }\n const result = [];\n result.push(sequenceDiffs[0]);\n // First move them all to the left as much as possible and join them if possible\n for (let i = 1; i < sequenceDiffs.length; i++) {\n const prevResult = result[result.length - 1];\n let cur = sequenceDiffs[i];\n if (cur.seq1Range.isEmpty || cur.seq2Range.isEmpty) {\n const length = cur.seq1Range.start - prevResult.seq1Range.endExclusive;\n let d;\n for (d = 1; d <= length; d++) {\n if (sequence1.getElement(cur.seq1Range.start - d) !== sequence1.getElement(cur.seq1Range.endExclusive - d) ||\n sequence2.getElement(cur.seq2Range.start - d) !== sequence2.getElement(cur.seq2Range.endExclusive - d)) {\n break;\n }\n }\n d--;\n if (d === length) {\n // Merge previous and current diff\n result[result.length - 1] = new SequenceDiff(new OffsetRange(prevResult.seq1Range.start, cur.seq1Range.endExclusive - length), new OffsetRange(prevResult.seq2Range.start, cur.seq2Range.endExclusive - length));\n continue;\n }\n cur = cur.delta(-d);\n }\n result.push(cur);\n }\n const result2 = [];\n // Then move them all to the right and join them again if possible\n for (let i = 0; i < result.length - 1; i++) {\n const nextResult = result[i + 1];\n let cur = result[i];\n if (cur.seq1Range.isEmpty || cur.seq2Range.isEmpty) {\n const length = nextResult.seq1Range.start - cur.seq1Range.endExclusive;\n let d;\n for (d = 0; d < length; d++) {\n if (!sequence1.isStronglyEqual(cur.seq1Range.start + d, cur.seq1Range.endExclusive + d) ||\n !sequence2.isStronglyEqual(cur.seq2Range.start + d, cur.seq2Range.endExclusive + d)) {\n break;\n }\n }\n if (d === length) {\n // Merge previous and current diff, write to result!\n result[i + 1] = new SequenceDiff(new OffsetRange(cur.seq1Range.start + length, nextResult.seq1Range.endExclusive), new OffsetRange(cur.seq2Range.start + length, nextResult.seq2Range.endExclusive));\n continue;\n }\n if (d > 0) {\n cur = cur.delta(d);\n }\n }\n result2.push(cur);\n }\n if (result.length > 0) {\n result2.push(result[result.length - 1]);\n }\n return result2;\n}\n// align character level diffs at whitespace characters\n// import { IBar } from \"foo\";\n// import { I[Arr, I]Bar } from \"foo\";\n// ->\n// import { [IArr, ]IBar } from \"foo\";\n// import { ITransaction, observableValue, transaction } from 'vs/base/common/observable';\n// import { ITransaction, observable[FromEvent, observable]Value, transaction } from 'vs/base/common/observable';\n// ->\n// import { ITransaction, [observableFromEvent, ]observableValue, transaction } from 'vs/base/common/observable';\n// collectBrackets(level + 1, levelPerBracketType);\n// collectBrackets(level + 1, levelPerBracket[ + 1, levelPerBracket]Type);\n// ->\n// collectBrackets(level + 1, [levelPerBracket + 1, ]levelPerBracketType);\nfunction shiftSequenceDiffs(sequence1, sequence2, sequenceDiffs) {\n if (!sequence1.getBoundaryScore || !sequence2.getBoundaryScore) {\n return sequenceDiffs;\n }\n for (let i = 0; i < sequenceDiffs.length; i++) {\n const prevDiff = (i > 0 ? sequenceDiffs[i - 1] : undefined);\n const diff = sequenceDiffs[i];\n const nextDiff = (i + 1 < sequenceDiffs.length ? sequenceDiffs[i + 1] : undefined);\n const seq1ValidRange = new OffsetRange(prevDiff ? prevDiff.seq1Range.endExclusive + 1 : 0, nextDiff ? nextDiff.seq1Range.start - 1 : sequence1.length);\n const seq2ValidRange = new OffsetRange(prevDiff ? prevDiff.seq2Range.endExclusive + 1 : 0, nextDiff ? nextDiff.seq2Range.start - 1 : sequence2.length);\n if (diff.seq1Range.isEmpty) {\n sequenceDiffs[i] = shiftDiffToBetterPosition(diff, sequence1, sequence2, seq1ValidRange, seq2ValidRange);\n }\n else if (diff.seq2Range.isEmpty) {\n sequenceDiffs[i] = shiftDiffToBetterPosition(diff.swap(), sequence2, sequence1, seq2ValidRange, seq1ValidRange).swap();\n }\n }\n return sequenceDiffs;\n}\nfunction shiftDiffToBetterPosition(diff, sequence1, sequence2, seq1ValidRange, seq2ValidRange) {\n const maxShiftLimit = 100; // To prevent performance issues\n // don't touch previous or next!\n let deltaBefore = 1;\n while (diff.seq1Range.start - deltaBefore >= seq1ValidRange.start &&\n diff.seq2Range.start - deltaBefore >= seq2ValidRange.start &&\n sequence2.isStronglyEqual(diff.seq2Range.start - deltaBefore, diff.seq2Range.endExclusive - deltaBefore) && deltaBefore < maxShiftLimit) {\n deltaBefore++;\n }\n deltaBefore--;\n let deltaAfter = 0;\n while (diff.seq1Range.start + deltaAfter < seq1ValidRange.endExclusive &&\n diff.seq2Range.endExclusive + deltaAfter < seq2ValidRange.endExclusive &&\n sequence2.isStronglyEqual(diff.seq2Range.start + deltaAfter, diff.seq2Range.endExclusive + deltaAfter) && deltaAfter < maxShiftLimit) {\n deltaAfter++;\n }\n if (deltaBefore === 0 && deltaAfter === 0) {\n return diff;\n }\n // Visualize `[sequence1.text, diff.seq1Range.start + deltaAfter]`\n // and `[sequence2.text, diff.seq2Range.start + deltaAfter, diff.seq2Range.endExclusive + deltaAfter]`\n let bestDelta = 0;\n let bestScore = -1;\n // find best scored delta\n for (let delta = -deltaBefore; delta <= deltaAfter; delta++) {\n const seq2OffsetStart = diff.seq2Range.start + delta;\n const seq2OffsetEndExclusive = diff.seq2Range.endExclusive + delta;\n const seq1Offset = diff.seq1Range.start + delta;\n const score = sequence1.getBoundaryScore(seq1Offset) + sequence2.getBoundaryScore(seq2OffsetStart) + sequence2.getBoundaryScore(seq2OffsetEndExclusive);\n if (score > bestScore) {\n bestScore = score;\n bestDelta = delta;\n }\n }\n return diff.delta(bestDelta);\n}\nexport function removeShortMatches(sequence1, sequence2, sequenceDiffs) {\n const result = [];\n for (const s of sequenceDiffs) {\n const last = result[result.length - 1];\n if (!last) {\n result.push(s);\n continue;\n }\n if (s.seq1Range.start - last.seq1Range.endExclusive <= 2 || s.seq2Range.start - last.seq2Range.endExclusive <= 2) {\n result[result.length - 1] = new SequenceDiff(last.seq1Range.join(s.seq1Range), last.seq2Range.join(s.seq2Range));\n }\n else {\n result.push(s);\n }\n }\n return result;\n}\nexport function extendDiffsToEntireWordIfAppropriate(sequence1, sequence2, sequenceDiffs) {\n const equalMappings = SequenceDiff.invert(sequenceDiffs, sequence1.length);\n const additional = [];\n let lastPoint = new OffsetPair(0, 0);\n function scanWord(pair, equalMapping) {\n if (pair.offset1 < lastPoint.offset1 || pair.offset2 < lastPoint.offset2) {\n return;\n }\n const w1 = sequence1.findWordContaining(pair.offset1);\n const w2 = sequence2.findWordContaining(pair.offset2);\n if (!w1 || !w2) {\n return;\n }\n let w = new SequenceDiff(w1, w2);\n const equalPart = w.intersect(equalMapping);\n let equalChars1 = equalPart.seq1Range.length;\n let equalChars2 = equalPart.seq2Range.length;\n // The words do not touch previous equals mappings, as we would have processed them already.\n // But they might touch the next ones.\n while (equalMappings.length > 0) {\n const next = equalMappings[0];\n const intersects = next.seq1Range.intersects(w.seq1Range) || next.seq2Range.intersects(w.seq2Range);\n if (!intersects) {\n break;\n }\n const v1 = sequence1.findWordContaining(next.seq1Range.start);\n const v2 = sequence2.findWordContaining(next.seq2Range.start);\n // Because there is an intersection, we know that the words are not empty.\n const v = new SequenceDiff(v1, v2);\n const equalPart = v.intersect(next);\n equalChars1 += equalPart.seq1Range.length;\n equalChars2 += equalPart.seq2Range.length;\n w = w.join(v);\n if (w.seq1Range.endExclusive >= next.seq1Range.endExclusive) {\n // The word extends beyond the next equal mapping.\n equalMappings.shift();\n }\n else {\n break;\n }\n }\n if (equalChars1 + equalChars2 < (w.seq1Range.length + w.seq2Range.length) * 2 / 3) {\n additional.push(w);\n }\n lastPoint = w.getEndExclusives();\n }\n while (equalMappings.length > 0) {\n const next = equalMappings.shift();\n if (next.seq1Range.isEmpty) {\n continue;\n }\n scanWord(next.getStarts(), next);\n // The equal parts are not empty, so -1 gives us a character that is equal in both parts.\n scanWord(next.getEndExclusives().delta(-1), next);\n }\n const merged = mergeSequenceDiffs(sequenceDiffs, additional);\n return merged;\n}\nfunction mergeSequenceDiffs(sequenceDiffs1, sequenceDiffs2) {\n const result = [];\n while (sequenceDiffs1.length > 0 || sequenceDiffs2.length > 0) {\n const sd1 = sequenceDiffs1[0];\n const sd2 = sequenceDiffs2[0];\n let next;\n if (sd1 && (!sd2 || sd1.seq1Range.start < sd2.seq1Range.start)) {\n next = sequenceDiffs1.shift();\n }\n else {\n next = sequenceDiffs2.shift();\n }\n if (result.length > 0 && result[result.length - 1].seq1Range.endExclusive >= next.seq1Range.start) {\n result[result.length - 1] = result[result.length - 1].join(next);\n }\n else {\n result.push(next);\n }\n }\n return result;\n}\nexport function removeVeryShortMatchingLinesBetweenDiffs(sequence1, _sequence2, sequenceDiffs) {\n let diffs = sequenceDiffs;\n if (diffs.length === 0) {\n return diffs;\n }\n let counter = 0;\n let shouldRepeat;\n do {\n shouldRepeat = false;\n const result = [\n diffs[0]\n ];\n for (let i = 1; i < diffs.length; i++) {\n const cur = diffs[i];\n const lastResult = result[result.length - 1];\n function shouldJoinDiffs(before, after) {\n const unchangedRange = new OffsetRange(lastResult.seq1Range.endExclusive, cur.seq1Range.start);\n const unchangedText = sequence1.getText(unchangedRange);\n const unchangedTextWithoutWs = unchangedText.replace(/\\s/g, '');\n if (unchangedTextWithoutWs.length <= 4\n && (before.seq1Range.length + before.seq2Range.length > 5 || after.seq1Range.length + after.seq2Range.length > 5)) {\n return true;\n }\n return false;\n }\n const shouldJoin = shouldJoinDiffs(lastResult, cur);\n if (shouldJoin) {\n shouldRepeat = true;\n result[result.length - 1] = result[result.length - 1].join(cur);\n }\n else {\n result.push(cur);\n }\n }\n diffs = result;\n } while (counter++ < 10 && shouldRepeat);\n return diffs;\n}\nexport function removeVeryShortMatchingTextBetweenLongDiffs(sequence1, sequence2, sequenceDiffs) {\n let diffs = sequenceDiffs;\n if (diffs.length === 0) {\n return diffs;\n }\n let counter = 0;\n let shouldRepeat;\n do {\n shouldRepeat = false;\n const result = [\n diffs[0]\n ];\n for (let i = 1; i < diffs.length; i++) {\n const cur = diffs[i];\n const lastResult = result[result.length - 1];\n function shouldJoinDiffs(before, after) {\n const unchangedRange = new OffsetRange(lastResult.seq1Range.endExclusive, cur.seq1Range.start);\n const unchangedLineCount = sequence1.countLinesIn(unchangedRange);\n if (unchangedLineCount > 5 || unchangedRange.length > 500) {\n return false;\n }\n const unchangedText = sequence1.getText(unchangedRange).trim();\n if (unchangedText.length > 20 || unchangedText.split(/\\r\\n|\\r|\\n/).length > 1) {\n return false;\n }\n const beforeLineCount1 = sequence1.countLinesIn(before.seq1Range);\n const beforeSeq1Length = before.seq1Range.length;\n const beforeLineCount2 = sequence2.countLinesIn(before.seq2Range);\n const beforeSeq2Length = before.seq2Range.length;\n const afterLineCount1 = sequence1.countLinesIn(after.seq1Range);\n const afterSeq1Length = after.seq1Range.length;\n const afterLineCount2 = sequence2.countLinesIn(after.seq2Range);\n const afterSeq2Length = after.seq2Range.length;\n // TODO: Maybe a neural net can be used to derive the result from these numbers\n const max = 2 * 40 + 50;\n function cap(v) {\n return Math.min(v, max);\n }\n if (Math.pow(Math.pow(cap(beforeLineCount1 * 40 + beforeSeq1Length), 1.5) + Math.pow(cap(beforeLineCount2 * 40 + beforeSeq2Length), 1.5), 1.5)\n + Math.pow(Math.pow(cap(afterLineCount1 * 40 + afterSeq1Length), 1.5) + Math.pow(cap(afterLineCount2 * 40 + afterSeq2Length), 1.5), 1.5) > ((max ** 1.5) ** 1.5) * 1.3) {\n return true;\n }\n return false;\n }\n const shouldJoin = shouldJoinDiffs(lastResult, cur);\n if (shouldJoin) {\n shouldRepeat = true;\n result[result.length - 1] = result[result.length - 1].join(cur);\n }\n else {\n result.push(cur);\n }\n }\n diffs = result;\n } while (counter++ < 10 && shouldRepeat);\n const newDiffs = [];\n // Remove short suffixes/prefixes\n forEachWithNeighbors(diffs, (prev, cur, next) => {\n let newDiff = cur;\n function shouldMarkAsChanged(text) {\n return text.length > 0 && text.trim().length <= 3 && cur.seq1Range.length + cur.seq2Range.length > 100;\n }\n const fullRange1 = sequence1.extendToFullLines(cur.seq1Range);\n const prefix = sequence1.getText(new OffsetRange(fullRange1.start, cur.seq1Range.start));\n if (shouldMarkAsChanged(prefix)) {\n newDiff = newDiff.deltaStart(-prefix.length);\n }\n const suffix = sequence1.getText(new OffsetRange(cur.seq1Range.endExclusive, fullRange1.endExclusive));\n if (shouldMarkAsChanged(suffix)) {\n newDiff = newDiff.deltaEnd(suffix.length);\n }\n const availableSpace = SequenceDiff.fromOffsetPairs(prev ? prev.getEndExclusives() : OffsetPair.zero, next ? next.getStarts() : OffsetPair.max);\n const result = newDiff.intersect(availableSpace);\n if (newDiffs.length > 0 && result.getStarts().equals(newDiffs[newDiffs.length - 1].getEndExclusives())) {\n newDiffs[newDiffs.length - 1] = newDiffs[newDiffs.length - 1].join(result);\n }\n else {\n newDiffs.push(result);\n }\n });\n return newDiffs;\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 *--------------------------------------------------------------------------------------------*/\nexport class LineSequence {\n constructor(trimmedHash, lines) {\n this.trimmedHash = trimmedHash;\n this.lines = lines;\n }\n getElement(offset) {\n return this.trimmedHash[offset];\n }\n get length() {\n return this.trimmedHash.length;\n }\n getBoundaryScore(length) {\n const indentationBefore = length === 0 ? 0 : getIndentation(this.lines[length - 1]);\n const indentationAfter = length === this.lines.length ? 0 : getIndentation(this.lines[length]);\n return 1000 - (indentationBefore + indentationAfter);\n }\n getText(range) {\n return this.lines.slice(range.start, range.endExclusive).join('\\n');\n }\n isStronglyEqual(offset1, offset2) {\n return this.lines[offset1] === this.lines[offset2];\n }\n}\nfunction getIndentation(str) {\n let i = 0;\n while (i < str.length && (str.charCodeAt(i) === 32 /* CharCode.Space */ || str.charCodeAt(i) === 9 /* CharCode.Tab */)) {\n i++;\n }\n return i;\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 { Color, HSLA } from '../../../base/common/color.js';\nfunction _parseCaptureGroups(captureGroups) {\n const values = [];\n for (const captureGroup of captureGroups) {\n const parsedNumber = Number(captureGroup);\n if (parsedNumber || parsedNumber === 0 && captureGroup.replace(/\\s/g, '') !== '') {\n values.push(parsedNumber);\n }\n }\n return values;\n}\nfunction _toIColor(r, g, b, a) {\n return {\n red: r / 255,\n blue: b / 255,\n green: g / 255,\n alpha: a\n };\n}\nfunction _findRange(model, match) {\n const index = match.index;\n const length = match[0].length;\n if (!index) {\n return;\n }\n const startPosition = model.positionAt(index);\n const range = {\n startLineNumber: startPosition.lineNumber,\n startColumn: startPosition.column,\n endLineNumber: startPosition.lineNumber,\n endColumn: startPosition.column + length\n };\n return range;\n}\nfunction _findHexColorInformation(range, hexValue) {\n if (!range) {\n return;\n }\n const parsedHexColor = Color.Format.CSS.parseHex(hexValue);\n if (!parsedHexColor) {\n return;\n }\n return {\n range: range,\n color: _toIColor(parsedHexColor.rgba.r, parsedHexColor.rgba.g, parsedHexColor.rgba.b, parsedHexColor.rgba.a)\n };\n}\nfunction _findRGBColorInformation(range, matches, isAlpha) {\n if (!range || matches.length !== 1) {\n return;\n }\n const match = matches[0];\n const captureGroups = match.values();\n const parsedRegex = _parseCaptureGroups(captureGroups);\n return {\n range: range,\n color: _toIColor(parsedRegex[0], parsedRegex[1], parsedRegex[2], isAlpha ? parsedRegex[3] : 1)\n };\n}\nfunction _findHSLColorInformation(range, matches, isAlpha) {\n if (!range || matches.length !== 1) {\n return;\n }\n const match = matches[0];\n const captureGroups = match.values();\n const parsedRegex = _parseCaptureGroups(captureGroups);\n const colorEquivalent = new Color(new HSLA(parsedRegex[0], parsedRegex[1] / 100, parsedRegex[2] / 100, isAlpha ? parsedRegex[3] : 1));\n return {\n range: range,\n color: _toIColor(colorEquivalent.rgba.r, colorEquivalent.rgba.g, colorEquivalent.rgba.b, colorEquivalent.rgba.a)\n };\n}\nfunction _findMatches(model, regex) {\n if (typeof model === 'string') {\n return [...model.matchAll(regex)];\n }\n else {\n return model.findMatches(regex);\n }\n}\nfunction computeColors(model) {\n const result = [];\n // Early validation for RGB and HSL\n const initialValidationRegex = /\\b(rgb|rgba|hsl|hsla)(\\([0-9\\s,.\\%]*\\))|(#)([A-Fa-f0-9]{3})\\b|(#)([A-Fa-f0-9]{4})\\b|(#)([A-Fa-f0-9]{6})\\b|(#)([A-Fa-f0-9]{8})\\b/gm;\n const initialValidationMatches = _findMatches(model, initialValidationRegex);\n // Potential colors have been found, validate the parameters\n if (initialValidationMatches.length > 0) {\n for (const initialMatch of initialValidationMatches) {\n const initialCaptureGroups = initialMatch.filter(captureGroup => captureGroup !== undefined);\n const colorScheme = initialCaptureGroups[1];\n const colorParameters = initialCaptureGroups[2];\n if (!colorParameters) {\n continue;\n }\n let colorInformation;\n if (colorScheme === 'rgb') {\n const regexParameters = /^\\(\\s*(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])\\s*,\\s*(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])\\s*,\\s*(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])\\s*\\)$/gm;\n colorInformation = _findRGBColorInformation(_findRange(model, initialMatch), _findMatches(colorParameters, regexParameters), false);\n }\n else if (colorScheme === 'rgba') {\n const regexParameters = /^\\(\\s*(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])\\s*,\\s*(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])\\s*,\\s*(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])\\s*,\\s*(0[.][0-9]+|[.][0-9]+|[01][.]|[01])\\s*\\)$/gm;\n colorInformation = _findRGBColorInformation(_findRange(model, initialMatch), _findMatches(colorParameters, regexParameters), true);\n }\n else if (colorScheme === 'hsl') {\n const regexParameters = /^\\(\\s*(36[0]|3[0-5][0-9]|[12][0-9][0-9]|[1-9]?[0-9])\\s*,\\s*(100|\\d{1,2}[.]\\d*|\\d{1,2})%\\s*,\\s*(100|\\d{1,2}[.]\\d*|\\d{1,2})%\\s*\\)$/gm;\n colorInformation = _findHSLColorInformation(_findRange(model, initialMatch), _findMatches(colorParameters, regexParameters), false);\n }\n else if (colorScheme === 'hsla') {\n const regexParameters = /^\\(\\s*(36[0]|3[0-5][0-9]|[12][0-9][0-9]|[1-9]?[0-9])\\s*,\\s*(100|\\d{1,2}[.]\\d*|\\d{1,2})%\\s*,\\s*(100|\\d{1,2}[.]\\d*|\\d{1,2})%\\s*,\\s*(0[.][0-9]+|[.][0-9]+|[01][.]|[01])\\s*\\)$/gm;\n colorInformation = _findHSLColorInformation(_findRange(model, initialMatch), _findMatches(colorParameters, regexParameters), true);\n }\n else if (colorScheme === '#') {\n colorInformation = _findHexColorInformation(_findRange(model, initialMatch), colorScheme + colorParameters);\n }\n if (colorInformation) {\n result.push(colorInformation);\n }\n }\n }\n return result;\n}\n/**\n * Returns an array of all default document colors in the provided document\n */\nexport function computeDefaultDocumentColors(model) {\n if (!model || typeof model.getValue !== 'function' || typeof model.positionAt !== 'function') {\n // Unknown caller!\n return [];\n }\n return computeColors(model);\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 *--------------------------------------------------------------------------------------------*/\nconst markRegex = /\\bMARK:\\s*(.*)$/d;\nconst trimDashesRegex = /^-+|-+$/g;\n/**\n * Find section headers in the model.\n *\n * @param model the text model to search in\n * @param options options to search with\n * @returns an array of section headers\n */\nexport function findSectionHeaders(model, options) {\n var _a;\n let headers = [];\n if (options.findRegionSectionHeaders && ((_a = options.foldingRules) === null || _a === void 0 ? void 0 : _a.markers)) {\n const regionHeaders = collectRegionHeaders(model, options);\n headers = headers.concat(regionHeaders);\n }\n if (options.findMarkSectionHeaders) {\n const markHeaders = collectMarkHeaders(model);\n headers = headers.concat(markHeaders);\n }\n return headers;\n}\nfunction collectRegionHeaders(model, options) {\n const regionHeaders = [];\n const endLineNumber = model.getLineCount();\n for (let lineNumber = 1; lineNumber <= endLineNumber; lineNumber++) {\n const lineContent = model.getLineContent(lineNumber);\n const match = lineContent.match(options.foldingRules.markers.start);\n if (match) {\n const range = { startLineNumber: lineNumber, startColumn: match[0].length + 1, endLineNumber: lineNumber, endColumn: lineContent.length + 1 };\n if (range.endColumn > range.startColumn) {\n const sectionHeader = {\n range,\n ...getHeaderText(lineContent.substring(match[0].length)),\n shouldBeInComments: false\n };\n if (sectionHeader.text || sectionHeader.hasSeparatorLine) {\n regionHeaders.push(sectionHeader);\n }\n }\n }\n }\n return regionHeaders;\n}\nfunction collectMarkHeaders(model) {\n const markHeaders = [];\n const endLineNumber = model.getLineCount();\n for (let lineNumber = 1; lineNumber <= endLineNumber; lineNumber++) {\n const lineContent = model.getLineContent(lineNumber);\n addMarkHeaderIfFound(lineContent, lineNumber, markHeaders);\n }\n return markHeaders;\n}\nfunction addMarkHeaderIfFound(lineContent, lineNumber, sectionHeaders) {\n markRegex.lastIndex = 0;\n const match = markRegex.exec(lineContent);\n if (match) {\n const column = match.indices[1][0] + 1;\n const endColumn = match.indices[1][1] + 1;\n const range = { startLineNumber: lineNumber, startColumn: column, endLineNumber: lineNumber, endColumn: endColumn };\n if (range.endColumn > range.startColumn) {\n const sectionHeader = {\n range,\n ...getHeaderText(match[1]),\n shouldBeInComments: true\n };\n if (sectionHeader.text || sectionHeader.hasSeparatorLine) {\n sectionHeaders.push(sectionHeader);\n }\n }\n }\n}\nfunction getHeaderText(text) {\n text = text.trim();\n const hasSeparatorLine = text.startsWith('-');\n text = text.replace(trimDashesRegex, '');\n return { text, hasSeparatorLine };\n}\n", "import { createDecorator } from '../../../platform/instantiation/common/instantiation.js';\nexport const ITextResourceConfigurationService = createDecorator('textResourceConfigurationService');\nexport const ITextResourcePropertiesService = createDecorator('textResourcePropertiesService');\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (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 * The type of the `IEditor`.\n */\nexport const EditorType = {\n ICodeEditor: 'vs.editor.ICodeEditor',\n IDiffEditor: 'vs.editor.IDiffEditor'\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 { createTrustedTypesPolicy } from '../../../base/browser/trustedTypes.js';\nimport * as strings from '../../../base/common/strings.js';\nimport { TokenizationRegistry } from '../../common/languages.js';\nimport { LineTokens } from '../../common/tokens/lineTokens.js';\nimport { RenderLineInput, renderViewLine2 as renderViewLine } from '../../common/viewLayout/viewLineRenderer.js';\nimport { ViewLineRenderingData } from '../../common/viewModel.js';\nimport { MonarchTokenizer } from '../common/monarch/monarchLexer.js';\nconst ttPolicy = createTrustedTypesPolicy('standaloneColorizer', { createHTML: value => value });\nexport class Colorizer {\n static colorizeElement(themeService, languageService, domNode, options) {\n options = options || {};\n const theme = options.theme || 'vs';\n const mimeType = options.mimeType || domNode.getAttribute('lang') || domNode.getAttribute('data-lang');\n if (!mimeType) {\n console.error('Mode not detected');\n return Promise.resolve();\n }\n const languageId = languageService.getLanguageIdByMimeType(mimeType) || mimeType;\n themeService.setTheme(theme);\n const text = domNode.firstChild ? domNode.firstChild.nodeValue : '';\n domNode.className += ' ' + theme;\n const render = (str) => {\n var _a;\n const trustedhtml = (_a = ttPolicy === null || ttPolicy === void 0 ? void 0 : ttPolicy.createHTML(str)) !== null && _a !== void 0 ? _a : str;\n domNode.innerHTML = trustedhtml;\n };\n return this.colorize(languageService, text || '', languageId, options).then(render, (err) => console.error(err));\n }\n static async colorize(languageService, text, languageId, options) {\n const languageIdCodec = languageService.languageIdCodec;\n let tabSize = 4;\n if (options && typeof options.tabSize === 'number') {\n tabSize = options.tabSize;\n }\n if (strings.startsWithUTF8BOM(text)) {\n text = text.substr(1);\n }\n const lines = strings.splitLines(text);\n if (!languageService.isRegisteredLanguageId(languageId)) {\n return _fakeColorize(lines, tabSize, languageIdCodec);\n }\n const tokenizationSupport = await TokenizationRegistry.getOrCreate(languageId);\n if (tokenizationSupport) {\n return _colorize(lines, tabSize, tokenizationSupport, languageIdCodec);\n }\n return _fakeColorize(lines, tabSize, languageIdCodec);\n }\n static colorizeLine(line, mightContainNonBasicASCII, mightContainRTL, tokens, tabSize = 4) {\n const isBasicASCII = ViewLineRenderingData.isBasicASCII(line, mightContainNonBasicASCII);\n const containsRTL = ViewLineRenderingData.containsRTL(line, isBasicASCII, mightContainRTL);\n const renderResult = renderViewLine(new RenderLineInput(false, true, line, false, isBasicASCII, containsRTL, 0, tokens, [], tabSize, 0, 0, 0, 0, -1, 'none', false, false, null));\n return renderResult.html;\n }\n static colorizeModelLine(model, lineNumber, tabSize = 4) {\n const content = model.getLineContent(lineNumber);\n model.tokenization.forceTokenization(lineNumber);\n const tokens = model.tokenization.getLineTokens(lineNumber);\n const inflatedTokens = tokens.inflate();\n return this.colorizeLine(content, model.mightContainNonBasicASCII(), model.mightContainRTL(), inflatedTokens, tabSize);\n }\n}\nfunction _colorize(lines, tabSize, tokenizationSupport, languageIdCodec) {\n return new Promise((c, e) => {\n const execute = () => {\n const result = _actualColorize(lines, tabSize, tokenizationSupport, languageIdCodec);\n if (tokenizationSupport instanceof MonarchTokenizer) {\n const status = tokenizationSupport.getLoadStatus();\n if (status.loaded === false) {\n status.promise.then(execute, e);\n return;\n }\n }\n c(result);\n };\n execute();\n });\n}\nfunction _fakeColorize(lines, tabSize, languageIdCodec) {\n let html = [];\n const defaultMetadata = ((0 /* FontStyle.None */ << 11 /* MetadataConsts.FONT_STYLE_OFFSET */)\n | (1 /* ColorId.DefaultForeground */ << 15 /* MetadataConsts.FOREGROUND_OFFSET */)\n | (2 /* ColorId.DefaultBackground */ << 24 /* MetadataConsts.BACKGROUND_OFFSET */)) >>> 0;\n const tokens = new Uint32Array(2);\n tokens[0] = 0;\n tokens[1] = defaultMetadata;\n for (let i = 0, length = lines.length; i < length; i++) {\n const line = lines[i];\n tokens[0] = line.length;\n const lineTokens = new LineTokens(tokens, line, languageIdCodec);\n const isBasicASCII = ViewLineRenderingData.isBasicASCII(line, /* check for basic ASCII */ true);\n const containsRTL = ViewLineRenderingData.containsRTL(line, isBasicASCII, /* check for RTL */ true);\n const renderResult = renderViewLine(new RenderLineInput(false, true, line, false, isBasicASCII, containsRTL, 0, lineTokens, [], tabSize, 0, 0, 0, 0, -1, 'none', false, false, null));\n html = html.concat(renderResult.html);\n html.push('
    ');\n }\n return html.join('');\n}\nfunction _actualColorize(lines, tabSize, tokenizationSupport, languageIdCodec) {\n let html = [];\n let state = tokenizationSupport.getInitialState();\n for (let i = 0, length = lines.length; i < length; i++) {\n const line = lines[i];\n const tokenizeResult = tokenizationSupport.tokenizeEncoded(line, true, state);\n LineTokens.convertToEndOffset(tokenizeResult.tokens, line.length);\n const lineTokens = new LineTokens(tokenizeResult.tokens, line, languageIdCodec);\n const isBasicASCII = ViewLineRenderingData.isBasicASCII(line, /* check for basic ASCII */ true);\n const containsRTL = ViewLineRenderingData.containsRTL(line, isBasicASCII, /* check for RTL */ true);\n const renderResult = renderViewLine(new RenderLineInput(false, true, line, false, isBasicASCII, containsRTL, 0, lineTokens.inflate(), [], tabSize, 0, 0, 0, 0, -1, 'none', false, false, null));\n html = html.concat(renderResult.html);\n html.push('
    ');\n state = tokenizeResult.endState;\n }\n return html.join('');\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 * as nls from '../../../nls.js';\nimport * as strings from '../../../base/common/strings.js';\nimport { StringBuilder } from '../core/stringBuilder.js';\nimport { LineDecoration, LineDecorationsNormalizer } from './lineDecorations.js';\nimport { LinePart } from './linePart.js';\nexport class LineRange {\n constructor(startIndex, endIndex) {\n this.startOffset = startIndex;\n this.endOffset = endIndex;\n }\n equals(otherLineRange) {\n return this.startOffset === otherLineRange.startOffset\n && this.endOffset === otherLineRange.endOffset;\n }\n}\nexport class RenderLineInput {\n constructor(useMonospaceOptimizations, canUseHalfwidthRightwardsArrow, lineContent, continuesWithWrappedLine, isBasicASCII, containsRTL, fauxIndentLength, lineTokens, lineDecorations, tabSize, startVisibleColumn, spaceWidth, middotWidth, wsmiddotWidth, stopRenderingLineAfter, renderWhitespace, renderControlCharacters, fontLigatures, selectionsOnLine) {\n this.useMonospaceOptimizations = useMonospaceOptimizations;\n this.canUseHalfwidthRightwardsArrow = canUseHalfwidthRightwardsArrow;\n this.lineContent = lineContent;\n this.continuesWithWrappedLine = continuesWithWrappedLine;\n this.isBasicASCII = isBasicASCII;\n this.containsRTL = containsRTL;\n this.fauxIndentLength = fauxIndentLength;\n this.lineTokens = lineTokens;\n this.lineDecorations = lineDecorations.sort(LineDecoration.compare);\n this.tabSize = tabSize;\n this.startVisibleColumn = startVisibleColumn;\n this.spaceWidth = spaceWidth;\n this.stopRenderingLineAfter = stopRenderingLineAfter;\n this.renderWhitespace = (renderWhitespace === 'all'\n ? 4 /* RenderWhitespace.All */\n : renderWhitespace === 'boundary'\n ? 1 /* RenderWhitespace.Boundary */\n : renderWhitespace === 'selection'\n ? 2 /* RenderWhitespace.Selection */\n : renderWhitespace === 'trailing'\n ? 3 /* RenderWhitespace.Trailing */\n : 0 /* RenderWhitespace.None */);\n this.renderControlCharacters = renderControlCharacters;\n this.fontLigatures = fontLigatures;\n this.selectionsOnLine = selectionsOnLine && selectionsOnLine.sort((a, b) => a.startOffset < b.startOffset ? -1 : 1);\n const wsmiddotDiff = Math.abs(wsmiddotWidth - spaceWidth);\n const middotDiff = Math.abs(middotWidth - spaceWidth);\n if (wsmiddotDiff < middotDiff) {\n this.renderSpaceWidth = wsmiddotWidth;\n this.renderSpaceCharCode = 0x2E31; // U+2E31 - WORD SEPARATOR MIDDLE DOT\n }\n else {\n this.renderSpaceWidth = middotWidth;\n this.renderSpaceCharCode = 0xB7; // U+00B7 - MIDDLE DOT\n }\n }\n sameSelection(otherSelections) {\n if (this.selectionsOnLine === null) {\n return otherSelections === null;\n }\n if (otherSelections === null) {\n return false;\n }\n if (otherSelections.length !== this.selectionsOnLine.length) {\n return false;\n }\n for (let i = 0; i < this.selectionsOnLine.length; i++) {\n if (!this.selectionsOnLine[i].equals(otherSelections[i])) {\n return false;\n }\n }\n return true;\n }\n equals(other) {\n return (this.useMonospaceOptimizations === other.useMonospaceOptimizations\n && this.canUseHalfwidthRightwardsArrow === other.canUseHalfwidthRightwardsArrow\n && this.lineContent === other.lineContent\n && this.continuesWithWrappedLine === other.continuesWithWrappedLine\n && this.isBasicASCII === other.isBasicASCII\n && this.containsRTL === other.containsRTL\n && this.fauxIndentLength === other.fauxIndentLength\n && this.tabSize === other.tabSize\n && this.startVisibleColumn === other.startVisibleColumn\n && this.spaceWidth === other.spaceWidth\n && this.renderSpaceWidth === other.renderSpaceWidth\n && this.renderSpaceCharCode === other.renderSpaceCharCode\n && this.stopRenderingLineAfter === other.stopRenderingLineAfter\n && this.renderWhitespace === other.renderWhitespace\n && this.renderControlCharacters === other.renderControlCharacters\n && this.fontLigatures === other.fontLigatures\n && LineDecoration.equalsArr(this.lineDecorations, other.lineDecorations)\n && this.lineTokens.equals(other.lineTokens)\n && this.sameSelection(other.selectionsOnLine));\n }\n}\nexport class DomPosition {\n constructor(partIndex, charIndex) {\n this.partIndex = partIndex;\n this.charIndex = charIndex;\n }\n}\n/**\n * Provides a both direction mapping between a line's character and its rendered position.\n */\nexport class CharacterMapping {\n static getPartIndex(partData) {\n return (partData & 4294901760 /* CharacterMappingConstants.PART_INDEX_MASK */) >>> 16 /* CharacterMappingConstants.PART_INDEX_OFFSET */;\n }\n static getCharIndex(partData) {\n return (partData & 65535 /* CharacterMappingConstants.CHAR_INDEX_MASK */) >>> 0 /* CharacterMappingConstants.CHAR_INDEX_OFFSET */;\n }\n constructor(length, partCount) {\n this.length = length;\n this._data = new Uint32Array(this.length);\n this._horizontalOffset = new Uint32Array(this.length);\n }\n setColumnInfo(column, partIndex, charIndex, horizontalOffset) {\n const partData = ((partIndex << 16 /* CharacterMappingConstants.PART_INDEX_OFFSET */)\n | (charIndex << 0 /* CharacterMappingConstants.CHAR_INDEX_OFFSET */)) >>> 0;\n this._data[column - 1] = partData;\n this._horizontalOffset[column - 1] = horizontalOffset;\n }\n getHorizontalOffset(column) {\n if (this._horizontalOffset.length === 0) {\n // No characters on this line\n return 0;\n }\n return this._horizontalOffset[column - 1];\n }\n charOffsetToPartData(charOffset) {\n if (this.length === 0) {\n return 0;\n }\n if (charOffset < 0) {\n return this._data[0];\n }\n if (charOffset >= this.length) {\n return this._data[this.length - 1];\n }\n return this._data[charOffset];\n }\n getDomPosition(column) {\n const partData = this.charOffsetToPartData(column - 1);\n const partIndex = CharacterMapping.getPartIndex(partData);\n const charIndex = CharacterMapping.getCharIndex(partData);\n return new DomPosition(partIndex, charIndex);\n }\n getColumn(domPosition, partLength) {\n const charOffset = this.partDataToCharOffset(domPosition.partIndex, partLength, domPosition.charIndex);\n return charOffset + 1;\n }\n partDataToCharOffset(partIndex, partLength, charIndex) {\n if (this.length === 0) {\n return 0;\n }\n const searchEntry = ((partIndex << 16 /* CharacterMappingConstants.PART_INDEX_OFFSET */)\n | (charIndex << 0 /* CharacterMappingConstants.CHAR_INDEX_OFFSET */)) >>> 0;\n let min = 0;\n let max = this.length - 1;\n while (min + 1 < max) {\n const mid = ((min + max) >>> 1);\n const midEntry = this._data[mid];\n if (midEntry === searchEntry) {\n return mid;\n }\n else if (midEntry > searchEntry) {\n max = mid;\n }\n else {\n min = mid;\n }\n }\n if (min === max) {\n return min;\n }\n const minEntry = this._data[min];\n const maxEntry = this._data[max];\n if (minEntry === searchEntry) {\n return min;\n }\n if (maxEntry === searchEntry) {\n return max;\n }\n const minPartIndex = CharacterMapping.getPartIndex(minEntry);\n const minCharIndex = CharacterMapping.getCharIndex(minEntry);\n const maxPartIndex = CharacterMapping.getPartIndex(maxEntry);\n let maxCharIndex;\n if (minPartIndex !== maxPartIndex) {\n // sitting between parts\n maxCharIndex = partLength;\n }\n else {\n maxCharIndex = CharacterMapping.getCharIndex(maxEntry);\n }\n const minEntryDistance = charIndex - minCharIndex;\n const maxEntryDistance = maxCharIndex - charIndex;\n if (minEntryDistance <= maxEntryDistance) {\n return min;\n }\n return max;\n }\n}\nexport class RenderLineOutput {\n constructor(characterMapping, containsRTL, containsForeignElements) {\n this._renderLineOutputBrand = undefined;\n this.characterMapping = characterMapping;\n this.containsRTL = containsRTL;\n this.containsForeignElements = containsForeignElements;\n }\n}\nexport function renderViewLine(input, sb) {\n if (input.lineContent.length === 0) {\n if (input.lineDecorations.length > 0) {\n // This line is empty, but it contains inline decorations\n sb.appendString(``);\n let beforeCount = 0;\n let afterCount = 0;\n let containsForeignElements = 0 /* ForeignElementType.None */;\n for (const lineDecoration of input.lineDecorations) {\n if (lineDecoration.type === 1 /* InlineDecorationType.Before */ || lineDecoration.type === 2 /* InlineDecorationType.After */) {\n sb.appendString(``);\n if (lineDecoration.type === 1 /* InlineDecorationType.Before */) {\n containsForeignElements |= 1 /* ForeignElementType.Before */;\n beforeCount++;\n }\n if (lineDecoration.type === 2 /* InlineDecorationType.After */) {\n containsForeignElements |= 2 /* ForeignElementType.After */;\n afterCount++;\n }\n }\n }\n sb.appendString(``);\n const characterMapping = new CharacterMapping(1, beforeCount + afterCount);\n characterMapping.setColumnInfo(1, beforeCount, 0, 0);\n return new RenderLineOutput(characterMapping, false, containsForeignElements);\n }\n // completely empty line\n sb.appendString('');\n return new RenderLineOutput(new CharacterMapping(0, 0), false, 0 /* ForeignElementType.None */);\n }\n return _renderLine(resolveRenderLineInput(input), sb);\n}\nexport class RenderLineOutput2 {\n constructor(characterMapping, html, containsRTL, containsForeignElements) {\n this.characterMapping = characterMapping;\n this.html = html;\n this.containsRTL = containsRTL;\n this.containsForeignElements = containsForeignElements;\n }\n}\nexport function renderViewLine2(input) {\n const sb = new StringBuilder(10000);\n const out = renderViewLine(input, sb);\n return new RenderLineOutput2(out.characterMapping, sb.build(), out.containsRTL, out.containsForeignElements);\n}\nclass ResolvedRenderLineInput {\n constructor(fontIsMonospace, canUseHalfwidthRightwardsArrow, lineContent, len, isOverflowing, overflowingCharCount, parts, containsForeignElements, fauxIndentLength, tabSize, startVisibleColumn, containsRTL, spaceWidth, renderSpaceCharCode, renderWhitespace, renderControlCharacters) {\n this.fontIsMonospace = fontIsMonospace;\n this.canUseHalfwidthRightwardsArrow = canUseHalfwidthRightwardsArrow;\n this.lineContent = lineContent;\n this.len = len;\n this.isOverflowing = isOverflowing;\n this.overflowingCharCount = overflowingCharCount;\n this.parts = parts;\n this.containsForeignElements = containsForeignElements;\n this.fauxIndentLength = fauxIndentLength;\n this.tabSize = tabSize;\n this.startVisibleColumn = startVisibleColumn;\n this.containsRTL = containsRTL;\n this.spaceWidth = spaceWidth;\n this.renderSpaceCharCode = renderSpaceCharCode;\n this.renderWhitespace = renderWhitespace;\n this.renderControlCharacters = renderControlCharacters;\n //\n }\n}\nfunction resolveRenderLineInput(input) {\n const lineContent = input.lineContent;\n let isOverflowing;\n let overflowingCharCount;\n let len;\n if (input.stopRenderingLineAfter !== -1 && input.stopRenderingLineAfter < lineContent.length) {\n isOverflowing = true;\n overflowingCharCount = lineContent.length - input.stopRenderingLineAfter;\n len = input.stopRenderingLineAfter;\n }\n else {\n isOverflowing = false;\n overflowingCharCount = 0;\n len = lineContent.length;\n }\n let tokens = transformAndRemoveOverflowing(lineContent, input.containsRTL, input.lineTokens, input.fauxIndentLength, len);\n if (input.renderControlCharacters && !input.isBasicASCII) {\n // Calling `extractControlCharacters` before adding (possibly empty) line parts\n // for inline decorations. `extractControlCharacters` removes empty line parts.\n tokens = extractControlCharacters(lineContent, tokens);\n }\n if (input.renderWhitespace === 4 /* RenderWhitespace.All */ ||\n input.renderWhitespace === 1 /* RenderWhitespace.Boundary */ ||\n (input.renderWhitespace === 2 /* RenderWhitespace.Selection */ && !!input.selectionsOnLine) ||\n (input.renderWhitespace === 3 /* RenderWhitespace.Trailing */ && !input.continuesWithWrappedLine)) {\n tokens = _applyRenderWhitespace(input, lineContent, len, tokens);\n }\n let containsForeignElements = 0 /* ForeignElementType.None */;\n if (input.lineDecorations.length > 0) {\n for (let i = 0, len = input.lineDecorations.length; i < len; i++) {\n const lineDecoration = input.lineDecorations[i];\n if (lineDecoration.type === 3 /* InlineDecorationType.RegularAffectingLetterSpacing */) {\n // Pretend there are foreign elements... although not 100% accurate.\n containsForeignElements |= 1 /* ForeignElementType.Before */;\n }\n else if (lineDecoration.type === 1 /* InlineDecorationType.Before */) {\n containsForeignElements |= 1 /* ForeignElementType.Before */;\n }\n else if (lineDecoration.type === 2 /* InlineDecorationType.After */) {\n containsForeignElements |= 2 /* ForeignElementType.After */;\n }\n }\n tokens = _applyInlineDecorations(lineContent, len, tokens, input.lineDecorations);\n }\n if (!input.containsRTL) {\n // We can never split RTL text, as it ruins the rendering\n tokens = splitLargeTokens(lineContent, tokens, !input.isBasicASCII || input.fontLigatures);\n }\n return new ResolvedRenderLineInput(input.useMonospaceOptimizations, input.canUseHalfwidthRightwardsArrow, lineContent, len, isOverflowing, overflowingCharCount, tokens, containsForeignElements, input.fauxIndentLength, input.tabSize, input.startVisibleColumn, input.containsRTL, input.spaceWidth, input.renderSpaceCharCode, input.renderWhitespace, input.renderControlCharacters);\n}\n/**\n * In the rendering phase, characters are always looped until token.endIndex.\n * Ensure that all tokens end before `len` and the last one ends precisely at `len`.\n */\nfunction transformAndRemoveOverflowing(lineContent, lineContainsRTL, tokens, fauxIndentLength, len) {\n const result = [];\n let resultLen = 0;\n // The faux indent part of the line should have no token type\n if (fauxIndentLength > 0) {\n result[resultLen++] = new LinePart(fauxIndentLength, '', 0, false);\n }\n let startOffset = fauxIndentLength;\n for (let tokenIndex = 0, tokensLen = tokens.getCount(); tokenIndex < tokensLen; tokenIndex++) {\n const endIndex = tokens.getEndOffset(tokenIndex);\n if (endIndex <= fauxIndentLength) {\n // The faux indent part of the line should have no token type\n continue;\n }\n const type = tokens.getClassName(tokenIndex);\n if (endIndex >= len) {\n const tokenContainsRTL = (lineContainsRTL ? strings.containsRTL(lineContent.substring(startOffset, len)) : false);\n result[resultLen++] = new LinePart(len, type, 0, tokenContainsRTL);\n break;\n }\n const tokenContainsRTL = (lineContainsRTL ? strings.containsRTL(lineContent.substring(startOffset, endIndex)) : false);\n result[resultLen++] = new LinePart(endIndex, type, 0, tokenContainsRTL);\n startOffset = endIndex;\n }\n return result;\n}\n/**\n * See https://github.com/microsoft/vscode/issues/6885.\n * It appears that having very large spans causes very slow reading of character positions.\n * So here we try to avoid that.\n */\nfunction splitLargeTokens(lineContent, tokens, onlyAtSpaces) {\n let lastTokenEndIndex = 0;\n const result = [];\n let resultLen = 0;\n if (onlyAtSpaces) {\n // Split only at spaces => we need to walk each character\n for (let i = 0, len = tokens.length; i < len; i++) {\n const token = tokens[i];\n const tokenEndIndex = token.endIndex;\n if (lastTokenEndIndex + 50 /* Constants.LongToken */ < tokenEndIndex) {\n const tokenType = token.type;\n const tokenMetadata = token.metadata;\n const tokenContainsRTL = token.containsRTL;\n let lastSpaceOffset = -1;\n let currTokenStart = lastTokenEndIndex;\n for (let j = lastTokenEndIndex; j < tokenEndIndex; j++) {\n if (lineContent.charCodeAt(j) === 32 /* CharCode.Space */) {\n lastSpaceOffset = j;\n }\n if (lastSpaceOffset !== -1 && j - currTokenStart >= 50 /* Constants.LongToken */) {\n // Split at `lastSpaceOffset` + 1\n result[resultLen++] = new LinePart(lastSpaceOffset + 1, tokenType, tokenMetadata, tokenContainsRTL);\n currTokenStart = lastSpaceOffset + 1;\n lastSpaceOffset = -1;\n }\n }\n if (currTokenStart !== tokenEndIndex) {\n result[resultLen++] = new LinePart(tokenEndIndex, tokenType, tokenMetadata, tokenContainsRTL);\n }\n }\n else {\n result[resultLen++] = token;\n }\n lastTokenEndIndex = tokenEndIndex;\n }\n }\n else {\n // Split anywhere => we don't need to walk each character\n for (let i = 0, len = tokens.length; i < len; i++) {\n const token = tokens[i];\n const tokenEndIndex = token.endIndex;\n const diff = (tokenEndIndex - lastTokenEndIndex);\n if (diff > 50 /* Constants.LongToken */) {\n const tokenType = token.type;\n const tokenMetadata = token.metadata;\n const tokenContainsRTL = token.containsRTL;\n const piecesCount = Math.ceil(diff / 50 /* Constants.LongToken */);\n for (let j = 1; j < piecesCount; j++) {\n const pieceEndIndex = lastTokenEndIndex + (j * 50 /* Constants.LongToken */);\n result[resultLen++] = new LinePart(pieceEndIndex, tokenType, tokenMetadata, tokenContainsRTL);\n }\n result[resultLen++] = new LinePart(tokenEndIndex, tokenType, tokenMetadata, tokenContainsRTL);\n }\n else {\n result[resultLen++] = token;\n }\n lastTokenEndIndex = tokenEndIndex;\n }\n }\n return result;\n}\nfunction isControlCharacter(charCode) {\n if (charCode < 32) {\n return (charCode !== 9 /* CharCode.Tab */);\n }\n if (charCode === 127) {\n // DEL\n return true;\n }\n if ((charCode >= 0x202A && charCode <= 0x202E)\n || (charCode >= 0x2066 && charCode <= 0x2069)\n || (charCode >= 0x200E && charCode <= 0x200F)\n || charCode === 0x061C) {\n // Unicode Directional Formatting Characters\n // LRE\tU+202A\tLEFT-TO-RIGHT EMBEDDING\n // RLE\tU+202B\tRIGHT-TO-LEFT EMBEDDING\n // PDF\tU+202C\tPOP DIRECTIONAL FORMATTING\n // LRO\tU+202D\tLEFT-TO-RIGHT OVERRIDE\n // RLO\tU+202E\tRIGHT-TO-LEFT OVERRIDE\n // LRI\tU+2066\tLEFT-TO-RIGHT ISOLATE\n // RLI\tU+2067\tRIGHT-TO-LEFT ISOLATE\n // FSI\tU+2068\tFIRST STRONG ISOLATE\n // PDI\tU+2069\tPOP DIRECTIONAL ISOLATE\n // LRM\tU+200E\tLEFT-TO-RIGHT MARK\n // RLM\tU+200F\tRIGHT-TO-LEFT MARK\n // ALM\tU+061C\tARABIC LETTER MARK\n return true;\n }\n return false;\n}\nfunction extractControlCharacters(lineContent, tokens) {\n const result = [];\n let lastLinePart = new LinePart(0, '', 0, false);\n let charOffset = 0;\n for (const token of tokens) {\n const tokenEndIndex = token.endIndex;\n for (; charOffset < tokenEndIndex; charOffset++) {\n const charCode = lineContent.charCodeAt(charOffset);\n if (isControlCharacter(charCode)) {\n if (charOffset > lastLinePart.endIndex) {\n // emit previous part if it has text\n lastLinePart = new LinePart(charOffset, token.type, token.metadata, token.containsRTL);\n result.push(lastLinePart);\n }\n lastLinePart = new LinePart(charOffset + 1, 'mtkcontrol', token.metadata, false);\n result.push(lastLinePart);\n }\n }\n if (charOffset > lastLinePart.endIndex) {\n // emit previous part if it has text\n lastLinePart = new LinePart(tokenEndIndex, token.type, token.metadata, token.containsRTL);\n result.push(lastLinePart);\n }\n }\n return result;\n}\n/**\n * Whitespace is rendered by \"replacing\" tokens with a special-purpose `mtkw` type that is later recognized in the rendering phase.\n * Moreover, a token is created for every visual indent because on some fonts the glyphs used for rendering whitespace (→ or ·) do not have the same width as  .\n * The rendering phase will generate `style=\"width:...\"` for these tokens.\n */\nfunction _applyRenderWhitespace(input, lineContent, len, tokens) {\n const continuesWithWrappedLine = input.continuesWithWrappedLine;\n const fauxIndentLength = input.fauxIndentLength;\n const tabSize = input.tabSize;\n const startVisibleColumn = input.startVisibleColumn;\n const useMonospaceOptimizations = input.useMonospaceOptimizations;\n const selections = input.selectionsOnLine;\n const onlyBoundary = (input.renderWhitespace === 1 /* RenderWhitespace.Boundary */);\n const onlyTrailing = (input.renderWhitespace === 3 /* RenderWhitespace.Trailing */);\n const generateLinePartForEachWhitespace = (input.renderSpaceWidth !== input.spaceWidth);\n const result = [];\n let resultLen = 0;\n let tokenIndex = 0;\n let tokenType = tokens[tokenIndex].type;\n let tokenContainsRTL = tokens[tokenIndex].containsRTL;\n let tokenEndIndex = tokens[tokenIndex].endIndex;\n const tokensLength = tokens.length;\n let lineIsEmptyOrWhitespace = false;\n let firstNonWhitespaceIndex = strings.firstNonWhitespaceIndex(lineContent);\n let lastNonWhitespaceIndex;\n if (firstNonWhitespaceIndex === -1) {\n lineIsEmptyOrWhitespace = true;\n firstNonWhitespaceIndex = len;\n lastNonWhitespaceIndex = len;\n }\n else {\n lastNonWhitespaceIndex = strings.lastNonWhitespaceIndex(lineContent);\n }\n let wasInWhitespace = false;\n let currentSelectionIndex = 0;\n let currentSelection = selections && selections[currentSelectionIndex];\n let tmpIndent = startVisibleColumn % tabSize;\n for (let charIndex = fauxIndentLength; charIndex < len; charIndex++) {\n const chCode = lineContent.charCodeAt(charIndex);\n if (currentSelection && charIndex >= currentSelection.endOffset) {\n currentSelectionIndex++;\n currentSelection = selections && selections[currentSelectionIndex];\n }\n let isInWhitespace;\n if (charIndex < firstNonWhitespaceIndex || charIndex > lastNonWhitespaceIndex) {\n // in leading or trailing whitespace\n isInWhitespace = true;\n }\n else if (chCode === 9 /* CharCode.Tab */) {\n // a tab character is rendered both in all and boundary cases\n isInWhitespace = true;\n }\n else if (chCode === 32 /* CharCode.Space */) {\n // hit a space character\n if (onlyBoundary) {\n // rendering only boundary whitespace\n if (wasInWhitespace) {\n isInWhitespace = true;\n }\n else {\n const nextChCode = (charIndex + 1 < len ? lineContent.charCodeAt(charIndex + 1) : 0 /* CharCode.Null */);\n isInWhitespace = (nextChCode === 32 /* CharCode.Space */ || nextChCode === 9 /* CharCode.Tab */);\n }\n }\n else {\n isInWhitespace = true;\n }\n }\n else {\n isInWhitespace = false;\n }\n // If rendering whitespace on selection, check that the charIndex falls within a selection\n if (isInWhitespace && selections) {\n isInWhitespace = !!currentSelection && currentSelection.startOffset <= charIndex && currentSelection.endOffset > charIndex;\n }\n // If rendering only trailing whitespace, check that the charIndex points to trailing whitespace.\n if (isInWhitespace && onlyTrailing) {\n isInWhitespace = lineIsEmptyOrWhitespace || charIndex > lastNonWhitespaceIndex;\n }\n if (isInWhitespace && tokenContainsRTL) {\n // If the token contains RTL text, breaking it up into multiple line parts\n // to render whitespace might affect the browser's bidi layout.\n //\n // We render whitespace in such tokens only if the whitespace\n // is the leading or the trailing whitespace of the line,\n // which doesn't affect the browser's bidi layout.\n if (charIndex >= firstNonWhitespaceIndex && charIndex <= lastNonWhitespaceIndex) {\n isInWhitespace = false;\n }\n }\n if (wasInWhitespace) {\n // was in whitespace token\n if (!isInWhitespace || (!useMonospaceOptimizations && tmpIndent >= tabSize)) {\n // leaving whitespace token or entering a new indent\n if (generateLinePartForEachWhitespace) {\n const lastEndIndex = (resultLen > 0 ? result[resultLen - 1].endIndex : fauxIndentLength);\n for (let i = lastEndIndex + 1; i <= charIndex; i++) {\n result[resultLen++] = new LinePart(i, 'mtkw', 1 /* LinePartMetadata.IS_WHITESPACE */, false);\n }\n }\n else {\n result[resultLen++] = new LinePart(charIndex, 'mtkw', 1 /* LinePartMetadata.IS_WHITESPACE */, false);\n }\n tmpIndent = tmpIndent % tabSize;\n }\n }\n else {\n // was in regular token\n if (charIndex === tokenEndIndex || (isInWhitespace && charIndex > fauxIndentLength)) {\n result[resultLen++] = new LinePart(charIndex, tokenType, 0, tokenContainsRTL);\n tmpIndent = tmpIndent % tabSize;\n }\n }\n if (chCode === 9 /* CharCode.Tab */) {\n tmpIndent = tabSize;\n }\n else if (strings.isFullWidthCharacter(chCode)) {\n tmpIndent += 2;\n }\n else {\n tmpIndent++;\n }\n wasInWhitespace = isInWhitespace;\n while (charIndex === tokenEndIndex) {\n tokenIndex++;\n if (tokenIndex < tokensLength) {\n tokenType = tokens[tokenIndex].type;\n tokenContainsRTL = tokens[tokenIndex].containsRTL;\n tokenEndIndex = tokens[tokenIndex].endIndex;\n }\n else {\n break;\n }\n }\n }\n let generateWhitespace = false;\n if (wasInWhitespace) {\n // was in whitespace token\n if (continuesWithWrappedLine && onlyBoundary) {\n const lastCharCode = (len > 0 ? lineContent.charCodeAt(len - 1) : 0 /* CharCode.Null */);\n const prevCharCode = (len > 1 ? lineContent.charCodeAt(len - 2) : 0 /* CharCode.Null */);\n const isSingleTrailingSpace = (lastCharCode === 32 /* CharCode.Space */ && (prevCharCode !== 32 /* CharCode.Space */ && prevCharCode !== 9 /* CharCode.Tab */));\n if (!isSingleTrailingSpace) {\n generateWhitespace = true;\n }\n }\n else {\n generateWhitespace = true;\n }\n }\n if (generateWhitespace) {\n if (generateLinePartForEachWhitespace) {\n const lastEndIndex = (resultLen > 0 ? result[resultLen - 1].endIndex : fauxIndentLength);\n for (let i = lastEndIndex + 1; i <= len; i++) {\n result[resultLen++] = new LinePart(i, 'mtkw', 1 /* LinePartMetadata.IS_WHITESPACE */, false);\n }\n }\n else {\n result[resultLen++] = new LinePart(len, 'mtkw', 1 /* LinePartMetadata.IS_WHITESPACE */, false);\n }\n }\n else {\n result[resultLen++] = new LinePart(len, tokenType, 0, tokenContainsRTL);\n }\n return result;\n}\n/**\n * Inline decorations are \"merged\" on top of tokens.\n * Special care must be taken when multiple inline decorations are at play and they overlap.\n */\nfunction _applyInlineDecorations(lineContent, len, tokens, _lineDecorations) {\n _lineDecorations.sort(LineDecoration.compare);\n const lineDecorations = LineDecorationsNormalizer.normalize(lineContent, _lineDecorations);\n const lineDecorationsLen = lineDecorations.length;\n let lineDecorationIndex = 0;\n const result = [];\n let resultLen = 0;\n let lastResultEndIndex = 0;\n for (let tokenIndex = 0, len = tokens.length; tokenIndex < len; tokenIndex++) {\n const token = tokens[tokenIndex];\n const tokenEndIndex = token.endIndex;\n const tokenType = token.type;\n const tokenMetadata = token.metadata;\n const tokenContainsRTL = token.containsRTL;\n while (lineDecorationIndex < lineDecorationsLen && lineDecorations[lineDecorationIndex].startOffset < tokenEndIndex) {\n const lineDecoration = lineDecorations[lineDecorationIndex];\n if (lineDecoration.startOffset > lastResultEndIndex) {\n lastResultEndIndex = lineDecoration.startOffset;\n result[resultLen++] = new LinePart(lastResultEndIndex, tokenType, tokenMetadata, tokenContainsRTL);\n }\n if (lineDecoration.endOffset + 1 <= tokenEndIndex) {\n // This line decoration ends before this token ends\n lastResultEndIndex = lineDecoration.endOffset + 1;\n result[resultLen++] = new LinePart(lastResultEndIndex, tokenType + ' ' + lineDecoration.className, tokenMetadata | lineDecoration.metadata, tokenContainsRTL);\n lineDecorationIndex++;\n }\n else {\n // This line decoration continues on to the next token\n lastResultEndIndex = tokenEndIndex;\n result[resultLen++] = new LinePart(lastResultEndIndex, tokenType + ' ' + lineDecoration.className, tokenMetadata | lineDecoration.metadata, tokenContainsRTL);\n break;\n }\n }\n if (tokenEndIndex > lastResultEndIndex) {\n lastResultEndIndex = tokenEndIndex;\n result[resultLen++] = new LinePart(lastResultEndIndex, tokenType, tokenMetadata, tokenContainsRTL);\n }\n }\n const lastTokenEndIndex = tokens[tokens.length - 1].endIndex;\n if (lineDecorationIndex < lineDecorationsLen && lineDecorations[lineDecorationIndex].startOffset === lastTokenEndIndex) {\n while (lineDecorationIndex < lineDecorationsLen && lineDecorations[lineDecorationIndex].startOffset === lastTokenEndIndex) {\n const lineDecoration = lineDecorations[lineDecorationIndex];\n result[resultLen++] = new LinePart(lastResultEndIndex, lineDecoration.className, lineDecoration.metadata, false);\n lineDecorationIndex++;\n }\n }\n return result;\n}\n/**\n * This function is on purpose not split up into multiple functions to allow runtime type inference (i.e. performance reasons).\n * Notice how all the needed data is fully resolved and passed in (i.e. no other calls).\n */\nfunction _renderLine(input, sb) {\n const fontIsMonospace = input.fontIsMonospace;\n const canUseHalfwidthRightwardsArrow = input.canUseHalfwidthRightwardsArrow;\n const containsForeignElements = input.containsForeignElements;\n const lineContent = input.lineContent;\n const len = input.len;\n const isOverflowing = input.isOverflowing;\n const overflowingCharCount = input.overflowingCharCount;\n const parts = input.parts;\n const fauxIndentLength = input.fauxIndentLength;\n const tabSize = input.tabSize;\n const startVisibleColumn = input.startVisibleColumn;\n const containsRTL = input.containsRTL;\n const spaceWidth = input.spaceWidth;\n const renderSpaceCharCode = input.renderSpaceCharCode;\n const renderWhitespace = input.renderWhitespace;\n const renderControlCharacters = input.renderControlCharacters;\n const characterMapping = new CharacterMapping(len + 1, parts.length);\n let lastCharacterMappingDefined = false;\n let charIndex = 0;\n let visibleColumn = startVisibleColumn;\n let charOffsetInPart = 0; // the character offset in the current part\n let charHorizontalOffset = 0; // the character horizontal position in terms of chars relative to line start\n let partDisplacement = 0;\n if (containsRTL) {\n sb.appendString('');\n }\n else {\n sb.appendString('');\n }\n for (let partIndex = 0, tokensLen = parts.length; partIndex < tokensLen; partIndex++) {\n const part = parts[partIndex];\n const partEndIndex = part.endIndex;\n const partType = part.type;\n const partContainsRTL = part.containsRTL;\n const partRendersWhitespace = (renderWhitespace !== 0 /* RenderWhitespace.None */ && part.isWhitespace());\n const partRendersWhitespaceWithWidth = partRendersWhitespace && !fontIsMonospace && (partType === 'mtkw' /*only whitespace*/ || !containsForeignElements);\n const partIsEmptyAndHasPseudoAfter = (charIndex === partEndIndex && part.isPseudoAfter());\n charOffsetInPart = 0;\n sb.appendString('= fauxIndentLength) {\n _visibleColumn += charWidth;\n }\n }\n }\n if (partRendersWhitespaceWithWidth) {\n sb.appendString(' style=\"width:');\n sb.appendString(String(spaceWidth * partWidth));\n sb.appendString('px\"');\n }\n sb.appendASCIICharCode(62 /* CharCode.GreaterThan */);\n for (; charIndex < partEndIndex; charIndex++) {\n characterMapping.setColumnInfo(charIndex + 1, partIndex - partDisplacement, charOffsetInPart, charHorizontalOffset);\n partDisplacement = 0;\n const charCode = lineContent.charCodeAt(charIndex);\n let producedCharacters;\n let charWidth;\n if (charCode === 9 /* CharCode.Tab */) {\n producedCharacters = (tabSize - (visibleColumn % tabSize)) | 0;\n charWidth = producedCharacters;\n if (!canUseHalfwidthRightwardsArrow || charWidth > 1) {\n sb.appendCharCode(0x2192); // RIGHTWARDS ARROW\n }\n else {\n sb.appendCharCode(0xFFEB); // HALFWIDTH RIGHTWARDS ARROW\n }\n for (let space = 2; space <= charWidth; space++) {\n sb.appendCharCode(0xA0); //  \n }\n }\n else { // must be CharCode.Space\n producedCharacters = 2;\n charWidth = 1;\n sb.appendCharCode(renderSpaceCharCode); // · or word separator middle dot\n sb.appendCharCode(0x200C); // ZERO WIDTH NON-JOINER\n }\n charOffsetInPart += producedCharacters;\n charHorizontalOffset += charWidth;\n if (charIndex >= fauxIndentLength) {\n visibleColumn += charWidth;\n }\n }\n }\n else {\n sb.appendASCIICharCode(62 /* CharCode.GreaterThan */);\n for (; charIndex < partEndIndex; charIndex++) {\n characterMapping.setColumnInfo(charIndex + 1, partIndex - partDisplacement, charOffsetInPart, charHorizontalOffset);\n partDisplacement = 0;\n const charCode = lineContent.charCodeAt(charIndex);\n let producedCharacters = 1;\n let charWidth = 1;\n switch (charCode) {\n case 9 /* CharCode.Tab */:\n producedCharacters = (tabSize - (visibleColumn % tabSize));\n charWidth = producedCharacters;\n for (let space = 1; space <= producedCharacters; space++) {\n sb.appendCharCode(0xA0); //  \n }\n break;\n case 32 /* CharCode.Space */:\n sb.appendCharCode(0xA0); //  \n break;\n case 60 /* CharCode.LessThan */:\n sb.appendString('<');\n break;\n case 62 /* CharCode.GreaterThan */:\n sb.appendString('>');\n break;\n case 38 /* CharCode.Ampersand */:\n sb.appendString('&');\n break;\n case 0 /* CharCode.Null */:\n if (renderControlCharacters) {\n // See https://unicode-table.com/en/blocks/control-pictures/\n sb.appendCharCode(9216);\n }\n else {\n sb.appendString('�');\n }\n break;\n case 65279 /* CharCode.UTF8_BOM */:\n case 8232 /* CharCode.LINE_SEPARATOR */:\n case 8233 /* CharCode.PARAGRAPH_SEPARATOR */:\n case 133 /* CharCode.NEXT_LINE */:\n sb.appendCharCode(0xFFFD);\n break;\n default:\n if (strings.isFullWidthCharacter(charCode)) {\n charWidth++;\n }\n // See https://unicode-table.com/en/blocks/control-pictures/\n if (renderControlCharacters && charCode < 32) {\n sb.appendCharCode(9216 + charCode);\n }\n else if (renderControlCharacters && charCode === 127) {\n // DEL\n sb.appendCharCode(9249);\n }\n else if (renderControlCharacters && isControlCharacter(charCode)) {\n sb.appendString('[U+');\n sb.appendString(to4CharHex(charCode));\n sb.appendString(']');\n producedCharacters = 8;\n charWidth = producedCharacters;\n }\n else {\n sb.appendCharCode(charCode);\n }\n }\n charOffsetInPart += producedCharacters;\n charHorizontalOffset += charWidth;\n if (charIndex >= fauxIndentLength) {\n visibleColumn += charWidth;\n }\n }\n }\n if (partIsEmptyAndHasPseudoAfter) {\n partDisplacement++;\n }\n else {\n partDisplacement = 0;\n }\n if (charIndex >= len && !lastCharacterMappingDefined && part.isPseudoAfter()) {\n lastCharacterMappingDefined = true;\n characterMapping.setColumnInfo(charIndex + 1, partIndex, charOffsetInPart, charHorizontalOffset);\n }\n sb.appendString('');\n }\n if (!lastCharacterMappingDefined) {\n // When getting client rects for the last character, we will position the\n // text range at the end of the span, insteaf of at the beginning of next span\n characterMapping.setColumnInfo(len + 1, parts.length - 1, charOffsetInPart, charHorizontalOffset);\n }\n if (isOverflowing) {\n sb.appendString('');\n sb.appendString(nls.localize('showMore', \"Show more ({0})\", renderOverflowingCharCount(overflowingCharCount)));\n sb.appendString('');\n }\n sb.appendString('');\n return new RenderLineOutput(characterMapping, containsRTL, containsForeignElements);\n}\nfunction to4CharHex(n) {\n return n.toString(16).toUpperCase().padStart(4, '0');\n}\nfunction renderOverflowingCharCount(n) {\n if (n < 1024) {\n return nls.localize('overflow.chars', \"{0} chars\", n);\n }\n if (n < 1024 * 1024) {\n return `${(n / 1024).toFixed(1)} KB`;\n }\n return `${(n / 1024 / 1024).toFixed(1)} MB`;\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 * as strings from '../../../base/common/strings.js';\nexport class LineDecoration {\n constructor(startColumn, endColumn, className, type) {\n this.startColumn = startColumn;\n this.endColumn = endColumn;\n this.className = className;\n this.type = type;\n this._lineDecorationBrand = undefined;\n }\n static _equals(a, b) {\n return (a.startColumn === b.startColumn\n && a.endColumn === b.endColumn\n && a.className === b.className\n && a.type === b.type);\n }\n static equalsArr(a, b) {\n const aLen = a.length;\n const bLen = b.length;\n if (aLen !== bLen) {\n return false;\n }\n for (let i = 0; i < aLen; i++) {\n if (!LineDecoration._equals(a[i], b[i])) {\n return false;\n }\n }\n return true;\n }\n static extractWrapped(arr, startOffset, endOffset) {\n if (arr.length === 0) {\n return arr;\n }\n const startColumn = startOffset + 1;\n const endColumn = endOffset + 1;\n const lineLength = endOffset - startOffset;\n const r = [];\n let rLength = 0;\n for (const dec of arr) {\n if (dec.endColumn <= startColumn || dec.startColumn >= endColumn) {\n continue;\n }\n r[rLength++] = new LineDecoration(Math.max(1, dec.startColumn - startColumn + 1), Math.min(lineLength + 1, dec.endColumn - startColumn + 1), dec.className, dec.type);\n }\n return r;\n }\n static filter(lineDecorations, lineNumber, minLineColumn, maxLineColumn) {\n if (lineDecorations.length === 0) {\n return [];\n }\n const result = [];\n let resultLen = 0;\n for (let i = 0, len = lineDecorations.length; i < len; i++) {\n const d = lineDecorations[i];\n const range = d.range;\n if (range.endLineNumber < lineNumber || range.startLineNumber > lineNumber) {\n // Ignore decorations that sit outside this line\n continue;\n }\n if (range.isEmpty() && (d.type === 0 /* InlineDecorationType.Regular */ || d.type === 3 /* InlineDecorationType.RegularAffectingLetterSpacing */)) {\n // Ignore empty range decorations\n continue;\n }\n const startColumn = (range.startLineNumber === lineNumber ? range.startColumn : minLineColumn);\n const endColumn = (range.endLineNumber === lineNumber ? range.endColumn : maxLineColumn);\n result[resultLen++] = new LineDecoration(startColumn, endColumn, d.inlineClassName, d.type);\n }\n return result;\n }\n static _typeCompare(a, b) {\n const ORDER = [2, 0, 1, 3];\n return ORDER[a] - ORDER[b];\n }\n static compare(a, b) {\n if (a.startColumn !== b.startColumn) {\n return a.startColumn - b.startColumn;\n }\n if (a.endColumn !== b.endColumn) {\n return a.endColumn - b.endColumn;\n }\n const typeCmp = LineDecoration._typeCompare(a.type, b.type);\n if (typeCmp !== 0) {\n return typeCmp;\n }\n if (a.className !== b.className) {\n return a.className < b.className ? -1 : 1;\n }\n return 0;\n }\n}\nexport class DecorationSegment {\n constructor(startOffset, endOffset, className, metadata) {\n this.startOffset = startOffset;\n this.endOffset = endOffset;\n this.className = className;\n this.metadata = metadata;\n }\n}\nclass Stack {\n constructor() {\n this.stopOffsets = [];\n this.classNames = [];\n this.metadata = [];\n this.count = 0;\n }\n static _metadata(metadata) {\n let result = 0;\n for (let i = 0, len = metadata.length; i < len; i++) {\n result |= metadata[i];\n }\n return result;\n }\n consumeLowerThan(maxStopOffset, nextStartOffset, result) {\n while (this.count > 0 && this.stopOffsets[0] < maxStopOffset) {\n let i = 0;\n // Take all equal stopping offsets\n while (i + 1 < this.count && this.stopOffsets[i] === this.stopOffsets[i + 1]) {\n i++;\n }\n // Basically we are consuming the first i + 1 elements of the stack\n result.push(new DecorationSegment(nextStartOffset, this.stopOffsets[i], this.classNames.join(' '), Stack._metadata(this.metadata)));\n nextStartOffset = this.stopOffsets[i] + 1;\n // Consume them\n this.stopOffsets.splice(0, i + 1);\n this.classNames.splice(0, i + 1);\n this.metadata.splice(0, i + 1);\n this.count -= (i + 1);\n }\n if (this.count > 0 && nextStartOffset < maxStopOffset) {\n result.push(new DecorationSegment(nextStartOffset, maxStopOffset - 1, this.classNames.join(' '), Stack._metadata(this.metadata)));\n nextStartOffset = maxStopOffset;\n }\n return nextStartOffset;\n }\n insert(stopOffset, className, metadata) {\n if (this.count === 0 || this.stopOffsets[this.count - 1] <= stopOffset) {\n // Insert at the end\n this.stopOffsets.push(stopOffset);\n this.classNames.push(className);\n this.metadata.push(metadata);\n }\n else {\n // Find the insertion position for `stopOffset`\n for (let i = 0; i < this.count; i++) {\n if (this.stopOffsets[i] >= stopOffset) {\n this.stopOffsets.splice(i, 0, stopOffset);\n this.classNames.splice(i, 0, className);\n this.metadata.splice(i, 0, metadata);\n break;\n }\n }\n }\n this.count++;\n return;\n }\n}\nexport class LineDecorationsNormalizer {\n /**\n * Normalize line decorations. Overlapping decorations will generate multiple segments\n */\n static normalize(lineContent, lineDecorations) {\n if (lineDecorations.length === 0) {\n return [];\n }\n const result = [];\n const stack = new Stack();\n let nextStartOffset = 0;\n for (let i = 0, len = lineDecorations.length; i < len; i++) {\n const d = lineDecorations[i];\n let startColumn = d.startColumn;\n let endColumn = d.endColumn;\n const className = d.className;\n const metadata = (d.type === 1 /* InlineDecorationType.Before */\n ? 2 /* LinePartMetadata.PSEUDO_BEFORE */\n : d.type === 2 /* InlineDecorationType.After */\n ? 4 /* LinePartMetadata.PSEUDO_AFTER */\n : 0);\n // If the position would end up in the middle of a high-low surrogate pair, we move it to before the pair\n if (startColumn > 1) {\n const charCodeBefore = lineContent.charCodeAt(startColumn - 2);\n if (strings.isHighSurrogate(charCodeBefore)) {\n startColumn--;\n }\n }\n if (endColumn > 1) {\n const charCodeBefore = lineContent.charCodeAt(endColumn - 2);\n if (strings.isHighSurrogate(charCodeBefore)) {\n endColumn--;\n }\n }\n const currentStartOffset = startColumn - 1;\n const currentEndOffset = endColumn - 2;\n nextStartOffset = stack.consumeLowerThan(currentStartOffset, nextStartOffset, result);\n if (stack.count === 0) {\n nextStartOffset = currentStartOffset;\n }\n stack.insert(currentEndOffset, className, metadata);\n }\n stack.consumeLowerThan(1073741824 /* Constants.MAX_SAFE_SMALL_INTEGER */, nextStartOffset, result);\n return result;\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 *--------------------------------------------------------------------------------------------*/\nexport class LinePart {\n constructor(\n /**\n * last char index of this token (not inclusive).\n */\n endIndex, type, metadata, containsRTL) {\n this.endIndex = endIndex;\n this.type = type;\n this.metadata = metadata;\n this.containsRTL = containsRTL;\n this._linePartBrand = undefined;\n }\n isWhitespace() {\n return (this.metadata & 1 /* LinePartMetadata.IS_WHITESPACE_MASK */ ? true : false);\n }\n isPseudoAfter() {\n return (this.metadata & 4 /* LinePartMetadata.PSEUDO_AFTER_MASK */ ? true : false);\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 *--------------------------------------------------------------------------------------------*/\nimport * as arrays from '../../base/common/arrays.js';\nimport * as strings from '../../base/common/strings.js';\nimport { Range } from './core/range.js';\nexport class Viewport {\n constructor(top, left, width, height) {\n this._viewportBrand = undefined;\n this.top = top | 0;\n this.left = left | 0;\n this.width = width | 0;\n this.height = height | 0;\n }\n}\nexport class MinimapLinesRenderingData {\n constructor(tabSize, data) {\n this.tabSize = tabSize;\n this.data = data;\n }\n}\nexport class ViewLineData {\n constructor(content, continuesWithWrappedLine, minColumn, maxColumn, startVisibleColumn, tokens, inlineDecorations) {\n this._viewLineDataBrand = undefined;\n this.content = content;\n this.continuesWithWrappedLine = continuesWithWrappedLine;\n this.minColumn = minColumn;\n this.maxColumn = maxColumn;\n this.startVisibleColumn = startVisibleColumn;\n this.tokens = tokens;\n this.inlineDecorations = inlineDecorations;\n }\n}\nexport class ViewLineRenderingData {\n constructor(minColumn, maxColumn, content, continuesWithWrappedLine, mightContainRTL, mightContainNonBasicASCII, tokens, inlineDecorations, tabSize, startVisibleColumn) {\n this.minColumn = minColumn;\n this.maxColumn = maxColumn;\n this.content = content;\n this.continuesWithWrappedLine = continuesWithWrappedLine;\n this.isBasicASCII = ViewLineRenderingData.isBasicASCII(content, mightContainNonBasicASCII);\n this.containsRTL = ViewLineRenderingData.containsRTL(content, this.isBasicASCII, mightContainRTL);\n this.tokens = tokens;\n this.inlineDecorations = inlineDecorations;\n this.tabSize = tabSize;\n this.startVisibleColumn = startVisibleColumn;\n }\n static isBasicASCII(lineContent, mightContainNonBasicASCII) {\n if (mightContainNonBasicASCII) {\n return strings.isBasicASCII(lineContent);\n }\n return true;\n }\n static containsRTL(lineContent, isBasicASCII, mightContainRTL) {\n if (!isBasicASCII && mightContainRTL) {\n return strings.containsRTL(lineContent);\n }\n return false;\n }\n}\nexport class InlineDecoration {\n constructor(range, inlineClassName, type) {\n this.range = range;\n this.inlineClassName = inlineClassName;\n this.type = type;\n }\n}\nexport class SingleLineInlineDecoration {\n constructor(startOffset, endOffset, inlineClassName, inlineClassNameAffectsLetterSpacing) {\n this.startOffset = startOffset;\n this.endOffset = endOffset;\n this.inlineClassName = inlineClassName;\n this.inlineClassNameAffectsLetterSpacing = inlineClassNameAffectsLetterSpacing;\n }\n toInlineDecoration(lineNumber) {\n return new InlineDecoration(new Range(lineNumber, this.startOffset + 1, lineNumber, this.endOffset + 1), this.inlineClassName, this.inlineClassNameAffectsLetterSpacing ? 3 /* InlineDecorationType.RegularAffectingLetterSpacing */ : 0 /* InlineDecorationType.Regular */);\n }\n}\nexport class ViewModelDecoration {\n constructor(range, options) {\n this._viewModelDecorationBrand = undefined;\n this.range = range;\n this.options = options;\n }\n}\nexport class OverviewRulerDecorationsGroup {\n constructor(color, zIndex, \n /**\n * Decorations are encoded in a number array using the following scheme:\n * - 3*i = lane\n * - 3*i+1 = startLineNumber\n * - 3*i+2 = endLineNumber\n */\n data) {\n this.color = color;\n this.zIndex = zIndex;\n this.data = data;\n }\n static compareByRenderingProps(a, b) {\n if (a.zIndex === b.zIndex) {\n if (a.color < b.color) {\n return -1;\n }\n if (a.color > b.color) {\n return 1;\n }\n return 0;\n }\n return a.zIndex - b.zIndex;\n }\n static equals(a, b) {\n return (a.color === b.color\n && a.zIndex === b.zIndex\n && arrays.equals(a.data, b.data));\n }\n static equalsArr(a, b) {\n return arrays.equals(a, b, OverviewRulerDecorationsGroup.equals);\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 *--------------------------------------------------------------------------------------------*/\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};\nvar MonarchTokenizer_1;\n/**\n * Create a syntax highighter with a fully declarative JSON style lexer description\n * using regular expressions.\n */\nimport { Disposable } from '../../../../base/common/lifecycle.js';\nimport * as languages from '../../../common/languages.js';\nimport { NullState, nullTokenizeEncoded, nullTokenize } from '../../../common/languages/nullTokenize.js';\nimport * as monarchCommon from './monarchCommon.js';\nimport { IConfigurationService } from '../../../../platform/configuration/common/configuration.js';\nconst CACHE_STACK_DEPTH = 5;\n/**\n * Reuse the same stack elements up to a certain depth.\n */\nclass MonarchStackElementFactory {\n static create(parent, state) {\n return this._INSTANCE.create(parent, state);\n }\n constructor(maxCacheDepth) {\n this._maxCacheDepth = maxCacheDepth;\n this._entries = Object.create(null);\n }\n create(parent, state) {\n if (parent !== null && parent.depth >= this._maxCacheDepth) {\n // no caching above a certain depth\n return new MonarchStackElement(parent, state);\n }\n let stackElementId = MonarchStackElement.getStackElementId(parent);\n if (stackElementId.length > 0) {\n stackElementId += '|';\n }\n stackElementId += state;\n let result = this._entries[stackElementId];\n if (result) {\n return result;\n }\n result = new MonarchStackElement(parent, state);\n this._entries[stackElementId] = result;\n return result;\n }\n}\nMonarchStackElementFactory._INSTANCE = new MonarchStackElementFactory(CACHE_STACK_DEPTH);\nclass MonarchStackElement {\n constructor(parent, state) {\n this.parent = parent;\n this.state = state;\n this.depth = (this.parent ? this.parent.depth : 0) + 1;\n }\n static getStackElementId(element) {\n let result = '';\n while (element !== null) {\n if (result.length > 0) {\n result += '|';\n }\n result += element.state;\n element = element.parent;\n }\n return result;\n }\n static _equals(a, b) {\n while (a !== null && b !== null) {\n if (a === b) {\n return true;\n }\n if (a.state !== b.state) {\n return false;\n }\n a = a.parent;\n b = b.parent;\n }\n if (a === null && b === null) {\n return true;\n }\n return false;\n }\n equals(other) {\n return MonarchStackElement._equals(this, other);\n }\n push(state) {\n return MonarchStackElementFactory.create(this, state);\n }\n pop() {\n return this.parent;\n }\n popall() {\n let result = this;\n while (result.parent) {\n result = result.parent;\n }\n return result;\n }\n switchTo(state) {\n return MonarchStackElementFactory.create(this.parent, state);\n }\n}\nclass EmbeddedLanguageData {\n constructor(languageId, state) {\n this.languageId = languageId;\n this.state = state;\n }\n equals(other) {\n return (this.languageId === other.languageId\n && this.state.equals(other.state));\n }\n clone() {\n const stateClone = this.state.clone();\n // save an object\n if (stateClone === this.state) {\n return this;\n }\n return new EmbeddedLanguageData(this.languageId, this.state);\n }\n}\n/**\n * Reuse the same line states up to a certain depth.\n */\nclass MonarchLineStateFactory {\n static create(stack, embeddedLanguageData) {\n return this._INSTANCE.create(stack, embeddedLanguageData);\n }\n constructor(maxCacheDepth) {\n this._maxCacheDepth = maxCacheDepth;\n this._entries = Object.create(null);\n }\n create(stack, embeddedLanguageData) {\n if (embeddedLanguageData !== null) {\n // no caching when embedding\n return new MonarchLineState(stack, embeddedLanguageData);\n }\n if (stack !== null && stack.depth >= this._maxCacheDepth) {\n // no caching above a certain depth\n return new MonarchLineState(stack, embeddedLanguageData);\n }\n const stackElementId = MonarchStackElement.getStackElementId(stack);\n let result = this._entries[stackElementId];\n if (result) {\n return result;\n }\n result = new MonarchLineState(stack, null);\n this._entries[stackElementId] = result;\n return result;\n }\n}\nMonarchLineStateFactory._INSTANCE = new MonarchLineStateFactory(CACHE_STACK_DEPTH);\nclass MonarchLineState {\n constructor(stack, embeddedLanguageData) {\n this.stack = stack;\n this.embeddedLanguageData = embeddedLanguageData;\n }\n clone() {\n const embeddedlanguageDataClone = this.embeddedLanguageData ? this.embeddedLanguageData.clone() : null;\n // save an object\n if (embeddedlanguageDataClone === this.embeddedLanguageData) {\n return this;\n }\n return MonarchLineStateFactory.create(this.stack, this.embeddedLanguageData);\n }\n equals(other) {\n if (!(other instanceof MonarchLineState)) {\n return false;\n }\n if (!this.stack.equals(other.stack)) {\n return false;\n }\n if (this.embeddedLanguageData === null && other.embeddedLanguageData === null) {\n return true;\n }\n if (this.embeddedLanguageData === null || other.embeddedLanguageData === null) {\n return false;\n }\n return this.embeddedLanguageData.equals(other.embeddedLanguageData);\n }\n}\nclass MonarchClassicTokensCollector {\n constructor() {\n this._tokens = [];\n this._languageId = null;\n this._lastTokenType = null;\n this._lastTokenLanguage = null;\n }\n enterLanguage(languageId) {\n this._languageId = languageId;\n }\n emit(startOffset, type) {\n if (this._lastTokenType === type && this._lastTokenLanguage === this._languageId) {\n return;\n }\n this._lastTokenType = type;\n this._lastTokenLanguage = this._languageId;\n this._tokens.push(new languages.Token(startOffset, type, this._languageId));\n }\n nestedLanguageTokenize(embeddedLanguageLine, hasEOL, embeddedLanguageData, offsetDelta) {\n const nestedLanguageId = embeddedLanguageData.languageId;\n const embeddedModeState = embeddedLanguageData.state;\n const nestedLanguageTokenizationSupport = languages.TokenizationRegistry.get(nestedLanguageId);\n if (!nestedLanguageTokenizationSupport) {\n this.enterLanguage(nestedLanguageId);\n this.emit(offsetDelta, '');\n return embeddedModeState;\n }\n const nestedResult = nestedLanguageTokenizationSupport.tokenize(embeddedLanguageLine, hasEOL, embeddedModeState);\n if (offsetDelta !== 0) {\n for (const token of nestedResult.tokens) {\n this._tokens.push(new languages.Token(token.offset + offsetDelta, token.type, token.language));\n }\n }\n else {\n this._tokens = this._tokens.concat(nestedResult.tokens);\n }\n this._lastTokenType = null;\n this._lastTokenLanguage = null;\n this._languageId = null;\n return nestedResult.endState;\n }\n finalize(endState) {\n return new languages.TokenizationResult(this._tokens, endState);\n }\n}\nclass MonarchModernTokensCollector {\n constructor(languageService, theme) {\n this._languageService = languageService;\n this._theme = theme;\n this._prependTokens = null;\n this._tokens = [];\n this._currentLanguageId = 0 /* LanguageId.Null */;\n this._lastTokenMetadata = 0;\n }\n enterLanguage(languageId) {\n this._currentLanguageId = this._languageService.languageIdCodec.encodeLanguageId(languageId);\n }\n emit(startOffset, type) {\n const metadata = this._theme.match(this._currentLanguageId, type) | 1024 /* MetadataConsts.BALANCED_BRACKETS_MASK */;\n if (this._lastTokenMetadata === metadata) {\n return;\n }\n this._lastTokenMetadata = metadata;\n this._tokens.push(startOffset);\n this._tokens.push(metadata);\n }\n static _merge(a, b, c) {\n const aLen = (a !== null ? a.length : 0);\n const bLen = b.length;\n const cLen = (c !== null ? c.length : 0);\n if (aLen === 0 && bLen === 0 && cLen === 0) {\n return new Uint32Array(0);\n }\n if (aLen === 0 && bLen === 0) {\n return c;\n }\n if (bLen === 0 && cLen === 0) {\n return a;\n }\n const result = new Uint32Array(aLen + bLen + cLen);\n if (a !== null) {\n result.set(a);\n }\n for (let i = 0; i < bLen; i++) {\n result[aLen + i] = b[i];\n }\n if (c !== null) {\n result.set(c, aLen + bLen);\n }\n return result;\n }\n nestedLanguageTokenize(embeddedLanguageLine, hasEOL, embeddedLanguageData, offsetDelta) {\n const nestedLanguageId = embeddedLanguageData.languageId;\n const embeddedModeState = embeddedLanguageData.state;\n const nestedLanguageTokenizationSupport = languages.TokenizationRegistry.get(nestedLanguageId);\n if (!nestedLanguageTokenizationSupport) {\n this.enterLanguage(nestedLanguageId);\n this.emit(offsetDelta, '');\n return embeddedModeState;\n }\n const nestedResult = nestedLanguageTokenizationSupport.tokenizeEncoded(embeddedLanguageLine, hasEOL, embeddedModeState);\n if (offsetDelta !== 0) {\n for (let i = 0, len = nestedResult.tokens.length; i < len; i += 2) {\n nestedResult.tokens[i] += offsetDelta;\n }\n }\n this._prependTokens = MonarchModernTokensCollector._merge(this._prependTokens, this._tokens, nestedResult.tokens);\n this._tokens = [];\n this._currentLanguageId = 0;\n this._lastTokenMetadata = 0;\n return nestedResult.endState;\n }\n finalize(endState) {\n return new languages.EncodedTokenizationResult(MonarchModernTokensCollector._merge(this._prependTokens, this._tokens, null), endState);\n }\n}\nlet MonarchTokenizer = MonarchTokenizer_1 = class MonarchTokenizer extends Disposable {\n constructor(languageService, standaloneThemeService, languageId, lexer, _configurationService) {\n super();\n this._configurationService = _configurationService;\n this._languageService = languageService;\n this._standaloneThemeService = standaloneThemeService;\n this._languageId = languageId;\n this._lexer = lexer;\n this._embeddedLanguages = Object.create(null);\n this.embeddedLoaded = Promise.resolve(undefined);\n // Set up listening for embedded modes\n let emitting = false;\n this._register(languages.TokenizationRegistry.onDidChange((e) => {\n if (emitting) {\n return;\n }\n let isOneOfMyEmbeddedModes = false;\n for (let i = 0, len = e.changedLanguages.length; i < len; i++) {\n const language = e.changedLanguages[i];\n if (this._embeddedLanguages[language]) {\n isOneOfMyEmbeddedModes = true;\n break;\n }\n }\n if (isOneOfMyEmbeddedModes) {\n emitting = true;\n languages.TokenizationRegistry.handleChange([this._languageId]);\n emitting = false;\n }\n }));\n this._maxTokenizationLineLength = this._configurationService.getValue('editor.maxTokenizationLineLength', {\n overrideIdentifier: this._languageId\n });\n this._register(this._configurationService.onDidChangeConfiguration(e => {\n if (e.affectsConfiguration('editor.maxTokenizationLineLength')) {\n this._maxTokenizationLineLength = this._configurationService.getValue('editor.maxTokenizationLineLength', {\n overrideIdentifier: this._languageId\n });\n }\n }));\n }\n getLoadStatus() {\n const promises = [];\n for (const nestedLanguageId in this._embeddedLanguages) {\n const tokenizationSupport = languages.TokenizationRegistry.get(nestedLanguageId);\n if (tokenizationSupport) {\n // The nested language is already loaded\n if (tokenizationSupport instanceof MonarchTokenizer_1) {\n const nestedModeStatus = tokenizationSupport.getLoadStatus();\n if (nestedModeStatus.loaded === false) {\n promises.push(nestedModeStatus.promise);\n }\n }\n continue;\n }\n if (!languages.TokenizationRegistry.isResolved(nestedLanguageId)) {\n // The nested language is in the process of being loaded\n promises.push(languages.TokenizationRegistry.getOrCreate(nestedLanguageId));\n }\n }\n if (promises.length === 0) {\n return {\n loaded: true\n };\n }\n return {\n loaded: false,\n promise: Promise.all(promises).then(_ => undefined)\n };\n }\n getInitialState() {\n const rootState = MonarchStackElementFactory.create(null, this._lexer.start);\n return MonarchLineStateFactory.create(rootState, null);\n }\n tokenize(line, hasEOL, lineState) {\n if (line.length >= this._maxTokenizationLineLength) {\n return nullTokenize(this._languageId, lineState);\n }\n const tokensCollector = new MonarchClassicTokensCollector();\n const endLineState = this._tokenize(line, hasEOL, lineState, tokensCollector);\n return tokensCollector.finalize(endLineState);\n }\n tokenizeEncoded(line, hasEOL, lineState) {\n if (line.length >= this._maxTokenizationLineLength) {\n return nullTokenizeEncoded(this._languageService.languageIdCodec.encodeLanguageId(this._languageId), lineState);\n }\n const tokensCollector = new MonarchModernTokensCollector(this._languageService, this._standaloneThemeService.getColorTheme().tokenTheme);\n const endLineState = this._tokenize(line, hasEOL, lineState, tokensCollector);\n return tokensCollector.finalize(endLineState);\n }\n _tokenize(line, hasEOL, lineState, collector) {\n if (lineState.embeddedLanguageData) {\n return this._nestedTokenize(line, hasEOL, lineState, 0, collector);\n }\n else {\n return this._myTokenize(line, hasEOL, lineState, 0, collector);\n }\n }\n _findLeavingNestedLanguageOffset(line, state) {\n let rules = this._lexer.tokenizer[state.stack.state];\n if (!rules) {\n rules = monarchCommon.findRules(this._lexer, state.stack.state); // do parent matching\n if (!rules) {\n throw monarchCommon.createError(this._lexer, 'tokenizer state is not defined: ' + state.stack.state);\n }\n }\n let popOffset = -1;\n let hasEmbeddedPopRule = false;\n for (const rule of rules) {\n if (!monarchCommon.isIAction(rule.action) || rule.action.nextEmbedded !== '@pop') {\n continue;\n }\n hasEmbeddedPopRule = true;\n let regex = rule.resolveRegex(state.stack.state);\n const regexSource = regex.source;\n if (regexSource.substr(0, 4) === '^(?:' && regexSource.substr(regexSource.length - 1, 1) === ')') {\n const flags = (regex.ignoreCase ? 'i' : '') + (regex.unicode ? 'u' : '');\n regex = new RegExp(regexSource.substr(4, regexSource.length - 5), flags);\n }\n const result = line.search(regex);\n if (result === -1 || (result !== 0 && rule.matchOnlyAtLineStart)) {\n continue;\n }\n if (popOffset === -1 || result < popOffset) {\n popOffset = result;\n }\n }\n if (!hasEmbeddedPopRule) {\n throw monarchCommon.createError(this._lexer, 'no rule containing nextEmbedded: \"@pop\" in tokenizer embedded state: ' + state.stack.state);\n }\n return popOffset;\n }\n _nestedTokenize(line, hasEOL, lineState, offsetDelta, tokensCollector) {\n const popOffset = this._findLeavingNestedLanguageOffset(line, lineState);\n if (popOffset === -1) {\n // tokenization will not leave nested language\n const nestedEndState = tokensCollector.nestedLanguageTokenize(line, hasEOL, lineState.embeddedLanguageData, offsetDelta);\n return MonarchLineStateFactory.create(lineState.stack, new EmbeddedLanguageData(lineState.embeddedLanguageData.languageId, nestedEndState));\n }\n const nestedLanguageLine = line.substring(0, popOffset);\n if (nestedLanguageLine.length > 0) {\n // tokenize with the nested language\n tokensCollector.nestedLanguageTokenize(nestedLanguageLine, false, lineState.embeddedLanguageData, offsetDelta);\n }\n const restOfTheLine = line.substring(popOffset);\n return this._myTokenize(restOfTheLine, hasEOL, lineState, offsetDelta + popOffset, tokensCollector);\n }\n _safeRuleName(rule) {\n if (rule) {\n return rule.name;\n }\n return '(unknown)';\n }\n _myTokenize(lineWithoutLF, hasEOL, lineState, offsetDelta, tokensCollector) {\n tokensCollector.enterLanguage(this._languageId);\n const lineWithoutLFLength = lineWithoutLF.length;\n const line = (hasEOL && this._lexer.includeLF ? lineWithoutLF + '\\n' : lineWithoutLF);\n const lineLength = line.length;\n let embeddedLanguageData = lineState.embeddedLanguageData;\n let stack = lineState.stack;\n let pos = 0;\n let groupMatching = null;\n // See https://github.com/microsoft/monaco-editor/issues/1235\n // Evaluate rules at least once for an empty line\n let forceEvaluation = true;\n while (forceEvaluation || pos < lineLength) {\n const pos0 = pos;\n const stackLen0 = stack.depth;\n const groupLen0 = groupMatching ? groupMatching.groups.length : 0;\n const state = stack.state;\n let matches = null;\n let matched = null;\n let action = null;\n let rule = null;\n let enteringEmbeddedLanguage = null;\n // check if we need to process group matches first\n if (groupMatching) {\n matches = groupMatching.matches;\n const groupEntry = groupMatching.groups.shift();\n matched = groupEntry.matched;\n action = groupEntry.action;\n rule = groupMatching.rule;\n // cleanup if necessary\n if (groupMatching.groups.length === 0) {\n groupMatching = null;\n }\n }\n else {\n // otherwise we match on the token stream\n if (!forceEvaluation && pos >= lineLength) {\n // nothing to do\n break;\n }\n forceEvaluation = false;\n // get the rules for this state\n let rules = this._lexer.tokenizer[state];\n if (!rules) {\n rules = monarchCommon.findRules(this._lexer, state); // do parent matching\n if (!rules) {\n throw monarchCommon.createError(this._lexer, 'tokenizer state is not defined: ' + state);\n }\n }\n // try each rule until we match\n const restOfLine = line.substr(pos);\n for (const rule of rules) {\n if (pos === 0 || !rule.matchOnlyAtLineStart) {\n matches = restOfLine.match(rule.resolveRegex(state));\n if (matches) {\n matched = matches[0];\n action = rule.action;\n break;\n }\n }\n }\n }\n // We matched 'rule' with 'matches' and 'action'\n if (!matches) {\n matches = [''];\n matched = '';\n }\n if (!action) {\n // bad: we didn't match anything, and there is no action to take\n // we need to advance the stream or we get progress trouble\n if (pos < lineLength) {\n matches = [line.charAt(pos)];\n matched = matches[0];\n }\n action = this._lexer.defaultToken;\n }\n if (matched === null) {\n // should never happen, needed for strict null checking\n break;\n }\n // advance stream\n pos += matched.length;\n // maybe call action function (used for 'cases')\n while (monarchCommon.isFuzzyAction(action) && monarchCommon.isIAction(action) && action.test) {\n action = action.test(matched, matches, state, pos === lineLength);\n }\n let result = null;\n // set the result: either a string or an array of actions\n if (typeof action === 'string' || Array.isArray(action)) {\n result = action;\n }\n else if (action.group) {\n result = action.group;\n }\n else if (action.token !== null && action.token !== undefined) {\n // do $n replacements?\n if (action.tokenSubst) {\n result = monarchCommon.substituteMatches(this._lexer, action.token, matched, matches, state);\n }\n else {\n result = action.token;\n }\n // enter embedded language?\n if (action.nextEmbedded) {\n if (action.nextEmbedded === '@pop') {\n if (!embeddedLanguageData) {\n throw monarchCommon.createError(this._lexer, 'cannot pop embedded language if not inside one');\n }\n embeddedLanguageData = null;\n }\n else if (embeddedLanguageData) {\n throw monarchCommon.createError(this._lexer, 'cannot enter embedded language from within an embedded language');\n }\n else {\n enteringEmbeddedLanguage = monarchCommon.substituteMatches(this._lexer, action.nextEmbedded, matched, matches, state);\n }\n }\n // state transformations\n if (action.goBack) { // back up the stream..\n pos = Math.max(0, pos - action.goBack);\n }\n if (action.switchTo && typeof action.switchTo === 'string') {\n let nextState = monarchCommon.substituteMatches(this._lexer, action.switchTo, matched, matches, state); // switch state without a push...\n if (nextState[0] === '@') {\n nextState = nextState.substr(1); // peel off starting '@'\n }\n if (!monarchCommon.findRules(this._lexer, nextState)) {\n throw monarchCommon.createError(this._lexer, 'trying to switch to a state \\'' + nextState + '\\' that is undefined in rule: ' + this._safeRuleName(rule));\n }\n else {\n stack = stack.switchTo(nextState);\n }\n }\n else if (action.transform && typeof action.transform === 'function') {\n throw monarchCommon.createError(this._lexer, 'action.transform not supported');\n }\n else if (action.next) {\n if (action.next === '@push') {\n if (stack.depth >= this._lexer.maxStack) {\n throw monarchCommon.createError(this._lexer, 'maximum tokenizer stack size reached: [' +\n stack.state + ',' + stack.parent.state + ',...]');\n }\n else {\n stack = stack.push(state);\n }\n }\n else if (action.next === '@pop') {\n if (stack.depth <= 1) {\n throw monarchCommon.createError(this._lexer, 'trying to pop an empty stack in rule: ' + this._safeRuleName(rule));\n }\n else {\n stack = stack.pop();\n }\n }\n else if (action.next === '@popall') {\n stack = stack.popall();\n }\n else {\n let nextState = monarchCommon.substituteMatches(this._lexer, action.next, matched, matches, state);\n if (nextState[0] === '@') {\n nextState = nextState.substr(1); // peel off starting '@'\n }\n if (!monarchCommon.findRules(this._lexer, nextState)) {\n throw monarchCommon.createError(this._lexer, 'trying to set a next state \\'' + nextState + '\\' that is undefined in rule: ' + this._safeRuleName(rule));\n }\n else {\n stack = stack.push(nextState);\n }\n }\n }\n if (action.log && typeof (action.log) === 'string') {\n monarchCommon.log(this._lexer, this._lexer.languageId + ': ' + monarchCommon.substituteMatches(this._lexer, action.log, matched, matches, state));\n }\n }\n // check result\n if (result === null) {\n throw monarchCommon.createError(this._lexer, 'lexer rule has no well-defined action in rule: ' + this._safeRuleName(rule));\n }\n const computeNewStateForEmbeddedLanguage = (enteringEmbeddedLanguage) => {\n // support language names, mime types, and language ids\n const languageId = (this._languageService.getLanguageIdByLanguageName(enteringEmbeddedLanguage)\n || this._languageService.getLanguageIdByMimeType(enteringEmbeddedLanguage)\n || enteringEmbeddedLanguage);\n const embeddedLanguageData = this._getNestedEmbeddedLanguageData(languageId);\n if (pos < lineLength) {\n // there is content from the embedded language on this line\n const restOfLine = lineWithoutLF.substr(pos);\n return this._nestedTokenize(restOfLine, hasEOL, MonarchLineStateFactory.create(stack, embeddedLanguageData), offsetDelta + pos, tokensCollector);\n }\n else {\n return MonarchLineStateFactory.create(stack, embeddedLanguageData);\n }\n };\n // is the result a group match?\n if (Array.isArray(result)) {\n if (groupMatching && groupMatching.groups.length > 0) {\n throw monarchCommon.createError(this._lexer, 'groups cannot be nested: ' + this._safeRuleName(rule));\n }\n if (matches.length !== result.length + 1) {\n throw monarchCommon.createError(this._lexer, 'matched number of groups does not match the number of actions in rule: ' + this._safeRuleName(rule));\n }\n let totalLen = 0;\n for (let i = 1; i < matches.length; i++) {\n totalLen += matches[i].length;\n }\n if (totalLen !== matched.length) {\n throw monarchCommon.createError(this._lexer, 'with groups, all characters should be matched in consecutive groups in rule: ' + this._safeRuleName(rule));\n }\n groupMatching = {\n rule: rule,\n matches: matches,\n groups: []\n };\n for (let i = 0; i < result.length; i++) {\n groupMatching.groups[i] = {\n action: result[i],\n matched: matches[i + 1]\n };\n }\n pos -= matched.length;\n // call recursively to initiate first result match\n continue;\n }\n else {\n // regular result\n // check for '@rematch'\n if (result === '@rematch') {\n pos -= matched.length;\n matched = ''; // better set the next state too..\n matches = null;\n result = '';\n // Even though `@rematch` was specified, if `nextEmbedded` also specified,\n // a state transition should occur.\n if (enteringEmbeddedLanguage !== null) {\n return computeNewStateForEmbeddedLanguage(enteringEmbeddedLanguage);\n }\n }\n // check progress\n if (matched.length === 0) {\n if (lineLength === 0 || stackLen0 !== stack.depth || state !== stack.state || (!groupMatching ? 0 : groupMatching.groups.length) !== groupLen0) {\n continue;\n }\n else {\n throw monarchCommon.createError(this._lexer, 'no progress in tokenizer in rule: ' + this._safeRuleName(rule));\n }\n }\n // return the result (and check for brace matching)\n // todo: for efficiency we could pre-sanitize tokenPostfix and substitutions\n let tokenType = null;\n if (monarchCommon.isString(result) && result.indexOf('@brackets') === 0) {\n const rest = result.substr('@brackets'.length);\n const bracket = findBracket(this._lexer, matched);\n if (!bracket) {\n throw monarchCommon.createError(this._lexer, '@brackets token returned but no bracket defined as: ' + matched);\n }\n tokenType = monarchCommon.sanitize(bracket.token + rest);\n }\n else {\n const token = (result === '' ? '' : result + this._lexer.tokenPostfix);\n tokenType = monarchCommon.sanitize(token);\n }\n if (pos0 < lineWithoutLFLength) {\n tokensCollector.emit(pos0 + offsetDelta, tokenType);\n }\n }\n if (enteringEmbeddedLanguage !== null) {\n return computeNewStateForEmbeddedLanguage(enteringEmbeddedLanguage);\n }\n }\n return MonarchLineStateFactory.create(stack, embeddedLanguageData);\n }\n _getNestedEmbeddedLanguageData(languageId) {\n if (!this._languageService.isRegisteredLanguageId(languageId)) {\n return new EmbeddedLanguageData(languageId, NullState);\n }\n if (languageId !== this._languageId) {\n // Fire language loading event\n this._languageService.requestBasicLanguageFeatures(languageId);\n languages.TokenizationRegistry.getOrCreate(languageId);\n this._embeddedLanguages[languageId] = true;\n }\n const tokenizationSupport = languages.TokenizationRegistry.get(languageId);\n if (tokenizationSupport) {\n return new EmbeddedLanguageData(languageId, tokenizationSupport.getInitialState());\n }\n return new EmbeddedLanguageData(languageId, NullState);\n }\n};\nMonarchTokenizer = MonarchTokenizer_1 = __decorate([\n __param(4, IConfigurationService)\n], MonarchTokenizer);\nexport { MonarchTokenizer };\n/**\n * Searches for a bracket in the 'brackets' attribute that matches the input.\n */\nfunction findBracket(lexer, matched) {\n if (!matched) {\n return null;\n }\n matched = monarchCommon.fixCase(lexer, matched);\n const brackets = lexer.brackets;\n for (const bracket of brackets) {\n if (bracket.open === matched) {\n return { token: bracket.token, bracketType: 1 /* monarchCommon.MonarchBracket.Open */ };\n }\n else if (bracket.close === matched) {\n return { token: bracket.token, bracketType: -1 /* monarchCommon.MonarchBracket.Close */ };\n }\n }\n return 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 *--------------------------------------------------------------------------------------------*/\nexport function isFuzzyActionArr(what) {\n return (Array.isArray(what));\n}\nexport function isFuzzyAction(what) {\n return !isFuzzyActionArr(what);\n}\nexport function isString(what) {\n return (typeof what === 'string');\n}\nexport function isIAction(what) {\n return !isString(what);\n}\n// Small helper functions\n/**\n * Is a string null, undefined, or empty?\n */\nexport function empty(s) {\n return (s ? false : true);\n}\n/**\n * Puts a string to lower case if 'ignoreCase' is set.\n */\nexport function fixCase(lexer, str) {\n return (lexer.ignoreCase && str ? str.toLowerCase() : str);\n}\n/**\n * Ensures there are no bad characters in a CSS token class.\n */\nexport function sanitize(s) {\n return s.replace(/[&<>'\"_]/g, '-'); // used on all output token CSS classes\n}\n// Logging\n/**\n * Logs a message.\n */\nexport function log(lexer, msg) {\n console.log(`${lexer.languageId}: ${msg}`);\n}\n// Throwing errors\nexport function createError(lexer, msg) {\n return new Error(`${lexer.languageId}: ${msg}`);\n}\n// Helper functions for rule finding and substitution\n/**\n * substituteMatches is used on lexer strings and can substitutes predefined patterns:\n * \t\t$$ => $\n * \t\t$# => id\n * \t\t$n => matched entry n\n * \t\t@attr => contents of lexer[attr]\n *\n * See documentation for more info\n */\nexport function substituteMatches(lexer, str, id, matches, state) {\n const re = /\\$((\\$)|(#)|(\\d\\d?)|[sS](\\d\\d?)|@(\\w+))/g;\n let stateMatches = null;\n return str.replace(re, function (full, sub, dollar, hash, n, s, attr, ofs, total) {\n if (!empty(dollar)) {\n return '$'; // $$\n }\n if (!empty(hash)) {\n return fixCase(lexer, id); // default $#\n }\n if (!empty(n) && n < matches.length) {\n return fixCase(lexer, matches[n]); // $n\n }\n if (!empty(attr) && lexer && typeof (lexer[attr]) === 'string') {\n return lexer[attr]; //@attribute\n }\n if (stateMatches === null) { // split state on demand\n stateMatches = state.split('.');\n stateMatches.unshift(state);\n }\n if (!empty(s) && s < stateMatches.length) {\n return fixCase(lexer, stateMatches[s]); //$Sn\n }\n return '';\n });\n}\n/**\n * substituteMatchesRe is used on lexer regex rules and can substitutes predefined patterns:\n * \t\t$Sn => n'th part of state\n *\n */\nexport function substituteMatchesRe(lexer, str, state) {\n const re = /\\$[sS](\\d\\d?)/g;\n let stateMatches = null;\n return str.replace(re, function (full, s) {\n if (stateMatches === null) { // split state on demand\n stateMatches = state.split('.');\n stateMatches.unshift(state);\n }\n if (!empty(s) && s < stateMatches.length) {\n return fixCase(lexer, stateMatches[s]); //$Sn\n }\n return '';\n });\n}\n/**\n * Find the tokenizer rules for a specific state (i.e. next action)\n */\nexport function findRules(lexer, inState) {\n let state = inState;\n while (state && state.length > 0) {\n const rules = lexer.tokenizer[state];\n if (rules) {\n return rules;\n }\n const idx = state.lastIndexOf('.');\n if (idx < 0) {\n state = null; // no further parent\n }\n else {\n state = state.substr(0, idx);\n }\n }\n return null;\n}\n/**\n * Is a certain state defined? In contrast to 'findRules' this works on a ILexerMin.\n * This is used during compilation where we may know the defined states\n * but not yet whether the corresponding rules are correct.\n */\nexport function stateExists(lexer, inState) {\n let state = inState;\n while (state && state.length > 0) {\n const exist = lexer.stateNames[state];\n if (exist) {\n return true;\n }\n const idx = state.lastIndexOf('.');\n if (idx < 0) {\n state = null; // no further parent\n }\n else {\n state = state.substr(0, idx);\n }\n }\n 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 *--------------------------------------------------------------------------------------------*/\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};\nimport * as aria from '../../../base/browser/ui/aria/aria.js';\nimport { Disposable, toDisposable, DisposableStore } from '../../../base/common/lifecycle.js';\nimport { ICodeEditorService } from '../../browser/services/codeEditorService.js';\nimport { CodeEditorWidget } from '../../browser/widget/codeEditor/codeEditorWidget.js';\nimport { InternalEditorAction } from '../../common/editorAction.js';\nimport { StandaloneKeybindingService, updateConfigurationService } from './standaloneServices.js';\nimport { IStandaloneThemeService } from '../common/standaloneTheme.js';\nimport { MenuId, MenuRegistry } from '../../../platform/actions/common/actions.js';\nimport { CommandsRegistry, ICommandService } from '../../../platform/commands/common/commands.js';\nimport { IConfigurationService } from '../../../platform/configuration/common/configuration.js';\nimport { ContextKeyExpr, IContextKeyService } from '../../../platform/contextkey/common/contextkey.js';\nimport { IContextMenuService } from '../../../platform/contextview/browser/contextView.js';\nimport { IInstantiationService } from '../../../platform/instantiation/common/instantiation.js';\nimport { IKeybindingService } from '../../../platform/keybinding/common/keybinding.js';\nimport { INotificationService } from '../../../platform/notification/common/notification.js';\nimport { IThemeService } from '../../../platform/theme/common/themeService.js';\nimport { IAccessibilityService } from '../../../platform/accessibility/common/accessibility.js';\nimport { StandaloneCodeEditorNLS } from '../../common/standaloneStrings.js';\nimport { IClipboardService } from '../../../platform/clipboard/common/clipboardService.js';\nimport { IEditorProgressService } from '../../../platform/progress/common/progress.js';\nimport { IModelService } from '../../common/services/model.js';\nimport { ILanguageService } from '../../common/languages/language.js';\nimport { StandaloneCodeEditorService } from './standaloneCodeEditorService.js';\nimport { PLAINTEXT_LANGUAGE_ID } from '../../common/languages/modesRegistry.js';\nimport { ILanguageConfigurationService } from '../../common/languages/languageConfigurationRegistry.js';\nimport { ILanguageFeaturesService } from '../../common/services/languageFeatures.js';\nimport { DiffEditorWidget } from '../../browser/widget/diffEditor/diffEditorWidget.js';\nimport { IAccessibilitySignalService } from '../../../platform/accessibilitySignal/browser/accessibilitySignalService.js';\nimport { mainWindow } from '../../../base/browser/window.js';\nimport { setHoverDelegateFactory } from '../../../base/browser/ui/hover/hoverDelegateFactory.js';\nimport { IHoverService, WorkbenchHoverDelegate } from '../../../platform/hover/browser/hover.js';\nimport { setBaseLayerHoverDelegate } from '../../../base/browser/ui/hover/hoverDelegate2.js';\nlet LAST_GENERATED_COMMAND_ID = 0;\nlet ariaDomNodeCreated = false;\n/**\n * Create ARIA dom node inside parent,\n * or only for the first editor instantiation inside document.body.\n * @param parent container element for ARIA dom node\n */\nfunction createAriaDomNode(parent) {\n if (!parent) {\n if (ariaDomNodeCreated) {\n return;\n }\n ariaDomNodeCreated = true;\n }\n aria.setARIAContainer(parent || mainWindow.document.body);\n}\n/**\n * A code editor to be used both by the standalone editor and the standalone diff editor.\n */\nlet StandaloneCodeEditor = class StandaloneCodeEditor extends CodeEditorWidget {\n constructor(domElement, _options, instantiationService, codeEditorService, commandService, contextKeyService, hoverService, keybindingService, themeService, notificationService, accessibilityService, languageConfigurationService, languageFeaturesService) {\n const options = { ..._options };\n options.ariaLabel = options.ariaLabel || StandaloneCodeEditorNLS.editorViewAccessibleLabel;\n options.ariaLabel = options.ariaLabel + ';' + (StandaloneCodeEditorNLS.accessibilityHelpMessage);\n super(domElement, options, {}, instantiationService, codeEditorService, commandService, contextKeyService, themeService, notificationService, accessibilityService, languageConfigurationService, languageFeaturesService);\n if (keybindingService instanceof StandaloneKeybindingService) {\n this._standaloneKeybindingService = keybindingService;\n }\n else {\n this._standaloneKeybindingService = null;\n }\n createAriaDomNode(options.ariaContainerElement);\n setHoverDelegateFactory((placement, enableInstantHover) => instantiationService.createInstance(WorkbenchHoverDelegate, placement, enableInstantHover, {}));\n setBaseLayerHoverDelegate(hoverService);\n }\n addCommand(keybinding, handler, context) {\n if (!this._standaloneKeybindingService) {\n console.warn('Cannot add command because the editor is configured with an unrecognized KeybindingService');\n return null;\n }\n const commandId = 'DYNAMIC_' + (++LAST_GENERATED_COMMAND_ID);\n const whenExpression = ContextKeyExpr.deserialize(context);\n this._standaloneKeybindingService.addDynamicKeybinding(commandId, keybinding, handler, whenExpression);\n return commandId;\n }\n createContextKey(key, defaultValue) {\n return this._contextKeyService.createKey(key, defaultValue);\n }\n addAction(_descriptor) {\n if ((typeof _descriptor.id !== 'string') || (typeof _descriptor.label !== 'string') || (typeof _descriptor.run !== 'function')) {\n throw new Error('Invalid action descriptor, `id`, `label` and `run` are required properties!');\n }\n if (!this._standaloneKeybindingService) {\n console.warn('Cannot add keybinding because the editor is configured with an unrecognized KeybindingService');\n return Disposable.None;\n }\n // Read descriptor options\n const id = _descriptor.id;\n const label = _descriptor.label;\n const precondition = ContextKeyExpr.and(ContextKeyExpr.equals('editorId', this.getId()), ContextKeyExpr.deserialize(_descriptor.precondition));\n const keybindings = _descriptor.keybindings;\n const keybindingsWhen = ContextKeyExpr.and(precondition, ContextKeyExpr.deserialize(_descriptor.keybindingContext));\n const contextMenuGroupId = _descriptor.contextMenuGroupId || null;\n const contextMenuOrder = _descriptor.contextMenuOrder || 0;\n const run = (_accessor, ...args) => {\n return Promise.resolve(_descriptor.run(this, ...args));\n };\n const toDispose = new DisposableStore();\n // Generate a unique id to allow the same descriptor.id across multiple editor instances\n const uniqueId = this.getId() + ':' + id;\n // Register the command\n toDispose.add(CommandsRegistry.registerCommand(uniqueId, run));\n // Register the context menu item\n if (contextMenuGroupId) {\n const menuItem = {\n command: {\n id: uniqueId,\n title: label\n },\n when: precondition,\n group: contextMenuGroupId,\n order: contextMenuOrder\n };\n toDispose.add(MenuRegistry.appendMenuItem(MenuId.EditorContext, menuItem));\n }\n // Register the keybindings\n if (Array.isArray(keybindings)) {\n for (const kb of keybindings) {\n toDispose.add(this._standaloneKeybindingService.addDynamicKeybinding(uniqueId, kb, run, keybindingsWhen));\n }\n }\n // Finally, register an internal editor action\n const internalAction = new InternalEditorAction(uniqueId, label, label, undefined, precondition, (...args) => Promise.resolve(_descriptor.run(this, ...args)), this._contextKeyService);\n // Store it under the original id, such that trigger with the original id will work\n this._actions.set(id, internalAction);\n toDispose.add(toDisposable(() => {\n this._actions.delete(id);\n }));\n return toDispose;\n }\n _triggerCommand(handlerId, payload) {\n if (this._codeEditorService instanceof StandaloneCodeEditorService) {\n // Help commands find this editor as the active editor\n try {\n this._codeEditorService.setActiveCodeEditor(this);\n super._triggerCommand(handlerId, payload);\n }\n finally {\n this._codeEditorService.setActiveCodeEditor(null);\n }\n }\n else {\n super._triggerCommand(handlerId, payload);\n }\n }\n};\nStandaloneCodeEditor = __decorate([\n __param(2, IInstantiationService),\n __param(3, ICodeEditorService),\n __param(4, ICommandService),\n __param(5, IContextKeyService),\n __param(6, IHoverService),\n __param(7, IKeybindingService),\n __param(8, IThemeService),\n __param(9, INotificationService),\n __param(10, IAccessibilityService),\n __param(11, ILanguageConfigurationService),\n __param(12, ILanguageFeaturesService)\n], StandaloneCodeEditor);\nexport { StandaloneCodeEditor };\nlet StandaloneEditor = class StandaloneEditor extends StandaloneCodeEditor {\n constructor(domElement, _options, instantiationService, codeEditorService, commandService, contextKeyService, hoverService, keybindingService, themeService, notificationService, configurationService, accessibilityService, modelService, languageService, languageConfigurationService, languageFeaturesService) {\n const options = { ..._options };\n updateConfigurationService(configurationService, options, false);\n const themeDomRegistration = themeService.registerEditorContainer(domElement);\n if (typeof options.theme === 'string') {\n themeService.setTheme(options.theme);\n }\n if (typeof options.autoDetectHighContrast !== 'undefined') {\n themeService.setAutoDetectHighContrast(Boolean(options.autoDetectHighContrast));\n }\n const _model = options.model;\n delete options.model;\n super(domElement, options, instantiationService, codeEditorService, commandService, contextKeyService, hoverService, keybindingService, themeService, notificationService, accessibilityService, languageConfigurationService, languageFeaturesService);\n this._configurationService = configurationService;\n this._standaloneThemeService = themeService;\n this._register(themeDomRegistration);\n let model;\n if (typeof _model === 'undefined') {\n const languageId = languageService.getLanguageIdByMimeType(options.language) || options.language || PLAINTEXT_LANGUAGE_ID;\n model = createTextModel(modelService, languageService, options.value || '', languageId, undefined);\n this._ownsModel = true;\n }\n else {\n model = _model;\n this._ownsModel = false;\n }\n this._attachModel(model);\n if (model) {\n const e = {\n oldModelUrl: null,\n newModelUrl: model.uri\n };\n this._onDidChangeModel.fire(e);\n }\n }\n dispose() {\n super.dispose();\n }\n updateOptions(newOptions) {\n updateConfigurationService(this._configurationService, newOptions, false);\n if (typeof newOptions.theme === 'string') {\n this._standaloneThemeService.setTheme(newOptions.theme);\n }\n if (typeof newOptions.autoDetectHighContrast !== 'undefined') {\n this._standaloneThemeService.setAutoDetectHighContrast(Boolean(newOptions.autoDetectHighContrast));\n }\n super.updateOptions(newOptions);\n }\n _postDetachModelCleanup(detachedModel) {\n super._postDetachModelCleanup(detachedModel);\n if (detachedModel && this._ownsModel) {\n detachedModel.dispose();\n this._ownsModel = false;\n }\n }\n};\nStandaloneEditor = __decorate([\n __param(2, IInstantiationService),\n __param(3, ICodeEditorService),\n __param(4, ICommandService),\n __param(5, IContextKeyService),\n __param(6, IHoverService),\n __param(7, IKeybindingService),\n __param(8, IStandaloneThemeService),\n __param(9, INotificationService),\n __param(10, IConfigurationService),\n __param(11, IAccessibilityService),\n __param(12, IModelService),\n __param(13, ILanguageService),\n __param(14, ILanguageConfigurationService),\n __param(15, ILanguageFeaturesService)\n], StandaloneEditor);\nexport { StandaloneEditor };\nlet StandaloneDiffEditor2 = class StandaloneDiffEditor2 extends DiffEditorWidget {\n constructor(domElement, _options, instantiationService, contextKeyService, codeEditorService, themeService, notificationService, configurationService, contextMenuService, editorProgressService, clipboardService, accessibilitySignalService) {\n const options = { ..._options };\n updateConfigurationService(configurationService, options, true);\n const themeDomRegistration = themeService.registerEditorContainer(domElement);\n if (typeof options.theme === 'string') {\n themeService.setTheme(options.theme);\n }\n if (typeof options.autoDetectHighContrast !== 'undefined') {\n themeService.setAutoDetectHighContrast(Boolean(options.autoDetectHighContrast));\n }\n super(domElement, options, {}, contextKeyService, instantiationService, codeEditorService, accessibilitySignalService, editorProgressService);\n this._configurationService = configurationService;\n this._standaloneThemeService = themeService;\n this._register(themeDomRegistration);\n }\n dispose() {\n super.dispose();\n }\n updateOptions(newOptions) {\n updateConfigurationService(this._configurationService, newOptions, true);\n if (typeof newOptions.theme === 'string') {\n this._standaloneThemeService.setTheme(newOptions.theme);\n }\n if (typeof newOptions.autoDetectHighContrast !== 'undefined') {\n this._standaloneThemeService.setAutoDetectHighContrast(Boolean(newOptions.autoDetectHighContrast));\n }\n super.updateOptions(newOptions);\n }\n _createInnerEditor(instantiationService, container, options) {\n return instantiationService.createInstance(StandaloneCodeEditor, container, options);\n }\n getOriginalEditor() {\n return super.getOriginalEditor();\n }\n getModifiedEditor() {\n return super.getModifiedEditor();\n }\n addCommand(keybinding, handler, context) {\n return this.getModifiedEditor().addCommand(keybinding, handler, context);\n }\n createContextKey(key, defaultValue) {\n return this.getModifiedEditor().createContextKey(key, defaultValue);\n }\n addAction(descriptor) {\n return this.getModifiedEditor().addAction(descriptor);\n }\n};\nStandaloneDiffEditor2 = __decorate([\n __param(2, IInstantiationService),\n __param(3, IContextKeyService),\n __param(4, ICodeEditorService),\n __param(5, IStandaloneThemeService),\n __param(6, INotificationService),\n __param(7, IConfigurationService),\n __param(8, IContextMenuService),\n __param(9, IEditorProgressService),\n __param(10, IClipboardService),\n __param(11, IAccessibilitySignalService)\n], StandaloneDiffEditor2);\nexport { StandaloneDiffEditor2 };\n/**\n * @internal\n */\nexport function createTextModel(modelService, languageService, value, languageId, uri) {\n value = value || '';\n if (!languageId) {\n const firstLF = value.indexOf('\\n');\n let firstLine = value;\n if (firstLF !== -1) {\n firstLine = value.substring(0, firstLF);\n }\n return doCreateModel(modelService, value, languageService.createByFilepathOrFirstLine(uri || null, firstLine), uri);\n }\n return doCreateModel(modelService, value, languageService.createById(languageId), uri);\n}\n/**\n * @internal\n */\nfunction doCreateModel(modelService, value, languageSelection, uri) {\n return modelService.createModel(value, languageSelection, 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 *--------------------------------------------------------------------------------------------*/\nimport * as dom from '../../dom.js';\nimport './aria.css';\n// Use a max length since we are inserting the whole msg in the DOM and that can cause browsers to freeze for long messages #94233\nconst MAX_MESSAGE_LENGTH = 20000;\nlet ariaContainer;\nlet alertContainer;\nlet alertContainer2;\nlet statusContainer;\nlet statusContainer2;\nexport function setARIAContainer(parent) {\n ariaContainer = document.createElement('div');\n ariaContainer.className = 'monaco-aria-container';\n const createAlertContainer = () => {\n const element = document.createElement('div');\n element.className = 'monaco-alert';\n element.setAttribute('role', 'alert');\n element.setAttribute('aria-atomic', 'true');\n ariaContainer.appendChild(element);\n return element;\n };\n alertContainer = createAlertContainer();\n alertContainer2 = createAlertContainer();\n const createStatusContainer = () => {\n const element = document.createElement('div');\n element.className = 'monaco-status';\n element.setAttribute('aria-live', 'polite');\n element.setAttribute('aria-atomic', 'true');\n ariaContainer.appendChild(element);\n return element;\n };\n statusContainer = createStatusContainer();\n statusContainer2 = createStatusContainer();\n parent.appendChild(ariaContainer);\n}\n/**\n * Given the provided message, will make sure that it is read as alert to screen readers.\n */\nexport function alert(msg) {\n if (!ariaContainer) {\n return;\n }\n // Use alternate containers such that duplicated messages get read out by screen readers #99466\n if (alertContainer.textContent !== msg) {\n dom.clearNode(alertContainer2);\n insertMessage(alertContainer, msg);\n }\n else {\n dom.clearNode(alertContainer);\n insertMessage(alertContainer2, msg);\n }\n}\n/**\n * Given the provided message, will make sure that it is read as status to screen readers.\n */\nexport function status(msg) {\n if (!ariaContainer) {\n return;\n }\n if (statusContainer.textContent !== msg) {\n dom.clearNode(statusContainer2);\n insertMessage(statusContainer, msg);\n }\n else {\n dom.clearNode(statusContainer);\n insertMessage(statusContainer2, msg);\n }\n}\nfunction insertMessage(target, msg) {\n dom.clearNode(target);\n if (msg.length > MAX_MESSAGE_LENGTH) {\n msg = msg.substr(0, MAX_MESSAGE_LENGTH);\n }\n target.textContent = msg;\n // See https://www.paciellogroup.com/blog/2012/06/html5-accessibility-chops-aria-rolealert-browser-support/\n target.style.visibility = 'hidden';\n target.style.visibility = 'visible';\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 *--------------------------------------------------------------------------------------------*/\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};\nvar CodeEditorWidget_1;\nimport '../../services/markerDecorations.js';\nimport * as dom from '../../../../base/browser/dom.js';\nimport { onUnexpectedError } from '../../../../base/common/errors.js';\nimport { Emitter, createEventDeliveryQueue } from '../../../../base/common/event.js';\nimport { Disposable, dispose } from '../../../../base/common/lifecycle.js';\nimport { Schemas } from '../../../../base/common/network.js';\nimport './editor.css';\nimport { applyFontInfo } from '../../config/domFontInfo.js';\nimport { EditorConfiguration } from '../../config/editorConfiguration.js';\nimport { TabFocus } from '../../config/tabFocus.js';\nimport { EditorExtensionsRegistry } from '../../editorExtensions.js';\nimport { ICodeEditorService } from '../../services/codeEditorService.js';\nimport { View } from '../../view.js';\nimport { DOMLineBreaksComputerFactory } from '../../view/domLineBreaksComputer.js';\nimport { ViewUserInputEvents } from '../../view/viewUserInputEvents.js';\nimport { CodeEditorContributions } from './codeEditorContributions.js';\nimport { filterValidationDecorations } from '../../../common/config/editorOptions.js';\nimport { CursorColumns } from '../../../common/core/cursorColumns.js';\nimport { editorUnnecessaryCodeOpacity } from '../../../common/core/editorColorRegistry.js';\nimport { Position } from '../../../common/core/position.js';\nimport { Range } from '../../../common/core/range.js';\nimport { Selection } from '../../../common/core/selection.js';\nimport { WordOperations } from '../../../common/cursor/cursorWordOperations.js';\nimport { InternalEditorAction } from '../../../common/editorAction.js';\nimport * as editorCommon from '../../../common/editorCommon.js';\nimport { EditorContextKeys } from '../../../common/editorContextKeys.js';\nimport { ILanguageConfigurationService } from '../../../common/languages/languageConfigurationRegistry.js';\nimport { ModelDecorationOptions } from '../../../common/model/textModel.js';\nimport { ILanguageFeaturesService } from '../../../common/services/languageFeatures.js';\nimport { MonospaceLineBreaksComputerFactory } from '../../../common/viewModel/monospaceLineBreaksComputer.js';\nimport { ViewModel } from '../../../common/viewModel/viewModelImpl.js';\nimport * as nls from '../../../../nls.js';\nimport { IAccessibilityService } from '../../../../platform/accessibility/common/accessibility.js';\nimport { ICommandService } from '../../../../platform/commands/common/commands.js';\nimport { IContextKeyService } from '../../../../platform/contextkey/common/contextkey.js';\nimport { IInstantiationService } from '../../../../platform/instantiation/common/instantiation.js';\nimport { ServiceCollection } from '../../../../platform/instantiation/common/serviceCollection.js';\nimport { INotificationService, Severity } from '../../../../platform/notification/common/notification.js';\nimport { editorErrorForeground, editorHintForeground, editorInfoForeground, editorWarningForeground } from '../../../../platform/theme/common/colorRegistry.js';\nimport { IThemeService, registerThemingParticipant } from '../../../../platform/theme/common/themeService.js';\nimport { MenuId } from '../../../../platform/actions/common/actions.js';\nlet CodeEditorWidget = CodeEditorWidget_1 = class CodeEditorWidget extends Disposable {\n //#endregion\n get isSimpleWidget() {\n return this._configuration.isSimpleWidget;\n }\n get contextMenuId() {\n return this._configuration.contextMenuId;\n }\n constructor(domElement, _options, codeEditorWidgetOptions, instantiationService, codeEditorService, commandService, contextKeyService, themeService, notificationService, accessibilityService, languageConfigurationService, languageFeaturesService) {\n var _a, _b;\n super();\n this.languageConfigurationService = languageConfigurationService;\n //#region Eventing\n this._deliveryQueue = createEventDeliveryQueue();\n this._contributions = this._register(new CodeEditorContributions());\n this._onDidDispose = this._register(new Emitter());\n this.onDidDispose = this._onDidDispose.event;\n this._onDidChangeModelContent = this._register(new Emitter({ deliveryQueue: this._deliveryQueue }));\n this.onDidChangeModelContent = this._onDidChangeModelContent.event;\n this._onDidChangeModelLanguage = this._register(new Emitter({ deliveryQueue: this._deliveryQueue }));\n this.onDidChangeModelLanguage = this._onDidChangeModelLanguage.event;\n this._onDidChangeModelLanguageConfiguration = this._register(new Emitter({ deliveryQueue: this._deliveryQueue }));\n this.onDidChangeModelLanguageConfiguration = this._onDidChangeModelLanguageConfiguration.event;\n this._onDidChangeModelOptions = this._register(new Emitter({ deliveryQueue: this._deliveryQueue }));\n this.onDidChangeModelOptions = this._onDidChangeModelOptions.event;\n this._onDidChangeModelDecorations = this._register(new Emitter({ deliveryQueue: this._deliveryQueue }));\n this.onDidChangeModelDecorations = this._onDidChangeModelDecorations.event;\n this._onDidChangeModelTokens = this._register(new Emitter({ deliveryQueue: this._deliveryQueue }));\n this.onDidChangeModelTokens = this._onDidChangeModelTokens.event;\n this._onDidChangeConfiguration = this._register(new Emitter({ deliveryQueue: this._deliveryQueue }));\n this.onDidChangeConfiguration = this._onDidChangeConfiguration.event;\n this._onWillChangeModel = this._register(new Emitter({ deliveryQueue: this._deliveryQueue }));\n this.onWillChangeModel = this._onWillChangeModel.event;\n this._onDidChangeModel = this._register(new Emitter({ deliveryQueue: this._deliveryQueue }));\n this.onDidChangeModel = this._onDidChangeModel.event;\n this._onDidChangeCursorPosition = this._register(new Emitter({ deliveryQueue: this._deliveryQueue }));\n this.onDidChangeCursorPosition = this._onDidChangeCursorPosition.event;\n this._onDidChangeCursorSelection = this._register(new Emitter({ deliveryQueue: this._deliveryQueue }));\n this.onDidChangeCursorSelection = this._onDidChangeCursorSelection.event;\n this._onDidAttemptReadOnlyEdit = this._register(new InteractionEmitter(this._contributions, this._deliveryQueue));\n this.onDidAttemptReadOnlyEdit = this._onDidAttemptReadOnlyEdit.event;\n this._onDidLayoutChange = this._register(new Emitter({ deliveryQueue: this._deliveryQueue }));\n this.onDidLayoutChange = this._onDidLayoutChange.event;\n this._editorTextFocus = this._register(new BooleanEventEmitter({ deliveryQueue: this._deliveryQueue }));\n this.onDidFocusEditorText = this._editorTextFocus.onDidChangeToTrue;\n this.onDidBlurEditorText = this._editorTextFocus.onDidChangeToFalse;\n this._editorWidgetFocus = this._register(new BooleanEventEmitter({ deliveryQueue: this._deliveryQueue }));\n this.onDidFocusEditorWidget = this._editorWidgetFocus.onDidChangeToTrue;\n this.onDidBlurEditorWidget = this._editorWidgetFocus.onDidChangeToFalse;\n this._onWillType = this._register(new InteractionEmitter(this._contributions, this._deliveryQueue));\n this.onWillType = this._onWillType.event;\n this._onDidType = this._register(new InteractionEmitter(this._contributions, this._deliveryQueue));\n this.onDidType = this._onDidType.event;\n this._onDidCompositionStart = this._register(new InteractionEmitter(this._contributions, this._deliveryQueue));\n this.onDidCompositionStart = this._onDidCompositionStart.event;\n this._onDidCompositionEnd = this._register(new InteractionEmitter(this._contributions, this._deliveryQueue));\n this.onDidCompositionEnd = this._onDidCompositionEnd.event;\n this._onDidPaste = this._register(new InteractionEmitter(this._contributions, this._deliveryQueue));\n this.onDidPaste = this._onDidPaste.event;\n this._onMouseUp = this._register(new InteractionEmitter(this._contributions, this._deliveryQueue));\n this.onMouseUp = this._onMouseUp.event;\n this._onMouseDown = this._register(new InteractionEmitter(this._contributions, this._deliveryQueue));\n this.onMouseDown = this._onMouseDown.event;\n this._onMouseDrag = this._register(new InteractionEmitter(this._contributions, this._deliveryQueue));\n this.onMouseDrag = this._onMouseDrag.event;\n this._onMouseDrop = this._register(new InteractionEmitter(this._contributions, this._deliveryQueue));\n this.onMouseDrop = this._onMouseDrop.event;\n this._onMouseDropCanceled = this._register(new InteractionEmitter(this._contributions, this._deliveryQueue));\n this.onMouseDropCanceled = this._onMouseDropCanceled.event;\n this._onDropIntoEditor = this._register(new InteractionEmitter(this._contributions, this._deliveryQueue));\n this.onDropIntoEditor = this._onDropIntoEditor.event;\n this._onContextMenu = this._register(new InteractionEmitter(this._contributions, this._deliveryQueue));\n this.onContextMenu = this._onContextMenu.event;\n this._onMouseMove = this._register(new InteractionEmitter(this._contributions, this._deliveryQueue));\n this.onMouseMove = this._onMouseMove.event;\n this._onMouseLeave = this._register(new InteractionEmitter(this._contributions, this._deliveryQueue));\n this.onMouseLeave = this._onMouseLeave.event;\n this._onMouseWheel = this._register(new InteractionEmitter(this._contributions, this._deliveryQueue));\n this.onMouseWheel = this._onMouseWheel.event;\n this._onKeyUp = this._register(new InteractionEmitter(this._contributions, this._deliveryQueue));\n this.onKeyUp = this._onKeyUp.event;\n this._onKeyDown = this._register(new InteractionEmitter(this._contributions, this._deliveryQueue));\n this.onKeyDown = this._onKeyDown.event;\n this._onDidContentSizeChange = this._register(new Emitter({ deliveryQueue: this._deliveryQueue }));\n this.onDidContentSizeChange = this._onDidContentSizeChange.event;\n this._onDidScrollChange = this._register(new Emitter({ deliveryQueue: this._deliveryQueue }));\n this.onDidScrollChange = this._onDidScrollChange.event;\n this._onDidChangeViewZones = this._register(new Emitter({ deliveryQueue: this._deliveryQueue }));\n this.onDidChangeViewZones = this._onDidChangeViewZones.event;\n this._onDidChangeHiddenAreas = this._register(new Emitter({ deliveryQueue: this._deliveryQueue }));\n this.onDidChangeHiddenAreas = this._onDidChangeHiddenAreas.event;\n this._actions = new Map();\n this._bannerDomNode = null;\n this._dropIntoEditorDecorations = this.createDecorationsCollection();\n codeEditorService.willCreateCodeEditor();\n const options = { ..._options };\n this._domElement = domElement;\n this._overflowWidgetsDomNode = options.overflowWidgetsDomNode;\n delete options.overflowWidgetsDomNode;\n this._id = (++EDITOR_ID);\n this._decorationTypeKeysToIds = {};\n this._decorationTypeSubtypes = {};\n this._telemetryData = codeEditorWidgetOptions.telemetryData;\n this._configuration = this._register(this._createConfiguration(codeEditorWidgetOptions.isSimpleWidget || false, (_a = codeEditorWidgetOptions.contextMenuId) !== null && _a !== void 0 ? _a : (codeEditorWidgetOptions.isSimpleWidget ? MenuId.SimpleEditorContext : MenuId.EditorContext), options, accessibilityService));\n this._register(this._configuration.onDidChange((e) => {\n this._onDidChangeConfiguration.fire(e);\n const options = this._configuration.options;\n if (e.hasChanged(145 /* EditorOption.layoutInfo */)) {\n const layoutInfo = options.get(145 /* EditorOption.layoutInfo */);\n this._onDidLayoutChange.fire(layoutInfo);\n }\n }));\n this._contextKeyService = this._register(contextKeyService.createScoped(this._domElement));\n this._notificationService = notificationService;\n this._codeEditorService = codeEditorService;\n this._commandService = commandService;\n this._themeService = themeService;\n this._register(new EditorContextKeysManager(this, this._contextKeyService));\n this._register(new EditorModeContext(this, this._contextKeyService, languageFeaturesService));\n this._instantiationService = instantiationService.createChild(new ServiceCollection([IContextKeyService, this._contextKeyService]));\n this._modelData = null;\n this._focusTracker = new CodeEditorWidgetFocusTracker(domElement, this._overflowWidgetsDomNode);\n this._register(this._focusTracker.onChange(() => {\n this._editorWidgetFocus.setValue(this._focusTracker.hasFocus());\n }));\n this._contentWidgets = {};\n this._overlayWidgets = {};\n this._glyphMarginWidgets = {};\n let contributions;\n if (Array.isArray(codeEditorWidgetOptions.contributions)) {\n contributions = codeEditorWidgetOptions.contributions;\n }\n else {\n contributions = EditorExtensionsRegistry.getEditorContributions();\n }\n this._contributions.initialize(this, contributions, this._instantiationService);\n for (const action of EditorExtensionsRegistry.getEditorActions()) {\n if (this._actions.has(action.id)) {\n onUnexpectedError(new Error(`Cannot have two actions with the same id ${action.id}`));\n continue;\n }\n const internalAction = new InternalEditorAction(action.id, action.label, action.alias, action.metadata, (_b = action.precondition) !== null && _b !== void 0 ? _b : undefined, (args) => {\n return this._instantiationService.invokeFunction((accessor) => {\n return Promise.resolve(action.runEditorCommand(accessor, this, args));\n });\n }, this._contextKeyService);\n this._actions.set(internalAction.id, internalAction);\n }\n const isDropIntoEnabled = () => {\n return !this._configuration.options.get(91 /* EditorOption.readOnly */)\n && this._configuration.options.get(36 /* EditorOption.dropIntoEditor */).enabled;\n };\n this._register(new dom.DragAndDropObserver(this._domElement, {\n onDragOver: e => {\n if (!isDropIntoEnabled()) {\n return;\n }\n const target = this.getTargetAtClientPoint(e.clientX, e.clientY);\n if (target === null || target === void 0 ? void 0 : target.position) {\n this.showDropIndicatorAt(target.position);\n }\n },\n onDrop: async (e) => {\n if (!isDropIntoEnabled()) {\n return;\n }\n this.removeDropIndicator();\n if (!e.dataTransfer) {\n return;\n }\n const target = this.getTargetAtClientPoint(e.clientX, e.clientY);\n if (target === null || target === void 0 ? void 0 : target.position) {\n this._onDropIntoEditor.fire({ position: target.position, event: e });\n }\n },\n onDragLeave: () => {\n this.removeDropIndicator();\n },\n onDragEnd: () => {\n this.removeDropIndicator();\n },\n }));\n this._codeEditorService.addCodeEditor(this);\n }\n writeScreenReaderContent(reason) {\n var _a;\n (_a = this._modelData) === null || _a === void 0 ? void 0 : _a.view.writeScreenReaderContent(reason);\n }\n _createConfiguration(isSimpleWidget, contextMenuId, options, accessibilityService) {\n return new EditorConfiguration(isSimpleWidget, contextMenuId, options, this._domElement, accessibilityService);\n }\n getId() {\n return this.getEditorType() + ':' + this._id;\n }\n getEditorType() {\n return editorCommon.EditorType.ICodeEditor;\n }\n dispose() {\n this._codeEditorService.removeCodeEditor(this);\n this._focusTracker.dispose();\n this._actions.clear();\n this._contentWidgets = {};\n this._overlayWidgets = {};\n this._removeDecorationTypes();\n this._postDetachModelCleanup(this._detachModel());\n this._onDidDispose.fire();\n super.dispose();\n }\n invokeWithinContext(fn) {\n return this._instantiationService.invokeFunction(fn);\n }\n updateOptions(newOptions) {\n this._configuration.updateOptions(newOptions || {});\n }\n getOptions() {\n return this._configuration.options;\n }\n getOption(id) {\n return this._configuration.options.get(id);\n }\n getRawOptions() {\n return this._configuration.getRawOptions();\n }\n getOverflowWidgetsDomNode() {\n return this._overflowWidgetsDomNode;\n }\n getConfiguredWordAtPosition(position) {\n if (!this._modelData) {\n return null;\n }\n return WordOperations.getWordAtPosition(this._modelData.model, this._configuration.options.get(131 /* EditorOption.wordSeparators */), this._configuration.options.get(130 /* EditorOption.wordSegmenterLocales */), position);\n }\n getValue(options = null) {\n if (!this._modelData) {\n return '';\n }\n const preserveBOM = (options && options.preserveBOM) ? true : false;\n let eolPreference = 0 /* EndOfLinePreference.TextDefined */;\n if (options && options.lineEnding && options.lineEnding === '\\n') {\n eolPreference = 1 /* EndOfLinePreference.LF */;\n }\n else if (options && options.lineEnding && options.lineEnding === '\\r\\n') {\n eolPreference = 2 /* EndOfLinePreference.CRLF */;\n }\n return this._modelData.model.getValue(eolPreference, preserveBOM);\n }\n setValue(newValue) {\n if (!this._modelData) {\n return;\n }\n this._modelData.model.setValue(newValue);\n }\n getModel() {\n if (!this._modelData) {\n return null;\n }\n return this._modelData.model;\n }\n setModel(_model = null) {\n var _a;\n const model = _model;\n if (this._modelData === null && model === null) {\n // Current model is the new model\n return;\n }\n if (this._modelData && this._modelData.model === model) {\n // Current model is the new model\n return;\n }\n const e = {\n oldModelUrl: ((_a = this._modelData) === null || _a === void 0 ? void 0 : _a.model.uri) || null,\n newModelUrl: (model === null || model === void 0 ? void 0 : model.uri) || null\n };\n this._onWillChangeModel.fire(e);\n const hasTextFocus = this.hasTextFocus();\n const detachedModel = this._detachModel();\n this._attachModel(model);\n if (hasTextFocus && this.hasModel()) {\n this.focus();\n }\n this._removeDecorationTypes();\n this._onDidChangeModel.fire(e);\n this._postDetachModelCleanup(detachedModel);\n this._contributionsDisposable = this._contributions.onAfterModelAttached();\n }\n _removeDecorationTypes() {\n this._decorationTypeKeysToIds = {};\n if (this._decorationTypeSubtypes) {\n for (const decorationType in this._decorationTypeSubtypes) {\n const subTypes = this._decorationTypeSubtypes[decorationType];\n for (const subType in subTypes) {\n this._removeDecorationType(decorationType + '-' + subType);\n }\n }\n this._decorationTypeSubtypes = {};\n }\n }\n getVisibleRanges() {\n if (!this._modelData) {\n return [];\n }\n return this._modelData.viewModel.getVisibleRanges();\n }\n getVisibleRangesPlusViewportAboveBelow() {\n if (!this._modelData) {\n return [];\n }\n return this._modelData.viewModel.getVisibleRangesPlusViewportAboveBelow();\n }\n getWhitespaces() {\n if (!this._modelData) {\n return [];\n }\n return this._modelData.viewModel.viewLayout.getWhitespaces();\n }\n static _getVerticalOffsetAfterPosition(modelData, modelLineNumber, modelColumn, includeViewZones) {\n const modelPosition = modelData.model.validatePosition({\n lineNumber: modelLineNumber,\n column: modelColumn\n });\n const viewPosition = modelData.viewModel.coordinatesConverter.convertModelPositionToViewPosition(modelPosition);\n return modelData.viewModel.viewLayout.getVerticalOffsetAfterLineNumber(viewPosition.lineNumber, includeViewZones);\n }\n getTopForLineNumber(lineNumber, includeViewZones = false) {\n if (!this._modelData) {\n return -1;\n }\n return CodeEditorWidget_1._getVerticalOffsetForPosition(this._modelData, lineNumber, 1, includeViewZones);\n }\n getTopForPosition(lineNumber, column) {\n if (!this._modelData) {\n return -1;\n }\n return CodeEditorWidget_1._getVerticalOffsetForPosition(this._modelData, lineNumber, column, false);\n }\n static _getVerticalOffsetForPosition(modelData, modelLineNumber, modelColumn, includeViewZones = false) {\n const modelPosition = modelData.model.validatePosition({\n lineNumber: modelLineNumber,\n column: modelColumn\n });\n const viewPosition = modelData.viewModel.coordinatesConverter.convertModelPositionToViewPosition(modelPosition);\n return modelData.viewModel.viewLayout.getVerticalOffsetForLineNumber(viewPosition.lineNumber, includeViewZones);\n }\n getBottomForLineNumber(lineNumber, includeViewZones = false) {\n if (!this._modelData) {\n return -1;\n }\n return CodeEditorWidget_1._getVerticalOffsetAfterPosition(this._modelData, lineNumber, 1, includeViewZones);\n }\n setHiddenAreas(ranges, source) {\n var _a;\n (_a = this._modelData) === null || _a === void 0 ? void 0 : _a.viewModel.setHiddenAreas(ranges.map(r => Range.lift(r)), source);\n }\n getVisibleColumnFromPosition(rawPosition) {\n if (!this._modelData) {\n return rawPosition.column;\n }\n const position = this._modelData.model.validatePosition(rawPosition);\n const tabSize = this._modelData.model.getOptions().tabSize;\n return CursorColumns.visibleColumnFromColumn(this._modelData.model.getLineContent(position.lineNumber), position.column, tabSize) + 1;\n }\n getPosition() {\n if (!this._modelData) {\n return null;\n }\n return this._modelData.viewModel.getPosition();\n }\n setPosition(position, source = 'api') {\n if (!this._modelData) {\n return;\n }\n if (!Position.isIPosition(position)) {\n throw new Error('Invalid arguments');\n }\n this._modelData.viewModel.setSelections(source, [{\n selectionStartLineNumber: position.lineNumber,\n selectionStartColumn: position.column,\n positionLineNumber: position.lineNumber,\n positionColumn: position.column\n }]);\n }\n _sendRevealRange(modelRange, verticalType, revealHorizontal, scrollType) {\n if (!this._modelData) {\n return;\n }\n if (!Range.isIRange(modelRange)) {\n throw new Error('Invalid arguments');\n }\n const validatedModelRange = this._modelData.model.validateRange(modelRange);\n const viewRange = this._modelData.viewModel.coordinatesConverter.convertModelRangeToViewRange(validatedModelRange);\n this._modelData.viewModel.revealRange('api', revealHorizontal, viewRange, verticalType, scrollType);\n }\n revealLine(lineNumber, scrollType = 0 /* editorCommon.ScrollType.Smooth */) {\n this._revealLine(lineNumber, 0 /* VerticalRevealType.Simple */, scrollType);\n }\n revealLineInCenter(lineNumber, scrollType = 0 /* editorCommon.ScrollType.Smooth */) {\n this._revealLine(lineNumber, 1 /* VerticalRevealType.Center */, scrollType);\n }\n revealLineInCenterIfOutsideViewport(lineNumber, scrollType = 0 /* editorCommon.ScrollType.Smooth */) {\n this._revealLine(lineNumber, 2 /* VerticalRevealType.CenterIfOutsideViewport */, scrollType);\n }\n revealLineNearTop(lineNumber, scrollType = 0 /* editorCommon.ScrollType.Smooth */) {\n this._revealLine(lineNumber, 5 /* VerticalRevealType.NearTop */, scrollType);\n }\n _revealLine(lineNumber, revealType, scrollType) {\n if (typeof lineNumber !== 'number') {\n throw new Error('Invalid arguments');\n }\n this._sendRevealRange(new Range(lineNumber, 1, lineNumber, 1), revealType, false, scrollType);\n }\n revealPosition(position, scrollType = 0 /* editorCommon.ScrollType.Smooth */) {\n this._revealPosition(position, 0 /* VerticalRevealType.Simple */, true, scrollType);\n }\n revealPositionInCenter(position, scrollType = 0 /* editorCommon.ScrollType.Smooth */) {\n this._revealPosition(position, 1 /* VerticalRevealType.Center */, true, scrollType);\n }\n revealPositionInCenterIfOutsideViewport(position, scrollType = 0 /* editorCommon.ScrollType.Smooth */) {\n this._revealPosition(position, 2 /* VerticalRevealType.CenterIfOutsideViewport */, true, scrollType);\n }\n revealPositionNearTop(position, scrollType = 0 /* editorCommon.ScrollType.Smooth */) {\n this._revealPosition(position, 5 /* VerticalRevealType.NearTop */, true, scrollType);\n }\n _revealPosition(position, verticalType, revealHorizontal, scrollType) {\n if (!Position.isIPosition(position)) {\n throw new Error('Invalid arguments');\n }\n this._sendRevealRange(new Range(position.lineNumber, position.column, position.lineNumber, position.column), verticalType, revealHorizontal, scrollType);\n }\n getSelection() {\n if (!this._modelData) {\n return null;\n }\n return this._modelData.viewModel.getSelection();\n }\n getSelections() {\n if (!this._modelData) {\n return null;\n }\n return this._modelData.viewModel.getSelections();\n }\n setSelection(something, source = 'api') {\n const isSelection = Selection.isISelection(something);\n const isRange = Range.isIRange(something);\n if (!isSelection && !isRange) {\n throw new Error('Invalid arguments');\n }\n if (isSelection) {\n this._setSelectionImpl(something, source);\n }\n else if (isRange) {\n // act as if it was an IRange\n const selection = {\n selectionStartLineNumber: something.startLineNumber,\n selectionStartColumn: something.startColumn,\n positionLineNumber: something.endLineNumber,\n positionColumn: something.endColumn\n };\n this._setSelectionImpl(selection, source);\n }\n }\n _setSelectionImpl(sel, source) {\n if (!this._modelData) {\n return;\n }\n const selection = new Selection(sel.selectionStartLineNumber, sel.selectionStartColumn, sel.positionLineNumber, sel.positionColumn);\n this._modelData.viewModel.setSelections(source, [selection]);\n }\n revealLines(startLineNumber, endLineNumber, scrollType = 0 /* editorCommon.ScrollType.Smooth */) {\n this._revealLines(startLineNumber, endLineNumber, 0 /* VerticalRevealType.Simple */, scrollType);\n }\n revealLinesInCenter(startLineNumber, endLineNumber, scrollType = 0 /* editorCommon.ScrollType.Smooth */) {\n this._revealLines(startLineNumber, endLineNumber, 1 /* VerticalRevealType.Center */, scrollType);\n }\n revealLinesInCenterIfOutsideViewport(startLineNumber, endLineNumber, scrollType = 0 /* editorCommon.ScrollType.Smooth */) {\n this._revealLines(startLineNumber, endLineNumber, 2 /* VerticalRevealType.CenterIfOutsideViewport */, scrollType);\n }\n revealLinesNearTop(startLineNumber, endLineNumber, scrollType = 0 /* editorCommon.ScrollType.Smooth */) {\n this._revealLines(startLineNumber, endLineNumber, 5 /* VerticalRevealType.NearTop */, scrollType);\n }\n _revealLines(startLineNumber, endLineNumber, verticalType, scrollType) {\n if (typeof startLineNumber !== 'number' || typeof endLineNumber !== 'number') {\n throw new Error('Invalid arguments');\n }\n this._sendRevealRange(new Range(startLineNumber, 1, endLineNumber, 1), verticalType, false, scrollType);\n }\n revealRange(range, scrollType = 0 /* editorCommon.ScrollType.Smooth */, revealVerticalInCenter = false, revealHorizontal = true) {\n this._revealRange(range, revealVerticalInCenter ? 1 /* VerticalRevealType.Center */ : 0 /* VerticalRevealType.Simple */, revealHorizontal, scrollType);\n }\n revealRangeInCenter(range, scrollType = 0 /* editorCommon.ScrollType.Smooth */) {\n this._revealRange(range, 1 /* VerticalRevealType.Center */, true, scrollType);\n }\n revealRangeInCenterIfOutsideViewport(range, scrollType = 0 /* editorCommon.ScrollType.Smooth */) {\n this._revealRange(range, 2 /* VerticalRevealType.CenterIfOutsideViewport */, true, scrollType);\n }\n revealRangeNearTop(range, scrollType = 0 /* editorCommon.ScrollType.Smooth */) {\n this._revealRange(range, 5 /* VerticalRevealType.NearTop */, true, scrollType);\n }\n revealRangeNearTopIfOutsideViewport(range, scrollType = 0 /* editorCommon.ScrollType.Smooth */) {\n this._revealRange(range, 6 /* VerticalRevealType.NearTopIfOutsideViewport */, true, scrollType);\n }\n revealRangeAtTop(range, scrollType = 0 /* editorCommon.ScrollType.Smooth */) {\n this._revealRange(range, 3 /* VerticalRevealType.Top */, true, scrollType);\n }\n _revealRange(range, verticalType, revealHorizontal, scrollType) {\n if (!Range.isIRange(range)) {\n throw new Error('Invalid arguments');\n }\n this._sendRevealRange(Range.lift(range), verticalType, revealHorizontal, scrollType);\n }\n setSelections(ranges, source = 'api', reason = 0 /* CursorChangeReason.NotSet */) {\n if (!this._modelData) {\n return;\n }\n if (!ranges || ranges.length === 0) {\n throw new Error('Invalid arguments');\n }\n for (let i = 0, len = ranges.length; i < len; i++) {\n if (!Selection.isISelection(ranges[i])) {\n throw new Error('Invalid arguments');\n }\n }\n this._modelData.viewModel.setSelections(source, ranges, reason);\n }\n getContentWidth() {\n if (!this._modelData) {\n return -1;\n }\n return this._modelData.viewModel.viewLayout.getContentWidth();\n }\n getScrollWidth() {\n if (!this._modelData) {\n return -1;\n }\n return this._modelData.viewModel.viewLayout.getScrollWidth();\n }\n getScrollLeft() {\n if (!this._modelData) {\n return -1;\n }\n return this._modelData.viewModel.viewLayout.getCurrentScrollLeft();\n }\n getContentHeight() {\n if (!this._modelData) {\n return -1;\n }\n return this._modelData.viewModel.viewLayout.getContentHeight();\n }\n getScrollHeight() {\n if (!this._modelData) {\n return -1;\n }\n return this._modelData.viewModel.viewLayout.getScrollHeight();\n }\n getScrollTop() {\n if (!this._modelData) {\n return -1;\n }\n return this._modelData.viewModel.viewLayout.getCurrentScrollTop();\n }\n setScrollLeft(newScrollLeft, scrollType = 1 /* editorCommon.ScrollType.Immediate */) {\n if (!this._modelData) {\n return;\n }\n if (typeof newScrollLeft !== 'number') {\n throw new Error('Invalid arguments');\n }\n this._modelData.viewModel.viewLayout.setScrollPosition({\n scrollLeft: newScrollLeft\n }, scrollType);\n }\n setScrollTop(newScrollTop, scrollType = 1 /* editorCommon.ScrollType.Immediate */) {\n if (!this._modelData) {\n return;\n }\n if (typeof newScrollTop !== 'number') {\n throw new Error('Invalid arguments');\n }\n this._modelData.viewModel.viewLayout.setScrollPosition({\n scrollTop: newScrollTop\n }, scrollType);\n }\n setScrollPosition(position, scrollType = 1 /* editorCommon.ScrollType.Immediate */) {\n if (!this._modelData) {\n return;\n }\n this._modelData.viewModel.viewLayout.setScrollPosition(position, scrollType);\n }\n hasPendingScrollAnimation() {\n if (!this._modelData) {\n return false;\n }\n return this._modelData.viewModel.viewLayout.hasPendingScrollAnimation();\n }\n saveViewState() {\n if (!this._modelData) {\n return null;\n }\n const contributionsState = this._contributions.saveViewState();\n const cursorState = this._modelData.viewModel.saveCursorState();\n const viewState = this._modelData.viewModel.saveState();\n return {\n cursorState: cursorState,\n viewState: viewState,\n contributionsState: contributionsState\n };\n }\n restoreViewState(s) {\n if (!this._modelData || !this._modelData.hasRealView) {\n return;\n }\n const codeEditorState = s;\n if (codeEditorState && codeEditorState.cursorState && codeEditorState.viewState) {\n const cursorState = codeEditorState.cursorState;\n if (Array.isArray(cursorState)) {\n if (cursorState.length > 0) {\n this._modelData.viewModel.restoreCursorState(cursorState);\n }\n }\n else {\n // Backwards compatibility\n this._modelData.viewModel.restoreCursorState([cursorState]);\n }\n this._contributions.restoreViewState(codeEditorState.contributionsState || {});\n const reducedState = this._modelData.viewModel.reduceRestoreState(codeEditorState.viewState);\n this._modelData.view.restoreState(reducedState);\n }\n }\n handleInitialized() {\n var _a;\n (_a = this._getViewModel()) === null || _a === void 0 ? void 0 : _a.visibleLinesStabilized();\n }\n getContribution(id) {\n return this._contributions.get(id);\n }\n getActions() {\n return Array.from(this._actions.values());\n }\n getSupportedActions() {\n let result = this.getActions();\n result = result.filter(action => action.isSupported());\n return result;\n }\n getAction(id) {\n return this._actions.get(id) || null;\n }\n trigger(source, handlerId, payload) {\n payload = payload || {};\n switch (handlerId) {\n case \"compositionStart\" /* editorCommon.Handler.CompositionStart */:\n this._startComposition();\n return;\n case \"compositionEnd\" /* editorCommon.Handler.CompositionEnd */:\n this._endComposition(source);\n return;\n case \"type\" /* editorCommon.Handler.Type */: {\n const args = payload;\n this._type(source, args.text || '');\n return;\n }\n case \"replacePreviousChar\" /* editorCommon.Handler.ReplacePreviousChar */: {\n const args = payload;\n this._compositionType(source, args.text || '', args.replaceCharCnt || 0, 0, 0);\n return;\n }\n case \"compositionType\" /* editorCommon.Handler.CompositionType */: {\n const args = payload;\n this._compositionType(source, args.text || '', args.replacePrevCharCnt || 0, args.replaceNextCharCnt || 0, args.positionDelta || 0);\n return;\n }\n case \"paste\" /* editorCommon.Handler.Paste */: {\n const args = payload;\n this._paste(source, args.text || '', args.pasteOnNewLine || false, args.multicursorText || null, args.mode || null, args.clipboardEvent);\n return;\n }\n case \"cut\" /* editorCommon.Handler.Cut */:\n this._cut(source);\n return;\n }\n const action = this.getAction(handlerId);\n if (action) {\n Promise.resolve(action.run(payload)).then(undefined, onUnexpectedError);\n return;\n }\n if (!this._modelData) {\n return;\n }\n if (this._triggerEditorCommand(source, handlerId, payload)) {\n return;\n }\n this._triggerCommand(handlerId, payload);\n }\n _triggerCommand(handlerId, payload) {\n this._commandService.executeCommand(handlerId, payload);\n }\n _startComposition() {\n if (!this._modelData) {\n return;\n }\n this._modelData.viewModel.startComposition();\n this._onDidCompositionStart.fire();\n }\n _endComposition(source) {\n if (!this._modelData) {\n return;\n }\n this._modelData.viewModel.endComposition(source);\n this._onDidCompositionEnd.fire();\n }\n _type(source, text) {\n if (!this._modelData || text.length === 0) {\n return;\n }\n if (source === 'keyboard') {\n this._onWillType.fire(text);\n }\n this._modelData.viewModel.type(text, source);\n if (source === 'keyboard') {\n this._onDidType.fire(text);\n }\n }\n _compositionType(source, text, replacePrevCharCnt, replaceNextCharCnt, positionDelta) {\n if (!this._modelData) {\n return;\n }\n this._modelData.viewModel.compositionType(text, replacePrevCharCnt, replaceNextCharCnt, positionDelta, source);\n }\n _paste(source, text, pasteOnNewLine, multicursorText, mode, clipboardEvent) {\n if (!this._modelData) {\n return;\n }\n const viewModel = this._modelData.viewModel;\n const startPosition = viewModel.getSelection().getStartPosition();\n viewModel.paste(text, pasteOnNewLine, multicursorText, source);\n const endPosition = viewModel.getSelection().getStartPosition();\n if (source === 'keyboard') {\n this._onDidPaste.fire({\n clipboardEvent,\n range: new Range(startPosition.lineNumber, startPosition.column, endPosition.lineNumber, endPosition.column),\n languageId: mode\n });\n }\n }\n _cut(source) {\n if (!this._modelData) {\n return;\n }\n this._modelData.viewModel.cut(source);\n }\n _triggerEditorCommand(source, handlerId, payload) {\n const command = EditorExtensionsRegistry.getEditorCommand(handlerId);\n if (command) {\n payload = payload || {};\n payload.source = source;\n this._instantiationService.invokeFunction((accessor) => {\n Promise.resolve(command.runEditorCommand(accessor, this, payload)).then(undefined, onUnexpectedError);\n });\n return true;\n }\n return false;\n }\n _getViewModel() {\n if (!this._modelData) {\n return null;\n }\n return this._modelData.viewModel;\n }\n pushUndoStop() {\n if (!this._modelData) {\n return false;\n }\n if (this._configuration.options.get(91 /* EditorOption.readOnly */)) {\n // read only editor => sorry!\n return false;\n }\n this._modelData.model.pushStackElement();\n return true;\n }\n popUndoStop() {\n if (!this._modelData) {\n return false;\n }\n if (this._configuration.options.get(91 /* EditorOption.readOnly */)) {\n // read only editor => sorry!\n return false;\n }\n this._modelData.model.popStackElement();\n return true;\n }\n executeEdits(source, edits, endCursorState) {\n if (!this._modelData) {\n return false;\n }\n if (this._configuration.options.get(91 /* EditorOption.readOnly */)) {\n // read only editor => sorry!\n return false;\n }\n let cursorStateComputer;\n if (!endCursorState) {\n cursorStateComputer = () => null;\n }\n else if (Array.isArray(endCursorState)) {\n cursorStateComputer = () => endCursorState;\n }\n else {\n cursorStateComputer = endCursorState;\n }\n this._modelData.viewModel.executeEdits(source, edits, cursorStateComputer);\n return true;\n }\n executeCommand(source, command) {\n if (!this._modelData) {\n return;\n }\n this._modelData.viewModel.executeCommand(command, source);\n }\n executeCommands(source, commands) {\n if (!this._modelData) {\n return;\n }\n this._modelData.viewModel.executeCommands(commands, source);\n }\n createDecorationsCollection(decorations) {\n return new EditorDecorationsCollection(this, decorations);\n }\n changeDecorations(callback) {\n if (!this._modelData) {\n // callback will not be called\n return null;\n }\n return this._modelData.model.changeDecorations(callback, this._id);\n }\n getLineDecorations(lineNumber) {\n if (!this._modelData) {\n return null;\n }\n return this._modelData.model.getLineDecorations(lineNumber, this._id, filterValidationDecorations(this._configuration.options));\n }\n getDecorationsInRange(range) {\n if (!this._modelData) {\n return null;\n }\n return this._modelData.model.getDecorationsInRange(range, this._id, filterValidationDecorations(this._configuration.options));\n }\n /**\n * @deprecated\n */\n deltaDecorations(oldDecorations, newDecorations) {\n if (!this._modelData) {\n return [];\n }\n if (oldDecorations.length === 0 && newDecorations.length === 0) {\n return oldDecorations;\n }\n return this._modelData.model.deltaDecorations(oldDecorations, newDecorations, this._id);\n }\n removeDecorations(decorationIds) {\n if (!this._modelData || decorationIds.length === 0) {\n return;\n }\n this._modelData.model.changeDecorations((changeAccessor) => {\n changeAccessor.deltaDecorations(decorationIds, []);\n });\n }\n removeDecorationsByType(decorationTypeKey) {\n // remove decorations for type and sub type\n const oldDecorationsIds = this._decorationTypeKeysToIds[decorationTypeKey];\n if (oldDecorationsIds) {\n this.changeDecorations(accessor => accessor.deltaDecorations(oldDecorationsIds, []));\n }\n if (this._decorationTypeKeysToIds.hasOwnProperty(decorationTypeKey)) {\n delete this._decorationTypeKeysToIds[decorationTypeKey];\n }\n if (this._decorationTypeSubtypes.hasOwnProperty(decorationTypeKey)) {\n delete this._decorationTypeSubtypes[decorationTypeKey];\n }\n }\n getLayoutInfo() {\n const options = this._configuration.options;\n const layoutInfo = options.get(145 /* EditorOption.layoutInfo */);\n return layoutInfo;\n }\n createOverviewRuler(cssClassName) {\n if (!this._modelData || !this._modelData.hasRealView) {\n return null;\n }\n return this._modelData.view.createOverviewRuler(cssClassName);\n }\n getContainerDomNode() {\n return this._domElement;\n }\n getDomNode() {\n if (!this._modelData || !this._modelData.hasRealView) {\n return null;\n }\n return this._modelData.view.domNode.domNode;\n }\n delegateVerticalScrollbarPointerDown(browserEvent) {\n if (!this._modelData || !this._modelData.hasRealView) {\n return;\n }\n this._modelData.view.delegateVerticalScrollbarPointerDown(browserEvent);\n }\n delegateScrollFromMouseWheelEvent(browserEvent) {\n if (!this._modelData || !this._modelData.hasRealView) {\n return;\n }\n this._modelData.view.delegateScrollFromMouseWheelEvent(browserEvent);\n }\n layout(dimension, postponeRendering = false) {\n this._configuration.observeContainer(dimension);\n if (!postponeRendering) {\n this.render();\n }\n }\n focus() {\n if (!this._modelData || !this._modelData.hasRealView) {\n return;\n }\n this._modelData.view.focus();\n }\n hasTextFocus() {\n if (!this._modelData || !this._modelData.hasRealView) {\n return false;\n }\n return this._modelData.view.isFocused();\n }\n hasWidgetFocus() {\n return this._focusTracker && this._focusTracker.hasFocus();\n }\n addContentWidget(widget) {\n const widgetData = {\n widget: widget,\n position: widget.getPosition()\n };\n if (this._contentWidgets.hasOwnProperty(widget.getId())) {\n console.warn('Overwriting a content widget with the same id:' + widget.getId());\n }\n this._contentWidgets[widget.getId()] = widgetData;\n if (this._modelData && this._modelData.hasRealView) {\n this._modelData.view.addContentWidget(widgetData);\n }\n }\n layoutContentWidget(widget) {\n const widgetId = widget.getId();\n if (this._contentWidgets.hasOwnProperty(widgetId)) {\n const widgetData = this._contentWidgets[widgetId];\n widgetData.position = widget.getPosition();\n if (this._modelData && this._modelData.hasRealView) {\n this._modelData.view.layoutContentWidget(widgetData);\n }\n }\n }\n removeContentWidget(widget) {\n const widgetId = widget.getId();\n if (this._contentWidgets.hasOwnProperty(widgetId)) {\n const widgetData = this._contentWidgets[widgetId];\n delete this._contentWidgets[widgetId];\n if (this._modelData && this._modelData.hasRealView) {\n this._modelData.view.removeContentWidget(widgetData);\n }\n }\n }\n addOverlayWidget(widget) {\n const widgetData = {\n widget: widget,\n position: widget.getPosition()\n };\n if (this._overlayWidgets.hasOwnProperty(widget.getId())) {\n console.warn('Overwriting an overlay widget with the same id.');\n }\n this._overlayWidgets[widget.getId()] = widgetData;\n if (this._modelData && this._modelData.hasRealView) {\n this._modelData.view.addOverlayWidget(widgetData);\n }\n }\n layoutOverlayWidget(widget) {\n const widgetId = widget.getId();\n if (this._overlayWidgets.hasOwnProperty(widgetId)) {\n const widgetData = this._overlayWidgets[widgetId];\n widgetData.position = widget.getPosition();\n if (this._modelData && this._modelData.hasRealView) {\n this._modelData.view.layoutOverlayWidget(widgetData);\n }\n }\n }\n removeOverlayWidget(widget) {\n const widgetId = widget.getId();\n if (this._overlayWidgets.hasOwnProperty(widgetId)) {\n const widgetData = this._overlayWidgets[widgetId];\n delete this._overlayWidgets[widgetId];\n if (this._modelData && this._modelData.hasRealView) {\n this._modelData.view.removeOverlayWidget(widgetData);\n }\n }\n }\n addGlyphMarginWidget(widget) {\n const widgetData = {\n widget: widget,\n position: widget.getPosition()\n };\n if (this._glyphMarginWidgets.hasOwnProperty(widget.getId())) {\n console.warn('Overwriting a glyph margin widget with the same id.');\n }\n this._glyphMarginWidgets[widget.getId()] = widgetData;\n if (this._modelData && this._modelData.hasRealView) {\n this._modelData.view.addGlyphMarginWidget(widgetData);\n }\n }\n layoutGlyphMarginWidget(widget) {\n const widgetId = widget.getId();\n if (this._glyphMarginWidgets.hasOwnProperty(widgetId)) {\n const widgetData = this._glyphMarginWidgets[widgetId];\n widgetData.position = widget.getPosition();\n if (this._modelData && this._modelData.hasRealView) {\n this._modelData.view.layoutGlyphMarginWidget(widgetData);\n }\n }\n }\n removeGlyphMarginWidget(widget) {\n const widgetId = widget.getId();\n if (this._glyphMarginWidgets.hasOwnProperty(widgetId)) {\n const widgetData = this._glyphMarginWidgets[widgetId];\n delete this._glyphMarginWidgets[widgetId];\n if (this._modelData && this._modelData.hasRealView) {\n this._modelData.view.removeGlyphMarginWidget(widgetData);\n }\n }\n }\n changeViewZones(callback) {\n if (!this._modelData || !this._modelData.hasRealView) {\n return;\n }\n this._modelData.view.change(callback);\n }\n getTargetAtClientPoint(clientX, clientY) {\n if (!this._modelData || !this._modelData.hasRealView) {\n return null;\n }\n return this._modelData.view.getTargetAtClientPoint(clientX, clientY);\n }\n getScrolledVisiblePosition(rawPosition) {\n if (!this._modelData || !this._modelData.hasRealView) {\n return null;\n }\n const position = this._modelData.model.validatePosition(rawPosition);\n const options = this._configuration.options;\n const layoutInfo = options.get(145 /* EditorOption.layoutInfo */);\n const top = CodeEditorWidget_1._getVerticalOffsetForPosition(this._modelData, position.lineNumber, position.column) - this.getScrollTop();\n const left = this._modelData.view.getOffsetForColumn(position.lineNumber, position.column) + layoutInfo.glyphMarginWidth + layoutInfo.lineNumbersWidth + layoutInfo.decorationsWidth - this.getScrollLeft();\n return {\n top: top,\n left: left,\n height: options.get(67 /* EditorOption.lineHeight */)\n };\n }\n getOffsetForColumn(lineNumber, column) {\n if (!this._modelData || !this._modelData.hasRealView) {\n return -1;\n }\n return this._modelData.view.getOffsetForColumn(lineNumber, column);\n }\n render(forceRedraw = false) {\n if (!this._modelData || !this._modelData.hasRealView) {\n return;\n }\n this._modelData.viewModel.batchEvents(() => {\n this._modelData.view.render(true, forceRedraw);\n });\n }\n setAriaOptions(options) {\n if (!this._modelData || !this._modelData.hasRealView) {\n return;\n }\n this._modelData.view.setAriaOptions(options);\n }\n applyFontInfo(target) {\n applyFontInfo(target, this._configuration.options.get(50 /* EditorOption.fontInfo */));\n }\n setBanner(domNode, domNodeHeight) {\n if (this._bannerDomNode && this._domElement.contains(this._bannerDomNode)) {\n this._domElement.removeChild(this._bannerDomNode);\n }\n this._bannerDomNode = domNode;\n this._configuration.setReservedHeight(domNode ? domNodeHeight : 0);\n if (this._bannerDomNode) {\n this._domElement.prepend(this._bannerDomNode);\n }\n }\n _attachModel(model) {\n if (!model) {\n this._modelData = null;\n return;\n }\n const listenersToRemove = [];\n this._domElement.setAttribute('data-mode-id', model.getLanguageId());\n this._configuration.setIsDominatedByLongLines(model.isDominatedByLongLines());\n this._configuration.setModelLineCount(model.getLineCount());\n const attachedView = model.onBeforeAttached();\n const viewModel = new ViewModel(this._id, this._configuration, model, DOMLineBreaksComputerFactory.create(dom.getWindow(this._domElement)), MonospaceLineBreaksComputerFactory.create(this._configuration.options), (callback) => dom.scheduleAtNextAnimationFrame(dom.getWindow(this._domElement), callback), this.languageConfigurationService, this._themeService, attachedView);\n // Someone might destroy the model from under the editor, so prevent any exceptions by setting a null model\n listenersToRemove.push(model.onWillDispose(() => this.setModel(null)));\n listenersToRemove.push(viewModel.onEvent((e) => {\n switch (e.kind) {\n case 0 /* OutgoingViewModelEventKind.ContentSizeChanged */:\n this._onDidContentSizeChange.fire(e);\n break;\n case 1 /* OutgoingViewModelEventKind.FocusChanged */:\n this._editorTextFocus.setValue(e.hasFocus);\n break;\n case 2 /* OutgoingViewModelEventKind.ScrollChanged */:\n this._onDidScrollChange.fire(e);\n break;\n case 3 /* OutgoingViewModelEventKind.ViewZonesChanged */:\n this._onDidChangeViewZones.fire();\n break;\n case 4 /* OutgoingViewModelEventKind.HiddenAreasChanged */:\n this._onDidChangeHiddenAreas.fire();\n break;\n case 5 /* OutgoingViewModelEventKind.ReadOnlyEditAttempt */:\n this._onDidAttemptReadOnlyEdit.fire();\n break;\n case 6 /* OutgoingViewModelEventKind.CursorStateChanged */: {\n if (e.reachedMaxCursorCount) {\n const multiCursorLimit = this.getOption(80 /* EditorOption.multiCursorLimit */);\n const message = nls.localize('cursors.maximum', \"The number of cursors has been limited to {0}. Consider using [find and replace](https://code.visualstudio.com/docs/editor/codebasics#_find-and-replace) for larger changes or increase the editor multi cursor limit setting.\", multiCursorLimit);\n this._notificationService.prompt(Severity.Warning, message, [\n {\n label: 'Find and Replace',\n run: () => {\n this._commandService.executeCommand('editor.action.startFindReplaceAction');\n }\n },\n {\n label: nls.localize('goToSetting', 'Increase Multi Cursor Limit'),\n run: () => {\n this._commandService.executeCommand('workbench.action.openSettings2', {\n query: 'editor.multiCursorLimit'\n });\n }\n }\n ]);\n }\n const positions = [];\n for (let i = 0, len = e.selections.length; i < len; i++) {\n positions[i] = e.selections[i].getPosition();\n }\n const e1 = {\n position: positions[0],\n secondaryPositions: positions.slice(1),\n reason: e.reason,\n source: e.source\n };\n this._onDidChangeCursorPosition.fire(e1);\n const e2 = {\n selection: e.selections[0],\n secondarySelections: e.selections.slice(1),\n modelVersionId: e.modelVersionId,\n oldSelections: e.oldSelections,\n oldModelVersionId: e.oldModelVersionId,\n source: e.source,\n reason: e.reason\n };\n this._onDidChangeCursorSelection.fire(e2);\n break;\n }\n case 7 /* OutgoingViewModelEventKind.ModelDecorationsChanged */:\n this._onDidChangeModelDecorations.fire(e.event);\n break;\n case 8 /* OutgoingViewModelEventKind.ModelLanguageChanged */:\n this._domElement.setAttribute('data-mode-id', model.getLanguageId());\n this._onDidChangeModelLanguage.fire(e.event);\n break;\n case 9 /* OutgoingViewModelEventKind.ModelLanguageConfigurationChanged */:\n this._onDidChangeModelLanguageConfiguration.fire(e.event);\n break;\n case 10 /* OutgoingViewModelEventKind.ModelContentChanged */:\n this._onDidChangeModelContent.fire(e.event);\n break;\n case 11 /* OutgoingViewModelEventKind.ModelOptionsChanged */:\n this._onDidChangeModelOptions.fire(e.event);\n break;\n case 12 /* OutgoingViewModelEventKind.ModelTokensChanged */:\n this._onDidChangeModelTokens.fire(e.event);\n break;\n }\n }));\n const [view, hasRealView] = this._createView(viewModel);\n if (hasRealView) {\n this._domElement.appendChild(view.domNode.domNode);\n let keys = Object.keys(this._contentWidgets);\n for (let i = 0, len = keys.length; i < len; i++) {\n const widgetId = keys[i];\n view.addContentWidget(this._contentWidgets[widgetId]);\n }\n keys = Object.keys(this._overlayWidgets);\n for (let i = 0, len = keys.length; i < len; i++) {\n const widgetId = keys[i];\n view.addOverlayWidget(this._overlayWidgets[widgetId]);\n }\n keys = Object.keys(this._glyphMarginWidgets);\n for (let i = 0, len = keys.length; i < len; i++) {\n const widgetId = keys[i];\n view.addGlyphMarginWidget(this._glyphMarginWidgets[widgetId]);\n }\n view.render(false, true);\n view.domNode.domNode.setAttribute('data-uri', model.uri.toString());\n }\n this._modelData = new ModelData(model, viewModel, view, hasRealView, listenersToRemove, attachedView);\n }\n _createView(viewModel) {\n let commandDelegate;\n if (this.isSimpleWidget) {\n commandDelegate = {\n paste: (text, pasteOnNewLine, multicursorText, mode) => {\n this._paste('keyboard', text, pasteOnNewLine, multicursorText, mode);\n },\n type: (text) => {\n this._type('keyboard', text);\n },\n compositionType: (text, replacePrevCharCnt, replaceNextCharCnt, positionDelta) => {\n this._compositionType('keyboard', text, replacePrevCharCnt, replaceNextCharCnt, positionDelta);\n },\n startComposition: () => {\n this._startComposition();\n },\n endComposition: () => {\n this._endComposition('keyboard');\n },\n cut: () => {\n this._cut('keyboard');\n }\n };\n }\n else {\n commandDelegate = {\n paste: (text, pasteOnNewLine, multicursorText, mode) => {\n const payload = { text, pasteOnNewLine, multicursorText, mode };\n this._commandService.executeCommand(\"paste\" /* editorCommon.Handler.Paste */, payload);\n },\n type: (text) => {\n const payload = { text };\n this._commandService.executeCommand(\"type\" /* editorCommon.Handler.Type */, payload);\n },\n compositionType: (text, replacePrevCharCnt, replaceNextCharCnt, positionDelta) => {\n // Try if possible to go through the existing `replacePreviousChar` command\n if (replaceNextCharCnt || positionDelta) {\n // must be handled through the new command\n const payload = { text, replacePrevCharCnt, replaceNextCharCnt, positionDelta };\n this._commandService.executeCommand(\"compositionType\" /* editorCommon.Handler.CompositionType */, payload);\n }\n else {\n const payload = { text, replaceCharCnt: replacePrevCharCnt };\n this._commandService.executeCommand(\"replacePreviousChar\" /* editorCommon.Handler.ReplacePreviousChar */, payload);\n }\n },\n startComposition: () => {\n this._commandService.executeCommand(\"compositionStart\" /* editorCommon.Handler.CompositionStart */, {});\n },\n endComposition: () => {\n this._commandService.executeCommand(\"compositionEnd\" /* editorCommon.Handler.CompositionEnd */, {});\n },\n cut: () => {\n this._commandService.executeCommand(\"cut\" /* editorCommon.Handler.Cut */, {});\n }\n };\n }\n const viewUserInputEvents = new ViewUserInputEvents(viewModel.coordinatesConverter);\n viewUserInputEvents.onKeyDown = (e) => this._onKeyDown.fire(e);\n viewUserInputEvents.onKeyUp = (e) => this._onKeyUp.fire(e);\n viewUserInputEvents.onContextMenu = (e) => this._onContextMenu.fire(e);\n viewUserInputEvents.onMouseMove = (e) => this._onMouseMove.fire(e);\n viewUserInputEvents.onMouseLeave = (e) => this._onMouseLeave.fire(e);\n viewUserInputEvents.onMouseDown = (e) => this._onMouseDown.fire(e);\n viewUserInputEvents.onMouseUp = (e) => this._onMouseUp.fire(e);\n viewUserInputEvents.onMouseDrag = (e) => this._onMouseDrag.fire(e);\n viewUserInputEvents.onMouseDrop = (e) => this._onMouseDrop.fire(e);\n viewUserInputEvents.onMouseDropCanceled = (e) => this._onMouseDropCanceled.fire(e);\n viewUserInputEvents.onMouseWheel = (e) => this._onMouseWheel.fire(e);\n const view = new View(commandDelegate, this._configuration, this._themeService.getColorTheme(), viewModel, viewUserInputEvents, this._overflowWidgetsDomNode, this._instantiationService);\n return [view, true];\n }\n _postDetachModelCleanup(detachedModel) {\n detachedModel === null || detachedModel === void 0 ? void 0 : detachedModel.removeAllDecorationsWithOwnerId(this._id);\n }\n _detachModel() {\n var _a;\n (_a = this._contributionsDisposable) === null || _a === void 0 ? void 0 : _a.dispose();\n this._contributionsDisposable = undefined;\n if (!this._modelData) {\n return null;\n }\n const model = this._modelData.model;\n const removeDomNode = this._modelData.hasRealView ? this._modelData.view.domNode.domNode : null;\n this._modelData.dispose();\n this._modelData = null;\n this._domElement.removeAttribute('data-mode-id');\n if (removeDomNode && this._domElement.contains(removeDomNode)) {\n this._domElement.removeChild(removeDomNode);\n }\n if (this._bannerDomNode && this._domElement.contains(this._bannerDomNode)) {\n this._domElement.removeChild(this._bannerDomNode);\n }\n return model;\n }\n _removeDecorationType(key) {\n this._codeEditorService.removeDecorationType(key);\n }\n hasModel() {\n return (this._modelData !== null);\n }\n showDropIndicatorAt(position) {\n const newDecorations = [{\n range: new Range(position.lineNumber, position.column, position.lineNumber, position.column),\n options: CodeEditorWidget_1.dropIntoEditorDecorationOptions\n }];\n this._dropIntoEditorDecorations.set(newDecorations);\n this.revealPosition(position, 1 /* editorCommon.ScrollType.Immediate */);\n }\n removeDropIndicator() {\n this._dropIntoEditorDecorations.clear();\n }\n setContextValue(key, value) {\n this._contextKeyService.createKey(key, value);\n }\n};\nCodeEditorWidget.dropIntoEditorDecorationOptions = ModelDecorationOptions.register({\n description: 'workbench-dnd-target',\n className: 'dnd-target'\n});\nCodeEditorWidget = CodeEditorWidget_1 = __decorate([\n __param(3, IInstantiationService),\n __param(4, ICodeEditorService),\n __param(5, ICommandService),\n __param(6, IContextKeyService),\n __param(7, IThemeService),\n __param(8, INotificationService),\n __param(9, IAccessibilityService),\n __param(10, ILanguageConfigurationService),\n __param(11, ILanguageFeaturesService)\n], CodeEditorWidget);\nexport { CodeEditorWidget };\nlet EDITOR_ID = 0;\nclass ModelData {\n constructor(model, viewModel, view, hasRealView, listenersToRemove, attachedView) {\n this.model = model;\n this.viewModel = viewModel;\n this.view = view;\n this.hasRealView = hasRealView;\n this.listenersToRemove = listenersToRemove;\n this.attachedView = attachedView;\n }\n dispose() {\n dispose(this.listenersToRemove);\n this.model.onBeforeDetached(this.attachedView);\n if (this.hasRealView) {\n this.view.dispose();\n }\n this.viewModel.dispose();\n }\n}\nexport class BooleanEventEmitter extends Disposable {\n constructor(_emitterOptions) {\n super();\n this._emitterOptions = _emitterOptions;\n this._onDidChangeToTrue = this._register(new Emitter(this._emitterOptions));\n this.onDidChangeToTrue = this._onDidChangeToTrue.event;\n this._onDidChangeToFalse = this._register(new Emitter(this._emitterOptions));\n this.onDidChangeToFalse = this._onDidChangeToFalse.event;\n this._value = 0 /* BooleanEventValue.NotSet */;\n }\n setValue(_value) {\n const value = (_value ? 2 /* BooleanEventValue.True */ : 1 /* BooleanEventValue.False */);\n if (this._value === value) {\n return;\n }\n this._value = value;\n if (this._value === 2 /* BooleanEventValue.True */) {\n this._onDidChangeToTrue.fire();\n }\n else if (this._value === 1 /* BooleanEventValue.False */) {\n this._onDidChangeToFalse.fire();\n }\n }\n}\n/**\n * A regular event emitter that also makes sure contributions are instantiated if necessary\n */\nclass InteractionEmitter extends Emitter {\n constructor(_contributions, deliveryQueue) {\n super({ deliveryQueue });\n this._contributions = _contributions;\n }\n fire(event) {\n this._contributions.onBeforeInteractionEvent();\n super.fire(event);\n }\n}\nclass EditorContextKeysManager extends Disposable {\n constructor(editor, contextKeyService) {\n super();\n this._editor = editor;\n contextKeyService.createKey('editorId', editor.getId());\n this._editorSimpleInput = EditorContextKeys.editorSimpleInput.bindTo(contextKeyService);\n this._editorFocus = EditorContextKeys.focus.bindTo(contextKeyService);\n this._textInputFocus = EditorContextKeys.textInputFocus.bindTo(contextKeyService);\n this._editorTextFocus = EditorContextKeys.editorTextFocus.bindTo(contextKeyService);\n this._tabMovesFocus = EditorContextKeys.tabMovesFocus.bindTo(contextKeyService);\n this._editorReadonly = EditorContextKeys.readOnly.bindTo(contextKeyService);\n this._inDiffEditor = EditorContextKeys.inDiffEditor.bindTo(contextKeyService);\n this._editorColumnSelection = EditorContextKeys.columnSelection.bindTo(contextKeyService);\n this._hasMultipleSelections = EditorContextKeys.hasMultipleSelections.bindTo(contextKeyService);\n this._hasNonEmptySelection = EditorContextKeys.hasNonEmptySelection.bindTo(contextKeyService);\n this._canUndo = EditorContextKeys.canUndo.bindTo(contextKeyService);\n this._canRedo = EditorContextKeys.canRedo.bindTo(contextKeyService);\n this._register(this._editor.onDidChangeConfiguration(() => this._updateFromConfig()));\n this._register(this._editor.onDidChangeCursorSelection(() => this._updateFromSelection()));\n this._register(this._editor.onDidFocusEditorWidget(() => this._updateFromFocus()));\n this._register(this._editor.onDidBlurEditorWidget(() => this._updateFromFocus()));\n this._register(this._editor.onDidFocusEditorText(() => this._updateFromFocus()));\n this._register(this._editor.onDidBlurEditorText(() => this._updateFromFocus()));\n this._register(this._editor.onDidChangeModel(() => this._updateFromModel()));\n this._register(this._editor.onDidChangeConfiguration(() => this._updateFromModel()));\n this._register(TabFocus.onDidChangeTabFocus((tabFocusMode) => this._tabMovesFocus.set(tabFocusMode)));\n this._updateFromConfig();\n this._updateFromSelection();\n this._updateFromFocus();\n this._updateFromModel();\n this._editorSimpleInput.set(this._editor.isSimpleWidget);\n }\n _updateFromConfig() {\n const options = this._editor.getOptions();\n this._tabMovesFocus.set(TabFocus.getTabFocusMode());\n this._editorReadonly.set(options.get(91 /* EditorOption.readOnly */));\n this._inDiffEditor.set(options.get(61 /* EditorOption.inDiffEditor */));\n this._editorColumnSelection.set(options.get(22 /* EditorOption.columnSelection */));\n }\n _updateFromSelection() {\n const selections = this._editor.getSelections();\n if (!selections) {\n this._hasMultipleSelections.reset();\n this._hasNonEmptySelection.reset();\n }\n else {\n this._hasMultipleSelections.set(selections.length > 1);\n this._hasNonEmptySelection.set(selections.some(s => !s.isEmpty()));\n }\n }\n _updateFromFocus() {\n this._editorFocus.set(this._editor.hasWidgetFocus() && !this._editor.isSimpleWidget);\n this._editorTextFocus.set(this._editor.hasTextFocus() && !this._editor.isSimpleWidget);\n this._textInputFocus.set(this._editor.hasTextFocus());\n }\n _updateFromModel() {\n const model = this._editor.getModel();\n this._canUndo.set(Boolean(model && model.canUndo()));\n this._canRedo.set(Boolean(model && model.canRedo()));\n }\n}\nexport class EditorModeContext extends Disposable {\n constructor(_editor, _contextKeyService, _languageFeaturesService) {\n super();\n this._editor = _editor;\n this._contextKeyService = _contextKeyService;\n this._languageFeaturesService = _languageFeaturesService;\n this._langId = EditorContextKeys.languageId.bindTo(_contextKeyService);\n this._hasCompletionItemProvider = EditorContextKeys.hasCompletionItemProvider.bindTo(_contextKeyService);\n this._hasCodeActionsProvider = EditorContextKeys.hasCodeActionsProvider.bindTo(_contextKeyService);\n this._hasCodeLensProvider = EditorContextKeys.hasCodeLensProvider.bindTo(_contextKeyService);\n this._hasDefinitionProvider = EditorContextKeys.hasDefinitionProvider.bindTo(_contextKeyService);\n this._hasDeclarationProvider = EditorContextKeys.hasDeclarationProvider.bindTo(_contextKeyService);\n this._hasImplementationProvider = EditorContextKeys.hasImplementationProvider.bindTo(_contextKeyService);\n this._hasTypeDefinitionProvider = EditorContextKeys.hasTypeDefinitionProvider.bindTo(_contextKeyService);\n this._hasHoverProvider = EditorContextKeys.hasHoverProvider.bindTo(_contextKeyService);\n this._hasDocumentHighlightProvider = EditorContextKeys.hasDocumentHighlightProvider.bindTo(_contextKeyService);\n this._hasDocumentSymbolProvider = EditorContextKeys.hasDocumentSymbolProvider.bindTo(_contextKeyService);\n this._hasReferenceProvider = EditorContextKeys.hasReferenceProvider.bindTo(_contextKeyService);\n this._hasRenameProvider = EditorContextKeys.hasRenameProvider.bindTo(_contextKeyService);\n this._hasSignatureHelpProvider = EditorContextKeys.hasSignatureHelpProvider.bindTo(_contextKeyService);\n this._hasInlayHintsProvider = EditorContextKeys.hasInlayHintsProvider.bindTo(_contextKeyService);\n this._hasDocumentFormattingProvider = EditorContextKeys.hasDocumentFormattingProvider.bindTo(_contextKeyService);\n this._hasDocumentSelectionFormattingProvider = EditorContextKeys.hasDocumentSelectionFormattingProvider.bindTo(_contextKeyService);\n this._hasMultipleDocumentFormattingProvider = EditorContextKeys.hasMultipleDocumentFormattingProvider.bindTo(_contextKeyService);\n this._hasMultipleDocumentSelectionFormattingProvider = EditorContextKeys.hasMultipleDocumentSelectionFormattingProvider.bindTo(_contextKeyService);\n this._isInEmbeddedEditor = EditorContextKeys.isInEmbeddedEditor.bindTo(_contextKeyService);\n const update = () => this._update();\n // update when model/mode changes\n this._register(_editor.onDidChangeModel(update));\n this._register(_editor.onDidChangeModelLanguage(update));\n // update when registries change\n this._register(_languageFeaturesService.completionProvider.onDidChange(update));\n this._register(_languageFeaturesService.codeActionProvider.onDidChange(update));\n this._register(_languageFeaturesService.codeLensProvider.onDidChange(update));\n this._register(_languageFeaturesService.definitionProvider.onDidChange(update));\n this._register(_languageFeaturesService.declarationProvider.onDidChange(update));\n this._register(_languageFeaturesService.implementationProvider.onDidChange(update));\n this._register(_languageFeaturesService.typeDefinitionProvider.onDidChange(update));\n this._register(_languageFeaturesService.hoverProvider.onDidChange(update));\n this._register(_languageFeaturesService.documentHighlightProvider.onDidChange(update));\n this._register(_languageFeaturesService.documentSymbolProvider.onDidChange(update));\n this._register(_languageFeaturesService.referenceProvider.onDidChange(update));\n this._register(_languageFeaturesService.renameProvider.onDidChange(update));\n this._register(_languageFeaturesService.documentFormattingEditProvider.onDidChange(update));\n this._register(_languageFeaturesService.documentRangeFormattingEditProvider.onDidChange(update));\n this._register(_languageFeaturesService.signatureHelpProvider.onDidChange(update));\n this._register(_languageFeaturesService.inlayHintsProvider.onDidChange(update));\n update();\n }\n dispose() {\n super.dispose();\n }\n reset() {\n this._contextKeyService.bufferChangeEvents(() => {\n this._langId.reset();\n this._hasCompletionItemProvider.reset();\n this._hasCodeActionsProvider.reset();\n this._hasCodeLensProvider.reset();\n this._hasDefinitionProvider.reset();\n this._hasDeclarationProvider.reset();\n this._hasImplementationProvider.reset();\n this._hasTypeDefinitionProvider.reset();\n this._hasHoverProvider.reset();\n this._hasDocumentHighlightProvider.reset();\n this._hasDocumentSymbolProvider.reset();\n this._hasReferenceProvider.reset();\n this._hasRenameProvider.reset();\n this._hasDocumentFormattingProvider.reset();\n this._hasDocumentSelectionFormattingProvider.reset();\n this._hasSignatureHelpProvider.reset();\n this._isInEmbeddedEditor.reset();\n });\n }\n _update() {\n const model = this._editor.getModel();\n if (!model) {\n this.reset();\n return;\n }\n this._contextKeyService.bufferChangeEvents(() => {\n this._langId.set(model.getLanguageId());\n this._hasCompletionItemProvider.set(this._languageFeaturesService.completionProvider.has(model));\n this._hasCodeActionsProvider.set(this._languageFeaturesService.codeActionProvider.has(model));\n this._hasCodeLensProvider.set(this._languageFeaturesService.codeLensProvider.has(model));\n this._hasDefinitionProvider.set(this._languageFeaturesService.definitionProvider.has(model));\n this._hasDeclarationProvider.set(this._languageFeaturesService.declarationProvider.has(model));\n this._hasImplementationProvider.set(this._languageFeaturesService.implementationProvider.has(model));\n this._hasTypeDefinitionProvider.set(this._languageFeaturesService.typeDefinitionProvider.has(model));\n this._hasHoverProvider.set(this._languageFeaturesService.hoverProvider.has(model));\n this._hasDocumentHighlightProvider.set(this._languageFeaturesService.documentHighlightProvider.has(model));\n this._hasDocumentSymbolProvider.set(this._languageFeaturesService.documentSymbolProvider.has(model));\n this._hasReferenceProvider.set(this._languageFeaturesService.referenceProvider.has(model));\n this._hasRenameProvider.set(this._languageFeaturesService.renameProvider.has(model));\n this._hasSignatureHelpProvider.set(this._languageFeaturesService.signatureHelpProvider.has(model));\n this._hasInlayHintsProvider.set(this._languageFeaturesService.inlayHintsProvider.has(model));\n this._hasDocumentFormattingProvider.set(this._languageFeaturesService.documentFormattingEditProvider.has(model) || this._languageFeaturesService.documentRangeFormattingEditProvider.has(model));\n this._hasDocumentSelectionFormattingProvider.set(this._languageFeaturesService.documentRangeFormattingEditProvider.has(model));\n this._hasMultipleDocumentFormattingProvider.set(this._languageFeaturesService.documentFormattingEditProvider.all(model).length + this._languageFeaturesService.documentRangeFormattingEditProvider.all(model).length > 1);\n this._hasMultipleDocumentSelectionFormattingProvider.set(this._languageFeaturesService.documentRangeFormattingEditProvider.all(model).length > 1);\n this._isInEmbeddedEditor.set(model.uri.scheme === Schemas.walkThroughSnippet || model.uri.scheme === Schemas.vscodeChatCodeBlock);\n });\n }\n}\nclass CodeEditorWidgetFocusTracker extends Disposable {\n constructor(domElement, overflowWidgetsDomNode) {\n super();\n this._onChange = this._register(new Emitter());\n this.onChange = this._onChange.event;\n this._hadFocus = undefined;\n this._hasDomElementFocus = false;\n this._domFocusTracker = this._register(dom.trackFocus(domElement));\n this._overflowWidgetsDomNodeHasFocus = false;\n this._register(this._domFocusTracker.onDidFocus(() => {\n this._hasDomElementFocus = true;\n this._update();\n }));\n this._register(this._domFocusTracker.onDidBlur(() => {\n this._hasDomElementFocus = false;\n this._update();\n }));\n if (overflowWidgetsDomNode) {\n this._overflowWidgetsDomNode = this._register(dom.trackFocus(overflowWidgetsDomNode));\n this._register(this._overflowWidgetsDomNode.onDidFocus(() => {\n this._overflowWidgetsDomNodeHasFocus = true;\n this._update();\n }));\n this._register(this._overflowWidgetsDomNode.onDidBlur(() => {\n this._overflowWidgetsDomNodeHasFocus = false;\n this._update();\n }));\n }\n }\n _update() {\n const focused = this._hasDomElementFocus || this._overflowWidgetsDomNodeHasFocus;\n if (this._hadFocus !== focused) {\n this._hadFocus = focused;\n this._onChange.fire(undefined);\n }\n }\n hasFocus() {\n var _a;\n return (_a = this._hadFocus) !== null && _a !== void 0 ? _a : false;\n }\n}\nclass EditorDecorationsCollection {\n get length() {\n return this._decorationIds.length;\n }\n constructor(_editor, decorations) {\n this._editor = _editor;\n this._decorationIds = [];\n this._isChangingDecorations = false;\n if (Array.isArray(decorations) && decorations.length > 0) {\n this.set(decorations);\n }\n }\n onDidChange(listener, thisArgs, disposables) {\n return this._editor.onDidChangeModelDecorations((e) => {\n if (this._isChangingDecorations) {\n return;\n }\n listener.call(thisArgs, e);\n }, disposables);\n }\n getRange(index) {\n if (!this._editor.hasModel()) {\n return null;\n }\n if (index >= this._decorationIds.length) {\n return null;\n }\n return this._editor.getModel().getDecorationRange(this._decorationIds[index]);\n }\n getRanges() {\n if (!this._editor.hasModel()) {\n return [];\n }\n const model = this._editor.getModel();\n const result = [];\n for (const decorationId of this._decorationIds) {\n const range = model.getDecorationRange(decorationId);\n if (range) {\n result.push(range);\n }\n }\n return result;\n }\n has(decoration) {\n return this._decorationIds.includes(decoration.id);\n }\n clear() {\n if (this._decorationIds.length === 0) {\n // nothing to do\n return;\n }\n this.set([]);\n }\n set(newDecorations) {\n try {\n this._isChangingDecorations = true;\n this._editor.changeDecorations((accessor) => {\n this._decorationIds = accessor.deltaDecorations(this._decorationIds, newDecorations);\n });\n }\n finally {\n this._isChangingDecorations = false;\n }\n return this._decorationIds;\n }\n append(newDecorations) {\n let newDecorationIds = [];\n try {\n this._isChangingDecorations = true;\n this._editor.changeDecorations((accessor) => {\n newDecorationIds = accessor.deltaDecorations([], newDecorations);\n this._decorationIds = this._decorationIds.concat(newDecorationIds);\n });\n }\n finally {\n this._isChangingDecorations = false;\n }\n return newDecorationIds;\n }\n}\nconst squigglyStart = encodeURIComponent(``);\nfunction getSquigglySVGData(color) {\n return squigglyStart + encodeURIComponent(color.toString()) + squigglyEnd;\n}\nconst dotdotdotStart = encodeURIComponent(``);\nfunction getDotDotDotSVGData(color) {\n return dotdotdotStart + encodeURIComponent(color.toString()) + dotdotdotEnd;\n}\nregisterThemingParticipant((theme, collector) => {\n const errorForeground = theme.getColor(editorErrorForeground);\n if (errorForeground) {\n collector.addRule(`.monaco-editor .${\"squiggly-error\" /* ClassName.EditorErrorDecoration */} { background: url(\"data:image/svg+xml,${getSquigglySVGData(errorForeground)}\") repeat-x bottom left; }`);\n }\n const warningForeground = theme.getColor(editorWarningForeground);\n if (warningForeground) {\n collector.addRule(`.monaco-editor .${\"squiggly-warning\" /* ClassName.EditorWarningDecoration */} { background: url(\"data:image/svg+xml,${getSquigglySVGData(warningForeground)}\") repeat-x bottom left; }`);\n }\n const infoForeground = theme.getColor(editorInfoForeground);\n if (infoForeground) {\n collector.addRule(`.monaco-editor .${\"squiggly-info\" /* ClassName.EditorInfoDecoration */} { background: url(\"data:image/svg+xml,${getSquigglySVGData(infoForeground)}\") repeat-x bottom left; }`);\n }\n const hintForeground = theme.getColor(editorHintForeground);\n if (hintForeground) {\n collector.addRule(`.monaco-editor .${\"squiggly-hint\" /* ClassName.EditorHintDecoration */} { background: url(\"data:image/svg+xml,${getDotDotDotSVGData(hintForeground)}\") no-repeat bottom left; }`);\n }\n const unnecessaryForeground = theme.getColor(editorUnnecessaryCodeOpacity);\n if (unnecessaryForeground) {\n collector.addRule(`.monaco-editor.showUnused .${\"squiggly-inline-unnecessary\" /* ClassName.EditorUnnecessaryInlineDecoration */} { opacity: ${unnecessaryForeground.rgba.a}; }`);\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 *--------------------------------------------------------------------------------------------*/\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};\nimport { IMarkerDecorationsService } from '../../common/services/markerDecorations.js';\nimport { registerEditorContribution } from '../editorExtensions.js';\nlet MarkerDecorationsContribution = class MarkerDecorationsContribution {\n constructor(_editor, _markerDecorationsService) {\n // Doesn't do anything, just requires `IMarkerDecorationsService` to make sure it gets instantiated\n }\n dispose() {\n }\n};\nMarkerDecorationsContribution.ID = 'editor.contrib.markerDecorations';\nMarkerDecorationsContribution = __decorate([\n __param(1, IMarkerDecorationsService)\n], MarkerDecorationsContribution);\nexport { MarkerDecorationsContribution };\nregisterEditorContribution(MarkerDecorationsContribution.ID, MarkerDecorationsContribution, 0 /* EditorContributionInstantiation.Eager */); // eager because it instantiates IMarkerDecorationsService which is responsible for rendering squiggles\n", "/*---------------------------------------------------------------------------------------------\n * 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 { createDecorator } from '../../../platform/instantiation/common/instantiation.js';\nexport const IMarkerDecorationsService = createDecorator('markerDecorationsService');\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};\nimport * as browser from '../../../base/browser/browser.js';\nimport * as arrays from '../../../base/common/arrays.js';\nimport { Emitter } from '../../../base/common/event.js';\nimport { Disposable } from '../../../base/common/lifecycle.js';\nimport * as objects from '../../../base/common/objects.js';\nimport * as platform from '../../../base/common/platform.js';\nimport { ElementSizeObserver } from './elementSizeObserver.js';\nimport { FontMeasurements } from './fontMeasurements.js';\nimport { migrateOptions } from './migrateOptions.js';\nimport { TabFocus } from './tabFocus.js';\nimport { ComputeOptionsMemory, ConfigurationChangedEvent, editorOptionsRegistry } from '../../common/config/editorOptions.js';\nimport { EditorZoom } from '../../common/config/editorZoom.js';\nimport { BareFontInfo } from '../../common/config/fontInfo.js';\nimport { IAccessibilityService } from '../../../platform/accessibility/common/accessibility.js';\nimport { getWindow, getWindowById } from '../../../base/browser/dom.js';\nimport { PixelRatio } from '../../../base/browser/pixelRatio.js';\nlet EditorConfiguration = class EditorConfiguration extends Disposable {\n constructor(isSimpleWidget, contextMenuId, options, container, _accessibilityService) {\n super();\n this._accessibilityService = _accessibilityService;\n this._onDidChange = this._register(new Emitter());\n this.onDidChange = this._onDidChange.event;\n this._onDidChangeFast = this._register(new Emitter());\n this.onDidChangeFast = this._onDidChangeFast.event;\n this._isDominatedByLongLines = false;\n this._viewLineCount = 1;\n this._lineNumbersDigitCount = 1;\n this._reservedHeight = 0;\n this._glyphMarginDecorationLaneCount = 1;\n this._computeOptionsMemory = new ComputeOptionsMemory();\n this.isSimpleWidget = isSimpleWidget;\n this.contextMenuId = contextMenuId;\n this._containerObserver = this._register(new ElementSizeObserver(container, options.dimension));\n this._targetWindowId = getWindow(container).vscodeWindowId;\n this._rawOptions = deepCloneAndMigrateOptions(options);\n this._validatedOptions = EditorOptionsUtil.validateOptions(this._rawOptions);\n this.options = this._computeOptions();\n if (this.options.get(13 /* EditorOption.automaticLayout */)) {\n this._containerObserver.startObserving();\n }\n this._register(EditorZoom.onDidChangeZoomLevel(() => this._recomputeOptions()));\n this._register(TabFocus.onDidChangeTabFocus(() => this._recomputeOptions()));\n this._register(this._containerObserver.onDidChange(() => this._recomputeOptions()));\n this._register(FontMeasurements.onDidChange(() => this._recomputeOptions()));\n this._register(PixelRatio.getInstance(getWindow(container)).onDidChange(() => this._recomputeOptions()));\n this._register(this._accessibilityService.onDidChangeScreenReaderOptimized(() => this._recomputeOptions()));\n }\n _recomputeOptions() {\n const newOptions = this._computeOptions();\n const changeEvent = EditorOptionsUtil.checkEquals(this.options, newOptions);\n if (changeEvent === null) {\n // nothing changed!\n return;\n }\n this.options = newOptions;\n this._onDidChangeFast.fire(changeEvent);\n this._onDidChange.fire(changeEvent);\n }\n _computeOptions() {\n const partialEnv = this._readEnvConfiguration();\n const bareFontInfo = BareFontInfo.createFromValidatedSettings(this._validatedOptions, partialEnv.pixelRatio, this.isSimpleWidget);\n const fontInfo = this._readFontInfo(bareFontInfo);\n const env = {\n memory: this._computeOptionsMemory,\n outerWidth: partialEnv.outerWidth,\n outerHeight: partialEnv.outerHeight - this._reservedHeight,\n fontInfo: fontInfo,\n extraEditorClassName: partialEnv.extraEditorClassName,\n isDominatedByLongLines: this._isDominatedByLongLines,\n viewLineCount: this._viewLineCount,\n lineNumbersDigitCount: this._lineNumbersDigitCount,\n emptySelectionClipboard: partialEnv.emptySelectionClipboard,\n pixelRatio: partialEnv.pixelRatio,\n tabFocusMode: TabFocus.getTabFocusMode(),\n accessibilitySupport: partialEnv.accessibilitySupport,\n glyphMarginDecorationLaneCount: this._glyphMarginDecorationLaneCount\n };\n return EditorOptionsUtil.computeOptions(this._validatedOptions, env);\n }\n _readEnvConfiguration() {\n return {\n extraEditorClassName: getExtraEditorClassName(),\n outerWidth: this._containerObserver.getWidth(),\n outerHeight: this._containerObserver.getHeight(),\n emptySelectionClipboard: browser.isWebKit || browser.isFirefox,\n pixelRatio: PixelRatio.getInstance(getWindowById(this._targetWindowId, true).window).value,\n accessibilitySupport: (this._accessibilityService.isScreenReaderOptimized()\n ? 2 /* AccessibilitySupport.Enabled */\n : this._accessibilityService.getAccessibilitySupport())\n };\n }\n _readFontInfo(bareFontInfo) {\n return FontMeasurements.readFontInfo(getWindowById(this._targetWindowId, true).window, bareFontInfo);\n }\n getRawOptions() {\n return this._rawOptions;\n }\n updateOptions(_newOptions) {\n const newOptions = deepCloneAndMigrateOptions(_newOptions);\n const didChange = EditorOptionsUtil.applyUpdate(this._rawOptions, newOptions);\n if (!didChange) {\n return;\n }\n this._validatedOptions = EditorOptionsUtil.validateOptions(this._rawOptions);\n this._recomputeOptions();\n }\n observeContainer(dimension) {\n this._containerObserver.observe(dimension);\n }\n setIsDominatedByLongLines(isDominatedByLongLines) {\n if (this._isDominatedByLongLines === isDominatedByLongLines) {\n return;\n }\n this._isDominatedByLongLines = isDominatedByLongLines;\n this._recomputeOptions();\n }\n setModelLineCount(modelLineCount) {\n const lineNumbersDigitCount = digitCount(modelLineCount);\n if (this._lineNumbersDigitCount === lineNumbersDigitCount) {\n return;\n }\n this._lineNumbersDigitCount = lineNumbersDigitCount;\n this._recomputeOptions();\n }\n setViewLineCount(viewLineCount) {\n if (this._viewLineCount === viewLineCount) {\n return;\n }\n this._viewLineCount = viewLineCount;\n this._recomputeOptions();\n }\n setReservedHeight(reservedHeight) {\n if (this._reservedHeight === reservedHeight) {\n return;\n }\n this._reservedHeight = reservedHeight;\n this._recomputeOptions();\n }\n setGlyphMarginDecorationLaneCount(decorationLaneCount) {\n if (this._glyphMarginDecorationLaneCount === decorationLaneCount) {\n return;\n }\n this._glyphMarginDecorationLaneCount = decorationLaneCount;\n this._recomputeOptions();\n }\n};\nEditorConfiguration = __decorate([\n __param(4, IAccessibilityService)\n], EditorConfiguration);\nexport { EditorConfiguration };\nfunction digitCount(n) {\n let r = 0;\n while (n) {\n n = Math.floor(n / 10);\n r++;\n }\n return r ? r : 1;\n}\nfunction getExtraEditorClassName() {\n let extra = '';\n if (!browser.isSafari && !browser.isWebkitWebView) {\n // Use user-select: none in all browsers except Safari and native macOS WebView\n extra += 'no-user-select ';\n }\n if (browser.isSafari) {\n // See https://github.com/microsoft/vscode/issues/108822\n extra += 'no-minimap-shadow ';\n extra += 'enable-user-select ';\n }\n if (platform.isMacintosh) {\n extra += 'mac ';\n }\n return extra;\n}\nclass ValidatedEditorOptions {\n constructor() {\n this._values = [];\n }\n _read(option) {\n return this._values[option];\n }\n get(id) {\n return this._values[id];\n }\n _write(option, value) {\n this._values[option] = value;\n }\n}\nexport class ComputedEditorOptions {\n constructor() {\n this._values = [];\n }\n _read(id) {\n if (id >= this._values.length) {\n throw new Error('Cannot read uninitialized value');\n }\n return this._values[id];\n }\n get(id) {\n return this._read(id);\n }\n _write(id, value) {\n this._values[id] = value;\n }\n}\nclass EditorOptionsUtil {\n static validateOptions(options) {\n const result = new ValidatedEditorOptions();\n for (const editorOption of editorOptionsRegistry) {\n const value = (editorOption.name === '_never_' ? undefined : options[editorOption.name]);\n result._write(editorOption.id, editorOption.validate(value));\n }\n return result;\n }\n static computeOptions(options, env) {\n const result = new ComputedEditorOptions();\n for (const editorOption of editorOptionsRegistry) {\n result._write(editorOption.id, editorOption.compute(env, result, options._read(editorOption.id)));\n }\n return result;\n }\n static _deepEquals(a, b) {\n if (typeof a !== 'object' || typeof b !== 'object' || !a || !b) {\n return a === b;\n }\n if (Array.isArray(a) || Array.isArray(b)) {\n return (Array.isArray(a) && Array.isArray(b) ? arrays.equals(a, b) : false);\n }\n if (Object.keys(a).length !== Object.keys(b).length) {\n return false;\n }\n for (const key in a) {\n if (!EditorOptionsUtil._deepEquals(a[key], b[key])) {\n return false;\n }\n }\n return true;\n }\n static checkEquals(a, b) {\n const result = [];\n let somethingChanged = false;\n for (const editorOption of editorOptionsRegistry) {\n const changed = !EditorOptionsUtil._deepEquals(a._read(editorOption.id), b._read(editorOption.id));\n result[editorOption.id] = changed;\n if (changed) {\n somethingChanged = true;\n }\n }\n return (somethingChanged ? new ConfigurationChangedEvent(result) : null);\n }\n /**\n * Returns true if something changed.\n * Modifies `options`.\n */\n static applyUpdate(options, update) {\n let changed = false;\n for (const editorOption of editorOptionsRegistry) {\n if (update.hasOwnProperty(editorOption.name)) {\n const result = editorOption.applyUpdate(options[editorOption.name], update[editorOption.name]);\n options[editorOption.name] = result.newValue;\n changed = changed || result.didChange;\n }\n }\n return changed;\n }\n}\nfunction deepCloneAndMigrateOptions(_options) {\n const options = objects.deepClone(_options);\n migrateOptions(options);\n return options;\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 *--------------------------------------------------------------------------------------------*/\nexport class EditorSettingMigration {\n constructor(key, migrate) {\n this.key = key;\n this.migrate = migrate;\n }\n apply(options) {\n const value = EditorSettingMigration._read(options, this.key);\n const read = (key) => EditorSettingMigration._read(options, key);\n const write = (key, value) => EditorSettingMigration._write(options, key, value);\n this.migrate(value, read, write);\n }\n static _read(source, key) {\n if (typeof source === 'undefined') {\n return undefined;\n }\n const firstDotIndex = key.indexOf('.');\n if (firstDotIndex >= 0) {\n const firstSegment = key.substring(0, firstDotIndex);\n return this._read(source[firstSegment], key.substring(firstDotIndex + 1));\n }\n return source[key];\n }\n static _write(target, key, value) {\n const firstDotIndex = key.indexOf('.');\n if (firstDotIndex >= 0) {\n const firstSegment = key.substring(0, firstDotIndex);\n target[firstSegment] = target[firstSegment] || {};\n this._write(target[firstSegment], key.substring(firstDotIndex + 1), value);\n return;\n }\n target[key] = value;\n }\n}\nEditorSettingMigration.items = [];\nfunction registerEditorSettingMigration(key, migrate) {\n EditorSettingMigration.items.push(new EditorSettingMigration(key, migrate));\n}\nfunction registerSimpleEditorSettingMigration(key, values) {\n registerEditorSettingMigration(key, (value, read, write) => {\n if (typeof value !== 'undefined') {\n for (const [oldValue, newValue] of values) {\n if (value === oldValue) {\n write(key, newValue);\n return;\n }\n }\n }\n });\n}\n/**\n * Compatibility with old options\n */\nexport function migrateOptions(options) {\n EditorSettingMigration.items.forEach(migration => migration.apply(options));\n}\nregisterSimpleEditorSettingMigration('wordWrap', [[true, 'on'], [false, 'off']]);\nregisterSimpleEditorSettingMigration('lineNumbers', [[true, 'on'], [false, 'off']]);\nregisterSimpleEditorSettingMigration('cursorBlinking', [['visible', 'solid']]);\nregisterSimpleEditorSettingMigration('renderWhitespace', [[true, 'boundary'], [false, 'none']]);\nregisterSimpleEditorSettingMigration('renderLineHighlight', [[true, 'line'], [false, 'none']]);\nregisterSimpleEditorSettingMigration('acceptSuggestionOnEnter', [[true, 'on'], [false, 'off']]);\nregisterSimpleEditorSettingMigration('tabCompletion', [[false, 'off'], [true, 'onlySnippets']]);\nregisterSimpleEditorSettingMigration('hover', [[true, { enabled: true }], [false, { enabled: false }]]);\nregisterSimpleEditorSettingMigration('parameterHints', [[true, { enabled: true }], [false, { enabled: false }]]);\nregisterSimpleEditorSettingMigration('autoIndent', [[false, 'advanced'], [true, 'full']]);\nregisterSimpleEditorSettingMigration('matchBrackets', [[true, 'always'], [false, 'never']]);\nregisterSimpleEditorSettingMigration('renderFinalNewline', [[true, 'on'], [false, 'off']]);\nregisterSimpleEditorSettingMigration('cursorSmoothCaretAnimation', [[true, 'on'], [false, 'off']]);\nregisterSimpleEditorSettingMigration('occurrencesHighlight', [[true, 'singleFile'], [false, 'off']]);\nregisterSimpleEditorSettingMigration('wordBasedSuggestions', [[true, 'matchingDocuments'], [false, 'off']]);\nregisterEditorSettingMigration('autoClosingBrackets', (value, read, write) => {\n if (value === false) {\n write('autoClosingBrackets', 'never');\n if (typeof read('autoClosingQuotes') === 'undefined') {\n write('autoClosingQuotes', 'never');\n }\n if (typeof read('autoSurround') === 'undefined') {\n write('autoSurround', 'never');\n }\n }\n});\nregisterEditorSettingMigration('renderIndentGuides', (value, read, write) => {\n if (typeof value !== 'undefined') {\n write('renderIndentGuides', undefined);\n if (typeof read('guides.indentation') === 'undefined') {\n write('guides.indentation', !!value);\n }\n }\n});\nregisterEditorSettingMigration('highlightActiveIndentGuide', (value, read, write) => {\n if (typeof value !== 'undefined') {\n write('highlightActiveIndentGuide', undefined);\n if (typeof read('guides.highlightActiveIndentation') === 'undefined') {\n write('guides.highlightActiveIndentation', !!value);\n }\n }\n});\nconst suggestFilteredTypesMapping = {\n method: 'showMethods',\n function: 'showFunctions',\n constructor: 'showConstructors',\n deprecated: 'showDeprecated',\n field: 'showFields',\n variable: 'showVariables',\n class: 'showClasses',\n struct: 'showStructs',\n interface: 'showInterfaces',\n module: 'showModules',\n property: 'showProperties',\n event: 'showEvents',\n operator: 'showOperators',\n unit: 'showUnits',\n value: 'showValues',\n constant: 'showConstants',\n enum: 'showEnums',\n enumMember: 'showEnumMembers',\n keyword: 'showKeywords',\n text: 'showWords',\n color: 'showColors',\n file: 'showFiles',\n reference: 'showReferences',\n folder: 'showFolders',\n typeParameter: 'showTypeParameters',\n snippet: 'showSnippets',\n};\nregisterEditorSettingMigration('suggest.filteredTypes', (value, read, write) => {\n if (value && typeof value === 'object') {\n for (const entry of Object.entries(suggestFilteredTypesMapping)) {\n const v = value[entry[0]];\n if (v === false) {\n if (typeof read(`suggest.${entry[1]}`) === 'undefined') {\n write(`suggest.${entry[1]}`, false);\n }\n }\n }\n write('suggest.filteredTypes', undefined);\n }\n});\nregisterEditorSettingMigration('quickSuggestions', (input, read, write) => {\n if (typeof input === 'boolean') {\n const value = input ? 'on' : 'off';\n const newValue = { comments: value, strings: value, other: value };\n write('quickSuggestions', newValue);\n }\n});\n// Sticky Scroll\nregisterEditorSettingMigration('experimental.stickyScroll.enabled', (value, read, write) => {\n if (typeof value === 'boolean') {\n write('experimental.stickyScroll.enabled', undefined);\n if (typeof read('stickyScroll.enabled') === 'undefined') {\n write('stickyScroll.enabled', value);\n }\n }\n});\nregisterEditorSettingMigration('experimental.stickyScroll.maxLineCount', (value, read, write) => {\n if (typeof value === 'number') {\n write('experimental.stickyScroll.maxLineCount', undefined);\n if (typeof read('stickyScroll.maxLineCount') === 'undefined') {\n write('stickyScroll.maxLineCount', value);\n }\n }\n});\n// Code Actions on Save\nregisterEditorSettingMigration('codeActionsOnSave', (value, read, write) => {\n if (value && typeof value === 'object') {\n let toBeModified = false;\n const newValue = {};\n for (const entry of Object.entries(value)) {\n if (typeof entry[1] === 'boolean') {\n toBeModified = true;\n newValue[entry[0]] = entry[1] ? 'explicit' : 'never';\n }\n else {\n newValue[entry[0]] = entry[1];\n }\n }\n if (toBeModified) {\n write(`codeActionsOnSave`, newValue);\n }\n }\n});\n// Migrate Quick Fix Settings\nregisterEditorSettingMigration('codeActionWidget.includeNearbyQuickfixes', (value, read, write) => {\n if (typeof value === 'boolean') {\n write('codeActionWidget.includeNearbyQuickfixes', undefined);\n if (typeof read('codeActionWidget.includeNearbyQuickFixes') === 'undefined') {\n write('codeActionWidget.includeNearbyQuickFixes', value);\n }\n }\n});\n// Migrate the lightbulb settings\nregisterEditorSettingMigration('lightbulb.enabled', (value, read, write) => {\n if (typeof value === 'boolean') {\n write('lightbulb.enabled', value ? undefined : 'off');\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 *--------------------------------------------------------------------------------------------*/\nimport { Emitter } from '../../../base/common/event.js';\nclass TabFocusImpl {\n constructor() {\n this._tabFocus = false;\n this._onDidChangeTabFocus = new Emitter();\n this.onDidChangeTabFocus = this._onDidChangeTabFocus.event;\n }\n getTabFocusMode() {\n return this._tabFocus;\n }\n setTabFocusMode(tabFocusMode) {\n this._tabFocus = tabFocusMode;\n this._onDidChangeTabFocus.fire(this._tabFocus);\n }\n}\n/**\n * Control what pressing Tab does.\n * If it is false, pressing Tab or Shift-Tab will be handled by the editor.\n * If it is true, pressing Tab or Shift-Tab will move the browser focus.\n * Defaults to false.\n */\nexport const TabFocus = new TabFocusImpl();\n", "/*---------------------------------------------------------------------------------------------\n * 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 { RawContextKey } from '../../contextkey/common/contextkey.js';\nimport { createDecorator } from '../../instantiation/common/instantiation.js';\nexport const IAccessibilityService = createDecorator('accessibilityService');\nexport const CONTEXT_ACCESSIBILITY_MODE_ENABLED = new RawContextKey('accessibilityModeEnabled', false);\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};\nimport * as dom from '../../base/browser/dom.js';\nimport { createFastDomNode } from '../../base/browser/fastDomNode.js';\nimport { inputLatency } from '../../base/browser/performance.js';\nimport { BugIndicatingError, onUnexpectedError } from '../../base/common/errors.js';\nimport { PointerHandlerLastRenderData } from './controller/mouseTarget.js';\nimport { PointerHandler } from './controller/pointerHandler.js';\nimport { TextAreaHandler } from './controller/textAreaHandler.js';\nimport { RenderingContext } from './view/renderingContext.js';\nimport { ViewController } from './view/viewController.js';\nimport { ContentViewOverlays, MarginViewOverlays } from './view/viewOverlays.js';\nimport { PartFingerprints } from './view/viewPart.js';\nimport { ViewUserInputEvents } from './view/viewUserInputEvents.js';\nimport { BlockDecorations } from './viewParts/blockDecorations/blockDecorations.js';\nimport { ViewContentWidgets } from './viewParts/contentWidgets/contentWidgets.js';\nimport { CurrentLineHighlightOverlay, CurrentLineMarginHighlightOverlay } from './viewParts/currentLineHighlight/currentLineHighlight.js';\nimport { DecorationsOverlay } from './viewParts/decorations/decorations.js';\nimport { EditorScrollbar } from './viewParts/editorScrollbar/editorScrollbar.js';\nimport { GlyphMarginWidgets } from './viewParts/glyphMargin/glyphMargin.js';\nimport { IndentGuidesOverlay } from './viewParts/indentGuides/indentGuides.js';\nimport { LineNumbersOverlay } from './viewParts/lineNumbers/lineNumbers.js';\nimport { ViewLines } from './viewParts/lines/viewLines.js';\nimport { LinesDecorationsOverlay } from './viewParts/linesDecorations/linesDecorations.js';\nimport { Margin } from './viewParts/margin/margin.js';\nimport { MarginViewLineDecorationsOverlay } from './viewParts/marginDecorations/marginDecorations.js';\nimport { Minimap } from './viewParts/minimap/minimap.js';\nimport { ViewOverlayWidgets } from './viewParts/overlayWidgets/overlayWidgets.js';\nimport { DecorationsOverviewRuler } from './viewParts/overviewRuler/decorationsOverviewRuler.js';\nimport { OverviewRuler } from './viewParts/overviewRuler/overviewRuler.js';\nimport { Rulers } from './viewParts/rulers/rulers.js';\nimport { ScrollDecorationViewPart } from './viewParts/scrollDecoration/scrollDecoration.js';\nimport { SelectionsOverlay } from './viewParts/selections/selections.js';\nimport { ViewCursors } from './viewParts/viewCursors/viewCursors.js';\nimport { ViewZones } from './viewParts/viewZones/viewZones.js';\nimport { WhitespaceOverlay } from './viewParts/whitespace/whitespace.js';\nimport { Position } from '../common/core/position.js';\nimport { Range } from '../common/core/range.js';\nimport { Selection } from '../common/core/selection.js';\nimport { GlyphMarginLane } from '../common/model.js';\nimport { ViewEventHandler } from '../common/viewEventHandler.js';\nimport { ViewportData } from '../common/viewLayout/viewLinesViewportData.js';\nimport { ViewContext } from '../common/viewModel/viewContext.js';\nimport { IInstantiationService } from '../../platform/instantiation/common/instantiation.js';\nimport { getThemeTypeSelector } from '../../platform/theme/common/themeService.js';\nlet View = class View extends ViewEventHandler {\n constructor(commandDelegate, configuration, colorTheme, model, userInputEvents, overflowWidgetsDomNode, _instantiationService) {\n super();\n this._instantiationService = _instantiationService;\n // Actual mutable state\n this._shouldRecomputeGlyphMarginLanes = false;\n this._selections = [new Selection(1, 1, 1, 1)];\n this._renderAnimationFrame = null;\n const viewController = new ViewController(configuration, model, userInputEvents, commandDelegate);\n // The view context is passed on to most classes (basically to reduce param. counts in ctors)\n this._context = new ViewContext(configuration, colorTheme, model);\n // Ensure the view is the first event handler in order to update the layout\n this._context.addEventHandler(this);\n this._viewParts = [];\n // Keyboard handler\n this._textAreaHandler = this._instantiationService.createInstance(TextAreaHandler, this._context, viewController, this._createTextAreaHandlerHelper());\n this._viewParts.push(this._textAreaHandler);\n // These two dom nodes must be constructed up front, since references are needed in the layout provider (scrolling & co.)\n this._linesContent = createFastDomNode(document.createElement('div'));\n this._linesContent.setClassName('lines-content' + ' monaco-editor-background');\n this._linesContent.setPosition('absolute');\n this.domNode = createFastDomNode(document.createElement('div'));\n this.domNode.setClassName(this._getEditorClassName());\n // Set role 'code' for better screen reader support https://github.com/microsoft/vscode/issues/93438\n this.domNode.setAttribute('role', 'code');\n this._overflowGuardContainer = createFastDomNode(document.createElement('div'));\n PartFingerprints.write(this._overflowGuardContainer, 3 /* PartFingerprint.OverflowGuard */);\n this._overflowGuardContainer.setClassName('overflow-guard');\n this._scrollbar = new EditorScrollbar(this._context, this._linesContent, this.domNode, this._overflowGuardContainer);\n this._viewParts.push(this._scrollbar);\n // View Lines\n this._viewLines = new ViewLines(this._context, this._linesContent);\n // View Zones\n this._viewZones = new ViewZones(this._context);\n this._viewParts.push(this._viewZones);\n // Decorations overview ruler\n const decorationsOverviewRuler = new DecorationsOverviewRuler(this._context);\n this._viewParts.push(decorationsOverviewRuler);\n const scrollDecoration = new ScrollDecorationViewPart(this._context);\n this._viewParts.push(scrollDecoration);\n const contentViewOverlays = new ContentViewOverlays(this._context);\n this._viewParts.push(contentViewOverlays);\n contentViewOverlays.addDynamicOverlay(new CurrentLineHighlightOverlay(this._context));\n contentViewOverlays.addDynamicOverlay(new SelectionsOverlay(this._context));\n contentViewOverlays.addDynamicOverlay(new IndentGuidesOverlay(this._context));\n contentViewOverlays.addDynamicOverlay(new DecorationsOverlay(this._context));\n contentViewOverlays.addDynamicOverlay(new WhitespaceOverlay(this._context));\n const marginViewOverlays = new MarginViewOverlays(this._context);\n this._viewParts.push(marginViewOverlays);\n marginViewOverlays.addDynamicOverlay(new CurrentLineMarginHighlightOverlay(this._context));\n marginViewOverlays.addDynamicOverlay(new MarginViewLineDecorationsOverlay(this._context));\n marginViewOverlays.addDynamicOverlay(new LinesDecorationsOverlay(this._context));\n marginViewOverlays.addDynamicOverlay(new LineNumbersOverlay(this._context));\n // Glyph margin widgets\n this._glyphMarginWidgets = new GlyphMarginWidgets(this._context);\n this._viewParts.push(this._glyphMarginWidgets);\n const margin = new Margin(this._context);\n margin.getDomNode().appendChild(this._viewZones.marginDomNode);\n margin.getDomNode().appendChild(marginViewOverlays.getDomNode());\n margin.getDomNode().appendChild(this._glyphMarginWidgets.domNode);\n this._viewParts.push(margin);\n // Content widgets\n this._contentWidgets = new ViewContentWidgets(this._context, this.domNode);\n this._viewParts.push(this._contentWidgets);\n this._viewCursors = new ViewCursors(this._context);\n this._viewParts.push(this._viewCursors);\n // Overlay widgets\n this._overlayWidgets = new ViewOverlayWidgets(this._context, this.domNode);\n this._viewParts.push(this._overlayWidgets);\n const rulers = new Rulers(this._context);\n this._viewParts.push(rulers);\n const blockOutline = new BlockDecorations(this._context);\n this._viewParts.push(blockOutline);\n const minimap = new Minimap(this._context);\n this._viewParts.push(minimap);\n // -------------- Wire dom nodes up\n if (decorationsOverviewRuler) {\n const overviewRulerData = this._scrollbar.getOverviewRulerLayoutInfo();\n overviewRulerData.parent.insertBefore(decorationsOverviewRuler.getDomNode(), overviewRulerData.insertBefore);\n }\n this._linesContent.appendChild(contentViewOverlays.getDomNode());\n this._linesContent.appendChild(rulers.domNode);\n this._linesContent.appendChild(this._viewZones.domNode);\n this._linesContent.appendChild(this._viewLines.getDomNode());\n this._linesContent.appendChild(this._contentWidgets.domNode);\n this._linesContent.appendChild(this._viewCursors.getDomNode());\n this._overflowGuardContainer.appendChild(margin.getDomNode());\n this._overflowGuardContainer.appendChild(this._scrollbar.getDomNode());\n this._overflowGuardContainer.appendChild(scrollDecoration.getDomNode());\n this._overflowGuardContainer.appendChild(this._textAreaHandler.textArea);\n this._overflowGuardContainer.appendChild(this._textAreaHandler.textAreaCover);\n this._overflowGuardContainer.appendChild(this._overlayWidgets.getDomNode());\n this._overflowGuardContainer.appendChild(minimap.getDomNode());\n this._overflowGuardContainer.appendChild(blockOutline.domNode);\n this.domNode.appendChild(this._overflowGuardContainer);\n if (overflowWidgetsDomNode) {\n overflowWidgetsDomNode.appendChild(this._contentWidgets.overflowingContentWidgetsDomNode.domNode);\n overflowWidgetsDomNode.appendChild(this._overlayWidgets.overflowingOverlayWidgetsDomNode.domNode);\n }\n else {\n this.domNode.appendChild(this._contentWidgets.overflowingContentWidgetsDomNode);\n this.domNode.appendChild(this._overlayWidgets.overflowingOverlayWidgetsDomNode);\n }\n this._applyLayout();\n // Pointer handler\n this._pointerHandler = this._register(new PointerHandler(this._context, viewController, this._createPointerHandlerHelper()));\n }\n _computeGlyphMarginLanes() {\n const model = this._context.viewModel.model;\n const laneModel = this._context.viewModel.glyphLanes;\n let glyphs = [];\n let maxLineNumber = 0;\n // Add all margin decorations\n glyphs = glyphs.concat(model.getAllMarginDecorations().map((decoration) => {\n var _a, _b, _c;\n const lane = (_b = (_a = decoration.options.glyphMargin) === null || _a === void 0 ? void 0 : _a.position) !== null && _b !== void 0 ? _b : GlyphMarginLane.Center;\n maxLineNumber = Math.max(maxLineNumber, decoration.range.endLineNumber);\n return { range: decoration.range, lane, persist: (_c = decoration.options.glyphMargin) === null || _c === void 0 ? void 0 : _c.persistLane };\n }));\n // Add all glyph margin widgets\n glyphs = glyphs.concat(this._glyphMarginWidgets.getWidgets().map((widget) => {\n const range = model.validateRange(widget.preference.range);\n maxLineNumber = Math.max(maxLineNumber, range.endLineNumber);\n return { range, lane: widget.preference.lane };\n }));\n // Sorted by their start position\n glyphs.sort((a, b) => Range.compareRangesUsingStarts(a.range, b.range));\n laneModel.reset(maxLineNumber);\n for (const glyph of glyphs) {\n laneModel.push(glyph.lane, glyph.range, glyph.persist);\n }\n return laneModel;\n }\n _createPointerHandlerHelper() {\n return {\n viewDomNode: this.domNode.domNode,\n linesContentDomNode: this._linesContent.domNode,\n viewLinesDomNode: this._viewLines.getDomNode().domNode,\n focusTextArea: () => {\n this.focus();\n },\n dispatchTextAreaEvent: (event) => {\n this._textAreaHandler.textArea.domNode.dispatchEvent(event);\n },\n getLastRenderData: () => {\n const lastViewCursorsRenderData = this._viewCursors.getLastRenderData() || [];\n const lastTextareaPosition = this._textAreaHandler.getLastRenderData();\n return new PointerHandlerLastRenderData(lastViewCursorsRenderData, lastTextareaPosition);\n },\n renderNow: () => {\n this.render(true, false);\n },\n shouldSuppressMouseDownOnViewZone: (viewZoneId) => {\n return this._viewZones.shouldSuppressMouseDownOnViewZone(viewZoneId);\n },\n shouldSuppressMouseDownOnWidget: (widgetId) => {\n return this._contentWidgets.shouldSuppressMouseDownOnWidget(widgetId);\n },\n getPositionFromDOMInfo: (spanNode, offset) => {\n this._flushAccumulatedAndRenderNow();\n return this._viewLines.getPositionFromDOMInfo(spanNode, offset);\n },\n visibleRangeForPosition: (lineNumber, column) => {\n this._flushAccumulatedAndRenderNow();\n return this._viewLines.visibleRangeForPosition(new Position(lineNumber, column));\n },\n getLineWidth: (lineNumber) => {\n this._flushAccumulatedAndRenderNow();\n return this._viewLines.getLineWidth(lineNumber);\n }\n };\n }\n _createTextAreaHandlerHelper() {\n return {\n visibleRangeForPosition: (position) => {\n this._flushAccumulatedAndRenderNow();\n return this._viewLines.visibleRangeForPosition(position);\n }\n };\n }\n _applyLayout() {\n const options = this._context.configuration.options;\n const layoutInfo = options.get(145 /* EditorOption.layoutInfo */);\n this.domNode.setWidth(layoutInfo.width);\n this.domNode.setHeight(layoutInfo.height);\n this._overflowGuardContainer.setWidth(layoutInfo.width);\n this._overflowGuardContainer.setHeight(layoutInfo.height);\n // https://stackoverflow.com/questions/38905916/content-in-google-chrome-larger-than-16777216-px-not-being-rendered\n this._linesContent.setWidth(16777216);\n this._linesContent.setHeight(16777216);\n }\n _getEditorClassName() {\n const focused = this._textAreaHandler.isFocused() ? ' focused' : '';\n return this._context.configuration.options.get(142 /* EditorOption.editorClassName */) + ' ' + getThemeTypeSelector(this._context.theme.type) + focused;\n }\n // --- begin event handlers\n handleEvents(events) {\n super.handleEvents(events);\n this._scheduleRender();\n }\n onConfigurationChanged(e) {\n this.domNode.setClassName(this._getEditorClassName());\n this._applyLayout();\n return false;\n }\n onCursorStateChanged(e) {\n this._selections = e.selections;\n return false;\n }\n onDecorationsChanged(e) {\n if (e.affectsGlyphMargin) {\n this._shouldRecomputeGlyphMarginLanes = true;\n }\n return false;\n }\n onFocusChanged(e) {\n this.domNode.setClassName(this._getEditorClassName());\n return false;\n }\n onThemeChanged(e) {\n this._context.theme.update(e.theme);\n this.domNode.setClassName(this._getEditorClassName());\n return false;\n }\n // --- end event handlers\n dispose() {\n if (this._renderAnimationFrame !== null) {\n this._renderAnimationFrame.dispose();\n this._renderAnimationFrame = null;\n }\n this._contentWidgets.overflowingContentWidgetsDomNode.domNode.remove();\n this._context.removeEventHandler(this);\n this._viewLines.dispose();\n // Destroy view parts\n for (const viewPart of this._viewParts) {\n viewPart.dispose();\n }\n super.dispose();\n }\n _scheduleRender() {\n if (this._store.isDisposed) {\n throw new BugIndicatingError();\n }\n if (this._renderAnimationFrame === null) {\n const rendering = this._createCoordinatedRendering();\n this._renderAnimationFrame = EditorRenderingCoordinator.INSTANCE.scheduleCoordinatedRendering({\n window: dom.getWindow(this.domNode.domNode),\n prepareRenderText: () => {\n if (this._store.isDisposed) {\n throw new BugIndicatingError();\n }\n try {\n return rendering.prepareRenderText();\n }\n finally {\n this._renderAnimationFrame = null;\n }\n },\n renderText: () => {\n if (this._store.isDisposed) {\n throw new BugIndicatingError();\n }\n return rendering.renderText();\n },\n prepareRender: (viewParts, ctx) => {\n if (this._store.isDisposed) {\n throw new BugIndicatingError();\n }\n return rendering.prepareRender(viewParts, ctx);\n },\n render: (viewParts, ctx) => {\n if (this._store.isDisposed) {\n throw new BugIndicatingError();\n }\n return rendering.render(viewParts, ctx);\n }\n });\n }\n }\n _flushAccumulatedAndRenderNow() {\n const rendering = this._createCoordinatedRendering();\n safeInvokeNoArg(() => rendering.prepareRenderText());\n const data = safeInvokeNoArg(() => rendering.renderText());\n if (data) {\n const [viewParts, ctx] = data;\n safeInvokeNoArg(() => rendering.prepareRender(viewParts, ctx));\n safeInvokeNoArg(() => rendering.render(viewParts, ctx));\n }\n }\n _getViewPartsToRender() {\n const result = [];\n let resultLen = 0;\n for (const viewPart of this._viewParts) {\n if (viewPart.shouldRender()) {\n result[resultLen++] = viewPart;\n }\n }\n return result;\n }\n _createCoordinatedRendering() {\n return {\n prepareRenderText: () => {\n if (this._shouldRecomputeGlyphMarginLanes) {\n this._shouldRecomputeGlyphMarginLanes = false;\n const model = this._computeGlyphMarginLanes();\n this._context.configuration.setGlyphMarginDecorationLaneCount(model.requiredLanes);\n }\n inputLatency.onRenderStart();\n },\n renderText: () => {\n if (!this.domNode.domNode.isConnected) {\n return null;\n }\n let viewPartsToRender = this._getViewPartsToRender();\n if (!this._viewLines.shouldRender() && viewPartsToRender.length === 0) {\n // Nothing to render\n return null;\n }\n const partialViewportData = this._context.viewLayout.getLinesViewportData();\n this._context.viewModel.setViewport(partialViewportData.startLineNumber, partialViewportData.endLineNumber, partialViewportData.centeredLineNumber);\n const viewportData = new ViewportData(this._selections, partialViewportData, this._context.viewLayout.getWhitespaceViewportData(), this._context.viewModel);\n if (this._contentWidgets.shouldRender()) {\n // Give the content widgets a chance to set their max width before a possible synchronous layout\n this._contentWidgets.onBeforeRender(viewportData);\n }\n if (this._viewLines.shouldRender()) {\n this._viewLines.renderText(viewportData);\n this._viewLines.onDidRender();\n // Rendering of viewLines might cause scroll events to occur, so collect view parts to render again\n viewPartsToRender = this._getViewPartsToRender();\n }\n return [viewPartsToRender, new RenderingContext(this._context.viewLayout, viewportData, this._viewLines)];\n },\n prepareRender: (viewPartsToRender, ctx) => {\n for (const viewPart of viewPartsToRender) {\n viewPart.prepareRender(ctx);\n }\n },\n render: (viewPartsToRender, ctx) => {\n for (const viewPart of viewPartsToRender) {\n viewPart.render(ctx);\n viewPart.onDidRender();\n }\n }\n };\n }\n // --- BEGIN CodeEditor helpers\n delegateVerticalScrollbarPointerDown(browserEvent) {\n this._scrollbar.delegateVerticalScrollbarPointerDown(browserEvent);\n }\n delegateScrollFromMouseWheelEvent(browserEvent) {\n this._scrollbar.delegateScrollFromMouseWheelEvent(browserEvent);\n }\n restoreState(scrollPosition) {\n this._context.viewModel.viewLayout.setScrollPosition({\n scrollTop: scrollPosition.scrollTop,\n scrollLeft: scrollPosition.scrollLeft\n }, 1 /* ScrollType.Immediate */);\n this._context.viewModel.visibleLinesStabilized();\n }\n getOffsetForColumn(modelLineNumber, modelColumn) {\n const modelPosition = this._context.viewModel.model.validatePosition({\n lineNumber: modelLineNumber,\n column: modelColumn\n });\n const viewPosition = this._context.viewModel.coordinatesConverter.convertModelPositionToViewPosition(modelPosition);\n this._flushAccumulatedAndRenderNow();\n const visibleRange = this._viewLines.visibleRangeForPosition(new Position(viewPosition.lineNumber, viewPosition.column));\n if (!visibleRange) {\n return -1;\n }\n return visibleRange.left;\n }\n getTargetAtClientPoint(clientX, clientY) {\n const mouseTarget = this._pointerHandler.getTargetAtClientPoint(clientX, clientY);\n if (!mouseTarget) {\n return null;\n }\n return ViewUserInputEvents.convertViewToModelMouseTarget(mouseTarget, this._context.viewModel.coordinatesConverter);\n }\n createOverviewRuler(cssClassName) {\n return new OverviewRuler(this._context, cssClassName);\n }\n change(callback) {\n this._viewZones.changeViewZones(callback);\n this._scheduleRender();\n }\n render(now, everything) {\n if (everything) {\n // Force everything to render...\n this._viewLines.forceShouldRender();\n for (const viewPart of this._viewParts) {\n viewPart.forceShouldRender();\n }\n }\n if (now) {\n this._flushAccumulatedAndRenderNow();\n }\n else {\n this._scheduleRender();\n }\n }\n writeScreenReaderContent(reason) {\n this._textAreaHandler.writeScreenReaderContent(reason);\n }\n focus() {\n this._textAreaHandler.focusTextArea();\n }\n isFocused() {\n return this._textAreaHandler.isFocused();\n }\n setAriaOptions(options) {\n this._textAreaHandler.setAriaOptions(options);\n }\n addContentWidget(widgetData) {\n this._contentWidgets.addWidget(widgetData.widget);\n this.layoutContentWidget(widgetData);\n this._scheduleRender();\n }\n layoutContentWidget(widgetData) {\n var _a, _b, _c, _d, _e, _f, _g, _h;\n this._contentWidgets.setWidgetPosition(widgetData.widget, (_b = (_a = widgetData.position) === null || _a === void 0 ? void 0 : _a.position) !== null && _b !== void 0 ? _b : null, (_d = (_c = widgetData.position) === null || _c === void 0 ? void 0 : _c.secondaryPosition) !== null && _d !== void 0 ? _d : null, (_f = (_e = widgetData.position) === null || _e === void 0 ? void 0 : _e.preference) !== null && _f !== void 0 ? _f : null, (_h = (_g = widgetData.position) === null || _g === void 0 ? void 0 : _g.positionAffinity) !== null && _h !== void 0 ? _h : null);\n this._scheduleRender();\n }\n removeContentWidget(widgetData) {\n this._contentWidgets.removeWidget(widgetData.widget);\n this._scheduleRender();\n }\n addOverlayWidget(widgetData) {\n this._overlayWidgets.addWidget(widgetData.widget);\n this.layoutOverlayWidget(widgetData);\n this._scheduleRender();\n }\n layoutOverlayWidget(widgetData) {\n const newPreference = widgetData.position ? widgetData.position.preference : null;\n const shouldRender = this._overlayWidgets.setWidgetPosition(widgetData.widget, newPreference);\n if (shouldRender) {\n this._scheduleRender();\n }\n }\n removeOverlayWidget(widgetData) {\n this._overlayWidgets.removeWidget(widgetData.widget);\n this._scheduleRender();\n }\n addGlyphMarginWidget(widgetData) {\n this._glyphMarginWidgets.addWidget(widgetData.widget);\n this._shouldRecomputeGlyphMarginLanes = true;\n this._scheduleRender();\n }\n layoutGlyphMarginWidget(widgetData) {\n const newPreference = widgetData.position;\n const shouldRender = this._glyphMarginWidgets.setWidgetPosition(widgetData.widget, newPreference);\n if (shouldRender) {\n this._shouldRecomputeGlyphMarginLanes = true;\n this._scheduleRender();\n }\n }\n removeGlyphMarginWidget(widgetData) {\n this._glyphMarginWidgets.removeWidget(widgetData.widget);\n this._shouldRecomputeGlyphMarginLanes = true;\n this._scheduleRender();\n }\n};\nView = __decorate([\n __param(6, IInstantiationService)\n], View);\nexport { View };\nfunction safeInvokeNoArg(func) {\n try {\n return func();\n }\n catch (e) {\n onUnexpectedError(e);\n return null;\n }\n}\nclass EditorRenderingCoordinator {\n constructor() {\n this._coordinatedRenderings = [];\n this._animationFrameRunners = new Map();\n }\n scheduleCoordinatedRendering(rendering) {\n this._coordinatedRenderings.push(rendering);\n this._scheduleRender(rendering.window);\n return {\n dispose: () => {\n const renderingIndex = this._coordinatedRenderings.indexOf(rendering);\n if (renderingIndex === -1) {\n return;\n }\n this._coordinatedRenderings.splice(renderingIndex, 1);\n if (this._coordinatedRenderings.length === 0) {\n // There are no more renderings to coordinate => cancel animation frames\n for (const [_, disposable] of this._animationFrameRunners) {\n disposable.dispose();\n }\n this._animationFrameRunners.clear();\n }\n }\n };\n }\n _scheduleRender(window) {\n if (!this._animationFrameRunners.has(window)) {\n const runner = () => {\n this._animationFrameRunners.delete(window);\n this._onRenderScheduled();\n };\n this._animationFrameRunners.set(window, dom.runAtThisOrScheduleAtNextAnimationFrame(window, runner, 100));\n }\n }\n _onRenderScheduled() {\n const coordinatedRenderings = this._coordinatedRenderings.slice(0);\n this._coordinatedRenderings = [];\n for (const rendering of coordinatedRenderings) {\n safeInvokeNoArg(() => rendering.prepareRenderText());\n }\n const datas = [];\n for (let i = 0, len = coordinatedRenderings.length; i < len; i++) {\n const rendering = coordinatedRenderings[i];\n datas[i] = safeInvokeNoArg(() => rendering.renderText());\n }\n for (let i = 0, len = coordinatedRenderings.length; i < len; i++) {\n const rendering = coordinatedRenderings[i];\n const data = datas[i];\n if (!data) {\n continue;\n }\n const [viewParts, ctx] = data;\n safeInvokeNoArg(() => rendering.prepareRender(viewParts, ctx));\n }\n for (let i = 0, len = coordinatedRenderings.length; i < len; i++) {\n const rendering = coordinatedRenderings[i];\n const data = datas[i];\n if (!data) {\n continue;\n }\n const [viewParts, ctx] = data;\n safeInvokeNoArg(() => rendering.render(viewParts, ctx));\n }\n }\n}\nEditorRenderingCoordinator.INSTANCE = new EditorRenderingCoordinator();\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nexport var inputLatency;\n(function (inputLatency) {\n const totalKeydownTime = { total: 0, min: Number.MAX_VALUE, max: 0 };\n const totalInputTime = { ...totalKeydownTime };\n const totalRenderTime = { ...totalKeydownTime };\n const totalInputLatencyTime = { ...totalKeydownTime };\n let measurementsCount = 0;\n const state = {\n keydown: 0 /* EventPhase.Before */,\n input: 0 /* EventPhase.Before */,\n render: 0 /* EventPhase.Before */,\n };\n /**\n * Record the start of the keydown event.\n */\n function onKeyDown() {\n /** Direct Check C. See explanation in {@link recordIfFinished} */\n recordIfFinished();\n performance.mark('inputlatency/start');\n performance.mark('keydown/start');\n state.keydown = 1 /* EventPhase.InProgress */;\n queueMicrotask(markKeyDownEnd);\n }\n inputLatency.onKeyDown = onKeyDown;\n /**\n * Mark the end of the keydown event.\n */\n function markKeyDownEnd() {\n if (state.keydown === 1 /* EventPhase.InProgress */) {\n performance.mark('keydown/end');\n state.keydown = 2 /* EventPhase.Finished */;\n }\n }\n /**\n * Record the start of the beforeinput event.\n */\n function onBeforeInput() {\n performance.mark('input/start');\n state.input = 1 /* EventPhase.InProgress */;\n /** Schedule Task A. See explanation in {@link recordIfFinished} */\n scheduleRecordIfFinishedTask();\n }\n inputLatency.onBeforeInput = onBeforeInput;\n /**\n * Record the start of the input event.\n */\n function onInput() {\n if (state.input === 0 /* EventPhase.Before */) {\n // it looks like we didn't receive a `beforeinput`\n onBeforeInput();\n }\n queueMicrotask(markInputEnd);\n }\n inputLatency.onInput = onInput;\n function markInputEnd() {\n if (state.input === 1 /* EventPhase.InProgress */) {\n performance.mark('input/end');\n state.input = 2 /* EventPhase.Finished */;\n }\n }\n /**\n * Record the start of the keyup event.\n */\n function onKeyUp() {\n /** Direct Check D. See explanation in {@link recordIfFinished} */\n recordIfFinished();\n }\n inputLatency.onKeyUp = onKeyUp;\n /**\n * Record the start of the selectionchange event.\n */\n function onSelectionChange() {\n /** Direct Check E. See explanation in {@link recordIfFinished} */\n recordIfFinished();\n }\n inputLatency.onSelectionChange = onSelectionChange;\n /**\n * Record the start of the animation frame performing the rendering.\n */\n function onRenderStart() {\n // Render may be triggered during input, but we only measure the following animation frame\n if (state.keydown === 2 /* EventPhase.Finished */ && state.input === 2 /* EventPhase.Finished */ && state.render === 0 /* EventPhase.Before */) {\n // Only measure the first render after keyboard input\n performance.mark('render/start');\n state.render = 1 /* EventPhase.InProgress */;\n queueMicrotask(markRenderEnd);\n /** Schedule Task B. See explanation in {@link recordIfFinished} */\n scheduleRecordIfFinishedTask();\n }\n }\n inputLatency.onRenderStart = onRenderStart;\n /**\n * Mark the end of the animation frame performing the rendering.\n */\n function markRenderEnd() {\n if (state.render === 1 /* EventPhase.InProgress */) {\n performance.mark('render/end');\n state.render = 2 /* EventPhase.Finished */;\n }\n }\n function scheduleRecordIfFinishedTask() {\n // Here we can safely assume that the `setTimeout` will not be\n // artificially delayed by 4ms because we schedule it from\n // event handlers\n setTimeout(recordIfFinished);\n }\n /**\n * Record the input latency sample if input handling and rendering are finished.\n *\n * The challenge here is that we want to record the latency in such a way that it includes\n * also the layout and painting work the browser does during the animation frame task.\n *\n * Simply scheduling a new task (via `setTimeout`) from the animation frame task would\n * schedule the new task at the end of the task queue (after other code that uses `setTimeout`),\n * so we need to use multiple strategies to make sure our task runs before others:\n *\n * We schedule tasks (A and B):\n * - we schedule a task A (via a `setTimeout` call) when the input starts in `markInputStart`.\n * If the animation frame task is scheduled quickly by the browser, then task A has a very good\n * chance of being the very first task after the animation frame and thus will record the input latency.\n * - however, if the animation frame task is scheduled a bit later, then task A might execute\n * before the animation frame task. We therefore schedule another task B from `markRenderStart`.\n *\n * We do direct checks in browser event handlers (C, D, E):\n * - if the browser has multiple keydown events queued up, they will be scheduled before the `setTimeout` tasks,\n * so we do a direct check in the keydown event handler (C).\n * - depending on timing, sometimes the animation frame is scheduled even before the `keyup` event, so we\n * do a direct check there too (E).\n * - the browser oftentimes emits a `selectionchange` event after an `input`, so we do a direct check there (D).\n */\n function recordIfFinished() {\n if (state.keydown === 2 /* EventPhase.Finished */ && state.input === 2 /* EventPhase.Finished */ && state.render === 2 /* EventPhase.Finished */) {\n performance.mark('inputlatency/end');\n performance.measure('keydown', 'keydown/start', 'keydown/end');\n performance.measure('input', 'input/start', 'input/end');\n performance.measure('render', 'render/start', 'render/end');\n performance.measure('inputlatency', 'inputlatency/start', 'inputlatency/end');\n addMeasure('keydown', totalKeydownTime);\n addMeasure('input', totalInputTime);\n addMeasure('render', totalRenderTime);\n addMeasure('inputlatency', totalInputLatencyTime);\n // console.info(\n // \t`input latency=${performance.getEntriesByName('inputlatency')[0].duration.toFixed(1)} [` +\n // \t`keydown=${performance.getEntriesByName('keydown')[0].duration.toFixed(1)}, ` +\n // \t`input=${performance.getEntriesByName('input')[0].duration.toFixed(1)}, ` +\n // \t`render=${performance.getEntriesByName('render')[0].duration.toFixed(1)}` +\n // \t`]`\n // );\n measurementsCount++;\n reset();\n }\n }\n function addMeasure(entryName, cumulativeMeasurement) {\n const duration = performance.getEntriesByName(entryName)[0].duration;\n cumulativeMeasurement.total += duration;\n cumulativeMeasurement.min = Math.min(cumulativeMeasurement.min, duration);\n cumulativeMeasurement.max = Math.max(cumulativeMeasurement.max, duration);\n }\n /**\n * Clear the current sample.\n */\n function reset() {\n performance.clearMarks('keydown/start');\n performance.clearMarks('keydown/end');\n performance.clearMarks('input/start');\n performance.clearMarks('input/end');\n performance.clearMarks('render/start');\n performance.clearMarks('render/end');\n performance.clearMarks('inputlatency/start');\n performance.clearMarks('inputlatency/end');\n performance.clearMeasures('keydown');\n performance.clearMeasures('input');\n performance.clearMeasures('render');\n performance.clearMeasures('inputlatency');\n state.keydown = 0 /* EventPhase.Before */;\n state.input = 0 /* EventPhase.Before */;\n state.render = 0 /* EventPhase.Before */;\n }\n /**\n * Gets all input latency samples and clears the internal buffers to start recording a new set\n * of samples.\n */\n function getAndClearMeasurements() {\n if (measurementsCount === 0) {\n return undefined;\n }\n // Assemble the result\n const result = {\n keydown: cumulativeToFinalMeasurement(totalKeydownTime),\n input: cumulativeToFinalMeasurement(totalInputTime),\n render: cumulativeToFinalMeasurement(totalRenderTime),\n total: cumulativeToFinalMeasurement(totalInputLatencyTime),\n sampleCount: measurementsCount\n };\n // Clear the cumulative measurements\n clearCumulativeMeasurement(totalKeydownTime);\n clearCumulativeMeasurement(totalInputTime);\n clearCumulativeMeasurement(totalRenderTime);\n clearCumulativeMeasurement(totalInputLatencyTime);\n measurementsCount = 0;\n return result;\n }\n inputLatency.getAndClearMeasurements = getAndClearMeasurements;\n function cumulativeToFinalMeasurement(cumulative) {\n return {\n average: cumulative.total / measurementsCount,\n max: cumulative.max,\n min: cumulative.min,\n };\n }\n function clearCumulativeMeasurement(cumulative) {\n cumulative.total = 0;\n cumulative.min = Number.MAX_VALUE;\n cumulative.max = 0;\n }\n})(inputLatency || (inputLatency = {}));\n", "/*---------------------------------------------------------------------------------------------\n * 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 { PageCoordinates } from '../editorDom.js';\nimport { PartFingerprints } from '../view/viewPart.js';\nimport { ViewLine } from '../viewParts/lines/viewLine.js';\nimport { Position } from '../../common/core/position.js';\nimport { Range as EditorRange } from '../../common/core/range.js';\nimport { CursorColumns } from '../../common/core/cursorColumns.js';\nimport * as dom from '../../../base/browser/dom.js';\nimport { AtomicTabMoveOperations } from '../../common/cursor/cursorAtomicMoveOperations.js';\nimport { Lazy } from '../../../base/common/lazy.js';\nclass UnknownHitTestResult {\n constructor(hitTarget = null) {\n this.hitTarget = hitTarget;\n this.type = 0 /* HitTestResultType.Unknown */;\n }\n}\nclass ContentHitTestResult {\n get hitTarget() { return this.spanNode; }\n constructor(position, spanNode, injectedText) {\n this.position = position;\n this.spanNode = spanNode;\n this.injectedText = injectedText;\n this.type = 1 /* HitTestResultType.Content */;\n }\n}\nvar HitTestResult;\n(function (HitTestResult) {\n function createFromDOMInfo(ctx, spanNode, offset) {\n const position = ctx.getPositionFromDOMInfo(spanNode, offset);\n if (position) {\n return new ContentHitTestResult(position, spanNode, null);\n }\n return new UnknownHitTestResult(spanNode);\n }\n HitTestResult.createFromDOMInfo = createFromDOMInfo;\n})(HitTestResult || (HitTestResult = {}));\nexport class PointerHandlerLastRenderData {\n constructor(lastViewCursorsRenderData, lastTextareaPosition) {\n this.lastViewCursorsRenderData = lastViewCursorsRenderData;\n this.lastTextareaPosition = lastTextareaPosition;\n }\n}\nexport class MouseTarget {\n static _deduceRage(position, range = null) {\n if (!range && position) {\n return new EditorRange(position.lineNumber, position.column, position.lineNumber, position.column);\n }\n return range !== null && range !== void 0 ? range : null;\n }\n static createUnknown(element, mouseColumn, position) {\n return { type: 0 /* MouseTargetType.UNKNOWN */, element, mouseColumn, position, range: this._deduceRage(position) };\n }\n static createTextarea(element, mouseColumn) {\n return { type: 1 /* MouseTargetType.TEXTAREA */, element, mouseColumn, position: null, range: null };\n }\n static createMargin(type, element, mouseColumn, position, range, detail) {\n return { type, element, mouseColumn, position, range, detail };\n }\n static createViewZone(type, element, mouseColumn, position, detail) {\n return { type, element, mouseColumn, position, range: this._deduceRage(position), detail };\n }\n static createContentText(element, mouseColumn, position, range, detail) {\n return { type: 6 /* MouseTargetType.CONTENT_TEXT */, element, mouseColumn, position, range: this._deduceRage(position, range), detail };\n }\n static createContentEmpty(element, mouseColumn, position, detail) {\n return { type: 7 /* MouseTargetType.CONTENT_EMPTY */, element, mouseColumn, position, range: this._deduceRage(position), detail };\n }\n static createContentWidget(element, mouseColumn, detail) {\n return { type: 9 /* MouseTargetType.CONTENT_WIDGET */, element, mouseColumn, position: null, range: null, detail };\n }\n static createScrollbar(element, mouseColumn, position) {\n return { type: 11 /* MouseTargetType.SCROLLBAR */, element, mouseColumn, position, range: this._deduceRage(position) };\n }\n static createOverlayWidget(element, mouseColumn, detail) {\n return { type: 12 /* MouseTargetType.OVERLAY_WIDGET */, element, mouseColumn, position: null, range: null, detail };\n }\n static createOutsideEditor(mouseColumn, position, outsidePosition, outsideDistance) {\n return { type: 13 /* MouseTargetType.OUTSIDE_EDITOR */, element: null, mouseColumn, position, range: this._deduceRage(position), outsidePosition, outsideDistance };\n }\n static _typeToString(type) {\n if (type === 1 /* MouseTargetType.TEXTAREA */) {\n return 'TEXTAREA';\n }\n if (type === 2 /* MouseTargetType.GUTTER_GLYPH_MARGIN */) {\n return 'GUTTER_GLYPH_MARGIN';\n }\n if (type === 3 /* MouseTargetType.GUTTER_LINE_NUMBERS */) {\n return 'GUTTER_LINE_NUMBERS';\n }\n if (type === 4 /* MouseTargetType.GUTTER_LINE_DECORATIONS */) {\n return 'GUTTER_LINE_DECORATIONS';\n }\n if (type === 5 /* MouseTargetType.GUTTER_VIEW_ZONE */) {\n return 'GUTTER_VIEW_ZONE';\n }\n if (type === 6 /* MouseTargetType.CONTENT_TEXT */) {\n return 'CONTENT_TEXT';\n }\n if (type === 7 /* MouseTargetType.CONTENT_EMPTY */) {\n return 'CONTENT_EMPTY';\n }\n if (type === 8 /* MouseTargetType.CONTENT_VIEW_ZONE */) {\n return 'CONTENT_VIEW_ZONE';\n }\n if (type === 9 /* MouseTargetType.CONTENT_WIDGET */) {\n return 'CONTENT_WIDGET';\n }\n if (type === 10 /* MouseTargetType.OVERVIEW_RULER */) {\n return 'OVERVIEW_RULER';\n }\n if (type === 11 /* MouseTargetType.SCROLLBAR */) {\n return 'SCROLLBAR';\n }\n if (type === 12 /* MouseTargetType.OVERLAY_WIDGET */) {\n return 'OVERLAY_WIDGET';\n }\n return 'UNKNOWN';\n }\n static toString(target) {\n return this._typeToString(target.type) + ': ' + target.position + ' - ' + target.range + ' - ' + JSON.stringify(target.detail);\n }\n}\nclass ElementPath {\n static isTextArea(path) {\n return (path.length === 2\n && path[0] === 3 /* PartFingerprint.OverflowGuard */\n && path[1] === 7 /* PartFingerprint.TextArea */);\n }\n static isChildOfViewLines(path) {\n return (path.length >= 4\n && path[0] === 3 /* PartFingerprint.OverflowGuard */\n && path[3] === 8 /* PartFingerprint.ViewLines */);\n }\n static isStrictChildOfViewLines(path) {\n return (path.length > 4\n && path[0] === 3 /* PartFingerprint.OverflowGuard */\n && path[3] === 8 /* PartFingerprint.ViewLines */);\n }\n static isChildOfScrollableElement(path) {\n return (path.length >= 2\n && path[0] === 3 /* PartFingerprint.OverflowGuard */\n && path[1] === 6 /* PartFingerprint.ScrollableElement */);\n }\n static isChildOfMinimap(path) {\n return (path.length >= 2\n && path[0] === 3 /* PartFingerprint.OverflowGuard */\n && path[1] === 9 /* PartFingerprint.Minimap */);\n }\n static isChildOfContentWidgets(path) {\n return (path.length >= 4\n && path[0] === 3 /* PartFingerprint.OverflowGuard */\n && path[3] === 1 /* PartFingerprint.ContentWidgets */);\n }\n static isChildOfOverflowGuard(path) {\n return (path.length >= 1\n && path[0] === 3 /* PartFingerprint.OverflowGuard */);\n }\n static isChildOfOverflowingContentWidgets(path) {\n return (path.length >= 1\n && path[0] === 2 /* PartFingerprint.OverflowingContentWidgets */);\n }\n static isChildOfOverlayWidgets(path) {\n return (path.length >= 2\n && path[0] === 3 /* PartFingerprint.OverflowGuard */\n && path[1] === 4 /* PartFingerprint.OverlayWidgets */);\n }\n static isChildOfOverflowingOverlayWidgets(path) {\n return (path.length >= 1\n && path[0] === 5 /* PartFingerprint.OverflowingOverlayWidgets */);\n }\n}\nexport class HitTestContext {\n constructor(context, viewHelper, lastRenderData) {\n this.viewModel = context.viewModel;\n const options = context.configuration.options;\n this.layoutInfo = options.get(145 /* EditorOption.layoutInfo */);\n this.viewDomNode = viewHelper.viewDomNode;\n this.lineHeight = options.get(67 /* EditorOption.lineHeight */);\n this.stickyTabStops = options.get(116 /* EditorOption.stickyTabStops */);\n this.typicalHalfwidthCharacterWidth = options.get(50 /* EditorOption.fontInfo */).typicalHalfwidthCharacterWidth;\n this.lastRenderData = lastRenderData;\n this._context = context;\n this._viewHelper = viewHelper;\n }\n getZoneAtCoord(mouseVerticalOffset) {\n return HitTestContext.getZoneAtCoord(this._context, mouseVerticalOffset);\n }\n static getZoneAtCoord(context, mouseVerticalOffset) {\n // The target is either a view zone or the empty space after the last view-line\n const viewZoneWhitespace = context.viewLayout.getWhitespaceAtVerticalOffset(mouseVerticalOffset);\n if (viewZoneWhitespace) {\n const viewZoneMiddle = viewZoneWhitespace.verticalOffset + viewZoneWhitespace.height / 2;\n const lineCount = context.viewModel.getLineCount();\n let positionBefore = null;\n let position;\n let positionAfter = null;\n if (viewZoneWhitespace.afterLineNumber !== lineCount) {\n // There are more lines after this view zone\n positionAfter = new Position(viewZoneWhitespace.afterLineNumber + 1, 1);\n }\n if (viewZoneWhitespace.afterLineNumber > 0) {\n // There are more lines above this view zone\n positionBefore = new Position(viewZoneWhitespace.afterLineNumber, context.viewModel.getLineMaxColumn(viewZoneWhitespace.afterLineNumber));\n }\n if (positionAfter === null) {\n position = positionBefore;\n }\n else if (positionBefore === null) {\n position = positionAfter;\n }\n else if (mouseVerticalOffset < viewZoneMiddle) {\n position = positionBefore;\n }\n else {\n position = positionAfter;\n }\n return {\n viewZoneId: viewZoneWhitespace.id,\n afterLineNumber: viewZoneWhitespace.afterLineNumber,\n positionBefore: positionBefore,\n positionAfter: positionAfter,\n position: position\n };\n }\n return null;\n }\n getFullLineRangeAtCoord(mouseVerticalOffset) {\n if (this._context.viewLayout.isAfterLines(mouseVerticalOffset)) {\n // Below the last line\n const lineNumber = this._context.viewModel.getLineCount();\n const maxLineColumn = this._context.viewModel.getLineMaxColumn(lineNumber);\n return {\n range: new EditorRange(lineNumber, maxLineColumn, lineNumber, maxLineColumn),\n isAfterLines: true\n };\n }\n const lineNumber = this._context.viewLayout.getLineNumberAtVerticalOffset(mouseVerticalOffset);\n const maxLineColumn = this._context.viewModel.getLineMaxColumn(lineNumber);\n return {\n range: new EditorRange(lineNumber, 1, lineNumber, maxLineColumn),\n isAfterLines: false\n };\n }\n getLineNumberAtVerticalOffset(mouseVerticalOffset) {\n return this._context.viewLayout.getLineNumberAtVerticalOffset(mouseVerticalOffset);\n }\n isAfterLines(mouseVerticalOffset) {\n return this._context.viewLayout.isAfterLines(mouseVerticalOffset);\n }\n isInTopPadding(mouseVerticalOffset) {\n return this._context.viewLayout.isInTopPadding(mouseVerticalOffset);\n }\n isInBottomPadding(mouseVerticalOffset) {\n return this._context.viewLayout.isInBottomPadding(mouseVerticalOffset);\n }\n getVerticalOffsetForLineNumber(lineNumber) {\n return this._context.viewLayout.getVerticalOffsetForLineNumber(lineNumber);\n }\n findAttribute(element, attr) {\n return HitTestContext._findAttribute(element, attr, this._viewHelper.viewDomNode);\n }\n static _findAttribute(element, attr, stopAt) {\n while (element && element !== element.ownerDocument.body) {\n if (element.hasAttribute && element.hasAttribute(attr)) {\n return element.getAttribute(attr);\n }\n if (element === stopAt) {\n return null;\n }\n element = element.parentNode;\n }\n return null;\n }\n getLineWidth(lineNumber) {\n return this._viewHelper.getLineWidth(lineNumber);\n }\n visibleRangeForPosition(lineNumber, column) {\n return this._viewHelper.visibleRangeForPosition(lineNumber, column);\n }\n getPositionFromDOMInfo(spanNode, offset) {\n return this._viewHelper.getPositionFromDOMInfo(spanNode, offset);\n }\n getCurrentScrollTop() {\n return this._context.viewLayout.getCurrentScrollTop();\n }\n getCurrentScrollLeft() {\n return this._context.viewLayout.getCurrentScrollLeft();\n }\n}\nclass BareHitTestRequest {\n constructor(ctx, editorPos, pos, relativePos) {\n this.editorPos = editorPos;\n this.pos = pos;\n this.relativePos = relativePos;\n this.mouseVerticalOffset = Math.max(0, ctx.getCurrentScrollTop() + this.relativePos.y);\n this.mouseContentHorizontalOffset = ctx.getCurrentScrollLeft() + this.relativePos.x - ctx.layoutInfo.contentLeft;\n this.isInMarginArea = (this.relativePos.x < ctx.layoutInfo.contentLeft && this.relativePos.x >= ctx.layoutInfo.glyphMarginLeft);\n this.isInContentArea = !this.isInMarginArea;\n this.mouseColumn = Math.max(0, MouseTargetFactory._getMouseColumn(this.mouseContentHorizontalOffset, ctx.typicalHalfwidthCharacterWidth));\n }\n}\nclass HitTestRequest extends BareHitTestRequest {\n get target() {\n if (this._useHitTestTarget) {\n return this.hitTestResult.value.hitTarget;\n }\n return this._eventTarget;\n }\n get targetPath() {\n if (this._targetPathCacheElement !== this.target) {\n this._targetPathCacheElement = this.target;\n this._targetPathCacheValue = PartFingerprints.collect(this.target, this._ctx.viewDomNode);\n }\n return this._targetPathCacheValue;\n }\n constructor(ctx, editorPos, pos, relativePos, eventTarget) {\n super(ctx, editorPos, pos, relativePos);\n this.hitTestResult = new Lazy(() => MouseTargetFactory.doHitTest(this._ctx, this));\n this._targetPathCacheElement = null;\n this._targetPathCacheValue = new Uint8Array(0);\n this._ctx = ctx;\n this._eventTarget = eventTarget;\n // If no event target is passed in, we will use the hit test target\n const hasEventTarget = Boolean(this._eventTarget);\n this._useHitTestTarget = !hasEventTarget;\n }\n toString() {\n return `pos(${this.pos.x},${this.pos.y}), editorPos(${this.editorPos.x},${this.editorPos.y}), relativePos(${this.relativePos.x},${this.relativePos.y}), mouseVerticalOffset: ${this.mouseVerticalOffset}, mouseContentHorizontalOffset: ${this.mouseContentHorizontalOffset}\\n\\ttarget: ${this.target ? this.target.outerHTML : null}`;\n }\n get wouldBenefitFromHitTestTargetSwitch() {\n return (!this._useHitTestTarget\n && this.hitTestResult.value.hitTarget !== null\n && this.target !== this.hitTestResult.value.hitTarget);\n }\n switchToHitTestTarget() {\n this._useHitTestTarget = true;\n }\n _getMouseColumn(position = null) {\n if (position && position.column < this._ctx.viewModel.getLineMaxColumn(position.lineNumber)) {\n // Most likely, the line contains foreign decorations...\n return CursorColumns.visibleColumnFromColumn(this._ctx.viewModel.getLineContent(position.lineNumber), position.column, this._ctx.viewModel.model.getOptions().tabSize) + 1;\n }\n return this.mouseColumn;\n }\n fulfillUnknown(position = null) {\n return MouseTarget.createUnknown(this.target, this._getMouseColumn(position), position);\n }\n fulfillTextarea() {\n return MouseTarget.createTextarea(this.target, this._getMouseColumn());\n }\n fulfillMargin(type, position, range, detail) {\n return MouseTarget.createMargin(type, this.target, this._getMouseColumn(position), position, range, detail);\n }\n fulfillViewZone(type, position, detail) {\n return MouseTarget.createViewZone(type, this.target, this._getMouseColumn(position), position, detail);\n }\n fulfillContentText(position, range, detail) {\n return MouseTarget.createContentText(this.target, this._getMouseColumn(position), position, range, detail);\n }\n fulfillContentEmpty(position, detail) {\n return MouseTarget.createContentEmpty(this.target, this._getMouseColumn(position), position, detail);\n }\n fulfillContentWidget(detail) {\n return MouseTarget.createContentWidget(this.target, this._getMouseColumn(), detail);\n }\n fulfillScrollbar(position) {\n return MouseTarget.createScrollbar(this.target, this._getMouseColumn(position), position);\n }\n fulfillOverlayWidget(detail) {\n return MouseTarget.createOverlayWidget(this.target, this._getMouseColumn(), detail);\n }\n}\nconst EMPTY_CONTENT_AFTER_LINES = { isAfterLines: true };\nfunction createEmptyContentDataInLines(horizontalDistanceToText) {\n return {\n isAfterLines: false,\n horizontalDistanceToText: horizontalDistanceToText\n };\n}\nexport class MouseTargetFactory {\n constructor(context, viewHelper) {\n this._context = context;\n this._viewHelper = viewHelper;\n }\n mouseTargetIsWidget(e) {\n const t = e.target;\n const path = PartFingerprints.collect(t, this._viewHelper.viewDomNode);\n // Is it a content widget?\n if (ElementPath.isChildOfContentWidgets(path) || ElementPath.isChildOfOverflowingContentWidgets(path)) {\n return true;\n }\n // Is it an overlay widget?\n if (ElementPath.isChildOfOverlayWidgets(path) || ElementPath.isChildOfOverflowingOverlayWidgets(path)) {\n return true;\n }\n return false;\n }\n createMouseTarget(lastRenderData, editorPos, pos, relativePos, target) {\n const ctx = new HitTestContext(this._context, this._viewHelper, lastRenderData);\n const request = new HitTestRequest(ctx, editorPos, pos, relativePos, target);\n try {\n const r = MouseTargetFactory._createMouseTarget(ctx, request);\n if (r.type === 6 /* MouseTargetType.CONTENT_TEXT */) {\n // Snap to the nearest soft tab boundary if atomic soft tabs are enabled.\n if (ctx.stickyTabStops && r.position !== null) {\n const position = MouseTargetFactory._snapToSoftTabBoundary(r.position, ctx.viewModel);\n const range = EditorRange.fromPositions(position, position).plusRange(r.range);\n return request.fulfillContentText(position, range, r.detail);\n }\n }\n // console.log(MouseTarget.toString(r));\n return r;\n }\n catch (err) {\n // console.log(err);\n return request.fulfillUnknown();\n }\n }\n static _createMouseTarget(ctx, request) {\n // console.log(`${domHitTestExecuted ? '=>' : ''}CAME IN REQUEST: ${request}`);\n if (request.target === null) {\n // No target\n return request.fulfillUnknown();\n }\n // we know for a fact that request.target is not null\n const resolvedRequest = request;\n let result = null;\n if (!ElementPath.isChildOfOverflowGuard(request.targetPath) && !ElementPath.isChildOfOverflowingContentWidgets(request.targetPath) && !ElementPath.isChildOfOverflowingOverlayWidgets(request.targetPath)) {\n // We only render dom nodes inside the overflow guard or in the overflowing content widgets\n result = result || request.fulfillUnknown();\n }\n result = result || MouseTargetFactory._hitTestContentWidget(ctx, resolvedRequest);\n result = result || MouseTargetFactory._hitTestOverlayWidget(ctx, resolvedRequest);\n result = result || MouseTargetFactory._hitTestMinimap(ctx, resolvedRequest);\n result = result || MouseTargetFactory._hitTestScrollbarSlider(ctx, resolvedRequest);\n result = result || MouseTargetFactory._hitTestViewZone(ctx, resolvedRequest);\n result = result || MouseTargetFactory._hitTestMargin(ctx, resolvedRequest);\n result = result || MouseTargetFactory._hitTestViewCursor(ctx, resolvedRequest);\n result = result || MouseTargetFactory._hitTestTextArea(ctx, resolvedRequest);\n result = result || MouseTargetFactory._hitTestViewLines(ctx, resolvedRequest);\n result = result || MouseTargetFactory._hitTestScrollbar(ctx, resolvedRequest);\n return (result || request.fulfillUnknown());\n }\n static _hitTestContentWidget(ctx, request) {\n // Is it a content widget?\n if (ElementPath.isChildOfContentWidgets(request.targetPath) || ElementPath.isChildOfOverflowingContentWidgets(request.targetPath)) {\n const widgetId = ctx.findAttribute(request.target, 'widgetId');\n if (widgetId) {\n return request.fulfillContentWidget(widgetId);\n }\n else {\n return request.fulfillUnknown();\n }\n }\n return null;\n }\n static _hitTestOverlayWidget(ctx, request) {\n // Is it an overlay widget?\n if (ElementPath.isChildOfOverlayWidgets(request.targetPath) || ElementPath.isChildOfOverflowingOverlayWidgets(request.targetPath)) {\n const widgetId = ctx.findAttribute(request.target, 'widgetId');\n if (widgetId) {\n return request.fulfillOverlayWidget(widgetId);\n }\n else {\n return request.fulfillUnknown();\n }\n }\n return null;\n }\n static _hitTestViewCursor(ctx, request) {\n if (request.target) {\n // Check if we've hit a painted cursor\n const lastViewCursorsRenderData = ctx.lastRenderData.lastViewCursorsRenderData;\n for (const d of lastViewCursorsRenderData) {\n if (request.target === d.domNode) {\n return request.fulfillContentText(d.position, null, { mightBeForeignElement: false, injectedText: null });\n }\n }\n }\n if (request.isInContentArea) {\n // Edge has a bug when hit-testing the exact position of a cursor,\n // instead of returning the correct dom node, it returns the\n // first or last rendered view line dom node, therefore help it out\n // and first check if we are on top of a cursor\n const lastViewCursorsRenderData = ctx.lastRenderData.lastViewCursorsRenderData;\n const mouseContentHorizontalOffset = request.mouseContentHorizontalOffset;\n const mouseVerticalOffset = request.mouseVerticalOffset;\n for (const d of lastViewCursorsRenderData) {\n if (mouseContentHorizontalOffset < d.contentLeft) {\n // mouse position is to the left of the cursor\n continue;\n }\n if (mouseContentHorizontalOffset > d.contentLeft + d.width) {\n // mouse position is to the right of the cursor\n continue;\n }\n const cursorVerticalOffset = ctx.getVerticalOffsetForLineNumber(d.position.lineNumber);\n if (cursorVerticalOffset <= mouseVerticalOffset\n && mouseVerticalOffset <= cursorVerticalOffset + d.height) {\n return request.fulfillContentText(d.position, null, { mightBeForeignElement: false, injectedText: null });\n }\n }\n }\n return null;\n }\n static _hitTestViewZone(ctx, request) {\n const viewZoneData = ctx.getZoneAtCoord(request.mouseVerticalOffset);\n if (viewZoneData) {\n const mouseTargetType = (request.isInContentArea ? 8 /* MouseTargetType.CONTENT_VIEW_ZONE */ : 5 /* MouseTargetType.GUTTER_VIEW_ZONE */);\n return request.fulfillViewZone(mouseTargetType, viewZoneData.position, viewZoneData);\n }\n return null;\n }\n static _hitTestTextArea(ctx, request) {\n // Is it the textarea?\n if (ElementPath.isTextArea(request.targetPath)) {\n if (ctx.lastRenderData.lastTextareaPosition) {\n return request.fulfillContentText(ctx.lastRenderData.lastTextareaPosition, null, { mightBeForeignElement: false, injectedText: null });\n }\n return request.fulfillTextarea();\n }\n return null;\n }\n static _hitTestMargin(ctx, request) {\n if (request.isInMarginArea) {\n const res = ctx.getFullLineRangeAtCoord(request.mouseVerticalOffset);\n const pos = res.range.getStartPosition();\n let offset = Math.abs(request.relativePos.x);\n const detail = {\n isAfterLines: res.isAfterLines,\n glyphMarginLeft: ctx.layoutInfo.glyphMarginLeft,\n glyphMarginWidth: ctx.layoutInfo.glyphMarginWidth,\n lineNumbersWidth: ctx.layoutInfo.lineNumbersWidth,\n offsetX: offset\n };\n offset -= ctx.layoutInfo.glyphMarginLeft;\n if (offset <= ctx.layoutInfo.glyphMarginWidth) {\n // On the glyph margin\n const modelCoordinate = ctx.viewModel.coordinatesConverter.convertViewPositionToModelPosition(res.range.getStartPosition());\n const lanes = ctx.viewModel.glyphLanes.getLanesAtLine(modelCoordinate.lineNumber);\n detail.glyphMarginLane = lanes[Math.floor(offset / ctx.lineHeight)];\n return request.fulfillMargin(2 /* MouseTargetType.GUTTER_GLYPH_MARGIN */, pos, res.range, detail);\n }\n offset -= ctx.layoutInfo.glyphMarginWidth;\n if (offset <= ctx.layoutInfo.lineNumbersWidth) {\n // On the line numbers\n return request.fulfillMargin(3 /* MouseTargetType.GUTTER_LINE_NUMBERS */, pos, res.range, detail);\n }\n offset -= ctx.layoutInfo.lineNumbersWidth;\n // On the line decorations\n return request.fulfillMargin(4 /* MouseTargetType.GUTTER_LINE_DECORATIONS */, pos, res.range, detail);\n }\n return null;\n }\n static _hitTestViewLines(ctx, request) {\n if (!ElementPath.isChildOfViewLines(request.targetPath)) {\n return null;\n }\n if (ctx.isInTopPadding(request.mouseVerticalOffset)) {\n return request.fulfillContentEmpty(new Position(1, 1), EMPTY_CONTENT_AFTER_LINES);\n }\n // Check if it is below any lines and any view zones\n if (ctx.isAfterLines(request.mouseVerticalOffset) || ctx.isInBottomPadding(request.mouseVerticalOffset)) {\n // This most likely indicates it happened after the last view-line\n const lineCount = ctx.viewModel.getLineCount();\n const maxLineColumn = ctx.viewModel.getLineMaxColumn(lineCount);\n return request.fulfillContentEmpty(new Position(lineCount, maxLineColumn), EMPTY_CONTENT_AFTER_LINES);\n }\n // Check if we are hitting a view-line (can happen in the case of inline decorations on empty lines)\n // See https://github.com/microsoft/vscode/issues/46942\n if (ElementPath.isStrictChildOfViewLines(request.targetPath)) {\n const lineNumber = ctx.getLineNumberAtVerticalOffset(request.mouseVerticalOffset);\n if (ctx.viewModel.getLineLength(lineNumber) === 0) {\n const lineWidth = ctx.getLineWidth(lineNumber);\n const detail = createEmptyContentDataInLines(request.mouseContentHorizontalOffset - lineWidth);\n return request.fulfillContentEmpty(new Position(lineNumber, 1), detail);\n }\n const lineWidth = ctx.getLineWidth(lineNumber);\n if (request.mouseContentHorizontalOffset >= lineWidth) {\n // TODO: This is wrong for RTL\n const detail = createEmptyContentDataInLines(request.mouseContentHorizontalOffset - lineWidth);\n const pos = new Position(lineNumber, ctx.viewModel.getLineMaxColumn(lineNumber));\n return request.fulfillContentEmpty(pos, detail);\n }\n }\n // Do the hit test (if not already done)\n const hitTestResult = request.hitTestResult.value;\n if (hitTestResult.type === 1 /* HitTestResultType.Content */) {\n return MouseTargetFactory.createMouseTargetFromHitTestPosition(ctx, request, hitTestResult.spanNode, hitTestResult.position, hitTestResult.injectedText);\n }\n // We didn't hit content...\n if (request.wouldBenefitFromHitTestTargetSwitch) {\n // We actually hit something different... Give it one last change by trying again with this new target\n request.switchToHitTestTarget();\n return this._createMouseTarget(ctx, request);\n }\n // We have tried everything...\n return request.fulfillUnknown();\n }\n static _hitTestMinimap(ctx, request) {\n if (ElementPath.isChildOfMinimap(request.targetPath)) {\n const possibleLineNumber = ctx.getLineNumberAtVerticalOffset(request.mouseVerticalOffset);\n const maxColumn = ctx.viewModel.getLineMaxColumn(possibleLineNumber);\n return request.fulfillScrollbar(new Position(possibleLineNumber, maxColumn));\n }\n return null;\n }\n static _hitTestScrollbarSlider(ctx, request) {\n if (ElementPath.isChildOfScrollableElement(request.targetPath)) {\n if (request.target && request.target.nodeType === 1) {\n const className = request.target.className;\n if (className && /\\b(slider|scrollbar)\\b/.test(className)) {\n const possibleLineNumber = ctx.getLineNumberAtVerticalOffset(request.mouseVerticalOffset);\n const maxColumn = ctx.viewModel.getLineMaxColumn(possibleLineNumber);\n return request.fulfillScrollbar(new Position(possibleLineNumber, maxColumn));\n }\n }\n }\n return null;\n }\n static _hitTestScrollbar(ctx, request) {\n // Is it the overview ruler?\n // Is it a child of the scrollable element?\n if (ElementPath.isChildOfScrollableElement(request.targetPath)) {\n const possibleLineNumber = ctx.getLineNumberAtVerticalOffset(request.mouseVerticalOffset);\n const maxColumn = ctx.viewModel.getLineMaxColumn(possibleLineNumber);\n return request.fulfillScrollbar(new Position(possibleLineNumber, maxColumn));\n }\n return null;\n }\n getMouseColumn(relativePos) {\n const options = this._context.configuration.options;\n const layoutInfo = options.get(145 /* EditorOption.layoutInfo */);\n const mouseContentHorizontalOffset = this._context.viewLayout.getCurrentScrollLeft() + relativePos.x - layoutInfo.contentLeft;\n return MouseTargetFactory._getMouseColumn(mouseContentHorizontalOffset, options.get(50 /* EditorOption.fontInfo */).typicalHalfwidthCharacterWidth);\n }\n static _getMouseColumn(mouseContentHorizontalOffset, typicalHalfwidthCharacterWidth) {\n if (mouseContentHorizontalOffset < 0) {\n return 1;\n }\n const chars = Math.round(mouseContentHorizontalOffset / typicalHalfwidthCharacterWidth);\n return (chars + 1);\n }\n static createMouseTargetFromHitTestPosition(ctx, request, spanNode, pos, injectedText) {\n const lineNumber = pos.lineNumber;\n const column = pos.column;\n const lineWidth = ctx.getLineWidth(lineNumber);\n if (request.mouseContentHorizontalOffset > lineWidth) {\n const detail = createEmptyContentDataInLines(request.mouseContentHorizontalOffset - lineWidth);\n return request.fulfillContentEmpty(pos, detail);\n }\n const visibleRange = ctx.visibleRangeForPosition(lineNumber, column);\n if (!visibleRange) {\n return request.fulfillUnknown(pos);\n }\n const columnHorizontalOffset = visibleRange.left;\n if (Math.abs(request.mouseContentHorizontalOffset - columnHorizontalOffset) < 1) {\n return request.fulfillContentText(pos, null, { mightBeForeignElement: !!injectedText, injectedText });\n }\n const points = [];\n points.push({ offset: visibleRange.left, column: column });\n if (column > 1) {\n const visibleRange = ctx.visibleRangeForPosition(lineNumber, column - 1);\n if (visibleRange) {\n points.push({ offset: visibleRange.left, column: column - 1 });\n }\n }\n const lineMaxColumn = ctx.viewModel.getLineMaxColumn(lineNumber);\n if (column < lineMaxColumn) {\n const visibleRange = ctx.visibleRangeForPosition(lineNumber, column + 1);\n if (visibleRange) {\n points.push({ offset: visibleRange.left, column: column + 1 });\n }\n }\n points.sort((a, b) => a.offset - b.offset);\n const mouseCoordinates = request.pos.toClientCoordinates(dom.getWindow(ctx.viewDomNode));\n const spanNodeClientRect = spanNode.getBoundingClientRect();\n const mouseIsOverSpanNode = (spanNodeClientRect.left <= mouseCoordinates.clientX && mouseCoordinates.clientX <= spanNodeClientRect.right);\n let rng = null;\n for (let i = 1; i < points.length; i++) {\n const prev = points[i - 1];\n const curr = points[i];\n if (prev.offset <= request.mouseContentHorizontalOffset && request.mouseContentHorizontalOffset <= curr.offset) {\n rng = new EditorRange(lineNumber, prev.column, lineNumber, curr.column);\n // See https://github.com/microsoft/vscode/issues/152819\n // Due to the use of zwj, the browser's hit test result is skewed towards the left\n // Here we try to correct that if the mouse horizontal offset is closer to the right than the left\n const prevDelta = Math.abs(prev.offset - request.mouseContentHorizontalOffset);\n const nextDelta = Math.abs(curr.offset - request.mouseContentHorizontalOffset);\n pos = (prevDelta < nextDelta\n ? new Position(lineNumber, prev.column)\n : new Position(lineNumber, curr.column));\n break;\n }\n }\n return request.fulfillContentText(pos, rng, { mightBeForeignElement: !mouseIsOverSpanNode || !!injectedText, injectedText });\n }\n /**\n * Most probably WebKit browsers and Edge\n */\n static _doHitTestWithCaretRangeFromPoint(ctx, request) {\n // In Chrome, especially on Linux it is possible to click between lines,\n // so try to adjust the `hity` below so that it lands in the center of a line\n const lineNumber = ctx.getLineNumberAtVerticalOffset(request.mouseVerticalOffset);\n const lineStartVerticalOffset = ctx.getVerticalOffsetForLineNumber(lineNumber);\n const lineEndVerticalOffset = lineStartVerticalOffset + ctx.lineHeight;\n const isBelowLastLine = (lineNumber === ctx.viewModel.getLineCount()\n && request.mouseVerticalOffset > lineEndVerticalOffset);\n if (!isBelowLastLine) {\n const lineCenteredVerticalOffset = Math.floor((lineStartVerticalOffset + lineEndVerticalOffset) / 2);\n let adjustedPageY = request.pos.y + (lineCenteredVerticalOffset - request.mouseVerticalOffset);\n if (adjustedPageY <= request.editorPos.y) {\n adjustedPageY = request.editorPos.y + 1;\n }\n if (adjustedPageY >= request.editorPos.y + request.editorPos.height) {\n adjustedPageY = request.editorPos.y + request.editorPos.height - 1;\n }\n const adjustedPage = new PageCoordinates(request.pos.x, adjustedPageY);\n const r = this._actualDoHitTestWithCaretRangeFromPoint(ctx, adjustedPage.toClientCoordinates(dom.getWindow(ctx.viewDomNode)));\n if (r.type === 1 /* HitTestResultType.Content */) {\n return r;\n }\n }\n // Also try to hit test without the adjustment (for the edge cases that we are near the top or bottom)\n return this._actualDoHitTestWithCaretRangeFromPoint(ctx, request.pos.toClientCoordinates(dom.getWindow(ctx.viewDomNode)));\n }\n static _actualDoHitTestWithCaretRangeFromPoint(ctx, coords) {\n const shadowRoot = dom.getShadowRoot(ctx.viewDomNode);\n let range;\n if (shadowRoot) {\n if (typeof shadowRoot.caretRangeFromPoint === 'undefined') {\n range = shadowCaretRangeFromPoint(shadowRoot, coords.clientX, coords.clientY);\n }\n else {\n range = shadowRoot.caretRangeFromPoint(coords.clientX, coords.clientY);\n }\n }\n else {\n range = ctx.viewDomNode.ownerDocument.caretRangeFromPoint(coords.clientX, coords.clientY);\n }\n if (!range || !range.startContainer) {\n return new UnknownHitTestResult();\n }\n // Chrome always hits a TEXT_NODE, while Edge sometimes hits a token span\n const startContainer = range.startContainer;\n if (startContainer.nodeType === startContainer.TEXT_NODE) {\n // startContainer is expected to be the token text\n const parent1 = startContainer.parentNode; // expected to be the token span\n const parent2 = parent1 ? parent1.parentNode : null; // expected to be the view line container span\n const parent3 = parent2 ? parent2.parentNode : null; // expected to be the view line div\n const parent3ClassName = parent3 && parent3.nodeType === parent3.ELEMENT_NODE ? parent3.className : null;\n if (parent3ClassName === ViewLine.CLASS_NAME) {\n return HitTestResult.createFromDOMInfo(ctx, parent1, range.startOffset);\n }\n else {\n return new UnknownHitTestResult(startContainer.parentNode);\n }\n }\n else if (startContainer.nodeType === startContainer.ELEMENT_NODE) {\n // startContainer is expected to be the token span\n const parent1 = startContainer.parentNode; // expected to be the view line container span\n const parent2 = parent1 ? parent1.parentNode : null; // expected to be the view line div\n const parent2ClassName = parent2 && parent2.nodeType === parent2.ELEMENT_NODE ? parent2.className : null;\n if (parent2ClassName === ViewLine.CLASS_NAME) {\n return HitTestResult.createFromDOMInfo(ctx, startContainer, startContainer.textContent.length);\n }\n else {\n return new UnknownHitTestResult(startContainer);\n }\n }\n return new UnknownHitTestResult();\n }\n /**\n * Most probably Gecko\n */\n static _doHitTestWithCaretPositionFromPoint(ctx, coords) {\n const hitResult = ctx.viewDomNode.ownerDocument.caretPositionFromPoint(coords.clientX, coords.clientY);\n if (hitResult.offsetNode.nodeType === hitResult.offsetNode.TEXT_NODE) {\n // offsetNode is expected to be the token text\n const parent1 = hitResult.offsetNode.parentNode; // expected to be the token span\n const parent2 = parent1 ? parent1.parentNode : null; // expected to be the view line container span\n const parent3 = parent2 ? parent2.parentNode : null; // expected to be the view line div\n const parent3ClassName = parent3 && parent3.nodeType === parent3.ELEMENT_NODE ? parent3.className : null;\n if (parent3ClassName === ViewLine.CLASS_NAME) {\n return HitTestResult.createFromDOMInfo(ctx, hitResult.offsetNode.parentNode, hitResult.offset);\n }\n else {\n return new UnknownHitTestResult(hitResult.offsetNode.parentNode);\n }\n }\n // For inline decorations, Gecko sometimes returns the `` of the line and the offset is the `` with the inline decoration\n // Some other times, it returns the `` with the inline decoration\n if (hitResult.offsetNode.nodeType === hitResult.offsetNode.ELEMENT_NODE) {\n const parent1 = hitResult.offsetNode.parentNode;\n const parent1ClassName = parent1 && parent1.nodeType === parent1.ELEMENT_NODE ? parent1.className : null;\n const parent2 = parent1 ? parent1.parentNode : null;\n const parent2ClassName = parent2 && parent2.nodeType === parent2.ELEMENT_NODE ? parent2.className : null;\n if (parent1ClassName === ViewLine.CLASS_NAME) {\n // it returned the `` of the line and the offset is the `` with the inline decoration\n const tokenSpan = hitResult.offsetNode.childNodes[Math.min(hitResult.offset, hitResult.offsetNode.childNodes.length - 1)];\n if (tokenSpan) {\n return HitTestResult.createFromDOMInfo(ctx, tokenSpan, 0);\n }\n }\n else if (parent2ClassName === ViewLine.CLASS_NAME) {\n // it returned the `` with the inline decoration\n return HitTestResult.createFromDOMInfo(ctx, hitResult.offsetNode, 0);\n }\n }\n return new UnknownHitTestResult(hitResult.offsetNode);\n }\n static _snapToSoftTabBoundary(position, viewModel) {\n const lineContent = viewModel.getLineContent(position.lineNumber);\n const { tabSize } = viewModel.model.getOptions();\n const newPosition = AtomicTabMoveOperations.atomicPosition(lineContent, position.column - 1, tabSize, 2 /* Direction.Nearest */);\n if (newPosition !== -1) {\n return new Position(position.lineNumber, newPosition + 1);\n }\n return position;\n }\n static doHitTest(ctx, request) {\n let result = new UnknownHitTestResult();\n if (typeof ctx.viewDomNode.ownerDocument.caretRangeFromPoint === 'function') {\n result = this._doHitTestWithCaretRangeFromPoint(ctx, request);\n }\n else if (ctx.viewDomNode.ownerDocument.caretPositionFromPoint) {\n result = this._doHitTestWithCaretPositionFromPoint(ctx, request.pos.toClientCoordinates(dom.getWindow(ctx.viewDomNode)));\n }\n if (result.type === 1 /* HitTestResultType.Content */) {\n const injectedText = ctx.viewModel.getInjectedTextAt(result.position);\n const normalizedPosition = ctx.viewModel.normalizePosition(result.position, 2 /* PositionAffinity.None */);\n if (injectedText || !normalizedPosition.equals(result.position)) {\n result = new ContentHitTestResult(normalizedPosition, result.spanNode, injectedText);\n }\n }\n return result;\n }\n}\nfunction shadowCaretRangeFromPoint(shadowRoot, x, y) {\n const range = document.createRange();\n // Get the element under the point\n let el = shadowRoot.elementFromPoint(x, y);\n if (el !== null) {\n // Get the last child of the element until its firstChild is a text node\n // This assumes that the pointer is on the right of the line, out of the tokens\n // and that we want to get the offset of the last token of the line\n while (el && el.firstChild && el.firstChild.nodeType !== el.firstChild.TEXT_NODE && el.lastChild && el.lastChild.firstChild) {\n el = el.lastChild;\n }\n // Grab its rect\n const rect = el.getBoundingClientRect();\n // And its font (the computed shorthand font property might be empty, see #3217)\n const elWindow = dom.getWindow(el);\n const fontStyle = elWindow.getComputedStyle(el, null).getPropertyValue('font-style');\n const fontVariant = elWindow.getComputedStyle(el, null).getPropertyValue('font-variant');\n const fontWeight = elWindow.getComputedStyle(el, null).getPropertyValue('font-weight');\n const fontSize = elWindow.getComputedStyle(el, null).getPropertyValue('font-size');\n const lineHeight = elWindow.getComputedStyle(el, null).getPropertyValue('line-height');\n const fontFamily = elWindow.getComputedStyle(el, null).getPropertyValue('font-family');\n const font = `${fontStyle} ${fontVariant} ${fontWeight} ${fontSize}/${lineHeight} ${fontFamily}`;\n // And also its txt content\n const text = el.innerText;\n // Position the pixel cursor at the left of the element\n let pixelCursor = rect.left;\n let offset = 0;\n let step;\n // If the point is on the right of the box put the cursor after the last character\n if (x > rect.left + rect.width) {\n offset = text.length;\n }\n else {\n const charWidthReader = CharWidthReader.getInstance();\n // Goes through all the characters of the innerText, and checks if the x of the point\n // belongs to the character.\n for (let i = 0; i < text.length + 1; i++) {\n // The step is half the width of the character\n step = charWidthReader.getCharWidth(text.charAt(i), font) / 2;\n // Move to the center of the character\n pixelCursor += step;\n // If the x of the point is smaller that the position of the cursor, the point is over that character\n if (x < pixelCursor) {\n offset = i;\n break;\n }\n // Move between the current character and the next\n pixelCursor += step;\n }\n }\n // Creates a range with the text node of the element and set the offset found\n range.setStart(el.firstChild, offset);\n range.setEnd(el.firstChild, offset);\n }\n return range;\n}\nclass CharWidthReader {\n static getInstance() {\n if (!CharWidthReader._INSTANCE) {\n CharWidthReader._INSTANCE = new CharWidthReader();\n }\n return CharWidthReader._INSTANCE;\n }\n constructor() {\n this._cache = {};\n this._canvas = document.createElement('canvas');\n }\n getCharWidth(char, font) {\n const cacheKey = char + font;\n if (this._cache[cacheKey]) {\n return this._cache[cacheKey];\n }\n const context = this._canvas.getContext('2d');\n context.font = font;\n const metrics = context.measureText(char);\n const width = metrics.width;\n this._cache[cacheKey] = width;\n return width;\n }\n}\nCharWidthReader._INSTANCE = 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 *--------------------------------------------------------------------------------------------*/\nimport * as dom from '../../base/browser/dom.js';\nimport { GlobalPointerMoveMonitor } from '../../base/browser/globalPointerMoveMonitor.js';\nimport { StandardMouseEvent } from '../../base/browser/mouseEvent.js';\nimport { RunOnceScheduler } from '../../base/common/async.js';\nimport { Disposable, DisposableStore } from '../../base/common/lifecycle.js';\nimport { asCssVariable } from '../../platform/theme/common/colorRegistry.js';\n/**\n * Coordinates relative to the whole document (e.g. mouse event's pageX and pageY)\n */\nexport class PageCoordinates {\n constructor(x, y) {\n this.x = x;\n this.y = y;\n this._pageCoordinatesBrand = undefined;\n }\n toClientCoordinates(targetWindow) {\n return new ClientCoordinates(this.x - targetWindow.scrollX, this.y - targetWindow.scrollY);\n }\n}\n/**\n * Coordinates within the application's client area (i.e. origin is document's scroll position).\n *\n * For example, clicking in the top-left corner of the client area will\n * always result in a mouse event with a client.x value of 0, regardless\n * of whether the page is scrolled horizontally.\n */\nexport class ClientCoordinates {\n constructor(clientX, clientY) {\n this.clientX = clientX;\n this.clientY = clientY;\n this._clientCoordinatesBrand = undefined;\n }\n toPageCoordinates(targetWindow) {\n return new PageCoordinates(this.clientX + targetWindow.scrollX, this.clientY + targetWindow.scrollY);\n }\n}\n/**\n * The position of the editor in the page.\n */\nexport class EditorPagePosition {\n constructor(x, y, width, height) {\n this.x = x;\n this.y = y;\n this.width = width;\n this.height = height;\n this._editorPagePositionBrand = undefined;\n }\n}\n/**\n * Coordinates relative to the the (top;left) of the editor that can be used safely with other internal editor metrics.\n * **NOTE**: This position is obtained by taking page coordinates and transforming them relative to the\n * editor's (top;left) position in a way in which scale transformations are taken into account.\n * **NOTE**: These coordinates could be negative if the mouse position is outside the editor.\n */\nexport class CoordinatesRelativeToEditor {\n constructor(x, y) {\n this.x = x;\n this.y = y;\n this._positionRelativeToEditorBrand = undefined;\n }\n}\nexport function createEditorPagePosition(editorViewDomNode) {\n const editorPos = dom.getDomNodePagePosition(editorViewDomNode);\n return new EditorPagePosition(editorPos.left, editorPos.top, editorPos.width, editorPos.height);\n}\nexport function createCoordinatesRelativeToEditor(editorViewDomNode, editorPagePosition, pos) {\n // The editor's page position is read from the DOM using getBoundingClientRect().\n //\n // getBoundingClientRect() returns the actual dimensions, while offsetWidth and offsetHeight\n // reflect the unscaled size. We can use this difference to detect a transform:scale()\n // and we will apply the transformation in inverse to get mouse coordinates that make sense inside the editor.\n //\n // This could be expanded to cover rotation as well maybe by walking the DOM up from `editorViewDomNode`\n // and computing the effective transformation matrix using getComputedStyle(element).transform.\n //\n const scaleX = editorPagePosition.width / editorViewDomNode.offsetWidth;\n const scaleY = editorPagePosition.height / editorViewDomNode.offsetHeight;\n // Adjust mouse offsets if editor appears to be scaled via transforms\n const relativeX = (pos.x - editorPagePosition.x) / scaleX;\n const relativeY = (pos.y - editorPagePosition.y) / scaleY;\n return new CoordinatesRelativeToEditor(relativeX, relativeY);\n}\nexport class EditorMouseEvent extends StandardMouseEvent {\n constructor(e, isFromPointerCapture, editorViewDomNode) {\n super(dom.getWindow(editorViewDomNode), e);\n this._editorMouseEventBrand = undefined;\n this.isFromPointerCapture = isFromPointerCapture;\n this.pos = new PageCoordinates(this.posx, this.posy);\n this.editorPos = createEditorPagePosition(editorViewDomNode);\n this.relativePos = createCoordinatesRelativeToEditor(editorViewDomNode, this.editorPos, this.pos);\n }\n}\nexport class EditorMouseEventFactory {\n constructor(editorViewDomNode) {\n this._editorViewDomNode = editorViewDomNode;\n }\n _create(e) {\n return new EditorMouseEvent(e, false, this._editorViewDomNode);\n }\n onContextMenu(target, callback) {\n return dom.addDisposableListener(target, 'contextmenu', (e) => {\n callback(this._create(e));\n });\n }\n onMouseUp(target, callback) {\n return dom.addDisposableListener(target, 'mouseup', (e) => {\n callback(this._create(e));\n });\n }\n onMouseDown(target, callback) {\n return dom.addDisposableListener(target, dom.EventType.MOUSE_DOWN, (e) => {\n callback(this._create(e));\n });\n }\n onPointerDown(target, callback) {\n return dom.addDisposableListener(target, dom.EventType.POINTER_DOWN, (e) => {\n callback(this._create(e), e.pointerId);\n });\n }\n onMouseLeave(target, callback) {\n return dom.addDisposableListener(target, dom.EventType.MOUSE_LEAVE, (e) => {\n callback(this._create(e));\n });\n }\n onMouseMove(target, callback) {\n return dom.addDisposableListener(target, 'mousemove', (e) => callback(this._create(e)));\n }\n}\nexport class EditorPointerEventFactory {\n constructor(editorViewDomNode) {\n this._editorViewDomNode = editorViewDomNode;\n }\n _create(e) {\n return new EditorMouseEvent(e, false, this._editorViewDomNode);\n }\n onPointerUp(target, callback) {\n return dom.addDisposableListener(target, 'pointerup', (e) => {\n callback(this._create(e));\n });\n }\n onPointerDown(target, callback) {\n return dom.addDisposableListener(target, dom.EventType.POINTER_DOWN, (e) => {\n callback(this._create(e), e.pointerId);\n });\n }\n onPointerLeave(target, callback) {\n return dom.addDisposableListener(target, dom.EventType.POINTER_LEAVE, (e) => {\n callback(this._create(e));\n });\n }\n onPointerMove(target, callback) {\n return dom.addDisposableListener(target, 'pointermove', (e) => callback(this._create(e)));\n }\n}\nexport class GlobalEditorPointerMoveMonitor extends Disposable {\n constructor(editorViewDomNode) {\n super();\n this._editorViewDomNode = editorViewDomNode;\n this._globalPointerMoveMonitor = this._register(new GlobalPointerMoveMonitor());\n this._keydownListener = null;\n }\n startMonitoring(initialElement, pointerId, initialButtons, pointerMoveCallback, onStopCallback) {\n // Add a <> keydown event listener that will cancel the monitoring\n // if something other than a modifier key is pressed\n this._keydownListener = dom.addStandardDisposableListener(initialElement.ownerDocument, 'keydown', (e) => {\n const chord = e.toKeyCodeChord();\n if (chord.isModifierKey()) {\n // Allow modifier keys\n return;\n }\n this._globalPointerMoveMonitor.stopMonitoring(true, e.browserEvent);\n }, true);\n this._globalPointerMoveMonitor.startMonitoring(initialElement, pointerId, initialButtons, (e) => {\n pointerMoveCallback(new EditorMouseEvent(e, true, this._editorViewDomNode));\n }, (e) => {\n this._keydownListener.dispose();\n onStopCallback(e);\n });\n }\n stopMonitoring() {\n this._globalPointerMoveMonitor.stopMonitoring(true);\n }\n}\n/**\n * A helper to create dynamic css rules, bound to a class name.\n * Rules are reused.\n * Reference counting and delayed garbage collection ensure that no rules leak.\n*/\nexport class DynamicCssRules {\n constructor(_editor) {\n this._editor = _editor;\n this._instanceId = ++DynamicCssRules._idPool;\n this._counter = 0;\n this._rules = new Map();\n // We delay garbage collection so that hanging rules can be reused.\n this._garbageCollectionScheduler = new RunOnceScheduler(() => this.garbageCollect(), 1000);\n }\n createClassNameRef(options) {\n const rule = this.getOrCreateRule(options);\n rule.increaseRefCount();\n return {\n className: rule.className,\n dispose: () => {\n rule.decreaseRefCount();\n this._garbageCollectionScheduler.schedule();\n }\n };\n }\n getOrCreateRule(properties) {\n const key = this.computeUniqueKey(properties);\n let existingRule = this._rules.get(key);\n if (!existingRule) {\n const counter = this._counter++;\n existingRule = new RefCountedCssRule(key, `dyn-rule-${this._instanceId}-${counter}`, dom.isInShadowDOM(this._editor.getContainerDomNode())\n ? this._editor.getContainerDomNode()\n : undefined, properties);\n this._rules.set(key, existingRule);\n }\n return existingRule;\n }\n computeUniqueKey(properties) {\n return JSON.stringify(properties);\n }\n garbageCollect() {\n for (const rule of this._rules.values()) {\n if (!rule.hasReferences()) {\n this._rules.delete(rule.key);\n rule.dispose();\n }\n }\n }\n}\nDynamicCssRules._idPool = 0;\nclass RefCountedCssRule {\n constructor(key, className, _containerElement, properties) {\n this.key = key;\n this.className = className;\n this.properties = properties;\n this._referenceCount = 0;\n this._styleElementDisposables = new DisposableStore();\n this._styleElement = dom.createStyleSheet(_containerElement, undefined, this._styleElementDisposables);\n this._styleElement.textContent = this.getCssText(this.className, this.properties);\n }\n getCssText(className, properties) {\n let str = `.${className} {`;\n for (const prop in properties) {\n const value = properties[prop];\n let cssValue;\n if (typeof value === 'object') {\n cssValue = asCssVariable(value.id);\n }\n else {\n cssValue = value;\n }\n const cssPropName = camelToDashes(prop);\n str += `\\n\\t${cssPropName}: ${cssValue};`;\n }\n str += `\\n}`;\n return str;\n }\n dispose() {\n this._styleElementDisposables.dispose();\n this._styleElement = undefined;\n }\n increaseRefCount() {\n this._referenceCount++;\n }\n decreaseRefCount() {\n this._referenceCount--;\n }\n hasReferences() {\n return this._referenceCount > 0;\n }\n}\nfunction camelToDashes(str) {\n return str.replace(/(^[A-Z])/, ([first]) => first.toLowerCase())\n .replace(/([A-Z])/g, ([letter]) => `-${letter.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 *--------------------------------------------------------------------------------------------*/\nimport * as dom from './dom.js';\nimport { DisposableStore, toDisposable } from '../common/lifecycle.js';\nexport class GlobalPointerMoveMonitor {\n constructor() {\n this._hooks = new DisposableStore();\n this._pointerMoveCallback = null;\n this._onStopCallback = null;\n }\n dispose() {\n this.stopMonitoring(false);\n this._hooks.dispose();\n }\n stopMonitoring(invokeStopCallback, browserEvent) {\n if (!this.isMonitoring()) {\n // Not monitoring\n return;\n }\n // Unhook\n this._hooks.clear();\n this._pointerMoveCallback = null;\n const onStopCallback = this._onStopCallback;\n this._onStopCallback = null;\n if (invokeStopCallback && onStopCallback) {\n onStopCallback(browserEvent);\n }\n }\n isMonitoring() {\n return !!this._pointerMoveCallback;\n }\n startMonitoring(initialElement, pointerId, initialButtons, pointerMoveCallback, onStopCallback) {\n if (this.isMonitoring()) {\n this.stopMonitoring(false);\n }\n this._pointerMoveCallback = pointerMoveCallback;\n this._onStopCallback = onStopCallback;\n let eventSource = initialElement;\n try {\n initialElement.setPointerCapture(pointerId);\n this._hooks.add(toDisposable(() => {\n try {\n initialElement.releasePointerCapture(pointerId);\n }\n catch (err) {\n // See https://github.com/microsoft/vscode/issues/161731\n //\n // `releasePointerCapture` sometimes fails when being invoked with the exception:\n // DOMException: Failed to execute 'releasePointerCapture' on 'Element':\n // No active pointer with the given id is found.\n //\n // There's no need to do anything in case of failure\n }\n }));\n }\n catch (err) {\n // See https://github.com/microsoft/vscode/issues/144584\n // See https://github.com/microsoft/vscode/issues/146947\n // `setPointerCapture` sometimes fails when being invoked\n // from a `mousedown` listener on macOS and Windows\n // and it always fails on Linux with the exception:\n // DOMException: Failed to execute 'setPointerCapture' on 'Element':\n // No active pointer with the given id is found.\n // In case of failure, we bind the listeners on the window\n eventSource = dom.getWindow(initialElement);\n }\n this._hooks.add(dom.addDisposableListener(eventSource, dom.EventType.POINTER_MOVE, (e) => {\n if (e.buttons !== initialButtons) {\n // Buttons state has changed in the meantime\n this.stopMonitoring(true);\n return;\n }\n e.preventDefault();\n this._pointerMoveCallback(e);\n }));\n this._hooks.add(dom.addDisposableListener(eventSource, dom.EventType.POINTER_UP, (e) => this.stopMonitoring(true)));\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 *--------------------------------------------------------------------------------------------*/\nimport { ViewEventHandler } from '../../common/viewEventHandler.js';\nexport class ViewPart extends ViewEventHandler {\n constructor(context) {\n super();\n this._context = context;\n this._context.addEventHandler(this);\n }\n dispose() {\n this._context.removeEventHandler(this);\n super.dispose();\n }\n}\nexport class PartFingerprints {\n static write(target, partId) {\n target.setAttribute('data-mprt', String(partId));\n }\n static read(target) {\n const r = target.getAttribute('data-mprt');\n if (r === null) {\n return 0 /* PartFingerprint.None */;\n }\n return parseInt(r, 10);\n }\n static collect(child, stopAt) {\n const result = [];\n let resultLen = 0;\n while (child && child !== child.ownerDocument.body) {\n if (child === stopAt) {\n break;\n }\n if (child.nodeType === child.ELEMENT_NODE) {\n result[resultLen++] = this.read(child);\n }\n child = child.parentElement;\n }\n const r = new Uint8Array(resultLen);\n for (let i = 0; i < resultLen; i++) {\n r[i] = result[resultLen - i - 1];\n }\n return r;\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 *--------------------------------------------------------------------------------------------*/\nimport { Disposable } from '../../base/common/lifecycle.js';\nexport class ViewEventHandler extends Disposable {\n constructor() {\n super();\n this._shouldRender = true;\n }\n shouldRender() {\n return this._shouldRender;\n }\n forceShouldRender() {\n this._shouldRender = true;\n }\n setShouldRender() {\n this._shouldRender = true;\n }\n onDidRender() {\n this._shouldRender = false;\n }\n // --- begin event handlers\n onCompositionStart(e) {\n return false;\n }\n onCompositionEnd(e) {\n return false;\n }\n onConfigurationChanged(e) {\n return false;\n }\n onCursorStateChanged(e) {\n return false;\n }\n onDecorationsChanged(e) {\n return false;\n }\n onFlushed(e) {\n return false;\n }\n onFocusChanged(e) {\n return false;\n }\n onLanguageConfigurationChanged(e) {\n return false;\n }\n onLineMappingChanged(e) {\n return false;\n }\n onLinesChanged(e) {\n return false;\n }\n onLinesDeleted(e) {\n return false;\n }\n onLinesInserted(e) {\n return false;\n }\n onRevealRangeRequest(e) {\n return false;\n }\n onScrollChanged(e) {\n return false;\n }\n onThemeChanged(e) {\n return false;\n }\n onTokensChanged(e) {\n return false;\n }\n onTokensColorsChanged(e) {\n return false;\n }\n onZonesChanged(e) {\n return false;\n }\n // --- end event handlers\n handleEvents(events) {\n let shouldRender = false;\n for (let i = 0, len = events.length; i < len; i++) {\n const e = events[i];\n switch (e.type) {\n case 0 /* viewEvents.ViewEventType.ViewCompositionStart */:\n if (this.onCompositionStart(e)) {\n shouldRender = true;\n }\n break;\n case 1 /* viewEvents.ViewEventType.ViewCompositionEnd */:\n if (this.onCompositionEnd(e)) {\n shouldRender = true;\n }\n break;\n case 2 /* viewEvents.ViewEventType.ViewConfigurationChanged */:\n if (this.onConfigurationChanged(e)) {\n shouldRender = true;\n }\n break;\n case 3 /* viewEvents.ViewEventType.ViewCursorStateChanged */:\n if (this.onCursorStateChanged(e)) {\n shouldRender = true;\n }\n break;\n case 4 /* viewEvents.ViewEventType.ViewDecorationsChanged */:\n if (this.onDecorationsChanged(e)) {\n shouldRender = true;\n }\n break;\n case 5 /* viewEvents.ViewEventType.ViewFlushed */:\n if (this.onFlushed(e)) {\n shouldRender = true;\n }\n break;\n case 6 /* viewEvents.ViewEventType.ViewFocusChanged */:\n if (this.onFocusChanged(e)) {\n shouldRender = true;\n }\n break;\n case 7 /* viewEvents.ViewEventType.ViewLanguageConfigurationChanged */:\n if (this.onLanguageConfigurationChanged(e)) {\n shouldRender = true;\n }\n break;\n case 8 /* viewEvents.ViewEventType.ViewLineMappingChanged */:\n if (this.onLineMappingChanged(e)) {\n shouldRender = true;\n }\n break;\n case 9 /* viewEvents.ViewEventType.ViewLinesChanged */:\n if (this.onLinesChanged(e)) {\n shouldRender = true;\n }\n break;\n case 10 /* viewEvents.ViewEventType.ViewLinesDeleted */:\n if (this.onLinesDeleted(e)) {\n shouldRender = true;\n }\n break;\n case 11 /* viewEvents.ViewEventType.ViewLinesInserted */:\n if (this.onLinesInserted(e)) {\n shouldRender = true;\n }\n break;\n case 12 /* viewEvents.ViewEventType.ViewRevealRangeRequest */:\n if (this.onRevealRangeRequest(e)) {\n shouldRender = true;\n }\n break;\n case 13 /* viewEvents.ViewEventType.ViewScrollChanged */:\n if (this.onScrollChanged(e)) {\n shouldRender = true;\n }\n break;\n case 15 /* viewEvents.ViewEventType.ViewTokensChanged */:\n if (this.onTokensChanged(e)) {\n shouldRender = true;\n }\n break;\n case 14 /* viewEvents.ViewEventType.ViewThemeChanged */:\n if (this.onThemeChanged(e)) {\n shouldRender = true;\n }\n break;\n case 16 /* viewEvents.ViewEventType.ViewTokensColorsChanged */:\n if (this.onTokensColorsChanged(e)) {\n shouldRender = true;\n }\n break;\n case 17 /* viewEvents.ViewEventType.ViewZonesChanged */:\n if (this.onZonesChanged(e)) {\n shouldRender = true;\n }\n break;\n default:\n console.info('View received unknown event: ');\n console.info(e);\n }\n }\n if (shouldRender) {\n this._shouldRender = true;\n }\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 *--------------------------------------------------------------------------------------------*/\nimport * as browser from '../../../../base/browser/browser.js';\nimport { createFastDomNode } from '../../../../base/browser/fastDomNode.js';\nimport * as platform from '../../../../base/common/platform.js';\nimport { RangeUtil } from './rangeUtil.js';\nimport { FloatHorizontalRange, VisibleRanges } from '../../view/renderingContext.js';\nimport { LineDecoration } from '../../../common/viewLayout/lineDecorations.js';\nimport { RenderLineInput, renderViewLine, LineRange, DomPosition } from '../../../common/viewLayout/viewLineRenderer.js';\nimport { isHighContrast } from '../../../../platform/theme/common/theme.js';\nimport { EditorFontLigatures } from '../../../common/config/editorOptions.js';\nconst canUseFastRenderedViewLine = (function () {\n if (platform.isNative) {\n // In VSCode we know very well when the zoom level changes\n return true;\n }\n if (platform.isLinux || browser.isFirefox || browser.isSafari) {\n // On Linux, it appears that zooming affects char widths (in pixels), which is unexpected.\n // --\n // Even though we read character widths correctly, having read them at a specific zoom level\n // does not mean they are the same at the current zoom level.\n // --\n // This could be improved if we ever figure out how to get an event when browsers zoom,\n // but until then we have to stick with reading client rects.\n // --\n // The same has been observed with Firefox on Windows7\n // --\n // The same has been oversved with Safari\n return false;\n }\n return true;\n})();\nlet monospaceAssumptionsAreValid = true;\nexport class ViewLineOptions {\n constructor(config, themeType) {\n this.themeType = themeType;\n const options = config.options;\n const fontInfo = options.get(50 /* EditorOption.fontInfo */);\n const experimentalWhitespaceRendering = options.get(38 /* EditorOption.experimentalWhitespaceRendering */);\n if (experimentalWhitespaceRendering === 'off') {\n this.renderWhitespace = options.get(99 /* EditorOption.renderWhitespace */);\n }\n else {\n // whitespace is rendered in a different layer\n this.renderWhitespace = 'none';\n }\n this.renderControlCharacters = options.get(94 /* EditorOption.renderControlCharacters */);\n this.spaceWidth = fontInfo.spaceWidth;\n this.middotWidth = fontInfo.middotWidth;\n this.wsmiddotWidth = fontInfo.wsmiddotWidth;\n this.useMonospaceOptimizations = (fontInfo.isMonospace\n && !options.get(33 /* EditorOption.disableMonospaceOptimizations */));\n this.canUseHalfwidthRightwardsArrow = fontInfo.canUseHalfwidthRightwardsArrow;\n this.lineHeight = options.get(67 /* EditorOption.lineHeight */);\n this.stopRenderingLineAfter = options.get(117 /* EditorOption.stopRenderingLineAfter */);\n this.fontLigatures = options.get(51 /* EditorOption.fontLigatures */);\n }\n equals(other) {\n return (this.themeType === other.themeType\n && this.renderWhitespace === other.renderWhitespace\n && this.renderControlCharacters === other.renderControlCharacters\n && this.spaceWidth === other.spaceWidth\n && this.middotWidth === other.middotWidth\n && this.wsmiddotWidth === other.wsmiddotWidth\n && this.useMonospaceOptimizations === other.useMonospaceOptimizations\n && this.canUseHalfwidthRightwardsArrow === other.canUseHalfwidthRightwardsArrow\n && this.lineHeight === other.lineHeight\n && this.stopRenderingLineAfter === other.stopRenderingLineAfter\n && this.fontLigatures === other.fontLigatures);\n }\n}\nexport class ViewLine {\n constructor(options) {\n this._options = options;\n this._isMaybeInvalid = true;\n this._renderedViewLine = null;\n }\n // --- begin IVisibleLineData\n getDomNode() {\n if (this._renderedViewLine && this._renderedViewLine.domNode) {\n return this._renderedViewLine.domNode.domNode;\n }\n return null;\n }\n setDomNode(domNode) {\n if (this._renderedViewLine) {\n this._renderedViewLine.domNode = createFastDomNode(domNode);\n }\n else {\n throw new Error('I have no rendered view line to set the dom node to...');\n }\n }\n onContentChanged() {\n this._isMaybeInvalid = true;\n }\n onTokensChanged() {\n this._isMaybeInvalid = true;\n }\n onDecorationsChanged() {\n this._isMaybeInvalid = true;\n }\n onOptionsChanged(newOptions) {\n this._isMaybeInvalid = true;\n this._options = newOptions;\n }\n onSelectionChanged() {\n if (isHighContrast(this._options.themeType) || this._options.renderWhitespace === 'selection') {\n this._isMaybeInvalid = true;\n return true;\n }\n return false;\n }\n renderLine(lineNumber, deltaTop, lineHeight, viewportData, sb) {\n if (this._isMaybeInvalid === false) {\n // it appears that nothing relevant has changed\n return false;\n }\n this._isMaybeInvalid = false;\n const lineData = viewportData.getViewLineRenderingData(lineNumber);\n const options = this._options;\n const actualInlineDecorations = LineDecoration.filter(lineData.inlineDecorations, lineNumber, lineData.minColumn, lineData.maxColumn);\n // Only send selection information when needed for rendering whitespace\n let selectionsOnLine = null;\n if (isHighContrast(options.themeType) || this._options.renderWhitespace === 'selection') {\n const selections = viewportData.selections;\n for (const selection of selections) {\n if (selection.endLineNumber < lineNumber || selection.startLineNumber > lineNumber) {\n // Selection does not intersect line\n continue;\n }\n const startColumn = (selection.startLineNumber === lineNumber ? selection.startColumn : lineData.minColumn);\n const endColumn = (selection.endLineNumber === lineNumber ? selection.endColumn : lineData.maxColumn);\n if (startColumn < endColumn) {\n if (isHighContrast(options.themeType)) {\n actualInlineDecorations.push(new LineDecoration(startColumn, endColumn, 'inline-selected-text', 0 /* InlineDecorationType.Regular */));\n }\n if (this._options.renderWhitespace === 'selection') {\n if (!selectionsOnLine) {\n selectionsOnLine = [];\n }\n selectionsOnLine.push(new LineRange(startColumn - 1, endColumn - 1));\n }\n }\n }\n }\n const renderLineInput = new RenderLineInput(options.useMonospaceOptimizations, options.canUseHalfwidthRightwardsArrow, lineData.content, lineData.continuesWithWrappedLine, lineData.isBasicASCII, lineData.containsRTL, lineData.minColumn - 1, lineData.tokens, actualInlineDecorations, lineData.tabSize, lineData.startVisibleColumn, options.spaceWidth, options.middotWidth, options.wsmiddotWidth, options.stopRenderingLineAfter, options.renderWhitespace, options.renderControlCharacters, options.fontLigatures !== EditorFontLigatures.OFF, selectionsOnLine);\n if (this._renderedViewLine && this._renderedViewLine.input.equals(renderLineInput)) {\n // no need to do anything, we have the same render input\n return false;\n }\n sb.appendString('
    ');\n const output = renderViewLine(renderLineInput, sb);\n sb.appendString('
    ');\n let renderedViewLine = null;\n if (monospaceAssumptionsAreValid && canUseFastRenderedViewLine && lineData.isBasicASCII && options.useMonospaceOptimizations && output.containsForeignElements === 0 /* ForeignElementType.None */) {\n renderedViewLine = new FastRenderedViewLine(this._renderedViewLine ? this._renderedViewLine.domNode : null, renderLineInput, output.characterMapping);\n }\n if (!renderedViewLine) {\n renderedViewLine = createRenderedLine(this._renderedViewLine ? this._renderedViewLine.domNode : null, renderLineInput, output.characterMapping, output.containsRTL, output.containsForeignElements);\n }\n this._renderedViewLine = renderedViewLine;\n return true;\n }\n layoutLine(lineNumber, deltaTop, lineHeight) {\n if (this._renderedViewLine && this._renderedViewLine.domNode) {\n this._renderedViewLine.domNode.setTop(deltaTop);\n this._renderedViewLine.domNode.setHeight(lineHeight);\n }\n }\n // --- end IVisibleLineData\n getWidth(context) {\n if (!this._renderedViewLine) {\n return 0;\n }\n return this._renderedViewLine.getWidth(context);\n }\n getWidthIsFast() {\n if (!this._renderedViewLine) {\n return true;\n }\n return this._renderedViewLine.getWidthIsFast();\n }\n needsMonospaceFontCheck() {\n if (!this._renderedViewLine) {\n return false;\n }\n return (this._renderedViewLine instanceof FastRenderedViewLine);\n }\n monospaceAssumptionsAreValid() {\n if (!this._renderedViewLine) {\n return monospaceAssumptionsAreValid;\n }\n if (this._renderedViewLine instanceof FastRenderedViewLine) {\n return this._renderedViewLine.monospaceAssumptionsAreValid();\n }\n return monospaceAssumptionsAreValid;\n }\n onMonospaceAssumptionsInvalidated() {\n if (this._renderedViewLine && this._renderedViewLine instanceof FastRenderedViewLine) {\n this._renderedViewLine = this._renderedViewLine.toSlowRenderedLine();\n }\n }\n getVisibleRangesForRange(lineNumber, startColumn, endColumn, context) {\n if (!this._renderedViewLine) {\n return null;\n }\n startColumn = Math.min(this._renderedViewLine.input.lineContent.length + 1, Math.max(1, startColumn));\n endColumn = Math.min(this._renderedViewLine.input.lineContent.length + 1, Math.max(1, endColumn));\n const stopRenderingLineAfter = this._renderedViewLine.input.stopRenderingLineAfter;\n if (stopRenderingLineAfter !== -1 && startColumn > stopRenderingLineAfter + 1 && endColumn > stopRenderingLineAfter + 1) {\n // This range is obviously not visible\n return new VisibleRanges(true, [new FloatHorizontalRange(this.getWidth(context), 0)]);\n }\n if (stopRenderingLineAfter !== -1 && startColumn > stopRenderingLineAfter + 1) {\n startColumn = stopRenderingLineAfter + 1;\n }\n if (stopRenderingLineAfter !== -1 && endColumn > stopRenderingLineAfter + 1) {\n endColumn = stopRenderingLineAfter + 1;\n }\n const horizontalRanges = this._renderedViewLine.getVisibleRangesForRange(lineNumber, startColumn, endColumn, context);\n if (horizontalRanges && horizontalRanges.length > 0) {\n return new VisibleRanges(false, horizontalRanges);\n }\n return null;\n }\n getColumnOfNodeOffset(spanNode, offset) {\n if (!this._renderedViewLine) {\n return 1;\n }\n return this._renderedViewLine.getColumnOfNodeOffset(spanNode, offset);\n }\n}\nViewLine.CLASS_NAME = 'view-line';\n/**\n * A rendered line which is guaranteed to contain only regular ASCII and is rendered with a monospace font.\n */\nclass FastRenderedViewLine {\n constructor(domNode, renderLineInput, characterMapping) {\n this._cachedWidth = -1;\n this.domNode = domNode;\n this.input = renderLineInput;\n const keyColumnCount = Math.floor(renderLineInput.lineContent.length / 300 /* Constants.MaxMonospaceDistance */);\n if (keyColumnCount > 0) {\n this._keyColumnPixelOffsetCache = new Float32Array(keyColumnCount);\n for (let i = 0; i < keyColumnCount; i++) {\n this._keyColumnPixelOffsetCache[i] = -1;\n }\n }\n else {\n this._keyColumnPixelOffsetCache = null;\n }\n this._characterMapping = characterMapping;\n this._charWidth = renderLineInput.spaceWidth;\n }\n getWidth(context) {\n if (!this.domNode || this.input.lineContent.length < 300 /* Constants.MaxMonospaceDistance */) {\n const horizontalOffset = this._characterMapping.getHorizontalOffset(this._characterMapping.length);\n return Math.round(this._charWidth * horizontalOffset);\n }\n if (this._cachedWidth === -1) {\n this._cachedWidth = this._getReadingTarget(this.domNode).offsetWidth;\n context === null || context === void 0 ? void 0 : context.markDidDomLayout();\n }\n return this._cachedWidth;\n }\n getWidthIsFast() {\n return (this.input.lineContent.length < 300 /* Constants.MaxMonospaceDistance */) || this._cachedWidth !== -1;\n }\n monospaceAssumptionsAreValid() {\n if (!this.domNode) {\n return monospaceAssumptionsAreValid;\n }\n if (this.input.lineContent.length < 300 /* Constants.MaxMonospaceDistance */) {\n const expectedWidth = this.getWidth(null);\n const actualWidth = this.domNode.domNode.firstChild.offsetWidth;\n if (Math.abs(expectedWidth - actualWidth) >= 2) {\n // more than 2px off\n console.warn(`monospace assumptions have been violated, therefore disabling monospace optimizations!`);\n monospaceAssumptionsAreValid = false;\n }\n }\n return monospaceAssumptionsAreValid;\n }\n toSlowRenderedLine() {\n return createRenderedLine(this.domNode, this.input, this._characterMapping, false, 0 /* ForeignElementType.None */);\n }\n getVisibleRangesForRange(lineNumber, startColumn, endColumn, context) {\n const startPosition = this._getColumnPixelOffset(lineNumber, startColumn, context);\n const endPosition = this._getColumnPixelOffset(lineNumber, endColumn, context);\n return [new FloatHorizontalRange(startPosition, endPosition - startPosition)];\n }\n _getColumnPixelOffset(lineNumber, column, context) {\n if (column <= 300 /* Constants.MaxMonospaceDistance */) {\n const horizontalOffset = this._characterMapping.getHorizontalOffset(column);\n return this._charWidth * horizontalOffset;\n }\n const keyColumnOrdinal = Math.floor((column - 1) / 300 /* Constants.MaxMonospaceDistance */) - 1;\n const keyColumn = (keyColumnOrdinal + 1) * 300 /* Constants.MaxMonospaceDistance */ + 1;\n let keyColumnPixelOffset = -1;\n if (this._keyColumnPixelOffsetCache) {\n keyColumnPixelOffset = this._keyColumnPixelOffsetCache[keyColumnOrdinal];\n if (keyColumnPixelOffset === -1) {\n keyColumnPixelOffset = this._actualReadPixelOffset(lineNumber, keyColumn, context);\n this._keyColumnPixelOffsetCache[keyColumnOrdinal] = keyColumnPixelOffset;\n }\n }\n if (keyColumnPixelOffset === -1) {\n // Could not read actual key column pixel offset\n const horizontalOffset = this._characterMapping.getHorizontalOffset(column);\n return this._charWidth * horizontalOffset;\n }\n const keyColumnHorizontalOffset = this._characterMapping.getHorizontalOffset(keyColumn);\n const horizontalOffset = this._characterMapping.getHorizontalOffset(column);\n return keyColumnPixelOffset + this._charWidth * (horizontalOffset - keyColumnHorizontalOffset);\n }\n _getReadingTarget(myDomNode) {\n return myDomNode.domNode.firstChild;\n }\n _actualReadPixelOffset(lineNumber, column, context) {\n if (!this.domNode) {\n return -1;\n }\n const domPosition = this._characterMapping.getDomPosition(column);\n const r = RangeUtil.readHorizontalRanges(this._getReadingTarget(this.domNode), domPosition.partIndex, domPosition.charIndex, domPosition.partIndex, domPosition.charIndex, context);\n if (!r || r.length === 0) {\n return -1;\n }\n return r[0].left;\n }\n getColumnOfNodeOffset(spanNode, offset) {\n return getColumnOfNodeOffset(this._characterMapping, spanNode, offset);\n }\n}\n/**\n * Every time we render a line, we save what we have rendered in an instance of this class.\n */\nclass RenderedViewLine {\n constructor(domNode, renderLineInput, characterMapping, containsRTL, containsForeignElements) {\n this.domNode = domNode;\n this.input = renderLineInput;\n this._characterMapping = characterMapping;\n this._isWhitespaceOnly = /^\\s*$/.test(renderLineInput.lineContent);\n this._containsForeignElements = containsForeignElements;\n this._cachedWidth = -1;\n this._pixelOffsetCache = null;\n if (!containsRTL || this._characterMapping.length === 0 /* the line is empty */) {\n this._pixelOffsetCache = new Float32Array(Math.max(2, this._characterMapping.length + 1));\n for (let column = 0, len = this._characterMapping.length; column <= len; column++) {\n this._pixelOffsetCache[column] = -1;\n }\n }\n }\n // --- Reading from the DOM methods\n _getReadingTarget(myDomNode) {\n return myDomNode.domNode.firstChild;\n }\n /**\n * Width of the line in pixels\n */\n getWidth(context) {\n if (!this.domNode) {\n return 0;\n }\n if (this._cachedWidth === -1) {\n this._cachedWidth = this._getReadingTarget(this.domNode).offsetWidth;\n context === null || context === void 0 ? void 0 : context.markDidDomLayout();\n }\n return this._cachedWidth;\n }\n getWidthIsFast() {\n if (this._cachedWidth === -1) {\n return false;\n }\n return true;\n }\n /**\n * Visible ranges for a model range\n */\n getVisibleRangesForRange(lineNumber, startColumn, endColumn, context) {\n if (!this.domNode) {\n return null;\n }\n if (this._pixelOffsetCache !== null) {\n // the text is LTR\n const startOffset = this._readPixelOffset(this.domNode, lineNumber, startColumn, context);\n if (startOffset === -1) {\n return null;\n }\n const endOffset = this._readPixelOffset(this.domNode, lineNumber, endColumn, context);\n if (endOffset === -1) {\n return null;\n }\n return [new FloatHorizontalRange(startOffset, endOffset - startOffset)];\n }\n return this._readVisibleRangesForRange(this.domNode, lineNumber, startColumn, endColumn, context);\n }\n _readVisibleRangesForRange(domNode, lineNumber, startColumn, endColumn, context) {\n if (startColumn === endColumn) {\n const pixelOffset = this._readPixelOffset(domNode, lineNumber, startColumn, context);\n if (pixelOffset === -1) {\n return null;\n }\n else {\n return [new FloatHorizontalRange(pixelOffset, 0)];\n }\n }\n else {\n return this._readRawVisibleRangesForRange(domNode, startColumn, endColumn, context);\n }\n }\n _readPixelOffset(domNode, lineNumber, column, context) {\n if (this._characterMapping.length === 0) {\n // This line has no content\n if (this._containsForeignElements === 0 /* ForeignElementType.None */) {\n // We can assume the line is really empty\n return 0;\n }\n if (this._containsForeignElements === 2 /* ForeignElementType.After */) {\n // We have foreign elements after the (empty) line\n return 0;\n }\n if (this._containsForeignElements === 1 /* ForeignElementType.Before */) {\n // We have foreign elements before the (empty) line\n return this.getWidth(context);\n }\n // We have foreign elements before & after the (empty) line\n const readingTarget = this._getReadingTarget(domNode);\n if (readingTarget.firstChild) {\n context.markDidDomLayout();\n return readingTarget.firstChild.offsetWidth;\n }\n else {\n return 0;\n }\n }\n if (this._pixelOffsetCache !== null) {\n // the text is LTR\n const cachedPixelOffset = this._pixelOffsetCache[column];\n if (cachedPixelOffset !== -1) {\n return cachedPixelOffset;\n }\n const result = this._actualReadPixelOffset(domNode, lineNumber, column, context);\n this._pixelOffsetCache[column] = result;\n return result;\n }\n return this._actualReadPixelOffset(domNode, lineNumber, column, context);\n }\n _actualReadPixelOffset(domNode, lineNumber, column, context) {\n if (this._characterMapping.length === 0) {\n // This line has no content\n const r = RangeUtil.readHorizontalRanges(this._getReadingTarget(domNode), 0, 0, 0, 0, context);\n if (!r || r.length === 0) {\n return -1;\n }\n return r[0].left;\n }\n if (column === this._characterMapping.length && this._isWhitespaceOnly && this._containsForeignElements === 0 /* ForeignElementType.None */) {\n // This branch helps in the case of whitespace only lines which have a width set\n return this.getWidth(context);\n }\n const domPosition = this._characterMapping.getDomPosition(column);\n const r = RangeUtil.readHorizontalRanges(this._getReadingTarget(domNode), domPosition.partIndex, domPosition.charIndex, domPosition.partIndex, domPosition.charIndex, context);\n if (!r || r.length === 0) {\n return -1;\n }\n const result = r[0].left;\n if (this.input.isBasicASCII) {\n const horizontalOffset = this._characterMapping.getHorizontalOffset(column);\n const expectedResult = Math.round(this.input.spaceWidth * horizontalOffset);\n if (Math.abs(expectedResult - result) <= 1) {\n return expectedResult;\n }\n }\n return result;\n }\n _readRawVisibleRangesForRange(domNode, startColumn, endColumn, context) {\n if (startColumn === 1 && endColumn === this._characterMapping.length) {\n // This branch helps IE with bidi text & gives a performance boost to other browsers when reading visible ranges for an entire line\n return [new FloatHorizontalRange(0, this.getWidth(context))];\n }\n const startDomPosition = this._characterMapping.getDomPosition(startColumn);\n const endDomPosition = this._characterMapping.getDomPosition(endColumn);\n return RangeUtil.readHorizontalRanges(this._getReadingTarget(domNode), startDomPosition.partIndex, startDomPosition.charIndex, endDomPosition.partIndex, endDomPosition.charIndex, context);\n }\n /**\n * Returns the column for the text found at a specific offset inside a rendered dom node\n */\n getColumnOfNodeOffset(spanNode, offset) {\n return getColumnOfNodeOffset(this._characterMapping, spanNode, offset);\n }\n}\nclass WebKitRenderedViewLine extends RenderedViewLine {\n _readVisibleRangesForRange(domNode, lineNumber, startColumn, endColumn, context) {\n const output = super._readVisibleRangesForRange(domNode, lineNumber, startColumn, endColumn, context);\n if (!output || output.length === 0 || startColumn === endColumn || (startColumn === 1 && endColumn === this._characterMapping.length)) {\n return output;\n }\n // WebKit is buggy and returns an expanded range (to contain words in some cases)\n // The last client rect is enlarged (I think)\n if (!this.input.containsRTL) {\n // This is an attempt to patch things up\n // Find position of last column\n const endPixelOffset = this._readPixelOffset(domNode, lineNumber, endColumn, context);\n if (endPixelOffset !== -1) {\n const lastRange = output[output.length - 1];\n if (lastRange.left < endPixelOffset) {\n // Trim down the width of the last visible range to not go after the last column's position\n lastRange.width = endPixelOffset - lastRange.left;\n }\n }\n }\n return output;\n }\n}\nconst createRenderedLine = (function () {\n if (browser.isWebKit) {\n return createWebKitRenderedLine;\n }\n return createNormalRenderedLine;\n})();\nfunction createWebKitRenderedLine(domNode, renderLineInput, characterMapping, containsRTL, containsForeignElements) {\n return new WebKitRenderedViewLine(domNode, renderLineInput, characterMapping, containsRTL, containsForeignElements);\n}\nfunction createNormalRenderedLine(domNode, renderLineInput, characterMapping, containsRTL, containsForeignElements) {\n return new RenderedViewLine(domNode, renderLineInput, characterMapping, containsRTL, containsForeignElements);\n}\nexport function getColumnOfNodeOffset(characterMapping, spanNode, offset) {\n const spanNodeTextContentLength = spanNode.textContent.length;\n let spanIndex = -1;\n while (spanNode) {\n spanNode = spanNode.previousSibling;\n spanIndex++;\n }\n return characterMapping.getColumn(new DomPosition(spanIndex, offset), spanNodeTextContentLength);\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 { FloatHorizontalRange } from '../../view/renderingContext.js';\nexport class RangeUtil {\n static _createRange() {\n if (!this._handyReadyRange) {\n this._handyReadyRange = document.createRange();\n }\n return this._handyReadyRange;\n }\n static _detachRange(range, endNode) {\n // Move range out of the span node, IE doesn't like having many ranges in\n // the same spot and will act badly for lines containing dashes ('-')\n range.selectNodeContents(endNode);\n }\n static _readClientRects(startElement, startOffset, endElement, endOffset, endNode) {\n const range = this._createRange();\n try {\n range.setStart(startElement, startOffset);\n range.setEnd(endElement, endOffset);\n return range.getClientRects();\n }\n catch (e) {\n // This is life ...\n return null;\n }\n finally {\n this._detachRange(range, endNode);\n }\n }\n static _mergeAdjacentRanges(ranges) {\n if (ranges.length === 1) {\n // There is nothing to merge\n return ranges;\n }\n ranges.sort(FloatHorizontalRange.compare);\n const result = [];\n let resultLen = 0;\n let prev = ranges[0];\n for (let i = 1, len = ranges.length; i < len; i++) {\n const range = ranges[i];\n if (prev.left + prev.width + 0.9 /* account for browser's rounding errors*/ >= range.left) {\n prev.width = Math.max(prev.width, range.left + range.width - prev.left);\n }\n else {\n result[resultLen++] = prev;\n prev = range;\n }\n }\n result[resultLen++] = prev;\n return result;\n }\n static _createHorizontalRangesFromClientRects(clientRects, clientRectDeltaLeft, clientRectScale) {\n if (!clientRects || clientRects.length === 0) {\n return null;\n }\n // We go through FloatHorizontalRange because it has been observed in bi-di text\n // that the clientRects are not coming in sorted from the browser\n const result = [];\n for (let i = 0, len = clientRects.length; i < len; i++) {\n const clientRect = clientRects[i];\n result[i] = new FloatHorizontalRange(Math.max(0, (clientRect.left - clientRectDeltaLeft) / clientRectScale), clientRect.width / clientRectScale);\n }\n return this._mergeAdjacentRanges(result);\n }\n static readHorizontalRanges(domNode, startChildIndex, startOffset, endChildIndex, endOffset, context) {\n // Panic check\n const min = 0;\n const max = domNode.children.length - 1;\n if (min > max) {\n return null;\n }\n startChildIndex = Math.min(max, Math.max(min, startChildIndex));\n endChildIndex = Math.min(max, Math.max(min, endChildIndex));\n if (startChildIndex === endChildIndex && startOffset === endOffset && startOffset === 0 && !domNode.children[startChildIndex].firstChild) {\n // We must find the position at the beginning of a \n // To cover cases of empty s, avoid using a range and use the 's bounding box\n const clientRects = domNode.children[startChildIndex].getClientRects();\n context.markDidDomLayout();\n return this._createHorizontalRangesFromClientRects(clientRects, context.clientRectDeltaLeft, context.clientRectScale);\n }\n // If crossing over to a span only to select offset 0, then use the previous span's maximum offset\n // Chrome is buggy and doesn't handle 0 offsets well sometimes.\n if (startChildIndex !== endChildIndex) {\n if (endChildIndex > 0 && endOffset === 0) {\n endChildIndex--;\n endOffset = 1073741824 /* Constants.MAX_SAFE_SMALL_INTEGER */;\n }\n }\n let startElement = domNode.children[startChildIndex].firstChild;\n let endElement = domNode.children[endChildIndex].firstChild;\n if (!startElement || !endElement) {\n // When having an empty (without any text content), try to move to the previous \n if (!startElement && startOffset === 0 && startChildIndex > 0) {\n startElement = domNode.children[startChildIndex - 1].firstChild;\n startOffset = 1073741824 /* Constants.MAX_SAFE_SMALL_INTEGER */;\n }\n if (!endElement && endOffset === 0 && endChildIndex > 0) {\n endElement = domNode.children[endChildIndex - 1].firstChild;\n endOffset = 1073741824 /* Constants.MAX_SAFE_SMALL_INTEGER */;\n }\n }\n if (!startElement || !endElement) {\n return null;\n }\n startOffset = Math.min(startElement.textContent.length, Math.max(0, startOffset));\n endOffset = Math.min(endElement.textContent.length, Math.max(0, endOffset));\n const clientRects = this._readClientRects(startElement, startOffset, endElement, endOffset, context.endNode);\n context.markDidDomLayout();\n return this._createHorizontalRangesFromClientRects(clientRects, context.clientRectDeltaLeft, context.clientRectScale);\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 *--------------------------------------------------------------------------------------------*/\nexport class RestrictedRenderingContext {\n constructor(viewLayout, viewportData) {\n this._restrictedRenderingContextBrand = undefined;\n this._viewLayout = viewLayout;\n this.viewportData = viewportData;\n this.scrollWidth = this._viewLayout.getScrollWidth();\n this.scrollHeight = this._viewLayout.getScrollHeight();\n this.visibleRange = this.viewportData.visibleRange;\n this.bigNumbersDelta = this.viewportData.bigNumbersDelta;\n const vInfo = this._viewLayout.getCurrentViewport();\n this.scrollTop = vInfo.top;\n this.scrollLeft = vInfo.left;\n this.viewportWidth = vInfo.width;\n this.viewportHeight = vInfo.height;\n }\n getScrolledTopFromAbsoluteTop(absoluteTop) {\n return absoluteTop - this.scrollTop;\n }\n getVerticalOffsetForLineNumber(lineNumber, includeViewZones) {\n return this._viewLayout.getVerticalOffsetForLineNumber(lineNumber, includeViewZones);\n }\n getVerticalOffsetAfterLineNumber(lineNumber, includeViewZones) {\n return this._viewLayout.getVerticalOffsetAfterLineNumber(lineNumber, includeViewZones);\n }\n getDecorationsInViewport() {\n return this.viewportData.getDecorationsInViewport();\n }\n}\nexport class RenderingContext extends RestrictedRenderingContext {\n constructor(viewLayout, viewportData, viewLines) {\n super(viewLayout, viewportData);\n this._renderingContextBrand = undefined;\n this._viewLines = viewLines;\n }\n linesVisibleRangesForRange(range, includeNewLines) {\n return this._viewLines.linesVisibleRangesForRange(range, includeNewLines);\n }\n visibleRangeForPosition(position) {\n return this._viewLines.visibleRangeForPosition(position);\n }\n}\nexport class LineVisibleRanges {\n constructor(outsideRenderedLine, lineNumber, ranges, \n /**\n * Indicates if the requested range does not end in this line, but continues on the next line.\n */\n continuesOnNextLine) {\n this.outsideRenderedLine = outsideRenderedLine;\n this.lineNumber = lineNumber;\n this.ranges = ranges;\n this.continuesOnNextLine = continuesOnNextLine;\n }\n}\nexport class HorizontalRange {\n static from(ranges) {\n const result = new Array(ranges.length);\n for (let i = 0, len = ranges.length; i < len; i++) {\n const range = ranges[i];\n result[i] = new HorizontalRange(range.left, range.width);\n }\n return result;\n }\n constructor(left, width) {\n this._horizontalRangeBrand = undefined;\n this.left = Math.round(left);\n this.width = Math.round(width);\n }\n toString() {\n return `[${this.left},${this.width}]`;\n }\n}\nexport class FloatHorizontalRange {\n constructor(left, width) {\n this._floatHorizontalRangeBrand = undefined;\n this.left = left;\n this.width = width;\n }\n toString() {\n return `[${this.left},${this.width}]`;\n }\n static compare(a, b) {\n return a.left - b.left;\n }\n}\nexport class HorizontalPosition {\n constructor(outsideRenderedLine, left) {\n this.outsideRenderedLine = outsideRenderedLine;\n this.originalLeft = left;\n this.left = Math.round(this.originalLeft);\n }\n}\nexport class VisibleRanges {\n constructor(outsideRenderedLine, ranges) {\n this.outsideRenderedLine = outsideRenderedLine;\n this.ranges = ranges;\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 *--------------------------------------------------------------------------------------------*/\nimport { CursorColumns } from '../core/cursorColumns.js';\nexport class AtomicTabMoveOperations {\n /**\n * Get the visible column at the position. If we get to a non-whitespace character first\n * or past the end of string then return -1.\n *\n * **Note** `position` and the return value are 0-based.\n */\n static whitespaceVisibleColumn(lineContent, position, tabSize) {\n const lineLength = lineContent.length;\n let visibleColumn = 0;\n let prevTabStopPosition = -1;\n let prevTabStopVisibleColumn = -1;\n for (let i = 0; i < lineLength; i++) {\n if (i === position) {\n return [prevTabStopPosition, prevTabStopVisibleColumn, visibleColumn];\n }\n if (visibleColumn % tabSize === 0) {\n prevTabStopPosition = i;\n prevTabStopVisibleColumn = visibleColumn;\n }\n const chCode = lineContent.charCodeAt(i);\n switch (chCode) {\n case 32 /* CharCode.Space */:\n visibleColumn += 1;\n break;\n case 9 /* CharCode.Tab */:\n // Skip to the next multiple of tabSize.\n visibleColumn = CursorColumns.nextRenderTabStop(visibleColumn, tabSize);\n break;\n default:\n return [-1, -1, -1];\n }\n }\n if (position === lineLength) {\n return [prevTabStopPosition, prevTabStopVisibleColumn, visibleColumn];\n }\n return [-1, -1, -1];\n }\n /**\n * Return the position that should result from a move left, right or to the\n * nearest tab, if atomic tabs are enabled. Left and right are used for the\n * arrow key movements, nearest is used for mouse selection. It returns\n * -1 if atomic tabs are not relevant and you should fall back to normal\n * behaviour.\n *\n * **Note**: `position` and the return value are 0-based.\n */\n static atomicPosition(lineContent, position, tabSize, direction) {\n const lineLength = lineContent.length;\n // Get the 0-based visible column corresponding to the position, or return\n // -1 if it is not in the initial whitespace.\n const [prevTabStopPosition, prevTabStopVisibleColumn, visibleColumn] = AtomicTabMoveOperations.whitespaceVisibleColumn(lineContent, position, tabSize);\n if (visibleColumn === -1) {\n return -1;\n }\n // Is the output left or right of the current position. The case for nearest\n // where it is the same as the current position is handled in the switch.\n let left;\n switch (direction) {\n case 0 /* Direction.Left */:\n left = true;\n break;\n case 1 /* Direction.Right */:\n left = false;\n break;\n case 2 /* Direction.Nearest */:\n // The code below assumes the output position is either left or right\n // of the input position. If it is the same, return immediately.\n if (visibleColumn % tabSize === 0) {\n return position;\n }\n // Go to the nearest indentation.\n left = visibleColumn % tabSize <= (tabSize / 2);\n break;\n }\n // If going left, we can just use the info about the last tab stop position and\n // last tab stop visible column that we computed in the first walk over the whitespace.\n if (left) {\n if (prevTabStopPosition === -1) {\n return -1;\n }\n // If the direction is left, we need to keep scanning right to ensure\n // that targetVisibleColumn + tabSize is before non-whitespace.\n // This is so that when we press left at the end of a partial\n // indentation it only goes one character. For example ' foo' with\n // tabSize 4, should jump from position 6 to position 5, not 4.\n let currentVisibleColumn = prevTabStopVisibleColumn;\n for (let i = prevTabStopPosition; i < lineLength; ++i) {\n if (currentVisibleColumn === prevTabStopVisibleColumn + tabSize) {\n // It is a full indentation.\n return prevTabStopPosition;\n }\n const chCode = lineContent.charCodeAt(i);\n switch (chCode) {\n case 32 /* CharCode.Space */:\n currentVisibleColumn += 1;\n break;\n case 9 /* CharCode.Tab */:\n currentVisibleColumn = CursorColumns.nextRenderTabStop(currentVisibleColumn, tabSize);\n break;\n default:\n return -1;\n }\n }\n if (currentVisibleColumn === prevTabStopVisibleColumn + tabSize) {\n return prevTabStopPosition;\n }\n // It must have been a partial indentation.\n return -1;\n }\n // We are going right.\n const targetVisibleColumn = CursorColumns.nextRenderTabStop(visibleColumn, tabSize);\n // We can just continue from where whitespaceVisibleColumn got to.\n let currentVisibleColumn = visibleColumn;\n for (let i = position; i < lineLength; i++) {\n if (currentVisibleColumn === targetVisibleColumn) {\n return i;\n }\n const chCode = lineContent.charCodeAt(i);\n switch (chCode) {\n case 32 /* CharCode.Space */:\n currentVisibleColumn += 1;\n break;\n case 9 /* CharCode.Tab */:\n currentVisibleColumn = CursorColumns.nextRenderTabStop(currentVisibleColumn, tabSize);\n break;\n default:\n return -1;\n }\n }\n // This condition handles when the target column is at the end of the line.\n if (currentVisibleColumn === targetVisibleColumn) {\n return lineLength;\n }\n return -1;\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 *--------------------------------------------------------------------------------------------*/\nimport { BrowserFeatures } from '../../../base/browser/canIUse.js';\nimport * as dom from '../../../base/browser/dom.js';\nimport { EventType, Gesture } from '../../../base/browser/touch.js';\nimport { mainWindow } from '../../../base/browser/window.js';\nimport { Disposable } from '../../../base/common/lifecycle.js';\nimport * as platform from '../../../base/common/platform.js';\nimport { MouseHandler } from './mouseHandler.js';\nimport { TextAreaSyntethicEvents } from './textAreaInput.js';\nimport { EditorMouseEvent, EditorPointerEventFactory } from '../editorDom.js';\n/**\n * Currently only tested on iOS 13/ iPadOS.\n */\nexport class PointerEventHandler extends MouseHandler {\n constructor(context, viewController, viewHelper) {\n super(context, viewController, viewHelper);\n this._register(Gesture.addTarget(this.viewHelper.linesContentDomNode));\n this._register(dom.addDisposableListener(this.viewHelper.linesContentDomNode, EventType.Tap, (e) => this.onTap(e)));\n this._register(dom.addDisposableListener(this.viewHelper.linesContentDomNode, EventType.Change, (e) => this.onChange(e)));\n this._register(dom.addDisposableListener(this.viewHelper.linesContentDomNode, EventType.Contextmenu, (e) => this._onContextMenu(new EditorMouseEvent(e, false, this.viewHelper.viewDomNode), false)));\n this._lastPointerType = 'mouse';\n this._register(dom.addDisposableListener(this.viewHelper.linesContentDomNode, 'pointerdown', (e) => {\n const pointerType = e.pointerType;\n if (pointerType === 'mouse') {\n this._lastPointerType = 'mouse';\n return;\n }\n else if (pointerType === 'touch') {\n this._lastPointerType = 'touch';\n }\n else {\n this._lastPointerType = 'pen';\n }\n }));\n // PonterEvents\n const pointerEvents = new EditorPointerEventFactory(this.viewHelper.viewDomNode);\n this._register(pointerEvents.onPointerMove(this.viewHelper.viewDomNode, (e) => this._onMouseMove(e)));\n this._register(pointerEvents.onPointerUp(this.viewHelper.viewDomNode, (e) => this._onMouseUp(e)));\n this._register(pointerEvents.onPointerLeave(this.viewHelper.viewDomNode, (e) => this._onMouseLeave(e)));\n this._register(pointerEvents.onPointerDown(this.viewHelper.viewDomNode, (e, pointerId) => this._onMouseDown(e, pointerId)));\n }\n onTap(event) {\n if (!event.initialTarget || !this.viewHelper.linesContentDomNode.contains(event.initialTarget)) {\n return;\n }\n event.preventDefault();\n this.viewHelper.focusTextArea();\n this._dispatchGesture(event, /*inSelectionMode*/ false);\n }\n onChange(event) {\n if (this._lastPointerType === 'touch') {\n this._context.viewModel.viewLayout.deltaScrollNow(-event.translationX, -event.translationY);\n }\n if (this._lastPointerType === 'pen') {\n this._dispatchGesture(event, /*inSelectionMode*/ true);\n }\n }\n _dispatchGesture(event, inSelectionMode) {\n const target = this._createMouseTarget(new EditorMouseEvent(event, false, this.viewHelper.viewDomNode), false);\n if (target.position) {\n this.viewController.dispatchMouse({\n position: target.position,\n mouseColumn: target.position.column,\n startedOnLineNumbers: false,\n revealType: 1 /* NavigationCommandRevealType.Minimal */,\n mouseDownCount: event.tapCount,\n inSelectionMode,\n altKey: false,\n ctrlKey: false,\n metaKey: false,\n shiftKey: false,\n leftButton: false,\n middleButton: false,\n onInjectedText: target.type === 6 /* MouseTargetType.CONTENT_TEXT */ && target.detail.injectedText !== null\n });\n }\n }\n _onMouseDown(e, pointerId) {\n if (e.browserEvent.pointerType === 'touch') {\n return;\n }\n super._onMouseDown(e, pointerId);\n }\n}\nclass TouchHandler extends MouseHandler {\n constructor(context, viewController, viewHelper) {\n super(context, viewController, viewHelper);\n this._register(Gesture.addTarget(this.viewHelper.linesContentDomNode));\n this._register(dom.addDisposableListener(this.viewHelper.linesContentDomNode, EventType.Tap, (e) => this.onTap(e)));\n this._register(dom.addDisposableListener(this.viewHelper.linesContentDomNode, EventType.Change, (e) => this.onChange(e)));\n this._register(dom.addDisposableListener(this.viewHelper.linesContentDomNode, EventType.Contextmenu, (e) => this._onContextMenu(new EditorMouseEvent(e, false, this.viewHelper.viewDomNode), false)));\n }\n onTap(event) {\n event.preventDefault();\n this.viewHelper.focusTextArea();\n const target = this._createMouseTarget(new EditorMouseEvent(event, false, this.viewHelper.viewDomNode), false);\n if (target.position) {\n // Send the tap event also to the